SYMBOL INDEX (65457 symbols across 3224 files) FILE: .circleci/create_circleci_config.py class EmptyJob (line 59) | class EmptyJob: method to_dict (line 62) | def to_dict(self): class CircleCIJob (line 84) | class CircleCIJob: method __post_init__ (line 99) | def __post_init__(self): method to_dict (line 134) | def to_dict(self): method job_name (line 230) | def job_name(self): function create_circleci_config (line 377) | def create_circleci_config(folder=None): FILE: .circleci/parse_test_outputs.py function parse_pytest_output (line 5) | def parse_pytest_output(file_path): function parse_pytest_failure_output (line 19) | def parse_pytest_failure_output(file_path): function parse_pytest_errors_output (line 35) | def parse_pytest_errors_output(file_path): function main (line 52) | def main(): FILE: .github/scripts/assign_reviewers.py function pattern_to_regex (line 26) | def pattern_to_regex(pattern): function get_file_owners (line 39) | def get_file_owners(file_path, codeowners_lines): function pr_author_is_in_hf (line 59) | def pr_author_is_in_hf(pr_author, codeowners_lines): function main (line 74) | def main(): FILE: benchmark/benches/llama.py function collect_metrics (line 52) | def collect_metrics(benchmark_id, continue_metric_collection, metrics_re... function run_benchmark (line 67) | def run_benchmark( FILE: benchmark/benchmark.py function checkout_commit (line 43) | def checkout_commit(repo: Repo, commit_id: str): function summarize (line 60) | def summarize(run_dir, metrics, expand_metrics=False): function combine_summaries (line 149) | def combine_summaries(summaries): function list_str (line 200) | def list_str(values): FILE: benchmark/benchmarks_entrypoint.py class ImportModuleException (line 36) | class ImportModuleException(Exception): class MetricsRecorder (line 40) | class MetricsRecorder: method __init__ (line 41) | def __init__( method initialise_benchmark (line 103) | def initialise_benchmark(self, metadata: dict[str, str]) -> str: method collect_device_measurements (line 146) | def collect_device_measurements(self, benchmark_id: str, cpu_util, mem... method collect_model_measurements (line 179) | def collect_model_measurements(self, benchmark_id: str, measurements: ... method export_to_csv (line 208) | def export_to_csv(self, output_dir: str = "benchmark_results"): method _export_pandas_data (line 228) | def _export_pandas_data(self, output_dir: str, timestamp: str, files_c... method _create_summary (line 255) | def _create_summary(self, summary_file: str): method close (line 305) | def close(self): function parse_arguments (line 320) | def parse_arguments() -> tuple[str, str, str, str, bool, str]: function import_from_path (line 367) | def import_from_path(module_name, file_path): function create_database_connection (line 378) | def create_database_connection(): function create_global_metrics_recorder (line 397) | def create_global_metrics_recorder( FILE: benchmark/optimum_benchmark_wrapper.py function main (line 5) | def main(config_dir, config_name, args): FILE: benchmark_v2/benchmark_scripts/continuous_batching_overall.py function run_and_parse_cb_example (line 16) | def run_and_parse_cb_example(args: str) -> dict: function build_comparison_table (line 38) | def build_comparison_table(results: list[dict], main_results: list[dict]... FILE: benchmark_v2/framework/benchmark_config.py function is_fa2_or_kernel_available (line 27) | def is_fa2_or_kernel_available() -> bool: class BenchmarkConfig (line 54) | class BenchmarkConfig: method __init__ (line 60) | def __init__( method check_validity (line 102) | def check_validity(self, skip_validity_check: bool = False) -> None: method hash (line 141) | def hash(self) -> str: method infer_name (line 144) | def infer_name(self, compact: bool = True) -> str: method to_dict (line 182) | def to_dict(self) -> dict[str, Any]: method from_dict (line 199) | def from_dict(cls, data: dict[str, Any], skip_validity_check: bool = F... function adapt_configs (line 217) | def adapt_configs( function get_config_by_level (line 255) | def get_config_by_level(level: int) -> list[BenchmarkConfig]: FILE: benchmark_v2/framework/benchmark_runner.py function compact_json_numeric_arrays (line 59) | def compact_json_numeric_arrays(data: dict): function get_git_revision (line 73) | def get_git_revision() -> str: function flush_memory (line 82) | def flush_memory(flush_compile: bool = True) -> None: class BenchmarkStreamer (line 112) | class BenchmarkStreamer(BaseStreamer): method __init__ (line 113) | def __init__(self, **kwargs) -> None: method put (line 119) | def put(self, value): method end (line 124) | def end(self): method __iter__ (line 128) | def __iter__(self): method __next__ (line 131) | def __next__(self): class BenchmarkRunner (line 139) | class BenchmarkRunner: method __init__ (line 142) | def __init__( method cleanup (line 167) | def cleanup(self) -> None: method _is_primary_process (line 173) | def _is_primary_process() -> bool: method setup_benchmark (line 178) | def setup_benchmark(self, model_id: str, config: BenchmarkConfig) -> N... method run_benchmark (line 228) | def run_benchmark(self, config: BenchmarkConfig, num_tokens_to_profile... method time_generate (line 263) | def time_generate( method profile_generate (line 313) | def profile_generate(self, num_tokens_to_profile: int, config_name: st... method run_benchmarks (line 336) | def run_benchmarks( method save_results (line 413) | def save_results(self, model_name: str, results: dict, timestamp: str ... method push_results_to_hub (line 443) | def push_results_to_hub(self, dataset_id: str, results: dict[Any, Any]... FILE: benchmark_v2/framework/data_classes.py function compute_basic_statistics (line 10) | def compute_basic_statistics(measurements: list[float]) -> dict[str, flo... function add_unit_to_duration (line 21) | def add_unit_to_duration(stats: dict[str, float]) -> dict[str, str]: function equalize_lengths_and_collate (line 39) | def equalize_lengths_and_collate(stats: dict[str, dict[str, str]]) -> di... function pretty_print_dict (line 49) | def pretty_print_dict(data: dict[str, str], tabs: int = 0) -> None: class BenchmarkMetadata (line 58) | class BenchmarkMetadata: method __init__ (line 69) | def __init__( method to_dict (line 80) | def to_dict(self) -> dict[str, Any]: class BenchmarkResult (line 92) | class BenchmarkResult: method __init__ (line 95) | def __init__(self) -> None: method accumulate (line 103) | def accumulate( method _accumulate_ttft_and_itl (line 116) | def _accumulate_ttft_and_itl(self, timestamps: list[float]) -> None: method to_dict (line 123) | def to_dict(self, summarized: bool = False) -> dict[str, Any]: method from_dict (line 139) | def from_dict(cls, data: dict[str, Any]) -> "BenchmarkResult": method get_throughput (line 160) | def get_throughput(self, total_generated_tokens: int) -> list[float]: method pprint (line 163) | def pprint(self, batch_size: int = 0, num_generated_tokens: int = 0, t... FILE: benchmark_v2/framework/hardware_metrics.py function get_device_name_and_memory_total (line 30) | def get_device_name_and_memory_total() -> tuple[str, float]: class HardwareInfo (line 39) | class HardwareInfo: method __init__ (line 42) | def __init__(self) -> None: method to_dict (line 59) | def to_dict(self) -> dict[str, None | int | float | str]: function get_amd_gpu_stats (line 69) | def get_amd_gpu_stats(device_handle) -> tuple[int, float]: function get_intel_xpu_stats (line 76) | def get_intel_xpu_stats() -> tuple[int, float]: function get_nvidia_gpu_stats (line 106) | def get_nvidia_gpu_stats(device_handle) -> tuple[int, float]: class GPUMonitoringStatus (line 115) | class GPUMonitoringStatus(Enum): class GPURawMetrics (line 125) | class GPURawMetrics: method to_dict (line 134) | def to_dict(self) -> dict[str, None | int | float | str]: method from_dict (line 144) | def from_dict(cls, data: dict[str, None | int | float | str]) -> "GPUR... class GPUMonitor (line 156) | class GPUMonitor: method __init__ (line 159) | def __init__(self, sample_interval_sec: float = 0.05, logger: Logger |... method _monitor_worker (line 184) | def _monitor_worker(gpu_type: str, sample_interval_sec: float, connect... method start (line 247) | def start(self): method stop_and_collect (line 266) | def stop_and_collect(self) -> GPURawMetrics: FILE: conftest.py function pytest_configure (line 85) | def pytest_configure(config): function pytest_collection_modifyitems (line 105) | def pytest_collection_modifyitems(items): function pytest_addoption (line 111) | def pytest_addoption(parser): function pytest_terminal_summary (line 117) | def pytest_terminal_summary(terminalreporter): function pytest_sessionfinish (line 125) | def pytest_sessionfinish(session, exitstatus): class CustomOutputChecker (line 137) | class CustomOutputChecker(OutputChecker): method check_output (line 138) | def check_output(self, want, got, optionflags): FILE: examples/3D_parallel.py function main (line 74) | def main(): function all_reduce_grads (line 355) | def all_reduce_grads(model, world_mesh, use_ddp): class AppState (line 383) | class AppState(Stateful): method __init__ (line 386) | def __init__(self, model, optimizer=None): method state_dict (line 390) | def state_dict(self): method load_state_dict (line 394) | def load_state_dict(self, state_dict): function clip_grad_norm_ (line 400) | def clip_grad_norm_( FILE: examples/metrics-monitoring/metrics_example.py class ExampleClass (line 7) | class ExampleClass: method __init__ (line 8) | def __init__(self, name): method process_data (line 13) | def process_data(self, data): method special_operation (line 18) | def special_operation(self, value): method operation_with_attributes (line 28) | def operation_with_attributes(self): function standalone_function (line 35) | def standalone_function(arg1, arg2): FILE: examples/modular-transformers/configuration_duplicated_method.py class DuplicatedMethodConfig (line 18) | class DuplicatedMethodConfig(PreTrainedConfig): method __post_init__ (line 73) | def __post_init__(self, **kwargs): method validate_architecture (line 81) | def validate_architecture(self): method vocab_size (line 90) | def vocab_size(self): # noqa: F811 -> we need this at we cannot delet... method vocab_size (line 94) | def vocab_size(self, value): FILE: examples/modular-transformers/configuration_my_new_model.py class MyNewModelConfig (line 18) | class MyNewModelConfig(PreTrainedConfig): method __post_init__ (line 178) | def __post_init__(self, **kwargs): method validate_architecture (line 186) | def validate_architecture(self): FILE: examples/modular-transformers/configuration_my_new_model2.py class MyNewModel2Config (line 17) | class MyNewModel2Config(PreTrainedConfig): method __post_init__ (line 79) | def __post_init__(self, **kwargs): method validate_architecture (line 87) | def validate_architecture(self): FILE: examples/modular-transformers/configuration_new_model.py class NewModelConfig (line 17) | class NewModelConfig(PreTrainedConfig): method num_heads (line 71) | def num_heads(self): FILE: examples/modular-transformers/image_processing_new_imgproc_model.py class ImgprocModelImageProcessor (line 35) | class ImgprocModelImageProcessor(BaseImageProcessor): method __init__ (line 72) | def __init__( method resize (line 99) | def resize( method preprocess (line 148) | def preprocess( method new_image_processing_method (line 279) | def new_image_processing_method(self, pixel_values: torch.FloatTensor): FILE: examples/modular-transformers/modeling_add_function.py function rotate_half (line 15) | def rotate_half(x): function apply_rotary_pos_emb (line 23) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class TestAttention (line 48) | class TestAttention(nn.Module): method __init__ (line 62) | def __init__(self): method forward (line 65) | def forward(self) -> tuple[torch.Tensor, torch.Tensor | None, tuple[to... FILE: examples/modular-transformers/modeling_dummy_bert.py class DummyBertEmbeddings (line 27) | class DummyBertEmbeddings(nn.Module): method __init__ (line 30) | def __init__(self, config): method forward (line 46) | def forward( function eager_attention_forward (line 89) | def eager_attention_forward( class DummyBertSelfAttention (line 117) | class DummyBertSelfAttention(nn.Module): method __init__ (line 118) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 142) | def forward( class DummyBertCrossAttention (line 184) | class DummyBertCrossAttention(nn.Module): method __init__ (line 185) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 208) | def forward( class DummyBertSelfOutput (line 261) | class DummyBertSelfOutput(nn.Module): method __init__ (line 262) | def __init__(self, config): method forward (line 268) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class DummyBertAttention (line 275) | class DummyBertAttention(nn.Module): method __init__ (line 276) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 283) | def forward( class DummyBertIntermediate (line 304) | class DummyBertIntermediate(nn.Module): method __init__ (line 305) | def __init__(self, config): method forward (line 313) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DummyBertOutput (line 319) | class DummyBertOutput(nn.Module): method __init__ (line 320) | def __init__(self, config): method forward (line 326) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class DummyBertLayer (line 333) | class DummyBertLayer(GradientCheckpointingLayer): method __init__ (line 334) | def __init__(self, config, layer_idx=None): method forward (line 353) | def forward( method feed_forward_chunk (line 392) | def feed_forward_chunk(self, attention_output): class DummyBertEncoder (line 398) | class DummyBertEncoder(nn.Module): method __init__ (line 399) | def __init__(self, config): method forward (line 404) | def forward( class DummyBertPooler (line 430) | class DummyBertPooler(nn.Module): method __init__ (line 431) | def __init__(self, config): method forward (line 436) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DummyBertPredictionHeadTransform (line 445) | class DummyBertPredictionHeadTransform(nn.Module): method __init__ (line 446) | def __init__(self, config): method forward (line 455) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DummyBertLMPredictionHead (line 462) | class DummyBertLMPredictionHead(nn.Module): method __init__ (line 463) | def __init__(self, config): method forward (line 472) | def forward(self, hidden_states): class DummyBertPreTrainedModel (line 479) | class DummyBertPreTrainedModel(PreTrainedModel): method _init_weights (line 494) | def _init_weights(self, module): class DummyBertModel (line 516) | class DummyBertModel(DummyBertPreTrainedModel): method __init__ (line 519) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 536) | def get_input_embeddings(self): method set_input_embeddings (line 539) | def set_input_embeddings(self, value): method forward (line 545) | def forward( method _create_attention_masks (line 613) | def _create_attention_masks( FILE: examples/modular-transformers/modeling_from_uppercase_model.py function eager_attention_forward (line 21) | def eager_attention_forward( class FromUppercaseModelAttention (line 42) | class FromUppercaseModelAttention(nn.Module): method __init__ (line 45) | def __init__(self, config: FromUppercaseModelVisionConfig | FromUpperc... method forward (line 60) | def forward( class FromUppercaseModelMLP (line 99) | class FromUppercaseModelMLP(nn.Module): method __init__ (line 100) | def __init__(self, config): method forward (line 107) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class FromUppercaseModelEncoderLayer (line 114) | class FromUppercaseModelEncoderLayer(GradientCheckpointingLayer): method __init__ (line 115) | def __init__(self, config: FromUppercaseModelVisionConfig | FromUpperc... method forward (line 123) | def forward( FILE: examples/modular-transformers/modeling_global_indexing.py function rotate_half (line 21) | def rotate_half(x): function apply_rotary_pos_emb (line 29) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 54) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 66) | def eager_attention_forward( function custom_flex (line 91) | def custom_flex(x, **kwargs): class GlobalIndexingAttention (line 102) | class GlobalIndexingAttention(nn.Module): method __init__ (line 105) | def __init__(self, config: GlobalIndexingConfig, layer_idx: int): method forward (line 128) | def forward( FILE: examples/modular-transformers/modeling_multimodal2.py function eager_attention_forward (line 24) | def eager_attention_forward( class Multimodal2VisionAttention (line 45) | class Multimodal2VisionAttention(nn.Module): method __init__ (line 48) | def __init__(self, config: Multimodal2VisionConfig | Multimodal2TextCo... method forward (line 63) | def forward( class Multimodal2VisionMLP (line 102) | class Multimodal2VisionMLP(nn.Module): method __init__ (line 103) | def __init__(self, config): method forward (line 110) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Multimodal2VisionEncoderLayer (line 117) | class Multimodal2VisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 118) | def __init__(self, config): method forward (line 126) | def forward( class Multimodal2VisionEncoder (line 150) | class Multimodal2VisionEncoder(nn.Module): method __init__ (line 159) | def __init__(self, config): method forward (line 165) | def forward( class Multimodal2VisionPreTrainedModel (line 199) | class Multimodal2VisionPreTrainedModel(PreTrainedModel): method _init_weights (line 214) | def _init_weights(self, module): class Multimodal2VisionEmbeddings (line 220) | class Multimodal2VisionEmbeddings(nn.Module): method __init__ (line 221) | def __init__(self, config: Multimodal2VisionConfig): method interpolate_pos_encoding (line 243) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 284) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class Multimodal2VisionTransformer (line 303) | class Multimodal2VisionTransformer(Multimodal2VisionPreTrainedModel): method __init__ (line 309) | def __init__(self, config): method forward (line 323) | def forward( class Multimodal2VisionModel (line 355) | class Multimodal2VisionModel(Multimodal2VisionPreTrainedModel): method __init__ (line 361) | def __init__(self, config: Multimodal2VisionConfig): method get_input_embeddings (line 367) | def get_input_embeddings(self) -> nn.Module: method forward (line 371) | def forward( FILE: examples/modular-transformers/modeling_my_new_model2.py class MyNewModel2TextScaledWordEmbedding (line 23) | class MyNewModel2TextScaledWordEmbedding(nn.Embedding): method __init__ (line 28) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 33) | def forward(self, input_ids: torch.Tensor): class MyNewModel2RMSNorm (line 37) | class MyNewModel2RMSNorm(nn.Module): method __init__ (line 38) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 43) | def _norm(self, x): method forward (line 46) | def forward(self, x): method extra_repr (line 53) | def extra_repr(self): class MyNewModel2MLP (line 57) | class MyNewModel2MLP(nn.Module): method __init__ (line 58) | def __init__(self, config): method forward (line 68) | def forward(self, x): function rotate_half (line 73) | def rotate_half(x): function apply_rotary_pos_emb (line 81) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 106) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 118) | def eager_attention_forward( class MyNewModel2Attention (line 144) | class MyNewModel2Attention(nn.Module): method __init__ (line 147) | def __init__(self, config: MyNewModel2Config, layer_idx: int): method forward (line 170) | def forward( class MyNewModel2DecoderLayer (line 211) | class MyNewModel2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 212) | def __init__(self, config: MyNewModel2Config, layer_idx: int): method forward (line 222) | def forward( class MyNewModel2PreTrainedModel (line 255) | class MyNewModel2PreTrainedModel(PreTrainedModel): method _init_weights (line 273) | def _init_weights(self, module): class MyNewModel2ForSequenceClassification (line 282) | class MyNewModel2ForSequenceClassification(GenericForSequenceClassificat... FILE: examples/modular-transformers/modeling_new_task_model.py class NewTaskModelModelOutputWithPast (line 37) | class NewTaskModelModelOutputWithPast(BaseModelOutputWithPast): class NewTaskModelCausalLMOutputWithPast (line 53) | class NewTaskModelCausalLMOutputWithPast(ModelOutput): class NewTaskModelMultiModalProjector (line 77) | class NewTaskModelMultiModalProjector(nn.Module): method __init__ (line 78) | def __init__(self, config: NewTaskModelConfig): method forward (line 82) | def forward(self, image_features): class NewTaskModelPreTrainedModel (line 89) | class NewTaskModelPreTrainedModel(PreTrainedModel): function token_type_ids_mask_function (line 103) | def token_type_ids_mask_function( function create_causal_mask_mapping (line 144) | def create_causal_mask_mapping( class NewTaskModelModel (line 221) | class NewTaskModelModel(NewTaskModelPreTrainedModel): method __init__ (line 225) | def __init__(self, config: NewTaskModelConfig): method get_input_embeddings (line 237) | def get_input_embeddings(self): method set_input_embeddings (line 240) | def set_input_embeddings(self, value): method get_image_features (line 247) | def get_image_features( method get_placeholder_mask (line 257) | def get_placeholder_mask( method forward (line 283) | def forward( class NewTaskModelForNewTask (line 390) | class NewTaskModelForNewTask(NewTaskModelPreTrainedModel, GenerationMixin): method __init__ (line 394) | def __init__(self, config): method get_input_embeddings (line 403) | def get_input_embeddings(self): method set_input_embeddings (line 406) | def set_input_embeddings(self, value): method get_image_features (line 410) | def get_image_features(self, pixel_values: torch.FloatTensor, **kwargs... method forward (line 415) | def forward( method prepare_inputs_for_generation (line 460) | def prepare_inputs_for_generation( method create_masks_for_generate (line 505) | def create_masks_for_generate( method resize_token_embeddings (line 527) | def resize_token_embeddings( FILE: examples/modular-transformers/modeling_roberta.py class RobertaEmbeddings (line 27) | class RobertaEmbeddings(nn.Module): method __init__ (line 30) | def __init__(self, config): method forward (line 49) | def forward( function eager_attention_forward (line 92) | def eager_attention_forward( class RobertaSelfAttention (line 120) | class RobertaSelfAttention(nn.Module): method __init__ (line 121) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 145) | def forward( class RobertaCrossAttention (line 187) | class RobertaCrossAttention(nn.Module): method __init__ (line 188) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 211) | def forward( class RobertaSelfOutput (line 264) | class RobertaSelfOutput(nn.Module): method __init__ (line 265) | def __init__(self, config): method forward (line 271) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RobertaAttention (line 278) | class RobertaAttention(nn.Module): method __init__ (line 279) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 286) | def forward( class RobertaIntermediate (line 307) | class RobertaIntermediate(nn.Module): method __init__ (line 308) | def __init__(self, config): method forward (line 316) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RobertaOutput (line 322) | class RobertaOutput(nn.Module): method __init__ (line 323) | def __init__(self, config): method forward (line 329) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RobertaLayer (line 336) | class RobertaLayer(GradientCheckpointingLayer): method __init__ (line 337) | def __init__(self, config, layer_idx=None): method forward (line 356) | def forward( method feed_forward_chunk (line 395) | def feed_forward_chunk(self, attention_output): class RobertaEncoder (line 401) | class RobertaEncoder(nn.Module): method __init__ (line 402) | def __init__(self, config): method forward (line 407) | def forward( class RobertaPooler (line 433) | class RobertaPooler(nn.Module): method __init__ (line 434) | def __init__(self, config): method forward (line 439) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RobertaPredictionHeadTransform (line 448) | class RobertaPredictionHeadTransform(nn.Module): method __init__ (line 449) | def __init__(self, config): method forward (line 458) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RobertaLMPredictionHead (line 465) | class RobertaLMPredictionHead(nn.Module): method __init__ (line 466) | def __init__(self, config): method forward (line 475) | def forward(self, hidden_states): class RobertaPreTrainedModel (line 482) | class RobertaPreTrainedModel(PreTrainedModel): method _init_weights (line 497) | def _init_weights(self, module): class RobertaModel (line 519) | class RobertaModel(RobertaPreTrainedModel): method __init__ (line 522) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 539) | def get_input_embeddings(self): method set_input_embeddings (line 542) | def set_input_embeddings(self, value): method forward (line 548) | def forward( method _create_attention_masks (line 613) | def _create_attention_masks( FILE: examples/modular-transformers/modeling_super.py class SuperRMSNorm (line 29) | class SuperRMSNorm(nn.Module): method __init__ (line 30) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 38) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 45) | def extra_repr(self): class SuperRotaryEmbedding (line 49) | class SuperRotaryEmbedding(nn.Module): method __init__ (line 52) | def __init__(self, config: SuperConfig, device=None): method compute_default_rope_parameters (line 69) | def compute_default_rope_parameters( method forward (line 100) | def forward(self, x, position_ids): class SuperMLP (line 114) | class SuperMLP(nn.Module): method __init__ (line 115) | def __init__(self, config): method forward (line 125) | def forward(self, x): function rotate_half (line 130) | def rotate_half(x): function apply_rotary_pos_emb (line 138) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 163) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 175) | def eager_attention_forward( class SuperAttention (line 201) | class SuperAttention(nn.Module): method __init__ (line 204) | def __init__(self, config: SuperConfig, layer_idx: int): method forward (line 227) | def forward( class SuperDecoderLayer (line 268) | class SuperDecoderLayer(GradientCheckpointingLayer): method __init__ (line 269) | def __init__(self, config: SuperConfig, layer_idx: int): method forward (line 279) | def forward( class SuperPreTrainedModel (line 312) | class SuperPreTrainedModel(PreTrainedModel): class SuperModel (line 331) | class SuperModel(SuperPreTrainedModel): method __init__ (line 332) | def __init__(self, config: SuperConfig): method forward (line 351) | def forward( FILE: examples/modular-transformers/modeling_switch_function.py function rotate_half (line 21) | def rotate_half(x): function apply_rotary_pos_emb (line 30) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 55) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 67) | def eager_attention_forward( class SwitchFunctionAttention (line 93) | class SwitchFunctionAttention(nn.Module): method __init__ (line 96) | def __init__(self, config: SwitchFunctionConfig, layer_idx: int): method forward (line 119) | def forward( FILE: examples/modular-transformers/modeling_test_detr.py class TestDetrDecoderOutput (line 40) | class TestDetrDecoderOutput(BaseModelOutputWithCrossAttentions): class TestDetrModelOutput (line 64) | class TestDetrModelOutput(ModelOutput): class MultiScaleDeformableAttention (line 97) | class MultiScaleDeformableAttention(nn.Module): method forward (line 98) | def forward( class TestDetrFrozenBatchNorm2d (line 151) | class TestDetrFrozenBatchNorm2d(nn.Module): method __init__ (line 159) | def __init__(self, n): method _load_from_state_dict (line 166) | def _load_from_state_dict( method forward (line 177) | def forward(self, x): function replace_batch_norm (line 190) | def replace_batch_norm(model): class TestDetrConvEncoder (line 214) | class TestDetrConvEncoder(nn.Module): method __init__ (line 222) | def __init__(self, config): method forward (line 252) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class TestDetrSinePositionEmbedding (line 266) | class TestDetrSinePositionEmbedding(nn.Module): method __init__ (line 272) | def __init__( method forward (line 288) | def forward( class TestDetrLearnedPositionEmbedding (line 318) | class TestDetrLearnedPositionEmbedding(nn.Module): method __init__ (line 323) | def __init__(self, embedding_dim=256): method forward (line 329) | def forward( function eager_attention_forward (line 351) | def eager_attention_forward( class TestDetrSelfAttention (line 379) | class TestDetrSelfAttention(nn.Module): method __init__ (line 386) | def __init__( method forward (line 406) | def forward( class TestDetrMultiscaleDeformableAttention (line 445) | class TestDetrMultiscaleDeformableAttention(nn.Module): method __init__ (line 450) | def __init__(self, config: TestDetrConfig, num_heads: int, n_points: i... method forward (line 482) | def forward( class TestDetrMLP (line 552) | class TestDetrMLP(nn.Module): method __init__ (line 553) | def __init__(self, config: TestDetrConfig, hidden_size: int, intermedi... method forward (line 561) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TestDetrEncoderLayer (line 569) | class TestDetrEncoderLayer(GradientCheckpointingLayer): method __init__ (line 570) | def __init__(self, config: TestDetrConfig): method forward (line 583) | def forward( class TestDetrDecoderLayer (line 639) | class TestDetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 640) | def __init__(self, config: TestDetrConfig): method forward (line 662) | def forward( class TestDetrPreTrainedModel (line 735) | class TestDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 755) | def _init_weights(self, module): class TestDetrEncoder (line 799) | class TestDetrEncoder(TestDetrPreTrainedModel): method __init__ (line 815) | def __init__(self, config: TestDetrConfig): method forward (line 826) | def forward( method get_reference_points (line 876) | def get_reference_points(spatial_shapes_list, valid_ratios, device): function inverse_sigmoid (line 907) | def inverse_sigmoid(x, eps=1e-5): class TestDetrDecoder (line 914) | class TestDetrDecoder(TestDetrPreTrainedModel): method __init__ (line 935) | def __init__(self, config: TestDetrConfig): method forward (line 950) | def forward( class TestDetrModel (line 1054) | class TestDetrModel(TestDetrPreTrainedModel): method __init__ (line 1055) | def __init__(self, config: TestDetrConfig): method freeze_backbone (line 1128) | def freeze_backbone(self): method unfreeze_backbone (line 1132) | def unfreeze_backbone(self): method get_valid_ratio (line 1136) | def get_valid_ratio(self, mask, dtype=torch.float32): method get_proposal_pos_embed (line 1147) | def get_proposal_pos_embed(self, proposals): method gen_encoder_output_proposals (line 1167) | def gen_encoder_output_proposals(self, enc_output, padding_mask, spati... method forward (line 1230) | def forward( FILE: examples/modular-transformers/modeling_test_suffix.py class TestSuffixDecoderLayer (line 22) | class TestSuffixDecoderLayer(nn.module): class TestSuffixLlamaRMSNorm (line 27) | class TestSuffixLlamaRMSNorm(nn.Module): method __init__ (line 28) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 36) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 43) | def extra_repr(self): class TestSuffixLlamaMLP (line 47) | class TestSuffixLlamaMLP(nn.Module): method __init__ (line 48) | def __init__(self, config): method forward (line 58) | def forward(self, x): function rotate_half (line 63) | def rotate_half(x): function apply_rotary_pos_emb (line 71) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 96) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 108) | def eager_attention_forward( class TestSuffixLlamaAttention (line 134) | class TestSuffixLlamaAttention(nn.Module): method __init__ (line 137) | def __init__(self, config: TestSuffixLlamaConfig, layer_idx: int): method forward (line 160) | def forward( class TestSuffixLlamaDecoderLayer (line 201) | class TestSuffixLlamaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 202) | def __init__(self, config: TestSuffixLlamaConfig, layer_idx: int): method forward (line 212) | def forward( FILE: examples/modular-transformers/modular_add_function.py class TestAttention (line 10) | class TestAttention(ZambaAttention): method __init__ (line 11) | def __init__(self): method forward (line 14) | def forward(self): FILE: examples/modular-transformers/modular_dummy_bert.py class DummyBertModel (line 10) | class DummyBertModel(BertModel): method forward (line 11) | def forward( FILE: examples/modular-transformers/modular_duplicated_method.py class DuplicatedMethodConfig (line 4) | class DuplicatedMethodConfig(LlamaConfig): method vocab_size (line 6) | def vocab_size(self): # noqa: F811 -> we need this at we cannot delet... method vocab_size (line 10) | def vocab_size(self, value): FILE: examples/modular-transformers/modular_from_uppercase_model.py class FromUppercaseModelEncoderLayer (line 5) | class FromUppercaseModelEncoderLayer(CLIPEncoderLayer): FILE: examples/modular-transformers/modular_global_indexing.py function custom_flex (line 5) | def custom_flex(x, **kwargs): class GlobalIndexingAttention (line 15) | class GlobalIndexingAttention(LlamaAttention): FILE: examples/modular-transformers/modular_multimodal2.py class Multimodal2VisionAttention (line 25) | class Multimodal2VisionAttention(CLIPAttention): class Multimodal2VisionMLP (line 29) | class Multimodal2VisionMLP(CLIPMLP): class Multimodal2VisionEncoderLayer (line 33) | class Multimodal2VisionEncoderLayer(CLIPEncoderLayer): method __init__ (line 34) | def __init__(self, config): class Multimodal2VisionEncoder (line 40) | class Multimodal2VisionEncoder(CLIPEncoder): method __init__ (line 41) | def __init__(self, config): class Multimodal2VisionPreTrainedModel (line 46) | class Multimodal2VisionPreTrainedModel(CLIPPreTrainedModel): method _init_weights (line 52) | def _init_weights(self, module): class Multimodal2VisionTransformer (line 59) | class Multimodal2VisionTransformer(CLIPVisionTransformer, Multimodal2Vis... method __init__ (line 62) | def __init__(self, config): class Multimodal2VisionModel (line 69) | class Multimodal2VisionModel(CLIPVisionModel, Multimodal2VisionPreTraine... FILE: examples/modular-transformers/modular_my_new_model.py class MyNewModelConfig (line 5) | class MyNewModelConfig(LlamaConfig): FILE: examples/modular-transformers/modular_my_new_model2.py class MyNewModel2Config (line 6) | class MyNewModel2Config(LlamaConfig): class MyNewModel2ForSequenceClassification (line 30) | class MyNewModel2ForSequenceClassification(GemmaForSequenceClassification): FILE: examples/modular-transformers/modular_new_imgproc_model.py class ImgprocModelImageProcessor (line 7) | class ImgprocModelImageProcessor(BlipImageProcessor): method new_image_processing_method (line 8) | def new_image_processing_method(self, pixel_values: torch.FloatTensor): FILE: examples/modular-transformers/modular_new_model.py class NewModelConfig (line 6) | class NewModelConfig(GemmaConfig): method num_heads (line 30) | def num_heads(self): FILE: examples/modular-transformers/modular_new_task_model.py class NewTaskModelForNewTask (line 12) | class NewTaskModelForNewTask(PaliGemmaForConditionalGeneration): method __init__ (line 15) | def __init__(self, config): method forward (line 23) | def forward( method resize_token_embeddings (line 68) | def resize_token_embeddings( FILE: examples/modular-transformers/modular_roberta.py class RobertaEmbeddings (line 6) | class RobertaEmbeddings(BertEmbeddings): method __init__ (line 7) | def __init__(self, config): class RobertaModel (line 15) | class RobertaModel(BertModel): method __init__ (line 16) | def __init__(self, config, add_pooling_layer=True): FILE: examples/modular-transformers/modular_super.py class SuperModel (line 10) | class SuperModel(LlamaModel): method forward (line 11) | def forward( FILE: examples/modular-transformers/modular_switch_function.py class SwitchFunctionAttention (line 9) | class SwitchFunctionAttention(LlamaAttention): FILE: examples/modular-transformers/modular_test_detr.py class TestDetrModel (line 6) | class TestDetrModel(DeformableDetrModel): FILE: examples/modular-transformers/modular_test_suffix.py class TestSuffixDecoderLayer (line 6) | class TestSuffixDecoderLayer(nn.module): class TestSuffixLlamaDecoderLayer (line 11) | class TestSuffixLlamaDecoderLayer(LlamaDecoderLayer): FILE: examples/pytorch/3d_parallel_checks.py function main (line 75) | def main(): function all_reduce_grads (line 557) | def all_reduce_grads(model, world_mesh, use_ddp): class ContextParallelCollator (line 585) | class ContextParallelCollator: method __init__ (line 588) | def __init__(self, cp_mesh: DeviceMesh | None = None): method __call__ (line 591) | def __call__(self, batch: dict[str, torch.Tensor]) -> dict[str, torch.... class AppState (line 612) | class AppState(Stateful): method __init__ (line 615) | def __init__(self, model, optimizer=None): method state_dict (line 619) | def state_dict(self): method load_state_dict (line 623) | def load_state_dict(self, state_dict): function sanity_check_tensor_sync (line 629) | def sanity_check_tensor_sync( function clip_grad_norm_ (line 694) | def clip_grad_norm_( function check_params_sync (line 727) | def check_params_sync(model_params, original_params): function get_parameters (line 745) | def get_parameters(model: nn.Module) -> Iterable[torch.Tensor]: function update_model_parameters (line 765) | def update_model_parameters(model: nn.Module) -> None: FILE: examples/pytorch/audio-classification/run_audio_classification.py function random_subsample (line 60) | def random_subsample(wav: np.ndarray, max_length: float, sample_rate: in... class DataTrainingArguments (line 70) | class DataTrainingArguments: class ModelArguments (line 134) | class ModelArguments: function main (line 185) | def main(): FILE: examples/pytorch/conftest.py function pytest_addoption (line 34) | def pytest_addoption(parser): function pytest_terminal_summary (line 40) | def pytest_terminal_summary(terminalreporter): FILE: examples/pytorch/continuous_batching.py function generate_without_cb (line 33) | def generate_without_cb( function maybe_setup_metrics (line 54) | def maybe_setup_metrics(use_metrics: bool) -> None: function batch_generate (line 86) | def batch_generate( FILE: examples/pytorch/contrastive-image-text/run_clip.py class ModelArguments (line 70) | class ModelArguments: class DataTrainingArguments (line 124) | class DataTrainingArguments: method __post_init__ (line 184) | def __post_init__(self): class Transform (line 203) | class Transform(torch.nn.Module): method __init__ (line 204) | def __init__(self, image_size, mean, std): method forward (line 213) | def forward(self, x) -> torch.Tensor: function collate_fn (line 220) | def collate_fn(examples): function main (line 232) | def main(): FILE: examples/pytorch/image-classification/run_image_classification.py function pil_loader (line 77) | def pil_loader(path: str): class DataTrainingArguments (line 84) | class DataTrainingArguments: method __post_init__ (line 132) | def __post_init__(self): class ModelArguments (line 140) | class ModelArguments: function main (line 189) | def main(): FILE: examples/pytorch/image-classification/run_image_classification_no_trainer.py function parse_args (line 73) | def parse_args(): function main (line 236) | def main(): FILE: examples/pytorch/image-pretraining/run_mae.py class DataTrainingArguments (line 58) | class DataTrainingArguments: method __post_init__ (line 109) | def __post_init__(self): class ModelArguments (line 119) | class ModelArguments: class CustomTrainingArguments (line 170) | class CustomTrainingArguments(TrainingArguments): function collate_fn (line 176) | def collate_fn(examples): function main (line 181) | def main(): function _mp_fn (line 387) | def _mp_fn(index): FILE: examples/pytorch/image-pretraining/run_mim.py class DataTrainingArguments (line 66) | class DataTrainingArguments: method __post_init__ (line 112) | def __post_init__(self): class ModelArguments (line 122) | class ModelArguments: class MaskGenerator (line 203) | class MaskGenerator: method __init__ (line 211) | def __init__(self, input_size=192, mask_patch_size=32, model_patch_siz... method __call__ (line 228) | def __call__(self): function collate_fn (line 239) | def collate_fn(examples): function main (line 245) | def main(): FILE: examples/pytorch/image-pretraining/run_mim_no_trainer.py function parse_args (line 74) | def parse_args(): class MaskGenerator (line 344) | class MaskGenerator: method __init__ (line 352) | def __init__(self, input_size=192, mask_patch_size=32, model_patch_siz... method __call__ (line 369) | def __call__(self): function collate_fn (line 380) | def collate_fn(examples): function main (line 386) | def main(): FILE: examples/pytorch/instance-segmentation/run_instance_segmentation.py class Arguments (line 65) | class Arguments: function augment_and_transform_batch (line 113) | def augment_and_transform_batch( function collate_fn (line 154) | def collate_fn(examples): class ModelOutput (line 165) | class ModelOutput: function nested_cpu (line 170) | def nested_cpu(tensors): class Evaluator (line 181) | class Evaluator: method __init__ (line 186) | def __init__( method get_metric (line 206) | def get_metric(self): method reset_metric (line 210) | def reset_metric(self): method postprocess_target_batch (line 213) | def postprocess_target_batch(self, target_batch) -> list[dict[str, tor... method get_target_sizes (line 227) | def get_target_sizes(self, post_processed_targets) -> list[list[int]]: method postprocess_prediction_batch (line 233) | def postprocess_prediction_batch(self, prediction_batch, target_sizes)... method __call__ (line 264) | def __call__(self, evaluation_results: EvalPrediction, compute_result:... function setup_logging (line 310) | def setup_logging(training_args: TrainingArguments) -> None: function find_last_checkpoint (line 330) | def find_last_checkpoint(training_args: TrainingArguments) -> str | None: function main (line 340) | def main(): FILE: examples/pytorch/instance-segmentation/run_instance_segmentation_no_trainer.py function parse_args (line 71) | def parse_args(): function augment_and_transform_batch (line 232) | def augment_and_transform_batch( function collate_fn (line 273) | def collate_fn(examples): function nested_cpu (line 283) | def nested_cpu(tensors): function evaluation_loop (line 294) | def evaluation_loop(model, image_processor, accelerator: Accelerator, da... function setup_logging (line 369) | def setup_logging(accelerator: Accelerator) -> None: function handle_repository_creation (line 387) | def handle_repository_creation(accelerator: Accelerator, args: argparse.... function main (line 413) | def main(): FILE: examples/pytorch/language-modeling/run_clm.py class ModelArguments (line 82) | class ModelArguments: method __post_init__ (line 156) | def __post_init__(self): class DataTrainingArguments (line 164) | class DataTrainingArguments: method __post_init__ (line 226) | def __post_init__(self): function split_streaming_dataset (line 241) | def split_streaming_dataset( function main (line 280) | def main(): function _mp_fn (line 704) | def _mp_fn(index): FILE: examples/pytorch/language-modeling/run_clm_no_trainer.py function parse_args (line 86) | def parse_args(): function main (line 270) | def main(): FILE: examples/pytorch/language-modeling/run_fim.py class ModelArguments (line 85) | class ModelArguments: method __post_init__ (line 171) | def __post_init__(self): class DataTrainingArguments (line 179) | class DataTrainingArguments: method __post_init__ (line 292) | def __post_init__(self): function main (line 307) | def main(): function _mp_fn (line 838) | def _mp_fn(index): FILE: examples/pytorch/language-modeling/run_fim_no_trainer.py function parse_args (line 89) | def parse_args(): function main (line 330) | def main(): FILE: examples/pytorch/language-modeling/run_mlm.py class ModelArguments (line 79) | class ModelArguments: method __post_init__ (line 153) | def __post_init__(self): class DataTrainingArguments (line 161) | class DataTrainingArguments: method __post_init__ (line 235) | def __post_init__(self): function main (line 252) | def main(): function _mp_fn (line 662) | def _mp_fn(index): FILE: examples/pytorch/language-modeling/run_mlm_no_trainer.py function parse_args (line 84) | def parse_args(): function main (line 277) | def main(): FILE: examples/pytorch/language-modeling/run_plm.py class ModelArguments (line 70) | class ModelArguments: method __post_init__ (line 120) | def __post_init__(self): class DataTrainingArguments (line 128) | class DataTrainingArguments: method __post_init__ (line 220) | def __post_init__(self): function main (line 232) | def main(): function _mp_fn (line 559) | def _mp_fn(index): FILE: examples/pytorch/multiple-choice/run_swag.py class ModelArguments (line 64) | class ModelArguments: class DataTrainingArguments (line 112) | class DataTrainingArguments: method __post_init__ (line 167) | def __post_init__(self): function main (line 176) | def main(): function _mp_fn (line 426) | def _mp_fn(index): FILE: examples/pytorch/multiple-choice/run_swag_no_trainer.py function parse_args (line 78) | def parse_args(): function main (line 240) | def main(): FILE: examples/pytorch/object-detection/run_object_detection.py class ModelOutput (line 67) | class ModelOutput: function format_image_annotations_as_coco (line 72) | def format_image_annotations_as_coco( function convert_bbox_yolo_to_pascal (line 107) | def convert_bbox_yolo_to_pascal(boxes: torch.Tensor, image_size: tuple[i... function augment_and_transform_batch (line 129) | def augment_and_transform_batch( function collate_fn (line 161) | def collate_fn(batch: list[BatchFeature]) -> Mapping[str, torch.Tensor |... function compute_metrics (line 171) | def compute_metrics( class DataTrainingArguments (line 243) | class DataTrainingArguments: class ModelArguments (line 291) | class ModelArguments: function main (line 338) | def main(): FILE: examples/pytorch/object-detection/run_object_detection_no_trainer.py function format_image_annotations_as_coco (line 75) | def format_image_annotations_as_coco( function convert_bbox_yolo_to_pascal (line 111) | def convert_bbox_yolo_to_pascal(boxes: torch.Tensor, image_size: tuple[i... function augment_and_transform_batch (line 134) | def augment_and_transform_batch( function collate_fn (line 167) | def collate_fn(batch: list[BatchFeature]) -> Mapping[str, torch.Tensor |... function nested_to_cpu (line 176) | def nested_to_cpu(objects): function evaluation_loop (line 189) | def evaluation_loop( function parse_args (line 240) | def parse_args(): function main (line 406) | def main(): FILE: examples/pytorch/old_test_xla_examples.py function get_results (line 31) | def get_results(output_dir): class TorchXLAExamplesTests (line 47) | class TorchXLAExamplesTests(TestCasePlus): method test_run_glue (line 48) | def test_run_glue(self): method test_trainer_tpu (line 83) | def test_trainer_tpu(self): FILE: examples/pytorch/question-answering/run_qa.py class ModelArguments (line 57) | class ModelArguments: class DataTrainingArguments (line 101) | class DataTrainingArguments: method __post_init__ (line 204) | def __post_init__(self): function main (line 224) | def main(): function _mp_fn (line 685) | def _mp_fn(index): FILE: examples/pytorch/question-answering/run_qa_beam_search.py class ModelArguments (line 56) | class ModelArguments: class DataTrainingArguments (line 90) | class DataTrainingArguments: method __post_init__ (line 203) | def __post_init__(self): function main (line 223) | def main(): function _mp_fn (line 712) | def _mp_fn(index): FILE: examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py function save_prefixed_metrics (line 66) | def save_prefixed_metrics(results, output_dir, file_name: str = "all_res... function parse_args (line 89) | def parse_args(): function main (line 301) | def main(): FILE: examples/pytorch/question-answering/run_qa_no_trainer.py function save_prefixed_metrics (line 71) | def save_prefixed_metrics(results, output_dir, file_name: str = "all_res... function parse_args (line 94) | def parse_args(): function main (line 340) | def main(): FILE: examples/pytorch/question-answering/run_seq2seq_qa.py class ModelArguments (line 55) | class ModelArguments: class DataTrainingArguments (line 103) | class DataTrainingArguments: method __post_init__ (line 244) | def __post_init__(self): function main (line 271) | def main(): function _mp_fn (line 714) | def _mp_fn(index): FILE: examples/pytorch/question-answering/trainer_qa.py class QuestionAnsweringTrainer (line 30) | class QuestionAnsweringTrainer(Trainer): method __init__ (line 31) | def __init__(self, *args, eval_examples=None, post_process_function=No... method evaluate (line 36) | def evaluate(self, eval_dataset=None, eval_examples=None, ignore_keys=... method predict (line 90) | def predict(self, predict_dataset, predict_examples, ignore_keys=None,... FILE: examples/pytorch/question-answering/trainer_seq2seq_qa.py class QuestionAnsweringSeq2SeqTrainer (line 32) | class QuestionAnsweringSeq2SeqTrainer(Seq2SeqTrainer): method __init__ (line 33) | def __init__(self, *args, eval_examples=None, post_process_function=No... method evaluate (line 39) | def evaluate( method predict (line 112) | def predict( FILE: examples/pytorch/question-answering/utils_qa.py function postprocess_qa_predictions (line 30) | def postprocess_qa_predictions( function postprocess_qa_predictions_with_beam_search (line 251) | def postprocess_qa_predictions_with_beam_search( FILE: examples/pytorch/semantic-segmentation/run_semantic_segmentation.py function reduce_labels_transform (line 67) | def reduce_labels_transform(labels: np.ndarray, **kwargs) -> np.ndarray: class DataTrainingArguments (line 83) | class DataTrainingArguments: method __post_init__ (line 125) | def __post_init__(self): class ModelArguments (line 133) | class ModelArguments: function main (line 174) | def main(): FILE: examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py function reduce_labels_transform (line 71) | def reduce_labels_transform(labels: np.ndarray, **kwargs) -> np.ndarray: function parse_args (line 86) | def parse_args(): function main (line 234) | def main(): FILE: examples/pytorch/speech-pretraining/run_wav2vec2_pretraining_no_trainer.py function parse_args (line 60) | def parse_args(): class DataCollatorForWav2Vec2Pretraining (line 297) | class DataCollatorForWav2Vec2Pretraining: method __call__ (line 340) | def __call__(self, features: list[dict[str, list[int] | torch.Tensor]]... function multiply_grads (line 385) | def multiply_grads(params, c): function get_grad_norm (line 394) | def get_grad_norm(params, scale=1): function main (line 405) | def main(): FILE: examples/pytorch/speech-recognition/run_speech_recognition_ctc.py function list_field (line 72) | def list_field(default=None, metadata=None): class ModelArguments (line 77) | class ModelArguments: class DataTrainingArguments (line 166) | class DataTrainingArguments: class DataCollatorCTCWithPadding (line 310) | class DataCollatorCTCWithPadding: method __call__ (line 341) | def __call__(self, features: list[dict[str, list[int] | torch.Tensor]]... function create_vocabulary_from_data (line 373) | def create_vocabulary_from_data( function main (line 416) | def main(): FILE: examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py function list_field (line 75) | def list_field(default=None, metadata=None): class ModelArguments (line 80) | class ModelArguments: class DataTrainingArguments (line 142) | class DataTrainingArguments: class DataCollatorCTCWithPadding (line 290) | class DataCollatorCTCWithPadding: method __call__ (line 320) | def __call__(self, features: list[dict[str, list[int] | torch.Tensor]]... function create_vocabulary_from_data (line 350) | def create_vocabulary_from_data( function main (line 393) | def main(): FILE: examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py class ModelArguments (line 72) | class ModelArguments: class DataTrainingArguments (line 140) | class DataTrainingArguments: class DataCollatorSpeechSeq2SeqWithPadding (line 244) | class DataCollatorSpeechSeq2SeqWithPadding: method __call__ (line 260) | def __call__(self, features: list[dict[str, list[int] | torch.Tensor]]... function main (line 287) | def main(): FILE: examples/pytorch/summarization/run_summarization.py class ModelArguments (line 90) | class ModelArguments: class DataTrainingArguments (line 147) | class DataTrainingArguments: method __post_init__ (line 288) | def __post_init__(self): function main (line 326) | def main(): function _mp_fn (line 760) | def _mp_fn(index): FILE: examples/pytorch/summarization/run_summarization_no_trainer.py function parse_args (line 108) | def parse_args(): function main (line 339) | def main(): FILE: examples/pytorch/test_accelerate_examples.py function get_setup_file (line 42) | def get_setup_file(): function get_results (line 49) | def get_results(output_dir): class ExamplesTestsNoTrainer (line 64) | class ExamplesTestsNoTrainer(TestCasePlus): method setUpClass (line 66) | def setUpClass(cls): method tearDownClass (line 74) | def tearDownClass(cls): method test_run_glue_no_trainer (line 79) | def test_run_glue_no_trainer(self): method test_run_clm_no_trainer (line 104) | def test_run_clm_no_trainer(self): method test_run_mlm_no_trainer (line 132) | def test_run_mlm_no_trainer(self): method test_run_ner_no_trainer (line 153) | def test_run_ner_no_trainer(self): method test_run_squad_no_trainer (line 182) | def test_run_squad_no_trainer(self): method test_run_swag_no_trainer (line 211) | def test_run_swag_no_trainer(self): method test_run_summarization_no_trainer (line 234) | def test_run_summarization_no_trainer(self): method test_run_translation_no_trainer (line 262) | def test_run_translation_no_trainer(self): method test_run_semantic_segmentation_no_trainer (line 291) | def test_run_semantic_segmentation_no_trainer(self): method test_run_image_classification_no_trainer (line 314) | def test_run_image_classification_no_trainer(self): method test_run_object_detection_no_trainer (line 341) | def test_run_object_detection_no_trainer(self): method test_run_instance_segmentation_no_trainer (line 365) | def test_run_instance_segmentation_no_trainer(self): FILE: examples/pytorch/test_pytorch_examples.py function get_results (line 85) | def get_results(output_dir): class ExamplesTests (line 100) | class ExamplesTests(TestCasePlus): method test_run_glue (line 101) | def test_run_glue(self): method test_run_clm (line 128) | def test_run_clm(self): method test_run_clm_config_overrides (line 156) | def test_run_clm_config_overrides(self): method test_run_mlm (line 181) | def test_run_mlm(self): method test_run_ner (line 203) | def test_run_ner(self): method test_run_squad (line 233) | def test_run_squad(self): method test_run_squad_seq2seq (line 257) | def test_run_squad_seq2seq(self): method test_run_swag (line 285) | def test_run_swag(self): method test_generation (line 307) | def test_generation(self): method test_run_summarization (line 322) | def test_run_summarization(self): method test_run_translation (line 349) | def test_run_translation(self): method test_run_image_classification (line 378) | def test_run_image_classification(self): method test_run_speech_recognition_ctc (line 408) | def test_run_speech_recognition_ctc(self): method test_run_speech_recognition_ctc_adapter (line 437) | def test_run_speech_recognition_ctc_adapter(self): method test_run_speech_recognition_seq2seq (line 468) | def test_run_speech_recognition_seq2seq(self): method test_run_audio_classification (line 497) | def test_run_audio_classification(self): method test_run_wav2vec2_pretraining (line 528) | def test_run_wav2vec2_pretraining(self): method test_run_vit_mae_pretraining (line 551) | def test_run_vit_mae_pretraining(self): method test_run_semantic_segmentation (line 579) | def test_run_semantic_segmentation(self): method test_run_object_detection (line 605) | def test_run_object_detection(self): method test_run_instance_segmentation (line 633) | def test_run_instance_segmentation(self): FILE: examples/pytorch/text-classification/run_classification.py class DataTrainingArguments (line 71) | class DataTrainingArguments: method __post_init__ (line 206) | def __post_init__(self): class ModelArguments (line 220) | class ModelArguments: function get_label_list (line 271) | def get_label_list(raw_dataset, split="train") -> list[str]: function main (line 284) | def main(): function _mp_fn (line 738) | def _mp_fn(index): FILE: examples/pytorch/text-classification/run_glue.py class DataTrainingArguments (line 84) | class DataTrainingArguments: method __post_init__ (line 159) | def __post_init__(self): class ModelArguments (line 178) | class ModelArguments: function main (line 229) | def main(): function _mp_fn (line 638) | def _mp_fn(index): FILE: examples/pytorch/text-classification/run_glue_no_trainer.py function parse_args (line 87) | def parse_args(): function main (line 237) | def main(): FILE: examples/pytorch/text-classification/run_xnli.py class DataTrainingArguments (line 71) | class DataTrainingArguments: class ModelArguments (line 131) | class ModelArguments: function main (line 192) | def main(): FILE: examples/pytorch/text-generation/run_generation.py function prepare_ctrl_input (line 99) | def prepare_ctrl_input(args, _, tokenizer, prompt_text): function prepare_xlm_input (line 109) | def prepare_xlm_input(args, model, tokenizer, prompt_text): function prepare_xlnet_input (line 135) | def prepare_xlnet_input(args, _, tokenizer, prompt_text): function prepare_transfoxl_input (line 141) | def prepare_transfoxl_input(args, _, tokenizer, prompt_text): function adjust_length_to_model (line 155) | def adjust_length_to_model(length, max_sequence_length): function sparse_model_config (line 165) | def sparse_model_config(model_config): function generate_past_key_values (line 194) | def generate_past_key_values(model, batch_size, seq_len): function prepare_jit_inputs (line 223) | def prepare_jit_inputs(inputs, model, tokenizer): class _ModelFallbackWrapper (line 241) | class _ModelFallbackWrapper(GenerationMixin): method __init__ (line 244) | def __init__(self, optimized, default): method __call__ (line 248) | def __call__(self, *args, **kwargs): method __getattr__ (line 267) | def __getattr__(self, item): method prepare_inputs_for_generation (line 270) | def prepare_inputs_for_generation( method _reorder_cache (line 277) | def _reorder_cache( function main (line 288) | def main(): FILE: examples/pytorch/token-classification/run_ner.py class ModelArguments (line 68) | class ModelArguments: class DataTrainingArguments (line 116) | class DataTrainingArguments: method __post_init__ (line 212) | def __post_init__(self): function main (line 225) | def main(): function _mp_fn (line 635) | def _mp_fn(index): FILE: examples/pytorch/token-classification/run_ner_no_trainer.py function parse_args (line 82) | def parse_args(): function main (line 286) | def main(): FILE: examples/pytorch/transformers_serve_cb_eval_job.py function wait_for_server_up (line 21) | def wait_for_server_up(server_process, port=8000, timeout=600): function main (line 56) | def main(): FILE: examples/pytorch/translation/run_translation.py class ModelArguments (line 79) | class ModelArguments: class DataTrainingArguments (line 127) | class DataTrainingArguments: method __post_init__ (line 254) | def __post_init__(self): function main (line 274) | def main(): function _mp_fn (line 685) | def _mp_fn(index): FILE: examples/pytorch/translation/run_translation_no_trainer.py function parse_args (line 85) | def parse_args(): function main (line 329) | def main(): FILE: examples/pytorch/xla_spawn.py function parse_args (line 34) | def parse_args(): function main (line 66) | def main(): FILE: examples/quantization/custom_quantization.py class CustomConfig (line 12) | class CustomConfig(QuantizationConfigMixin): method __init__ (line 13) | def __init__(self): method to_dict (line 17) | def to_dict(self) -> dict[str, Any]: method __repr__ (line 23) | def __repr__(self): method to_diff_dict (line 27) | def to_diff_dict(self) -> dict[str, Any]: class CustomQuantizer (line 42) | class CustomQuantizer(HfQuantizer): method __init__ (line 43) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method _process_model_before_weight_loading (line 50) | def _process_model_before_weight_loading(self, model, **kwargs): method _process_model_after_weight_loading (line 53) | def _process_model_after_weight_loading(self, model, **kwargs): method is_serializable (line 56) | def is_serializable(self) -> bool: method is_trainable (line 59) | def is_trainable(self) -> bool: FILE: examples/quantization/custom_quantization_int8_example.py class Int8SymmetricLinear (line 16) | class Int8SymmetricLinear(torch.nn.Module): method __init__ (line 17) | def __init__(self, in_features, out_features, bias, dtype=torch.float32): method forward (line 30) | def forward(self, x): function _replace_with_int8_symmetric_linear (line 39) | def _replace_with_int8_symmetric_linear( function replace_with_int8_symmetric_linear (line 85) | def replace_with_int8_symmetric_linear( class Int8SymmetricConfig (line 110) | class Int8SymmetricConfig(QuantizationConfigMixin): method __init__ (line 115) | def __init__(self, modules_to_not_convert: list[str] | None = None, **... method __repr__ (line 119) | def __repr__(self): method to_diff_dict (line 123) | def to_diff_dict(self) -> dict[str, Any]: class Int8SymmetricQuantizer (line 136) | class Int8SymmetricQuantizer(HfQuantizer): method __init__ (line 145) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method _process_model_before_weight_loading (line 149) | def _process_model_before_weight_loading(self, model, **kwargs): method param_needs_quantization (line 162) | def param_needs_quantization(self, model, param_name: str, **kwargs) -... method create_quantized_param (line 172) | def create_quantized_param( method update_missing_keys (line 200) | def update_missing_keys(self, model, missing_keys: list[str], prefix: ... method _process_model_after_weight_loading (line 213) | def _process_model_after_weight_loading(self, model, **kwargs): method is_serializable (line 219) | def is_serializable(self): method is_trainable (line 223) | def is_trainable(self) -> bool: FILE: examples/scheduler/run_greedy.py function parse_args (line 53) | def parse_args(): function main (line 89) | def main(): FILE: examples/training/distributed_training.py function run (line 18) | def run(backend): function init_processes (line 34) | def init_processes(backend): FILE: scripts/check_tokenizers.py function check_diff (line 25) | def check_diff( function check_LTR_mark (line 48) | def check_LTR_mark(line: str, idx: int, fast: PreTrainedTokenizerBase) -... function check_details (line 59) | def check_details( function test_string (line 122) | def test_string(slow: PreTrainedTokenizerBase, fast: PreTrainedTokenizer... function test_tokenizer (line 154) | def test_tokenizer(slow: PreTrainedTokenizerBase, fast: PreTrainedTokeni... FILE: scripts/distributed/torch-distributed-gpu-test.py function printflock (line 53) | def printflock(*msgs): FILE: scripts/stale.py function main (line 36) | def main(): FILE: setup.py function deps_list (line 172) | def deps_list(*pkgs): class DepsTableUpdateCommand (line 274) | class DepsTableUpdateCommand(Command): method initialize_options (line 286) | def initialize_options(self): method finalize_options (line 289) | def finalize_options(self): method run (line 292) | def run(self): FILE: src/transformers/__init__.py function _create_module_alias (line 803) | def _create_module_alias(alias: str, target: str) -> None: function getattr_factory (line 833) | def getattr_factory(target): FILE: src/transformers/_typing.py class TransformersLogger (line 39) | class TransformersLogger(Protocol): method setLevel (line 52) | def setLevel(self, level: Level) -> None: ... method isEnabledFor (line 53) | def isEnabledFor(self, level: Level) -> bool: ... method getEffectiveLevel (line 54) | def getEffectiveLevel(self) -> int: ... method getChild (line 56) | def getChild(self, suffix: str) -> logging.Logger: ... method addHandler (line 58) | def addHandler(self, hdlr: logging.Handler) -> None: ... method removeHandler (line 59) | def removeHandler(self, hdlr: logging.Handler) -> None: ... method hasHandlers (line 60) | def hasHandlers(self) -> bool: ... method debug (line 63) | def debug(self, msg: object, *args: object, **kwargs: object) -> None:... method info (line 64) | def info(self, msg: object, *args: object, **kwargs: object) -> None: ... method warning (line 65) | def warning(self, msg: object, *args: object, **kwargs: object) -> Non... method warn (line 66) | def warn(self, msg: object, *args: object, **kwargs: object) -> None: ... method error (line 67) | def error(self, msg: object, *args: object, **kwargs: object) -> None:... method exception (line 68) | def exception(self, msg: object, *args: object, exc_info: ExcInfo = Tr... method critical (line 69) | def critical(self, msg: object, *args: object, **kwargs: object) -> No... method fatal (line 70) | def fatal(self, msg: object, *args: object, **kwargs: object) -> None:... method log (line 73) | def log(self, level: Level, msg: object, *args: object, **kwargs: obje... method makeRecord (line 76) | def makeRecord( method handle (line 90) | def handle(self, record: logging.LogRecord) -> None: ... method findCaller (line 91) | def findCaller( method callHandlers (line 97) | def callHandlers(self, record: logging.LogRecord) -> None: ... method getMessage (line 98) | def getMessage(self) -> str: ... # NOTE: actually on LogRecord; inclu... method _log (line 100) | def _log( method addFilter (line 112) | def addFilter(self, filt: logging.Filter) -> None: ... method removeFilter (line 113) | def removeFilter(self, filt: logging.Filter) -> None: ... method filters (line 115) | def filters(self) -> list[logging.Filter]: ... method filter (line 117) | def filter(self, record: logging.LogRecord) -> bool: ... method setFormatter (line 120) | def setFormatter(self, fmt: logging.Formatter) -> None: ... # mostly ... method debugStack (line 121) | def debugStack(self, msg: object, *args: object, **kwargs: object) -> ... method warning_advice (line 129) | def warning_advice(self, msg: object, *args: object, **kwargs: object)... method warning_once (line 130) | def warning_once(self, msg: object, *args: object, **kwargs: object) -... method info_once (line 131) | def info_once(self, msg: object, *args: object, **kwargs: object) -> N... class GenerativePreTrainedModel (line 134) | class GenerativePreTrainedModel(Protocol): method __getattr__ (line 155) | def __getattr__(self, name: str) -> Any: ... method forward (line 156) | def forward(self, *args: Any, **kwargs: Any) -> Any: ... method __call__ (line 157) | def __call__(self, *args: Any, **kwargs: Any) -> Any: ... method can_generate (line 158) | def can_generate(self) -> bool: ... method get_encoder (line 159) | def get_encoder(self) -> Any: ... method get_output_embeddings (line 160) | def get_output_embeddings(self) -> Any: ... method get_input_embeddings (line 161) | def get_input_embeddings(self) -> Any: ... method set_output_embeddings (line 162) | def set_output_embeddings(self, value: Any) -> None: ... method set_input_embeddings (line 163) | def set_input_embeddings(self, value: Any) -> None: ... method get_compiled_call (line 164) | def get_compiled_call(self, compile_config: Any) -> Any: ... method set_experts_implementation (line 165) | def set_experts_implementation(self, *args: Any, **kwargs: Any) -> Any... method _supports_logits_to_keep (line 166) | def _supports_logits_to_keep(self) -> bool: ... class WhisperGenerationConfigLike (line 169) | class WhisperGenerationConfigLike(Protocol): FILE: src/transformers/activations.py class GELUTanh (line 31) | class GELUTanh(nn.Module): method __init__ (line 40) | def __init__(self, use_gelu_tanh_python: bool = False): method _gelu_tanh_python (line 47) | def _gelu_tanh_python(self, input: Tensor) -> Tensor: method forward (line 50) | def forward(self, input: Tensor) -> Tensor: class NewGELUActivation (line 59) | class NewGELUActivation(nn.Module): method forward (line 65) | def forward(self, input: Tensor) -> Tensor: class GELUActivation (line 70) | class GELUActivation(nn.Module): method __init__ (line 78) | def __init__(self, use_gelu_python: bool = False): method _gelu_python (line 85) | def _gelu_python(self, input: Tensor) -> Tensor: method forward (line 88) | def forward(self, input: Tensor) -> Tensor: class SiLUActivation (line 93) | class SiLUActivation(nn.Module): method forward (line 102) | def forward(self, input: Tensor) -> Tensor: class FastGELUActivation (line 107) | class FastGELUActivation(nn.Module): method forward (line 112) | def forward(self, input: Tensor) -> Tensor: class QuickGELUActivation (line 117) | class QuickGELUActivation(nn.Module): method forward (line 122) | def forward(self, input: Tensor) -> Tensor: class ClippedGELUActivation (line 126) | class ClippedGELUActivation(nn.Module): method __init__ (line 139) | def __init__(self, min: float, max: float): method forward (line 147) | def forward(self, x: Tensor) -> Tensor: class AccurateGELUActivation (line 151) | class AccurateGELUActivation(nn.Module): method __init__ (line 159) | def __init__(self): method forward (line 163) | def forward(self, input: Tensor) -> Tensor: class MishActivation (line 167) | class MishActivation(nn.Module): method __init__ (line 173) | def __init__(self): method _mish_python (line 177) | def _mish_python(self, input: Tensor) -> Tensor: method forward (line 180) | def forward(self, input: Tensor) -> Tensor: class LinearActivation (line 184) | class LinearActivation(nn.Module): method forward (line 189) | def forward(self, input: Tensor) -> Tensor: class LaplaceActivation (line 193) | class LaplaceActivation(nn.Module): method forward (line 201) | def forward(self, input, mu=0.707107, sigma=0.282095): class ReLUSquaredActivation (line 206) | class ReLUSquaredActivation(nn.Module): method forward (line 211) | def forward(self, input): class ClassInstantier (line 217) | class ClassInstantier(OrderedDict): method __getitem__ (line 218) | def __getitem__(self, key): class XIELUActivation (line 224) | class XIELUActivation(nn.Module): method __init__ (line 232) | def __init__( method _xielu_python (line 274) | def _xielu_python(self, x: Tensor) -> Tensor: method _xielu_cuda (line 283) | def _xielu_cuda(self, x: Tensor) -> Tensor: method forward (line 308) | def forward(self, input: Tensor) -> Tensor: function get_activation (line 345) | def get_activation(activation_string): FILE: src/transformers/audio_utils.py function load_audio (line 60) | def load_audio(audio: str | np.ndarray, sampling_rate=16000, timeout=Non... function load_audio_torchcodec (line 91) | def load_audio_torchcodec(audio: str | np.ndarray, sampling_rate=16000) ... function load_audio_librosa (line 115) | def load_audio_librosa(audio: str | np.ndarray, sampling_rate=16000, tim... function load_audio_as (line 143) | def load_audio_as( function conv1d_output_length (line 221) | def conv1d_output_length(module: "torch.nn.Conv1d", input_length: int) -... function is_valid_audio (line 233) | def is_valid_audio(audio): function is_valid_list_of_audio (line 237) | def is_valid_list_of_audio(audio): function make_list_of_audio (line 241) | def make_list_of_audio( function hertz_to_mel (line 263) | def hertz_to_mel(freq: float | np.ndarray, mel_scale: str = "htk") -> fl... function mel_to_hertz (line 299) | def mel_to_hertz(mels: float | np.ndarray, mel_scale: str = "htk") -> fl... function hertz_to_octave (line 335) | def hertz_to_octave(freq: float | np.ndarray, tuning: float = 0.0, bins_... function _create_triangular_filter_bank (line 356) | def _create_triangular_filter_bank(fft_freqs: np.ndarray, filter_freqs: ... function chroma_filter_bank (line 378) | def chroma_filter_bank( function mel_filter_bank (line 453) | def mel_filter_bank( function optimal_fft_length (line 547) | def optimal_fft_length(window_length: int) -> int: function window_function (line 560) | def window_function( function spectrogram (line 624) | def spectrogram( function spectrogram_batch (line 835) | def spectrogram_batch( function power_to_db (line 1046) | def power_to_db( function power_to_db_batch (line 1097) | def power_to_db_batch( function amplitude_to_db (line 1146) | def amplitude_to_db( function amplitude_to_db_batch (line 1195) | def amplitude_to_db_batch( FILE: src/transformers/backbone_utils.py class BackboneType (line 30) | class BackboneType(enum.Enum): class BackboneConfigMixin (line 35) | class BackboneConfigMixin: method set_output_features_output_indices (line 40) | def set_output_features_output_indices( method verify_out_features_out_indices (line 76) | def verify_out_features_out_indices(self): method out_features (line 127) | def out_features(self): method out_features (line 131) | def out_features(self, out_features: list[str]): method out_indices (line 138) | def out_indices(self): method out_indices (line 142) | def out_indices(self, out_indices: tuple[int, ...] | list[int]): method to_dict (line 149) | def to_dict(self): function filter_output_hidden_states (line 160) | def filter_output_hidden_states(forward_function): class BackboneMixin (line 181) | class BackboneMixin: method __init__ (line 188) | def __init__(self, *args, **kwargs) -> None: method post_init (line 207) | def post_init(self): method _init_timm_backbone (line 219) | def _init_timm_backbone(self, backbone) -> None: method _init_transformers_backbone (line 252) | def _init_transformers_backbone(self) -> None: method out_features (line 259) | def out_features(self): method out_features (line 263) | def out_features(self, out_features: list[str]): method out_indices (line 270) | def out_indices(self): method out_indices (line 274) | def out_indices(self, out_indices: tuple[int] | list[int]): method out_feature_channels (line 281) | def out_feature_channels(self): method channels (line 287) | def channels(self): method forward_with_filtered_kwargs (line 290) | def forward_with_filtered_kwargs(self, *args, **kwargs): method forward (line 298) | def forward( function consolidate_backbone_kwargs_to_config (line 308) | def consolidate_backbone_kwargs_to_config( function load_backbone (line 358) | def load_backbone(config): FILE: src/transformers/cache_utils.py class CacheLayerMixin (line 26) | class CacheLayerMixin(ABC): method __init__ (line 31) | def __init__(self): method __repr__ (line 36) | def __repr__(self): method lazy_initialization (line 40) | def lazy_initialization(self, key_states: torch.Tensor, value_states: ... method update (line 43) | def update( method get_mask_sizes (line 48) | def get_mask_sizes(self, query_length: int) -> tuple[int, int]: ... method get_seq_length (line 51) | def get_seq_length(self) -> int: ... method get_max_cache_shape (line 54) | def get_max_cache_shape(self) -> int: ... method offload (line 56) | def offload(self): method prefetch (line 62) | def prefetch(self): method reset (line 68) | def reset(self) -> None: method reorder_cache (line 81) | def reorder_cache(self, beam_idx: torch.LongTensor) -> None: class DynamicLayer (line 88) | class DynamicLayer(CacheLayerMixin): method lazy_initialization (line 96) | def lazy_initialization(self, key_states: torch.Tensor, value_states: ... method update (line 102) | def update( method get_mask_sizes (line 123) | def get_mask_sizes(self, query_length: int) -> tuple[int, int]: method get_seq_length (line 129) | def get_seq_length(self) -> int: method get_max_cache_shape (line 135) | def get_max_cache_shape(self) -> int: method crop (line 139) | def crop(self, max_length: int) -> None: method batch_repeat_interleave (line 153) | def batch_repeat_interleave(self, repeats: int) -> None: method batch_select_indices (line 159) | def batch_select_indices(self, indices: torch.Tensor) -> None: class DynamicSlidingWindowLayer (line 166) | class DynamicSlidingWindowLayer(DynamicLayer): method __init__ (line 174) | def __init__(self, sliding_window: int): method lazy_initialization (line 180) | def lazy_initialization(self, key_states: torch.Tensor, value_states: ... method update (line 184) | def update( method get_mask_sizes (line 213) | def get_mask_sizes(self, query_length: int) -> tuple[int, int]: method get_seq_length (line 225) | def get_seq_length(self) -> int: method get_max_cache_shape (line 229) | def get_max_cache_shape(self) -> int: method crop (line 233) | def crop(self, max_length: int) -> None: class StaticLayer (line 247) | class StaticLayer(CacheLayerMixin): method __init__ (line 260) | def __init__(self, max_cache_len: int): method lazy_initialization (line 266) | def lazy_initialization(self, key_states: torch.Tensor, value_states: ... method update (line 308) | def update( method get_mask_sizes (line 342) | def get_mask_sizes(self, query_length: int) -> tuple[int, int]: method get_seq_length (line 348) | def get_seq_length(self) -> int: method get_max_cache_shape (line 352) | def get_max_cache_shape(self) -> int: class StaticSlidingWindowLayer (line 357) | class StaticSlidingWindowLayer(StaticLayer): method __init__ (line 372) | def __init__(self, max_cache_len: int, sliding_window: int): method update (line 378) | def update( method get_mask_sizes (line 457) | def get_mask_sizes(self, query_length: int) -> tuple[int, int]: method get_seq_length (line 475) | def get_seq_length(self) -> int: method reset (line 479) | def reset(self): class QuantizedLayer (line 484) | class QuantizedLayer(DynamicLayer): method __init__ (line 496) | def __init__( method update (line 512) | def update( method _quantize (line 550) | def _quantize(self, tensor, axis): ... method _dequantize (line 553) | def _dequantize(self, q_tensor): ... method get_seq_length (line 555) | def get_seq_length(self) -> int: class QuantoQuantizedLayer (line 560) | class QuantoQuantizedLayer(QuantizedLayer): method __init__ (line 561) | def __init__( method _quantize (line 604) | def _quantize(self, tensor, axis): method _dequantize (line 611) | def _dequantize(self, qtensor): class HQQQuantizedLayer (line 615) | class HQQQuantizedLayer(QuantizedLayer): method __init__ (line 616) | def __init__( method _quantize (line 651) | def _quantize(self, tensor, axis): method _dequantize (line 666) | def _dequantize(self, qtensor): class LinearAttentionCacheLayerMixin (line 672) | class LinearAttentionCacheLayerMixin(ABC): method __init__ (line 678) | def __init__(self): method __repr__ (line 685) | def __repr__(self): method lazy_initialization (line 689) | def lazy_initialization( method update_conv_state (line 694) | def update_conv_state(self, conv_states: torch.Tensor) -> torch.Tensor... method update_recurrent_state (line 697) | def update_recurrent_state(self, recurrent_states: torch.Tensor) -> to... method offload (line 699) | def offload(self): method prefetch (line 706) | def prefetch(self): method reset (line 713) | def reset(self) -> None: method reorder_cache (line 721) | def reorder_cache(self, beam_idx: torch.LongTensor): method crop (line 729) | def crop(self, max_length: int): class LinearAttentionLayer (line 734) | class LinearAttentionLayer(LinearAttentionCacheLayerMixin): method lazy_initialization (line 735) | def lazy_initialization( method update_conv_state (line 757) | def update_conv_state(self, conv_states: torch.Tensor, **kwargs) -> to... method update_recurrent_state (line 790) | def update_recurrent_state(self, recurrent_states: torch.Tensor, **kwa... class LinearAttentionAndFullAttentionLayer (line 807) | class LinearAttentionAndFullAttentionLayer(LinearAttentionLayer, Dynamic... method __init__ (line 811) | def __init__(self): method lazy_initialization (line 815) | def lazy_initialization(self, *args, **kwargs) -> None: method reset (line 824) | def reset(self) -> None: method reorder_cache (line 828) | def reorder_cache(self, beam_idx: torch.LongTensor): class Cache (line 834) | class Cache: method __init__ (line 854) | def __init__( method __repr__ (line 878) | def __repr__(self): method prefetch (line 881) | def prefetch(self, layer_idx: int, only_non_sliding: bool = True): method offload (line 901) | def offload(self, layer_idx: int, only_non_sliding: bool = True): method update (line 910) | def update( method update_conv_state (line 944) | def update_conv_state(self, conv_states: torch.Tensor, layer_idx: int,... method update_recurrent_state (line 964) | def update_recurrent_state(self, recurrent_states: torch.Tensor, layer... method early_initialization (line 984) | def early_initialization( method get_seq_length (line 999) | def get_seq_length(self, layer_idx: int = 0) -> int: method has_previous_state (line 1023) | def has_previous_state(self, layer_idx: int | None = None) -> bool: method get_mask_sizes (line 1049) | def get_mask_sizes(self, query_length: int, layer_idx: int) -> tuple[i... method get_max_cache_shape (line 1079) | def get_max_cache_shape(self, layer_idx: int = 0) -> int: method reset (line 1087) | def reset(self): method reorder_cache (line 1092) | def reorder_cache(self, beam_idx: torch.LongTensor): method crop (line 1097) | def crop(self, max_length: int): method batch_repeat_interleave (line 1102) | def batch_repeat_interleave(self, repeats: int): method batch_select_indices (line 1107) | def batch_select_indices(self, indices: torch.Tensor): method max_batch_size (line 1113) | def max_batch_size(self) -> int: method max_cache_len (line 1121) | def max_cache_len(self) -> int: method is_compileable (line 1127) | def is_compileable(self) -> bool: method is_initialized (line 1135) | def is_initialized(self) -> bool: method is_sliding (line 1140) | def is_sliding(self) -> list[bool]: method __len__ (line 1144) | def __len__(self): class DynamicCache (line 1153) | class DynamicCache(Cache): method __init__ (line 1196) | def __init__( method __iter__ (line 1267) | def __iter__(self): class StaticCache (line 1272) | class StaticCache(Cache): method __init__ (line 1312) | def __init__( class QuantizedCache (line 1354) | class QuantizedCache(Cache): method __init__ (line 1385) | def __init__( class EncoderDecoderCache (line 1410) | class EncoderDecoderCache(Cache): method __init__ (line 1443) | def __init__(self, *caches) -> None: method __iter__ (line 1473) | def __iter__(self): method __repr__ (line 1478) | def __repr__(self) -> str: method __len__ (line 1484) | def __len__(self): method get_seq_length (line 1491) | def get_seq_length(self, layer_idx: int = 0) -> int: method reset (line 1495) | def reset(self): method reorder_cache (line 1501) | def reorder_cache(self, beam_idx: torch.LongTensor): method check_dynamic_cache (line 1506) | def check_dynamic_cache(self, method: str): method crop (line 1517) | def crop(self, maximum_length: int): method batch_repeat_interleave (line 1525) | def batch_repeat_interleave(self, repeats: int): method batch_select_indices (line 1531) | def batch_select_indices(self, indices: torch.Tensor): method get_max_cache_shape (line 1537) | def get_max_cache_shape(self) -> int: method get_mask_sizes (line 1541) | def get_mask_sizes(self, query_length: int, layer_idx: int) -> tuple[i... method is_sliding (line 1545) | def is_sliding(self): method is_compileable (line 1549) | def is_compileable(self) -> bool: FILE: src/transformers/cli/add_new_model_like.py class ClassFinder (line 36) | class ClassFinder(CSTVisitor): method __init__ (line 41) | def __init__(self): method visit_ClassDef (line 46) | def visit_ClassDef(self, node: cst.ClassDef) -> None: method leave_ClassDef (line 51) | def leave_ClassDef(self, node: cst.ClassDef): method visit_SimpleStatementLine (line 54) | def visit_SimpleStatementLine(self, node: cst.SimpleStatementLine): function add_new_model_like (line 89) | def add_new_model_like( class ModelInfos (line 116) | class ModelInfos: method __init__ (line 121) | def __init__(self, lowercase_name: str): function add_content_to_file (line 156) | def add_content_to_file(file_name: str | os.PathLike, new_content: str, ... function add_model_to_auto_mappings (line 178) | def add_model_to_auto_mappings( function create_doc_file (line 245) | def create_doc_file(new_paper_name: str, public_classes: list[str]): function insert_model_in_doc_toc (line 301) | def insert_model_in_doc_toc( function create_init_file (line 326) | def create_init_file(old_lowercase_name: str, new_lowercase_name: str, f... function find_all_classes_from_file (line 364) | def find_all_classes_from_file(module_name: str) -> set: function find_modular_structure (line 380) | def find_modular_structure( function create_modular_file (line 405) | def create_modular_file( function create_test_files (line 458) | def create_test_files( function _add_new_model_like_internal (line 510) | def _add_new_model_like_internal( function get_user_field (line 605) | def get_user_field( function convert_to_bool (line 654) | def convert_to_bool(x: str) -> bool: function get_user_input (line 665) | def get_user_input(): FILE: src/transformers/cli/chat.py class RichInterface (line 106) | class RichInterface: method __init__ (line 107) | def __init__(self, model_id: str, user_id: str, base_url: str): method stream_output (line 113) | async def stream_output(self, stream: AsyncIterator[ChatCompletionStre... method input (line 172) | def input(self) -> str: method clear (line 178) | def clear(self): method print_user_message (line 182) | def print_user_message(self, text: str): method print_color (line 187) | def print_color(self, text: str, color: str): method confirm (line 192) | def confirm(self, message: str, default: bool = False) -> bool: method print_help (line 204) | def print_help(self, minimal: bool = False): method print_model_load (line 209) | def print_model_load(self, model: str): method print_status (line 291) | def print_status(self, config: GenerationConfig): class Chat (line 298) | class Chat: method __init__ (line 303) | def __init__( method check_health (line 374) | def check_health(url): method handle_non_exit_user_commands (line 390) | def handle_non_exit_user_commands( method _inner_run (line 464) | async def _inner_run(self): function load_generation_config (line 583) | def load_generation_config(generation_config: str | None) -> GenerationC... function parse_generate_flags (line 595) | def parse_generate_flags(generate_flags: list[str] | None) -> dict: function new_chat_history (line 649) | def new_chat_history(system_prompt: str | None = None) -> list[dict]: function save_chat (line 654) | def save_chat(filename: str, chat: list[dict], settings: dict) -> str: function get_username (line 662) | def get_username() -> str: FILE: src/transformers/cli/download.py function download (line 19) | def download( FILE: src/transformers/cli/serve.py class Serve (line 33) | class Serve: method __init__ (line 34) | def __init__( method start_server (line 157) | def start_server(self): method reset_loaded_models (line 166) | def reset_loaded_models(self): method kill_server (line 170) | def kill_server(self): FILE: src/transformers/cli/serving/chat_completion.py class TransformersCompletionCreateParamsStreaming (line 51) | class TransformersCompletionCreateParamsStreaming(CompletionCreateParams... class ChatCompletionHandler (line 86) | class ChatCompletionHandler(BaseHandler): method handle_request (line 95) | async def handle_request(self, body: dict, request_id: str) -> Streami... method _streaming (line 162) | def _streaming( method _non_streaming (line 255) | async def _non_streaming( method _build_generation_config (line 314) | def _build_generation_config(self, body: dict, model_generation_config... method _build_completion (line 332) | def _build_completion( method _build_chunk_sse (line 371) | def _build_chunk_sse( FILE: src/transformers/cli/serving/model_manager.py class TimedModel (line 43) | class TimedModel: method __init__ (line 53) | def __init__( method reset_timer (line 68) | def reset_timer(self) -> None: method delete_model (line 74) | def delete_model(self) -> None: method _timeout_reached (line 87) | def _timeout_reached(self) -> None: class ModelManager (line 93) | class ModelManager: method __init__ (line 109) | def __init__( method _resolve_dtype (line 149) | def _resolve_dtype(dtype: str | None): method _validate_args (line 161) | def _validate_args(self): method process_model_name (line 181) | def process_model_name(model_id: str) -> str: method get_quantization_config (line 187) | def get_quantization_config(self) -> BitsAndBytesConfig | None: method _load_processor (line 199) | def _load_processor(self, model_id_and_revision: str) -> "ProcessorMix... method _load_model (line 210) | def _load_model( method load_model_and_processor (line 244) | def load_model_and_processor( method load_model_streaming (line 287) | async def load_model_streaming(self, model_id_and_revision: str): method shutdown (line 373) | def shutdown(self) -> None: method get_model_modality (line 379) | def get_model_modality( method get_gen_models (line 410) | def get_gen_models(cache_dir: str | None = None) -> list[dict]: FILE: src/transformers/cli/serving/response.py class TransformersResponseCreateParamsStreaming (line 70) | class TransformersResponseCreateParamsStreaming(ResponseCreateParamsStre... class ResponseHandler (line 92) | class ResponseHandler(BaseHandler): method handle_request (line 98) | async def handle_request(self, body: dict, request_id: str) -> Streami... method _input_to_messages (line 168) | def _input_to_messages(body: dict) -> list[dict]: method _streaming (line 205) | def _streaming( method _non_streaming (line 475) | async def _non_streaming( method _build_generation_config (line 538) | def _build_generation_config(self, body: dict, model_generation_config... function compute_usage (line 548) | def compute_usage(input_tokens: int, output_tokens: int) -> ResponseUsage: FILE: src/transformers/cli/serving/server.py function build_server (line 40) | def build_server( FILE: src/transformers/cli/serving/transcription.py class TransformersTranscriptionCreateParams (line 41) | class TransformersTranscriptionCreateParams(TranscriptionCreateParamsBas... class TranscriptionHandler (line 56) | class TranscriptionHandler: method __init__ (line 67) | def __init__(self, model_manager: ModelManager, generation_state: Gene... method _validate_request (line 76) | def _validate_request(self, form_keys: set[str]) -> None: method handle_request (line 85) | async def handle_request(self, request: Request) -> JSONResponse | Str... method _prepare_audio_inputs (line 120) | def _prepare_audio_inputs( method _non_streaming (line 134) | async def _non_streaming( method _streaming (line 150) | def _streaming( FILE: src/transformers/cli/serving/utils.py class Modality (line 61) | class Modality(enum.Enum): class _StreamError (line 68) | class _StreamError: method __init__ (line 71) | def __init__(self, msg: str): class _GenerationCancelled (line 75) | class _GenerationCancelled(Exception): function detect_tool_format (line 91) | def detect_tool_format(model: "PreTrainedModel") -> dict | None: class ToolCallParser (line 108) | class ToolCallParser: method __init__ (line 132) | def __init__(self, tool_format: dict): method feed (line 140) | def feed(self, text: str) -> object | dict | None: method _extract_name_and_args (line 166) | def _extract_name_and_args(block: str) -> tuple[str, str] | None: method parse (line 178) | def parse(text: str, tool_format: dict) -> list[dict] | None: method _parse_block (line 199) | def _parse_block(self, block: str) -> dict | None: class DownloadAggregator (line 207) | class DownloadAggregator: method __init__ (line 214) | def __init__(self, enqueue: Callable, model_id: str): method register (line 220) | def register(self, bar_id: int, total: int | None) -> None: method update (line 225) | def update(self, bar_id: int, current: int, total: int | None) -> None: method close (line 230) | def close(self, bar_id: int) -> None: method _emit (line 233) | def _emit(self) -> None: function make_progress_tqdm_class (line 250) | def make_progress_tqdm_class(callback: Callable, model_id: str) -> type: class DirectStreamer (line 321) | class DirectStreamer: method __init__ (line 330) | def __init__( method put (line 355) | def put(self, value: "torch.Tensor") -> None: method end (line 369) | def end(self) -> None: method cancel (line 373) | def cancel(self) -> None: class CBStreamer (line 378) | class CBStreamer: method __init__ (line 387) | def __init__( method put (line 414) | def put(self, output: "GenerationOutput") -> None: method end (line 424) | def end(self) -> None: method cancel (line 428) | def cancel(self) -> None: function set_torch_seed (line 433) | def set_torch_seed(seed: int) -> None: function reset_torch_cache (line 440) | def reset_torch_cache() -> None: class InferenceThread (line 448) | class InferenceThread: method __init__ (line 455) | def __init__(self): method _run (line 460) | def _run(self) -> None: method submit (line 475) | def submit(self, fn, *args, **kwargs) -> Future: method async_submit (line 481) | def async_submit(self, fn, *args, **kwargs) -> asyncio.Future: class BaseGenerateManager (line 489) | class BaseGenerateManager(ABC): method generate_streaming (line 498) | def generate_streaming( method generate_non_streaming (line 522) | def generate_non_streaming( method stop (line 544) | def stop(self) -> None: class GenerateManager (line 548) | class GenerateManager(BaseGenerateManager): method __init__ (line 551) | def __init__(self): method generate_streaming (line 554) | def generate_streaming( method generate_non_streaming (line 579) | async def generate_non_streaming( method submit (line 596) | def submit(self, fn: Callable, *args, **kwargs) -> Future: method async_submit (line 600) | def async_submit(self, fn: Callable, *args, **kwargs) -> asyncio.Future: method stop (line 604) | def stop(self) -> None: class CBGenerateManager (line 608) | class CBGenerateManager(BaseGenerateManager): method __init__ (line 623) | def __init__(self, cb_config: "ContinuousBatchingConfig | None" = None): method init_cb (line 627) | def init_cb(self, model: "PreTrainedModel", gen_config: "GenerationCon... method generate_streaming (line 644) | def generate_streaming( method generate_non_streaming (line 679) | async def generate_non_streaming( method scheduler (line 716) | def scheduler(self) -> "Scheduler": method stop (line 720) | def stop(self) -> None: class GenerationState (line 725) | class GenerationState: method __init__ (line 739) | def __init__( method use_continuous_batching (line 752) | def use_continuous_batching(self, model: "PreTrainedModel", modality: ... method get_manager (line 772) | def get_manager(self, model_id: str, use_cb: bool = False) -> BaseGene... method shutdown (line 795) | def shutdown(self) -> None: class BaseHandler (line 802) | class BaseHandler: method __init__ (line 818) | def __init__( method _validate_request (line 826) | def _validate_request(self, body: dict) -> None: method chunk_to_sse (line 840) | def chunk_to_sse(chunk: "str | pydantic.BaseModel") -> str: method _resolve_model (line 846) | def _resolve_model(self, body: dict) -> tuple[str, "PreTrainedModel", ... method _build_generation_config (line 859) | def _build_generation_config( method get_processor_inputs_from_messages (line 910) | def get_processor_inputs_from_messages(messages: list[dict], modality:... FILE: src/transformers/cli/system.py function env (line 41) | def env( function version (line 131) | def version() -> None: function _format_dict (line 136) | def _format_dict(d: dict) -> str: FILE: src/transformers/cli/transformers.py function main (line 35) | def main(): FILE: src/transformers/configuration_utils.py function wrap_init_to_accept_kwargs (line 77) | def wrap_init_to_accept_kwargs(cls: dataclass): class PreTrainedConfig (line 118) | class PreTrainedConfig(PushToHubMixin, RotaryEmbeddingConfigMixin): method __post_init__ (line 238) | def __post_init__(self, **kwargs): method __init_subclass__ (line 298) | def __init_subclass__(cls, *args, **kwargs): method name_or_path (line 311) | def name_or_path(self) -> str | None: method name_or_path (line 315) | def name_or_path(self, value): method num_labels (line 319) | def num_labels(self) -> int: method num_labels (line 326) | def num_labels(self, num_labels: int): method output_attentions (line 334) | def output_attentions(self): method output_attentions (line 341) | def output_attentions(self, value: bool): method _attn_implementation (line 353) | def _attn_implementation(self): method _attn_implementation (line 357) | def _attn_implementation(self, value: str | dict | None): method _experts_implementation (line 375) | def _experts_implementation(self): method _experts_implementation (line 379) | def _experts_implementation(self, value: str | dict | None): method torch_dtype (line 397) | def torch_dtype(self): method use_return_dict (line 402) | def use_return_dict(self): method torch_dtype (line 407) | def torch_dtype(self, value): method __setattr__ (line 411) | def __setattr__(self, key, value): method __getattribute__ (line 416) | def __getattribute__(self, key): method validate_output_attentions (line 421) | def validate_output_attentions(self): method validate_architecture (line 428) | def validate_architecture(self): method validate_token_ids (line 441) | def validate_token_ids(self): method validate_layer_type (line 456) | def validate_layer_type(self): method rope_scaling (line 469) | def rope_scaling(self): method rope_scaling (line 473) | def rope_scaling(self, value): method save_pretrained (line 476) | def save_pretrained(self, save_directory: str | os.PathLike, push_to_h... method from_pretrained (line 539) | def from_pretrained( method get_config_dict (line 650) | def get_config_dict( method _get_config_dict (line 683) | def _get_config_dict( method from_dict (line 783) | def from_dict( method from_json_file (line 848) | def from_json_file( method _dict_from_json_file (line 866) | def _dict_from_json_file(cls, json_file: str | os.PathLike): method _encode_special_floats (line 874) | def _encode_special_floats(cls, obj: Any) -> Any: method _decode_special_floats (line 899) | def _decode_special_floats(cls, obj: Any) -> Any: method __eq__ (line 920) | def __eq__(self, other): method __repr__ (line 923) | def __repr__(self): method __iter__ (line 926) | def __iter__(self): method to_diff_dict (line 929) | def to_diff_dict(self) -> dict[str, Any]: method to_dict (line 988) | def to_dict(self) -> dict[str, Any]: method to_json_string (line 1035) | def to_json_string(self, use_diff: bool = True) -> str: method to_json_file (line 1057) | def to_json_file(self, json_file_path: str | os.PathLike, use_diff: bo... method update (line 1071) | def update(self, config_dict: dict[str, Any]): method update_from_string (line 1081) | def update_from_string(self, update_str: str): method dict_dtype_to_str (line 1119) | def dict_dtype_to_str(self, d: dict[str, Any]) -> None: method _remove_keys_not_serialized (line 1136) | def _remove_keys_not_serialized(self, d: dict[str, Any]) -> None: method register_for_auto_class (line 1162) | def register_for_auto_class(cls, auto_class="AutoConfig"): method _get_generation_parameters (line 1183) | def _get_generation_parameters(self) -> dict[str, Any]: method get_text_config (line 1199) | def get_text_config(self, decoder=None, encoder=None) -> "PreTrainedCo... function get_configuration_file (line 1277) | def get_configuration_file(configuration_files: list[str]) -> str: function recursive_diff_dict (line 1307) | def recursive_diff_dict(dict_a, dict_b, config_obj=None): function layer_type_validation (line 1337) | def layer_type_validation(layer_types: list[str], num_hidden_layers: int... FILE: src/transformers/conversion_mapping.py function _build_checkpoint_conversion_mapping (line 85) | def _build_checkpoint_conversion_mapping(): function get_checkpoint_conversion_mapping (line 546) | def get_checkpoint_conversion_mapping(model_type): function register_checkpoint_conversion_mapping (line 553) | def register_checkpoint_conversion_mapping( function extract_weight_conversions_for_model (line 564) | def extract_weight_conversions_for_model(model: PreTrainedModel) -> list... function get_model_conversion_mapping (line 572) | def get_model_conversion_mapping( FILE: src/transformers/convert_slow_tokenizer.py function import_protobuf (line 95) | def import_protobuf(error_message=""): function _get_prepend_scheme (line 112) | def _get_prepend_scheme(add_prefix_space: bool, original_tokenizer) -> str: function generate_merges (line 122) | def generate_merges(vocab, vocab_scores, skip_tokens: Collection[str] | ... class SentencePieceExtractor (line 146) | class SentencePieceExtractor: method __init__ (line 151) | def __init__(self, model: str): method extract (line 163) | def extract(self, model_type, **kwargs) -> tuple[dict[str, int], list[... class GemmaSentencePieceExtractor (line 199) | class GemmaSentencePieceExtractor(SentencePieceExtractor): method extract (line 200) | def extract(self, vocab_scores=None) -> tuple[dict[str, int], list[tup... function check_number_comma (line 216) | def check_number_comma(piece: str) -> bool: class Converter (line 220) | class Converter: method __init__ (line 221) | def __init__(self, original_tokenizer): method converted (line 224) | def converted(self) -> Tokenizer: class BertConverter (line 228) | class BertConverter(Converter): method converted (line 229) | def converted(self) -> Tokenizer: class SplinterConverter (line 267) | class SplinterConverter(Converter): method converted (line 268) | def converted(self) -> Tokenizer: class FunnelConverter (line 317) | class FunnelConverter(Converter): method converted (line 318) | def converted(self) -> Tokenizer: class MPNetConverter (line 356) | class MPNetConverter(Converter): method converted (line 357) | def converted(self) -> Tokenizer: class OpenAIGPTConverter (line 395) | class OpenAIGPTConverter(Converter): method converted (line 396) | def converted(self) -> Tokenizer: class GPT2Converter (line 422) | class GPT2Converter(Converter): method converted (line 423) | def converted(self, vocab: dict[str, int] | None = None, merges: list[... class HerbertConverter (line 460) | class HerbertConverter(Converter): method converted (line 461) | def converted(self) -> Tokenizer: class Qwen2Converter (line 491) | class Qwen2Converter(Converter): method converted (line 492) | def converted(self, vocab: dict[str, int] | None = None, merges: list[... class RobertaConverter (line 535) | class RobertaConverter(Converter): method converted (line 536) | def converted(self) -> Tokenizer: class RoFormerConverter (line 564) | class RoFormerConverter(Converter): method converted (line 565) | def converted(self) -> Tokenizer: class DebertaConverter (line 603) | class DebertaConverter(Converter): method converted (line 604) | def converted(self) -> Tokenizer: class SpmConverter (line 634) | class SpmConverter(Converter): method build_tokenizer_from_spm_proto (line 640) | def build_tokenizer_from_spm_proto(proto, vocab, merges=None): method convert_from_spm (line 688) | def convert_from_spm(cls, vocab=None, **kwargs): method __init__ (line 697) | def __init__(self, *args): method vocab (line 718) | def vocab(self, proto): method unk_id (line 721) | def unk_id(self, proto): method tokenizer (line 724) | def tokenizer(self, proto): method normalizer (line 774) | def normalizer(self, proto): method pre_tokenizer (line 785) | def pre_tokenizer(self, replacement, add_prefix_space): method post_processor (line 789) | def post_processor(self): method decoder (line 792) | def decoder(self, replacement, add_prefix_space): method converted (line 796) | def converted(self) -> Tokenizer: class AlbertConverter (line 821) | class AlbertConverter(SpmConverter): method vocab (line 822) | def vocab(self, proto): method normalizer (line 828) | def normalizer(self, proto): method post_processor (line 847) | def post_processor(self): class BarthezConverter (line 858) | class BarthezConverter(SpmConverter): method unk_id (line 859) | def unk_id(self, proto): method post_processor (line 863) | def post_processor(self): class CamembertConverter (line 874) | class CamembertConverter(SpmConverter): method vocab (line 875) | def vocab(self, proto): method unk_id (line 888) | def unk_id(self, proto): method post_processor (line 892) | def post_processor(self): method convert_from_spm (line 903) | def convert_from_spm(cls, vocab=None, **kwargs): class DebertaV2Converter (line 922) | class DebertaV2Converter(SpmConverter): method pre_tokenizer (line 923) | def pre_tokenizer(self, replacement, add_prefix_space): method normalizer (line 931) | def normalizer(self, proto): method post_processor (line 944) | def post_processor(self): class MBartConverter (line 955) | class MBartConverter(SpmConverter): method vocab (line 956) | def vocab(self, proto): method unk_id (line 994) | def unk_id(self, proto): method post_processor (line 997) | def post_processor(self): method convert_from_spm (line 1008) | def convert_from_spm(cls, vocab=None, **kwargs): class MBart50Converter (line 1029) | class MBart50Converter(SpmConverter): method vocab (line 1030) | def vocab(self, proto): method unk_id (line 1042) | def unk_id(self, proto): method post_processor (line 1045) | def post_processor(self): method convert_from_spm (line 1056) | def convert_from_spm(cls, vocab=None, **kwargs): class NllbConverter (line 1077) | class NllbConverter(SpmConverter): method vocab (line 1078) | def vocab(self, proto): method unk_id (line 1088) | def unk_id(self, proto): method post_processor (line 1091) | def post_processor(self): method convert_from_spm (line 1102) | def convert_from_spm(cls, vocab=None, **kwargs): class SeamlessM4TConverter (line 1124) | class SeamlessM4TConverter(SpmConverter): method vocab (line 1125) | def vocab(self, proto): method unk_id (line 1135) | def unk_id(self, proto): method post_processor (line 1138) | def post_processor(self): class XLMRobertaConverter (line 1149) | class XLMRobertaConverter(SpmConverter): method vocab (line 1150) | def vocab(self, proto): method unk_id (line 1161) | def unk_id(self, proto): method post_processor (line 1165) | def post_processor(self): method convert_from_spm (line 1176) | def convert_from_spm(cls, vocab=None, **kwargs): class XLNetConverter (line 1196) | class XLNetConverter(SpmConverter): method vocab (line 1197) | def vocab(self, proto): method normalizer (line 1203) | def normalizer(self, proto): method post_processor (line 1222) | def post_processor(self): class ReformerConverter (line 1233) | class ReformerConverter(SpmConverter): class RemBertConverter (line 1237) | class RemBertConverter(SpmConverter): method normalizer (line 1239) | def normalizer(self, proto): method post_processor (line 1258) | def post_processor(self): class BertGenerationConverter (line 1269) | class BertGenerationConverter(SpmConverter): class PegasusConverter (line 1273) | class PegasusConverter(SpmConverter): method vocab (line 1274) | def vocab(self, proto): method convert_from_spm (line 1294) | def convert_from_spm(cls, vocab=None, **kwargs): method unk_id (line 1315) | def unk_id(self, proto): method pre_tokenizer (line 1318) | def pre_tokenizer(self, replacement, add_prefix_space): method post_processor (line 1327) | def post_processor(self): class T5Converter (line 1335) | class T5Converter(SpmConverter): method vocab (line 1336) | def vocab(self, proto): method post_processor (line 1342) | def post_processor(self): method convert_from_spm (line 1352) | def convert_from_spm(cls, vocab=None, **kwargs): class UdopConverter (line 1363) | class UdopConverter(SpmConverter): method post_processor (line 1364) | def post_processor(self): class WhisperConverter (line 1374) | class WhisperConverter(Converter): method converted (line 1375) | def converted(self) -> Tokenizer: class BigBirdConverter (line 1410) | class BigBirdConverter(SpmConverter): method post_processor (line 1411) | def post_processor(self): class CLIPConverter (line 1422) | class CLIPConverter(Converter): method converted (line 1423) | def converted(self) -> Tokenizer: class LayoutLMv2Converter (line 1465) | class LayoutLMv2Converter(Converter): method converted (line 1466) | def converted(self) -> Tokenizer: class BlenderbotConverter (line 1504) | class BlenderbotConverter(Converter): method converted (line 1505) | def converted(self) -> Tokenizer: class XGLMConverter (line 1533) | class XGLMConverter(SpmConverter): method vocab (line 1534) | def vocab(self, proto): method unk_id (line 1545) | def unk_id(self, proto): method post_processor (line 1549) | def post_processor(self): class GemmaConverter (line 1560) | class GemmaConverter(SpmConverter): method normalizer (line 1576) | def normalizer(self, proto): method vocab (line 1579) | def vocab(self, proto): method pre_tokenizer (line 1595) | def pre_tokenizer(self, replacement, add_prefix_space): method unk_id (line 1598) | def unk_id(self, proto): method decoder (line 1602) | def decoder(self, replacement, add_prefix_space): class LlamaConverter (line 1612) | class LlamaConverter(SpmConverter): method vocab (line 1615) | def vocab(self, proto): method unk_id (line 1624) | def unk_id(self, proto): method decoder (line 1628) | def decoder(self, replacement, add_prefix_space): method normalizer (line 1638) | def normalizer(self, proto): method pre_tokenizer (line 1647) | def pre_tokenizer(self, replacement, add_prefix_space): method post_processor (line 1653) | def post_processor(self): class MarkupLMConverter (line 1658) | class MarkupLMConverter(Converter): method converted (line 1659) | def converted(self) -> Tokenizer: class MoshiConverter (line 1696) | class MoshiConverter(SpmConverter): method __init__ (line 1699) | def __init__(self, vocab_file, **kwargs): method normalizer (line 1712) | def normalizer(self, proto): method decoder (line 1722) | def decoder(self, replacement, add_prefix_space): method pre_tokenizer (line 1732) | def pre_tokenizer(self, replacement, add_prefix_space): class HeliumConverter (line 1737) | class HeliumConverter(SpmConverter): method __init__ (line 1740) | def __init__(self, vocab_file=None, **kwargs): method tokenizer (line 1752) | def tokenizer(self, proto): method vocab (line 1780) | def vocab(self, proto): method unk_id (line 1789) | def unk_id(self, proto): method decoder (line 1793) | def decoder(self, replacement, add_prefix_space): method normalizer (line 1802) | def normalizer(self, proto): method pre_tokenizer (line 1805) | def pre_tokenizer(self, replacement, add_prefix_space): method post_processor (line 1808) | def post_processor(self): class ParakeetConverter (line 1826) | class ParakeetConverter(SpmConverter): method __init__ (line 1829) | def __init__(self, vocab_file=None, *args): method tokenizer (line 1842) | def tokenizer(self, proto): function bytes_to_unicode (line 1874) | def bytes_to_unicode(): class TikTokenConverter (line 1898) | class TikTokenConverter: method __init__ (line 1903) | def __init__( method extract_vocab_merges_from_model (line 1918) | def extract_vocab_merges_from_model(self, tiktoken_url: str): method tokenizer (line 1949) | def tokenizer(self): method converted (line 1956) | def converted(self) -> Tokenizer: class MistralConverter (line 1976) | class MistralConverter: method __init__ (line 1977) | def __init__( method extract_vocab_merges_from_model (line 1994) | def extract_vocab_merges_from_model(self, tiktoken_url: str): method tokenizer (line 2033) | def tokenizer(self): method converted (line 2040) | def converted(self) -> Tokenizer: function convert_slow_tokenizer (line 2115) | def convert_slow_tokenizer(transformer_tokenizer, from_tiktoken=False) -... FILE: src/transformers/convert_slow_tokenizers_checkpoints_to_fast.py function convert_slow_checkpoint_to_fast (line 48) | def convert_slow_checkpoint_to_fast(tokenizer_name, checkpoint_name, dum... FILE: src/transformers/core_model_loading.py function build_glob_alternation (line 52) | def build_glob_alternation( class ConversionOps (line 84) | class ConversionOps: method __repr__ (line 87) | def __repr__(self): method convert (line 94) | def convert( method reverse_op (line 100) | def reverse_op(self) -> ConversionOps: class _IdentityOp (line 104) | class _IdentityOp(ConversionOps): method convert (line 111) | def convert(self, input_dict: dict[str, Any], **kwargs) -> dict[str, A... class Chunk (line 115) | class Chunk(ConversionOps): method __init__ (line 118) | def __init__(self, dim: int = 0): method convert (line 122) | def convert( method get_target_patterns (line 132) | def get_target_patterns(self, input_dict: dict, target_patterns: list[... method reverse_op (line 139) | def reverse_op(self) -> ConversionOps: class Concatenate (line 143) | class Concatenate(ConversionOps): method __init__ (line 146) | def __init__(self, dim: int = 0): method convert (line 150) | def convert( method get_target_pattern (line 169) | def get_target_pattern(self, target_patterns: list[str]) -> str: method reverse_op (line 176) | def reverse_op(self) -> ConversionOps: class MergeModulelist (line 180) | class MergeModulelist(ConversionOps): method __init__ (line 187) | def __init__(self, dim: int = 0): method convert (line 191) | def convert( method get_target_pattern (line 204) | def get_target_pattern(self, input_dict: dict, source_pattern: str, ta... method reverse_op (line 216) | def reverse_op(self) -> ConversionOps: class SplitModulelist (line 220) | class SplitModulelist(ConversionOps): method __init__ (line 223) | def __init__(self, dim: int = 0): method convert (line 227) | def convert( method get_target_patterns (line 241) | def get_target_patterns( method reverse_op (line 255) | def reverse_op(self) -> ConversionOps: class Transpose (line 259) | class Transpose(ConversionOps): method __init__ (line 264) | def __init__(self, dim0: int = 0, dim1: int = 1, check_dims: bool = Fa... method convert (line 270) | def convert( method get_target_pattern (line 289) | def get_target_pattern( method reverse_op (line 305) | def reverse_op(self) -> ConversionOps: class PermuteForRope (line 309) | class PermuteForRope(ConversionOps): method __init__ (line 314) | def __init__(self): method _apply (line 317) | def _apply(self, tensor: torch.Tensor) -> torch.Tensor: method convert (line 326) | def convert( class ErnieFuseAndSplitTextVisionExperts (line 343) | class ErnieFuseAndSplitTextVisionExperts(ConversionOps): method __init__ (line 363) | def __init__(self, stack_dim: int = 0, concat_dim: int = 1): method split_list_into_chunks (line 367) | def split_list_into_chunks(self, tensor_list: list[torch.Tensor], chun... method convert (line 372) | def convert( method reverse_op (line 400) | def reverse_op(self) -> ConversionOps: class ErnieSplitAndDecoupleTextVisionExperts (line 404) | class ErnieSplitAndDecoupleTextVisionExperts(ConversionOps): method __init__ (line 425) | def __init__(self, stack_dim: int = 0, concat_dim: int = 1): method convert (line 430) | def convert( method reverse_op (line 462) | def reverse_op(self) -> ConversionOps: function process_target_pattern (line 466) | def process_target_pattern(pattern: str) -> tuple[str, str | None]: function process_source_pattern (line 500) | def process_source_pattern(source_pattern: str, target_pattern: str) -> ... class WeightTransform (line 517) | class WeightTransform: method __setattr__ (line 528) | def __setattr__(self, name, value): method __post_init__ (line 539) | def __post_init__(self): method add_tensor (line 587) | def add_tensor(self, target_key: str, source_key: str, source_pattern:... method rename_source_key (line 591) | def rename_source_key(self, source_key: str) -> tuple[str, str | None]: method reverse_transform (line 617) | def reverse_transform(self) -> WeightTransform: method materialize_tensors (line 635) | def materialize_tensors(self) -> dict[str, list[torch.Tensor]]: class WeightRenaming (line 663) | class WeightRenaming(WeightTransform): method convert (line 666) | def convert( class WeightConverter (line 708) | class WeightConverter(WeightTransform): method __post_init__ (line 711) | def __post_init__(self): method convert (line 722) | def convert( function _materialize_copy (line 783) | def _materialize_copy(tensor: torch.Tensor, device=None, dtype=None) -> ... function spawn_materialize (line 791) | def spawn_materialize( function spawn_tp_materialize (line 811) | def spawn_tp_materialize( function dot_natural_key (line 828) | def dot_natural_key(s: str): function log_conversion_errors (line 843) | def log_conversion_errors( function set_param_for_module (line 891) | def set_param_for_module( function offload_and_maybe_resave_param (line 934) | def offload_and_maybe_resave_param( class SkipParameters (line 953) | class SkipParameters(Exception): function rename_source_key (line 960) | def rename_source_key( function convert_and_load_state_dict_in_model (line 998) | def convert_and_load_state_dict_in_model( function revert_weight_conversion (line 1277) | def revert_weight_conversion(model: PreTrainedModel, state_dict: dict[st... FILE: src/transformers/data/data_collator.py class DataCollatorMixin (line 37) | class DataCollatorMixin: method __call__ (line 38) | def __call__(self, features, return_tensors: str | None = None): function pad_without_fast_tokenizer_warning (line 49) | def pad_without_fast_tokenizer_warning(tokenizer, *pad_args, **pad_kwargs): function default_data_collator (line 71) | def default_data_collator(features: list[InputDataClass], return_tensors... class DefaultDataCollator (line 95) | class DefaultDataCollator(DataCollatorMixin): method __call__ (line 116) | def __call__(self, features: list[dict[str, Any]], return_tensors=None... function torch_default_data_collator (line 122) | def torch_default_data_collator(features: list[InputDataClass]) -> dict[... function numpy_default_data_collator (line 158) | def numpy_default_data_collator(features: list[InputDataClass]) -> dict[... class DataCollatorWithPadding (line 191) | class DataCollatorWithPadding: method __call__ (line 224) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, Any]: class DataCollatorForTokenClassification (line 243) | class DataCollatorForTokenClassification(DataCollatorMixin): method torch_call (line 279) | def torch_call(self, features): method numpy_call (line 319) | def numpy_call(self, features): function _torch_collate_batch (line 350) | def _torch_collate_batch(examples, tokenizer, pad_to_multiple_of: int | ... function _numpy_collate_batch (line 387) | def _numpy_collate_batch(examples, tokenizer, pad_to_multiple_of: int | ... class DataCollatorForMultipleChoice (line 420) | class DataCollatorForMultipleChoice(DataCollatorMixin): method torch_call (line 455) | def torch_call(self, examples: list[dict[str, Any]]): # Refactored im... class DataCollatorForSeq2Seq (line 487) | class DataCollatorForSeq2Seq: method __call__ (line 529) | def __call__(self, features, return_tensors=None): class DataCollatorForLanguageModeling (line 619) | class DataCollatorForLanguageModeling(DataCollatorMixin): method __post_init__ (line 692) | def __post_init__(self): method get_generator (line 734) | def get_generator(self, seed): method create_rng (line 742) | def create_rng(self): method torch_call (line 765) | def torch_call(self, examples: list[list[int] | Any | dict[str, Any]])... method torch_mask_tokens (line 796) | def torch_mask_tokens( method numpy_call (line 859) | def numpy_call(self, examples: list[list[int] | Any | dict[str, Any]])... method numpy_mask_tokens (line 890) | def numpy_mask_tokens( method _calc_word_ids_and_prob_mask (line 973) | def _calc_word_ids_and_prob_mask( method _whole_word_mask (line 1003) | def _whole_word_mask(word_ids: np.ndarray[np.ndarray[int]], mask: Any)... class DataCollatorForWholeWordMask (line 1019) | class DataCollatorForWholeWordMask(DataCollatorForLanguageModeling): method __init__ (line 1027) | def __init__(self, *args, **kwargs): function tolist (line 1038) | def tolist(x) -> list[Any]: function to_numpy (line 1046) | def to_numpy(x) -> np.ndarray[Any]: class DataCollatorForSOP (line 1056) | class DataCollatorForSOP(DataCollatorForLanguageModeling): method __init__ (line 1064) | def __init__(self, *args, **kwargs): method __call__ (line 1071) | def __call__(self, examples: list[dict[str, Any]]) -> dict[str, Any]: method mask_tokens (line 1094) | def mask_tokens(self, inputs: Any) -> tuple[Any, Any, Any]: class DataCollatorForPermutationLanguageModeling (line 1139) | class DataCollatorForPermutationLanguageModeling(DataCollatorMixin): method torch_call (line 1152) | def torch_call(self, examples: list[list[int] | Any | dict[str, Any]])... method numpy_call (line 1159) | def numpy_call(self, examples: list[list[int] | Any | dict[str, Any]])... method torch_mask_tokens (line 1166) | def torch_mask_tokens(self, inputs: Any) -> tuple[Any, Any, Any, Any]: method numpy_mask_tokens (line 1265) | def numpy_mask_tokens(self, inputs: Any) -> tuple[Any, Any, Any, Any]: class DataCollatorWithFlattening (line 1364) | class DataCollatorWithFlattening(DefaultDataCollator): method __init__ (line 1382) | def __init__( method __call__ (line 1400) | def __call__(self, features, return_tensors=None, separator_id=None): FILE: src/transformers/data/datasets/glue.py class GlueDataTrainingArguments (line 35) | class GlueDataTrainingArguments: method __post_init__ (line 60) | def __post_init__(self): class Split (line 64) | class Split(Enum): class GlueDataset (line 70) | class GlueDataset(Dataset): method __init__ (line 75) | def __init__( method __len__ (line 149) | def __len__(self): method __getitem__ (line 152) | def __getitem__(self, i) -> InputFeatures: method get_labels (line 155) | def get_labels(self): FILE: src/transformers/data/datasets/squad.py class SquadDataTrainingArguments (line 37) | class SquadDataTrainingArguments: class Split (line 103) | class Split(Enum): class SquadDataset (line 108) | class SquadDataset(Dataset): method __init__ (line 114) | def __init__( method __len__ (line 190) | def __len__(self): method __getitem__ (line 193) | def __getitem__(self, i) -> dict[str, torch.Tensor]: FILE: src/transformers/data/metrics/__init__.py function simple_accuracy (line 30) | def simple_accuracy(preds, labels): function acc_and_f1 (line 36) | def acc_and_f1(preds, labels): function pearson_and_spearman (line 48) | def pearson_and_spearman(preds, labels): function glue_compute_metrics (line 60) | def glue_compute_metrics(task_name, preds, labels): function xnli_compute_metrics (line 90) | def xnli_compute_metrics(task_name, preds, labels): FILE: src/transformers/data/metrics/squad_metrics.py function normalize_answer (line 36) | def normalize_answer(s): function get_tokens (line 56) | def get_tokens(s): function compute_exact (line 62) | def compute_exact(a_gold, a_pred): function compute_f1 (line 66) | def compute_f1(a_gold, a_pred): function get_raw_scores (line 82) | def get_raw_scores(examples, preds): function apply_no_ans_threshold (line 108) | def apply_no_ans_threshold(scores, na_probs, qid_to_has_ans, na_prob_thr... function make_eval_dict (line 119) | def make_eval_dict(exact_scores, f1_scores, qid_list=None): function merge_eval (line 140) | def merge_eval(main_eval, new_eval, prefix): function find_best_thresh_v2 (line 145) | def find_best_thresh_v2(preds, scores, na_probs, qid_to_has_ans): function find_all_best_thresh_v2 (line 179) | def find_all_best_thresh_v2(main_eval, preds, exact_raw, f1_raw, na_prob... function find_best_thresh (line 190) | def find_best_thresh(preds, scores, na_probs, qid_to_has_ans): function find_all_best_thresh (line 213) | def find_all_best_thresh(main_eval, preds, exact_raw, f1_raw, na_probs, ... function squad_evaluate (line 223) | def squad_evaluate(examples, preds, no_answer_probs=None, no_answer_prob... function get_final_text (line 254) | def get_final_text(pred_text, orig_text, do_lower_case, verbose_logging=... function _get_best_indexes (line 348) | def _get_best_indexes(logits, n_best_size): function _compute_softmax (line 360) | def _compute_softmax(scores): function compute_predictions_logits (line 383) | def compute_predictions_logits( function compute_predictions_log_probs (line 590) | def compute_predictions_log_probs( FILE: src/transformers/data/processors/glue.py function glue_convert_examples_to_features (line 35) | def glue_convert_examples_to_features( function _glue_convert_examples_to_features (line 64) | def _glue_convert_examples_to_features( class OutputMode (line 119) | class OutputMode(Enum): class MrpcProcessor (line 124) | class MrpcProcessor(DataProcessor): method __init__ (line 127) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 131) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 140) | def get_train_examples(self, data_dir): method get_dev_examples (line 145) | def get_dev_examples(self, data_dir): method get_test_examples (line 149) | def get_test_examples(self, data_dir): method get_labels (line 153) | def get_labels(self): method _create_examples (line 157) | def _create_examples(self, lines, set_type): class MnliProcessor (line 171) | class MnliProcessor(DataProcessor): method __init__ (line 174) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 178) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 187) | def get_train_examples(self, data_dir): method get_dev_examples (line 191) | def get_dev_examples(self, data_dir): method get_test_examples (line 195) | def get_test_examples(self, data_dir): method get_labels (line 199) | def get_labels(self): method _create_examples (line 203) | def _create_examples(self, lines, set_type): class MnliMismatchedProcessor (line 217) | class MnliMismatchedProcessor(MnliProcessor): method __init__ (line 220) | def __init__(self, *args, **kwargs): method get_dev_examples (line 224) | def get_dev_examples(self, data_dir): method get_test_examples (line 228) | def get_test_examples(self, data_dir): class ColaProcessor (line 233) | class ColaProcessor(DataProcessor): method __init__ (line 236) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 240) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 249) | def get_train_examples(self, data_dir): method get_dev_examples (line 253) | def get_dev_examples(self, data_dir): method get_test_examples (line 257) | def get_test_examples(self, data_dir): method get_labels (line 261) | def get_labels(self): method _create_examples (line 265) | def _create_examples(self, lines, set_type): class Sst2Processor (line 280) | class Sst2Processor(DataProcessor): method __init__ (line 283) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 287) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 296) | def get_train_examples(self, data_dir): method get_dev_examples (line 300) | def get_dev_examples(self, data_dir): method get_test_examples (line 304) | def get_test_examples(self, data_dir): method get_labels (line 308) | def get_labels(self): method _create_examples (line 312) | def _create_examples(self, lines, set_type): class StsbProcessor (line 326) | class StsbProcessor(DataProcessor): method __init__ (line 329) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 333) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 342) | def get_train_examples(self, data_dir): method get_dev_examples (line 346) | def get_dev_examples(self, data_dir): method get_test_examples (line 350) | def get_test_examples(self, data_dir): method get_labels (line 354) | def get_labels(self): method _create_examples (line 358) | def _create_examples(self, lines, set_type): class QqpProcessor (line 372) | class QqpProcessor(DataProcessor): method __init__ (line 375) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 379) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 388) | def get_train_examples(self, data_dir): method get_dev_examples (line 392) | def get_dev_examples(self, data_dir): method get_test_examples (line 396) | def get_test_examples(self, data_dir): method get_labels (line 400) | def get_labels(self): method _create_examples (line 404) | def _create_examples(self, lines, set_type): class QnliProcessor (line 424) | class QnliProcessor(DataProcessor): method __init__ (line 427) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 431) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 440) | def get_train_examples(self, data_dir): method get_dev_examples (line 444) | def get_dev_examples(self, data_dir): method get_test_examples (line 448) | def get_test_examples(self, data_dir): method get_labels (line 452) | def get_labels(self): method _create_examples (line 456) | def _create_examples(self, lines, set_type): class RteProcessor (line 470) | class RteProcessor(DataProcessor): method __init__ (line 473) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 477) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 486) | def get_train_examples(self, data_dir): method get_dev_examples (line 490) | def get_dev_examples(self, data_dir): method get_test_examples (line 494) | def get_test_examples(self, data_dir): method get_labels (line 498) | def get_labels(self): method _create_examples (line 502) | def _create_examples(self, lines, set_type): class WnliProcessor (line 516) | class WnliProcessor(DataProcessor): method __init__ (line 519) | def __init__(self, *args, **kwargs): method get_example_from_tensor_dict (line 523) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 532) | def get_train_examples(self, data_dir): method get_dev_examples (line 536) | def get_dev_examples(self, data_dir): method get_test_examples (line 540) | def get_test_examples(self, data_dir): method get_labels (line 544) | def get_labels(self): method _create_examples (line 548) | def _create_examples(self, lines, set_type): FILE: src/transformers/data/processors/squad.py function _improve_answer_span (line 42) | def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer, ... function _check_is_max_context (line 55) | def _check_is_max_context(doc_spans, cur_span_index, position): function _new_check_is_max_context (line 75) | def _new_check_is_max_context(doc_spans, cur_span_index, position): function _is_whitespace (line 97) | def _is_whitespace(c): function squad_convert_example_to_features (line 103) | def squad_convert_example_to_features( function squad_convert_example_to_features_init (line 308) | def squad_convert_example_to_features_init(tokenizer_for_convert: PreTra... function squad_convert_examples_to_features (line 313) | def squad_convert_examples_to_features( class SquadProcessor (line 433) | class SquadProcessor(DataProcessor): method _get_example_from_tensor_dict (line 442) | def _get_example_from_tensor_dict(self, tensor_dict, evaluate=False): method get_examples_from_dataset (line 466) | def get_examples_from_dataset(self, dataset, evaluate=False): method get_train_examples (line 499) | def get_train_examples(self, data_dir, filename=None): method get_dev_examples (line 521) | def get_dev_examples(self, data_dir, filename=None): method _create_examples (line 542) | def _create_examples(self, input_data, set_type): class SquadV1Processor (line 579) | class SquadV1Processor(SquadProcessor): class SquadV2Processor (line 584) | class SquadV2Processor(SquadProcessor): class SquadExample (line 589) | class SquadExample: method __init__ (line 604) | def __init__( class SquadFeatures (line 652) | class SquadFeatures: method __init__ (line 679) | def __init__( class SquadResult (line 719) | class SquadResult: method __init__ (line 729) | def __init__(self, unique_id, start_logits, end_logits, start_top_inde... FILE: src/transformers/data/processors/utils.py class InputExample (line 28) | class InputExample: method to_json_string (line 47) | def to_json_string(self): class InputFeatures (line 53) | class InputFeatures: method to_json_string (line 73) | def to_json_string(self): class DataProcessor (line 78) | class DataProcessor: method get_example_from_tensor_dict (line 81) | def get_example_from_tensor_dict(self, tensor_dict): method get_train_examples (line 91) | def get_train_examples(self, data_dir): method get_dev_examples (line 95) | def get_dev_examples(self, data_dir): method get_test_examples (line 99) | def get_test_examples(self, data_dir): method get_labels (line 103) | def get_labels(self): method tfds_map (line 107) | def tfds_map(self, example): method _read_tsv (line 117) | def _read_tsv(cls, input_file, quotechar=None): class SingleSentenceClassificationProcessor (line 123) | class SingleSentenceClassificationProcessor(DataProcessor): method __init__ (line 126) | def __init__(self, labels=None, examples=None, mode="classification", ... method __len__ (line 132) | def __len__(self): method __getitem__ (line 135) | def __getitem__(self, idx): method create_from_csv (line 141) | def create_from_csv( method create_from_examples (line 158) | def create_from_examples(cls, texts_or_text_and_labels, labels=None, *... method add_examples_from_csv (line 163) | def add_examples_from_csv( method add_examples (line 193) | def add_examples( method get_features (line 230) | def get_features( FILE: src/transformers/data/processors/xnli.py class XnliProcessor (line 26) | class XnliProcessor(DataProcessor): method __init__ (line 32) | def __init__(self, language, train_language=None): method get_train_examples (line 36) | def get_train_examples(self, data_dir): method get_test_examples (line 57) | def get_test_examples(self, data_dir): method get_labels (line 80) | def get_labels(self): FILE: src/transformers/debug_utils.py class DebugUnderflowOverflow (line 27) | class DebugUnderflowOverflow: method __init__ (line 145) | def __init__(self, model, max_frames_to_save=21, trace_batch_nums=None... method save_frame (line 164) | def save_frame(self, frame=None): method expand_frame (line 170) | def expand_frame(self, line): method trace_frames (line 173) | def trace_frames(self): method reset_saved_frames (line 177) | def reset_saved_frames(self): method dump_saved_frames (line 180) | def dump_saved_frames(self): method analyse_model (line 188) | def analyse_model(self): method analyse_variable (line 196) | def analyse_variable(self, var, ctx): method batch_start_frame (line 206) | def batch_start_frame(self): method batch_end_frame (line 210) | def batch_end_frame(self): method create_frame (line 213) | def create_frame(self, module, input, output): method register_forward_hook (line 241) | def register_forward_hook(self): method _register_forward_hook (line 244) | def _register_forward_hook(self, module): method forward_hook (line 247) | def forward_hook(self, module, input, output): function get_abs_min_max (line 295) | def get_abs_min_max(var, ctx): function detect_overflow (line 300) | def detect_overflow(var, ctx): class DebugOption (line 346) | class DebugOption(ExplicitEnum): FILE: src/transformers/dependency_versions_check.py function dep_version_check (line 61) | def dep_version_check(pkg, hint=None): FILE: src/transformers/distributed/configuration_utils.py class DistributedConfig (line 23) | class DistributedConfig: method from_dict (line 32) | def from_dict(cls, config_dict, **kwargs): method to_json_file (line 52) | def to_json_file(self, json_file_path: str | os.PathLike): method to_dict (line 68) | def to_dict(self) -> dict[str, Any]: method __iter__ (line 76) | def __iter__(self): method __repr__ (line 81) | def __repr__(self): method to_json_string (line 84) | def to_json_string(self): method update (line 92) | def update(self, **kwargs): FILE: src/transformers/dynamic_module_utils.py function _sanitize_module_name (line 49) | def _sanitize_module_name(name: str) -> str: function init_hf_modules (line 85) | def init_hf_modules(): function create_dynamic_module (line 101) | def create_dynamic_module(name: str | os.PathLike) -> None: function get_relative_imports (line 123) | def get_relative_imports(module_file: str | os.PathLike) -> list[str]: function get_relative_import_files (line 144) | def get_relative_import_files(module_file: str | os.PathLike) -> list[str]: function get_imports (line 176) | def get_imports(filename: str | os.PathLike) -> list[str]: function check_imports (line 231) | def check_imports(filename: str | os.PathLike) -> list[str]: function get_class_in_module (line 266) | def get_class_in_module( function get_cached_module_file (line 314) | def get_cached_module_file( function get_class_from_dynamic_module (line 476) | def get_class_from_dynamic_module( function custom_object_save (line 586) | def custom_object_save(obj: Any, folder: str | os.PathLike, config: dict... function _raise_timeout_error (line 662) | def _raise_timeout_error(signum, frame): function resolve_trust_remote_code (line 672) | def resolve_trust_remote_code( function check_python_requirements (line 757) | def check_python_requirements(path_or_repo_id, requirements_file="requir... FILE: src/transformers/feature_extraction_sequence_utils.py class SequenceFeatureExtractor (line 28) | class SequenceFeatureExtractor(FeatureExtractionMixin): method __init__ (line 41) | def __init__(self, feature_size: int, sampling_rate: int, padding_valu... method pad (line 51) | def pad( method _pad (line 221) | def _pad( method _truncate (line 293) | def _truncate( method _get_padding_strategies (line 336) | def _get_padding_strategies(self, padding=False, max_length=None): method fetch_audio (line 368) | def fetch_audio(self, audio_url_or_urls: str | list[str] | list[list[s... FILE: src/transformers/feature_extraction_utils.py class BatchFeature (line 58) | class BatchFeature(UserDict): method __init__ (line 75) | def __init__( method __getitem__ (line 85) | def __getitem__(self, item: str) -> Any: method __getattr__ (line 95) | def __getattr__(self, item: str): method __getstate__ (line 101) | def __getstate__(self): method __setstate__ (line 104) | def __setstate__(self, state): method _get_is_as_tensor_fns (line 108) | def _get_is_as_tensor_fns(self, tensor_type: str | TensorType | None =... method convert_to_tensors (line 158) | def convert_to_tensors( method to (line 215) | def to(self, *args, **kwargs) -> "BatchFeature": class FeatureExtractionMixin (line 266) | class FeatureExtractionMixin(PushToHubMixin): method __init__ (line 274) | def __init__(self, **kwargs): method from_pretrained (line 287) | def from_pretrained( method save_pretrained (line 383) | def save_pretrained(self, save_directory: str | os.PathLike, push_to_h... method get_feature_extractor_dict (line 432) | def get_feature_extractor_dict( method from_dict (line 546) | def from_dict( method to_dict (line 584) | def to_dict(self) -> dict[str, Any]: method from_json_file (line 598) | def from_json_file(cls, json_file: str | os.PathLike) -> "FeatureExtra... method to_json_string (line 616) | def to_json_string(self) -> str: method to_json_file (line 631) | def to_json_file(self, json_file_path: str | os.PathLike): method __repr__ (line 642) | def __repr__(self): method register_for_auto_class (line 646) | def register_for_auto_class(cls, auto_class="AutoFeatureExtractor"): FILE: src/transformers/generation/candidate_generator.py class CandidateGenerator (line 39) | class CandidateGenerator: method get_candidates (line 42) | def get_candidates(self, input_ids: torch.LongTensor) -> tuple[torch.L... method update_candidate_strategy (line 59) | def update_candidate_strategy(self, input_ids: torch.LongTensor, score... class AssistedCandidateGenerator (line 78) | class AssistedCandidateGenerator(CandidateGenerator): method __init__ (line 101) | def __init__( method get_candidates (line 200) | def get_candidates(self, input_ids: torch.LongTensor) -> tuple[torch.L... method update_candidate_strategy (line 225) | def update_candidate_strategy(self, input_ids: torch.LongTensor, score... method _calculate_new_tokens (line 283) | def _calculate_new_tokens(self, input_ids: torch.LongTensor) -> tuple[... method _update_past_and_masks (line 290) | def _update_past_and_masks( method _prepare_generation_args (line 312) | def _prepare_generation_args(self, input_ids: torch.LongTensor, min_ne... method _generate_candidates (line 322) | def _generate_candidates(self, generation_args: dict) -> tuple[torch.L... class AssistedCandidateGeneratorDifferentTokenizers (line 341) | class AssistedCandidateGeneratorDifferentTokenizers(AssistedCandidateGen... method __init__ (line 374) | def __init__( method _get_longest_diag_dict (line 395) | def _get_longest_diag_dict(input_matrix, nonzero_idx): method _get_longest_diag_index (line 431) | def _get_longest_diag_index(input_matrix): method _get_tokens_diag (line 451) | def _get_tokens_diag(prompt, prompt_plus_new_tokens): method convert_source_tokens_to_target_tokens (line 483) | def convert_source_tokens_to_target_tokens( method get_candidates (line 502) | def get_candidates(self, input_ids: torch.LongTensor) -> tuple[torch.L... method _prepare_assistant_input_ids (line 544) | def _prepare_assistant_input_ids(self, input_ids: torch.LongTensor) ->... method _process_assistant_outputs (line 590) | def _process_assistant_outputs( class _PruneReindexingLMHead (line 624) | class _PruneReindexingLMHead(nn.Module): method __init__ (line 636) | def __init__(self, original_lm_head, assistant_overlap_token_ids): method forward (line 642) | def forward(self, hidden_states): class _MapInputEmbedding (line 647) | class _MapInputEmbedding(nn.Module): method __init__ (line 648) | def __init__(self, original_embedding: nn.Embedding, assistant_overlap... method forward (line 663) | def forward(self, input_ids: torch.LongTensor) -> torch.FloatTensor: class AssistantToTargetTranslator (line 681) | class AssistantToTargetTranslator: method __init__ (line 705) | def __init__( method unmap_input_ids (line 746) | def unmap_input_ids(self): method _get_assistant_to_target_input_ids (line 756) | def _get_assistant_to_target_input_ids(self): method _get_suppress_input_ids (line 791) | def _get_suppress_input_ids(self) -> list[int]: method get_target_ids (line 797) | def get_target_ids( method get_target_logits (line 818) | def get_target_logits(self, assistant_logits: torch.FloatTensor) -> to... class AssistantVocabTranslatorCache (line 840) | class AssistantVocabTranslatorCache: method get_translator (line 849) | def get_translator( method cleanup (line 876) | def cleanup(cls): class UniversalSpeculativeDecodingGenerator (line 894) | class UniversalSpeculativeDecodingGenerator(AssistedCandidateGeneratorDi... method __init__ (line 900) | def __init__( method get_candidates (line 928) | def get_candidates(self, input_ids: torch.LongTensor) -> tuple[torch.L... method _update_past_and_masks (line 960) | def _update_past_and_masks(self, assistant_input_ids: torch.LongTensor... method _prepare_assistant_input_ids (line 972) | def _prepare_assistant_input_ids(self, target_input_ids: torch.LongTen... class PromptLookupCandidateGenerator (line 1013) | class PromptLookupCandidateGenerator(CandidateGenerator): method __init__ (line 1038) | def __init__( method get_candidates (line 1057) | def get_candidates(self, input_ids: torch.LongTensor) -> tuple[torch.L... method update_candidate_strategy (line 1151) | def update_candidate_strategy(self, input_ids: torch.LongTensor, score... class EarlyExitCandidateGenerator (line 1168) | class EarlyExitCandidateGenerator(AssistedCandidateGenerator): method __init__ (line 1192) | def __init__( method get_candidates (line 1214) | def get_candidates(self, input_ids: torch.LongTensor) -> tuple[torch.L... function _prepare_attention_mask (line 1224) | def _prepare_attention_mask(model_kwargs: dict[str, Any], new_length: in... function _prepare_position_ids (line 1260) | def _prepare_position_ids(model_kwargs: dict[str, Any], new_length: int,... function _prepare_token_type_ids (line 1286) | def _prepare_token_type_ids(model_kwargs: dict[str, Any], new_length: in... FILE: src/transformers/generation/configuration_utils.py class GenerationMode (line 65) | class GenerationMode(ExplicitEnum): class GenerationConfig (line 83) | class GenerationConfig(PushToHubMixin): method __init__ (line 352) | def __init__(self, **kwargs): method __hash__ (line 471) | def __hash__(self): method __eq__ (line 474) | def __eq__(self, other): method __repr__ (line 482) | def __repr__(self): method get_generation_mode (line 485) | def get_generation_mode(self, assistant_model: Optional["PreTrainedMod... method _get_default_generation_params (line 551) | def _get_default_generation_params() -> dict[str, Any]: method validate (line 590) | def validate(self, strict=False): method save_pretrained (line 768) | def save_pretrained( method from_pretrained (line 828) | def from_pretrained( method _dict_from_json_file (line 994) | def _dict_from_json_file(cls, json_file: str | os.PathLike): method from_dict (line 1000) | def from_dict(cls, config_dict: dict[str, Any], **kwargs) -> "Generati... method dict_dtype_to_str (line 1033) | def dict_dtype_to_str(self, d: dict[str, Any]) -> None: method to_diff_dict (line 1045) | def to_diff_dict(self) -> dict[str, Any]: method to_dict (line 1068) | def to_dict(self) -> dict[str, Any]: method to_json_string (line 1089) | def to_json_string( method to_json_file (line 1141) | def to_json_file( method from_model_config (line 1160) | def from_model_config(cls, model_config: Union["PreTrainedConfig", dic... method update (line 1209) | def update(self, defaults_only=False, allow_custom_entries=False, **kw... class BaseWatermarkingConfig (line 1244) | class BaseWatermarkingConfig(ABC): method from_dict (line 1248) | def from_dict(cls, config_dict, **kwargs): method to_json_file (line 1269) | def to_json_file(self, json_file_path: str | os.PathLike): method to_dict (line 1282) | def to_dict(self) -> dict[str, Any]: method __iter__ (line 1292) | def __iter__(self): method __repr__ (line 1295) | def __repr__(self): method to_json_string (line 1298) | def to_json_string(self): method update (line 1307) | def update(self, **kwargs): method validate (line 1319) | def validate(self): ... method construct_processor (line 1322) | def construct_processor(self, vocab_size): ... class WatermarkingConfig (line 1326) | class WatermarkingConfig(BaseWatermarkingConfig): method __init__ (line 1347) | def __init__( method validate (line 1361) | def validate(self): method construct_processor (line 1391) | def construct_processor(self, vocab_size: int, device) -> "WatermarkLo... class SynthIDTextWatermarkingConfig (line 1404) | class SynthIDTextWatermarkingConfig(BaseWatermarkingConfig): method __init__ (line 1448) | def __init__( method validate (line 1466) | def validate(self): method construct_processor (line 1480) | def construct_processor(self, vocab_size: int, device) -> "WatermarkLo... class CompileConfig (line 1494) | class CompileConfig: method to_dict (line 1540) | def to_dict(self) -> dict[str, Any]: class ContinuousBatchingConfig (line 1547) | class ContinuousBatchingConfig: method account_for_cb_deprecated_arguments (line 1645) | def account_for_cb_deprecated_arguments( method decide_use_cuda_graphs (line 1684) | def decide_use_cuda_graphs(self, compile_config: CompileConfig | None,... method decide_use_async_batching (line 1732) | def decide_use_async_batching(self, is_attn_mask_needed: bool) -> bool: method resolve_sentinel_values (line 1749) | def resolve_sentinel_values(self) -> None: method resolve_compile_configs (line 1762) | def resolve_compile_configs( FILE: src/transformers/generation/continuous_batching/cache.py function group_layers_by_attn_type (line 28) | def group_layers_by_attn_type(config: PreTrainedConfig) -> tuple[list[li... class PagedAttentionCache (line 62) | class PagedAttentionCache: method __init__ (line 119) | def __init__( method will_allocation_be_successful (line 261) | def will_allocation_be_successful(self, num_requested_blocks: int, all... method allocate_blocks (line 280) | def allocate_blocks(self, n_blocks: int, request_id: str, allocated_bl... method free_blocks (line 296) | def free_blocks(self, request_id: str) -> None: method get_num_free_blocks (line 302) | def get_num_free_blocks(self) -> int: method extend_read_and_write_indices (line 307) | def extend_read_and_write_indices( method fill_block_table (line 324) | def fill_block_table( method get_seqlens_k (line 331) | def get_seqlens_k(self, past_length: int, query_length: int) -> dict[s... method update (line 343) | def update( method get_block_table_key (line 395) | def get_block_table_key(self, flash_attn_with_kvcache_fn: Any) -> str: method search_prefix_match (line 411) | def search_prefix_match(self, request_id: str, prompt_ids: list[int]) ... method mark_shareable_blocks_as_complete (line 437) | def mark_shareable_blocks_as_complete(self, state: RequestState, num_c... method copy_cache (line 454) | def copy_cache(self, list_source_blocks: list[int], list_forked_blocks... method fork_request (line 466) | def fork_request(self, source_request_id: str, destination_request_ids... method free_all_requests (line 477) | def free_all_requests(self) -> None: class PagedAttentionMemoryHandler (line 489) | class PagedAttentionMemoryHandler: method __init__ (line 519) | def __init__( method get_available_memory (line 546) | def get_available_memory(max_memory_percent: float = 1.0) -> int: method infer_num_blocks_and_max_batch_tokens (line 562) | def infer_num_blocks_and_max_batch_tokens( method compute_num_blocks_and_max_batch_tokens (line 606) | def compute_num_blocks_and_max_batch_tokens( method compute_max_batch_tokens (line 661) | def compute_max_batch_tokens( method compute_num_blocks (line 689) | def compute_num_blocks( method compute_memory_footprint (line 717) | def compute_memory_footprint( FILE: src/transformers/generation/continuous_batching/cache_manager.py function reverse_enumerate (line 28) | def reverse_enumerate(xs: list[T]) -> Iterator[tuple[int, T]]: class Block (line 35) | class Block: # TODO: rename to ShareableBlock and update the docs method __init__ (line 41) | def __init__(self, id_: int, parent_id: int | None, group_id: int) -> ... method __repr__ (line 48) | def __repr__(self) -> str: method is_complete (line 52) | def is_complete(self) -> bool: class BlockManager (line 56) | class BlockManager: method __init__ (line 76) | def __init__(self, num_blocks: int, block_size: int) -> None: method num_free_blocks (line 86) | def num_free_blocks(self) -> int: method has_enough_free_blocks (line 90) | def has_enough_free_blocks(self, n_blocks: int) -> bool: method get_free_blocks (line 109) | def get_free_blocks( method fork_blocks (line 128) | def fork_blocks( method increase_ref_count (line 184) | def increase_ref_count(self, block_id: int) -> None: method decrease_ref_count (line 191) | def decrease_ref_count(self, block_id: int) -> None: method free_blocks (line 203) | def free_blocks(self, blocks: list[int], shareable: bool) -> None: method uninitialize_unshared_block (line 212) | def uninitialize_unshared_block(self, block_id: int) -> None: method mark_shareable_blocks_as_complete (line 221) | def mark_shareable_blocks_as_complete( method compute_hash (line 276) | def compute_hash(self, parent_hash: int | None, tokens: list[int], gro... class CacheAllocator (line 282) | class CacheAllocator(ABC): method allocate_blocks (line 291) | def allocate_blocks(self, n_blocks: int, request_id: str, block_manage... method free_blocks (line 295) | def free_blocks(self, request_id: str, block_manager: BlockManager) ->... method get_read_indices (line 306) | def get_read_indices(self, request_id: str, past_length: int, query_le... method get_write_indices (line 310) | def get_write_indices(self, request_id: str, past_length: int, query_l... method fill_block_table (line 314) | def fill_block_table( method fork_blocks (line 319) | def fork_blocks( class FullAttentionCacheAllocator (line 350) | class FullAttentionCacheAllocator(CacheAllocator): method __init__ (line 353) | def __init__(self, index: int, block_size: int, allow_block_sharing: b... method allocate_blocks (line 364) | def allocate_blocks(self, n_blocks: int, request_id: str, block_manage... method get_read_indices (line 382) | def get_read_indices(self, request_id: str, past_length: int, query_le... method get_write_indices (line 403) | def get_write_indices(self, request_id: str, past_length: int, query_l... method fill_block_table (line 424) | def fill_block_table( class SlidingAttentionCacheAllocator (line 441) | class SlidingAttentionCacheAllocator(CacheAllocator): method __init__ (line 444) | def __init__(self, index: int, block_size: int, sliding_window: int) -... method allocate_blocks (line 458) | def allocate_blocks(self, n_blocks: int, request_id: str, block_manage... method get_read_indices (line 480) | def get_read_indices(self, request_id: str, past_length: int, query_le... method get_write_indices (line 503) | def get_write_indices(self, request_id: str, past_length: int, query_l... method fill_block_table (line 528) | def fill_block_table( FILE: src/transformers/generation/continuous_batching/continuous_api.py class ProtoPretrainedModel (line 68) | class ProtoPretrainedModel(nn.Module): method set_attn_implementation (line 74) | def set_attn_implementation(self, attn_implementation: str) -> None: method _get_logits_processor (line 78) | def _get_logits_processor(self, generation_config: GenerationConfig) -... class OutputRouter (line 82) | class OutputRouter: method __init__ (line 90) | def __init__(self) -> None: method deliver (line 95) | def deliver(self, output: GenerationOutput) -> None: method deliver_batch (line 105) | def deliver_batch(self, outputs: list[GenerationOutput]) -> None: class ContinuousBatchProcessor (line 131) | class ContinuousBatchProcessor: method __init__ (line 135) | def __init__( method __repr__ (line 227) | def __repr__(self) -> str: method __del__ (line 234) | def __del__(self) -> None: method _ensure_decode_fast_path_is_available (line 240) | def _ensure_decode_fast_path_is_available(self) -> None: method reset (line 264) | def reset(self) -> None: method _get_new_requests (line 272) | def _get_new_requests(self) -> None: method _handle_request_error (line 290) | def _handle_request_error(self, error: Exception, state: RequestState)... method soft_reset_one_request (line 306) | def soft_reset_one_request(self) -> None: method prepare_next_batch (line 334) | def prepare_next_batch(self) -> bool: method update_batch (line 380) | def update_batch(self) -> None: method has_pending_requests (line 450) | def has_pending_requests(self) -> bool: method handle_batch_error (line 455) | def handle_batch_error(self, error): method fail_all_requests (line 463) | def fail_all_requests(self, error: Exception) -> None: method _generation_step (line 485) | def _generation_step(self, model: nn.Module, logit_processor: LogitsPr... method capture_graph (line 520) | def capture_graph(self, forward_fn: Any, compute_stream: torch.cuda.St... method _forward_process_and_sample (line 535) | def _forward_process_and_sample( method _model_forward (line 552) | def _model_forward(self, model: nn.Module, batch_data: dict) -> torch.... method _process_logit (line 556) | def _process_logit( method _sample (line 574) | def _sample(self, probs: torch.Tensor, logits_indices: torch.Tensor, o... method warmup (line 610) | def warmup( class ContinuousBatchingManager (line 711) | class ContinuousBatchingManager: method __init__ (line 720) | def __init__( method start (line 776) | def start(self) -> None: method is_running (line 785) | def is_running(self) -> bool: method warmup (line 789) | def warmup(self, num_query_tokens: int = 0, num_cache_tokens: int = 0)... method stop (line 798) | def stop(self, block: bool = True, timeout: float | None = None, keep_... method join (line 838) | def join(self, stop_trigger_time: float, timeout: float | None = None)... method add_request (line 853) | def add_request( method add_requests (line 896) | def add_requests( method cancel_request (line 920) | def cancel_request(self, request_id: str) -> None: method get_result (line 930) | def get_result(self, request_id: str | None = None, timeout: float | N... method __iter__ (line 951) | def __iter__(self): method request_id_iter (line 958) | def request_id_iter(self, request_id: str) -> Generator[GenerationOutp... method register_result_handler (line 971) | def register_result_handler(self, request_id: str, callback: Callable)... method _generation_step (line 996) | def _generation_step(self) -> None: method _create_batch_processor (line 1002) | def _create_batch_processor(self) -> ContinuousBatchProcessor: method _run_generation_loop (line 1036) | def _run_generation_loop(self) -> None: method _inner_generation_loop (line 1076) | def _inner_generation_loop(self, batch_processor: ContinuousBatchProce... method _handle_critical_error (line 1087) | def _handle_critical_error(self, error: Exception, batch_processor: Co... class ContinuousMixin (line 1106) | class ContinuousMixin: method init_continuous_batching (line 1119) | def init_continuous_batching( method destroy_cached_continuous_batching_manager (line 1171) | def destroy_cached_continuous_batching_manager(self) -> None: method continuous_batching_context_manager (line 1180) | def continuous_batching_context_manager( method generate_batch (line 1218) | def generate_batch( FILE: src/transformers/generation/continuous_batching/input_outputs.py class PagedAttentionArgs (line 32) | class PagedAttentionArgs: method asdict (line 68) | def asdict(self) -> dict[str, Any]: class ContinuousBatchingIOs (line 86) | class ContinuousBatchingIOs: method __init__ (line 92) | def __init__( method _setup_static_tensors (line 133) | def _setup_static_tensors(self) -> None: method _transfer_inputs (line 214) | def _transfer_inputs( method _reset_static_tensors (line 246) | def _reset_static_tensors(self, full_reset: bool = False) -> None: method reset (line 284) | def reset(self) -> None: method get_cumulative_seqlens (line 293) | def get_cumulative_seqlens(self) -> tuple[torch.Tensor, dict[str, torc... method carry_over_tokens (line 297) | def carry_over_tokens( method retrieve_device_outputs (line 302) | def retrieve_device_outputs(self) -> None: method prepare_batch_update (line 306) | def prepare_batch_update(self) -> tuple[list[FutureRequestState], list... method prepare_batch_tensors (line 318) | def prepare_batch_tensors( method get_model_kwargs (line 432) | def get_model_kwargs(self, use_padding: bool = False) -> dict[str, Any]: method get_cb_kwargs (line 503) | def get_cb_kwargs(self) -> tuple[torch.Tensor, torch.Tensor, torch.Ten... method get_graph (line 509) | def get_graph(self) -> torch.cuda.CUDAGraph | None: method set_graph (line 517) | def set_graph(self, graph: torch.cuda.CUDAGraph) -> None: class HostDeviceIOPair (line 521) | class HostDeviceIOPair: method __init__ (line 522) | def __init__( method reset (line 541) | def reset(self) -> None: method transfer_inputs_h2d (line 548) | def transfer_inputs_h2d(self, stream: torch.cuda.Stream) -> None: method transfer_outputs_d2h (line 551) | def transfer_outputs_d2h(self, stream: torch.cuda.Stream | None) -> None: class ContinuousBatchingAsyncIOs (line 557) | class ContinuousBatchingAsyncIOs: method __init__ (line 603) | def __init__( method get_cumulative_seqlens (line 633) | def get_cumulative_seqlens(self) -> tuple[torch.Tensor, dict[str, torc... method prepare_batch_tensors (line 637) | def prepare_batch_tensors( method infer_carry_over_ids (line 648) | def infer_carry_over_ids(self) -> torch.Tensor: method get_model_kwargs (line 668) | def get_model_kwargs(self, use_padding: bool = False) -> dict[str, Any]: method get_cb_kwargs (line 675) | def get_cb_kwargs(self) -> tuple[torch.Tensor, torch.Tensor, torch.Ten... method carry_over_tokens (line 691) | def carry_over_tokens( method output_ids (line 708) | def output_ids(self) -> torch.Tensor: method get_graph (line 712) | def get_graph(self) -> torch.cuda.CUDAGraph | None: method set_graph (line 715) | def set_graph(self, graph: torch.cuda.CUDAGraph) -> None: method use_block_table (line 719) | def use_block_table(self) -> bool: method retrieve_device_outputs (line 723) | def retrieve_device_outputs(self) -> None: method prepare_batch_update (line 735) | def prepare_batch_update(self) -> tuple[list[FutureRequestState], list... method reset (line 740) | def reset(self) -> None: FILE: src/transformers/generation/continuous_batching/requests.py function get_device_and_memory_breakdown (line 42) | def get_device_and_memory_breakdown() -> tuple[torch.device, int, int, i... class RequestStatus (line 81) | class RequestStatus(IntEnum): class GenerationOutput (line 92) | class GenerationOutput: method is_finished (line 116) | def is_finished(self) -> bool: class RequestState (line 121) | class RequestState: method __post_init__ (line 172) | def __post_init__(self): method status (line 191) | def status(self) -> RequestStatus: method status (line 195) | def status(self, value: RequestStatus): method timestamps (line 204) | def timestamps(self) -> list[float] | None: method log_end_of_request (line 207) | def log_end_of_request(self): method current_len (line 216) | def current_len(self) -> int: method generated_len (line 220) | def generated_len(self) -> int: method update_and_check_completion (line 226) | def update_and_check_completion(self, token_id: int, logprob: float | ... method __repr__ (line 257) | def __repr__(self): method to_generation_output (line 271) | def to_generation_output(self): method fork (line 288) | def fork(self, new_request_id: str) -> "RequestState": method create_equivalent_initial_request (line 314) | def create_equivalent_initial_request(self) -> "RequestState": class FutureRequestState (line 338) | class FutureRequestState: method __init__ (line 344) | def __init__(self, state: RequestState, has_new_token: bool, complete_... FILE: src/transformers/generation/continuous_batching/scheduler.py class Scheduler (line 23) | class Scheduler(ABC): method __init__ (line 30) | def __init__(self, cache: PagedAttentionCache): method reset (line 39) | def reset(self) -> None: method add_waiting_request (line 49) | def add_waiting_request(self, state: RequestState): method schedule_batch (line 55) | def schedule_batch( method has_pending_requests (line 66) | def has_pending_requests(self) -> bool: method finish_request (line 71) | def finish_request(self, request_id: str) -> None: method get_active_request_static_outputs (line 79) | def get_active_request_static_outputs(self, request_id: str) -> list[i... method set_request_cancellation (line 86) | def set_request_cancellation(self, request_id: str): method clear_cancelled_requests (line 92) | def clear_cancelled_requests(self): method request_is_cancelled (line 104) | def request_is_cancelled(self, request_id: str) -> bool: method _allocate_blocks_if_needed (line 111) | def _allocate_blocks_if_needed(self, state: RequestState, len_next_tok... method _infer_request_tokens (line 129) | def _infer_request_tokens(self, state: RequestState, request_ids_to_re... method _schedule_request (line 154) | def _schedule_request( method _process_candidates (line 192) | def _process_candidates( method _cleanup_waiting_queue (line 283) | def _cleanup_waiting_queue(self, request_ids_to_remove_from_waiting: s... class FIFOScheduler (line 292) | class FIFOScheduler(Scheduler): method __init__ (line 297) | def __init__(self, cache: PagedAttentionCache, safety_margin: float = ... method schedule_batch (line 306) | def schedule_batch( class PrefillFirstScheduler (line 348) | class PrefillFirstScheduler(Scheduler): method schedule_batch (line 354) | def schedule_batch( FILE: src/transformers/generation/continuous_batching/utils.py class CudaGraphBuffer (line 25) | class CudaGraphBuffer: method __init__ (line 28) | def __init__(self, max_size: int) -> None: method __del__ (line 34) | def __del__(self) -> None: method get_graph (line 40) | def get_graph(self, q_len: int, kv_len: int) -> torch.cuda.CUDAGraph |... method plan_for_new_graph (line 46) | def plan_for_new_graph(self, silent: bool = False) -> None: method set_graph (line 53) | def set_graph(self, q_len: int, kv_len: int, graph: torch.cuda.CUDAGra... function attn_mask_is_needed (line 60) | def attn_mask_is_needed(config: PretrainedConfig) -> bool: function pad_to_interval (line 65) | def pad_to_interval(size: int, interval_size: int, max_value: int) -> int: function aligned_divide (line 73) | def aligned_divide(x: int, divide_by: int, align_to: int) -> int: function build_attention_mask (line 80) | def build_attention_mask( function create_warmup_future_states (line 164) | def create_warmup_future_states( FILE: src/transformers/generation/logits_process.py class LogitsProcessor (line 49) | class LogitsProcessor: method __call__ (line 53) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class LogitsProcessorList (line 59) | class LogitsProcessorList(list): method __call__ (line 66) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... method set_continuous_batching_context (line 96) | def set_continuous_batching_context(self, logits_indices: torch.Tensor... class MinLengthLogitsProcessor (line 103) | class MinLengthLogitsProcessor(LogitsProcessor): method __init__ (line 142) | def __init__(self, min_length: int, eos_token_id: int | list[int] | to... method __call__ (line 155) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class MinNewTokensLengthLogitsProcessor (line 164) | class MinNewTokensLengthLogitsProcessor(LogitsProcessor): method __init__ (line 201) | def __init__( method __call__ (line 225) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class TemperatureLogitsWarper (line 236) | class TemperatureLogitsWarper(LogitsProcessor): method __init__ (line 284) | def __init__(self, temperature: float): method __call__ (line 297) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class RepetitionPenaltyLogitsProcessor (line 302) | class RepetitionPenaltyLogitsProcessor(LogitsProcessor): method __init__ (line 352) | def __init__(self, penalty: float, prompt_ignore_length: int | None = ... method set_continuous_batching_context (line 366) | def set_continuous_batching_context(self, logits_indices: torch.Tensor... method __call__ (line 371) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class EncoderRepetitionPenaltyLogitsProcessor (line 414) | class EncoderRepetitionPenaltyLogitsProcessor(LogitsProcessor): method __init__ (line 451) | def __init__(self, penalty: float, encoder_input_ids: torch.LongTensor): method __call__ (line 459) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class TopPLogitsWarper (line 469) | class TopPLogitsWarper(LogitsProcessor): method __init__ (line 509) | def __init__(self, top_p: float, filter_value: float = -float("Inf"), ... method __call__ (line 521) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class TopKLogitsWarper (line 536) | class TopKLogitsWarper(LogitsProcessor): method __init__ (line 573) | def __init__(self, top_k: int, filter_value: float = -float("Inf"), mi... method __call__ (line 581) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class TopHLogitsWarper (line 589) | class TopHLogitsWarper(LogitsProcessor): method __init__ (line 625) | def __init__(self, top_h: float, filter_value: float = -float("Inf")): method __call__ (line 640) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class MinPLogitsWarper (line 695) | class MinPLogitsWarper(LogitsProcessor): method __init__ (line 742) | def __init__(self, min_p: float, filter_value: float = -float("Inf"), ... method __call__ (line 752) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class TypicalLogitsWarper (line 771) | class TypicalLogitsWarper(LogitsProcessor): method __init__ (line 824) | def __init__(self, mass: float = 0.9, filter_value: float = -float("In... method __call__ (line 836) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class EpsilonLogitsWarper (line 859) | class EpsilonLogitsWarper(LogitsProcessor): method __init__ (line 899) | def __init__(self, epsilon: float, filter_value: float = -float("Inf")... method __call__ (line 915) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class EtaLogitsWarper (line 928) | class EtaLogitsWarper(LogitsProcessor): method __init__ (line 980) | def __init__( method __call__ (line 998) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... function _get_ngrams (line 1012) | def _get_ngrams(ngram_size: int, prev_input_ids: torch.Tensor, num_hypos... function _get_generated_ngrams (line 1041) | def _get_generated_ngrams(banned_ngrams, prev_input_ids, ngram_size, cur... function _calc_banned_ngram_tokens (line 1064) | def _calc_banned_ngram_tokens( class NoRepeatNGramLogitsProcessor (line 1079) | class NoRepeatNGramLogitsProcessor(LogitsProcessor): method __init__ (line 1121) | def __init__(self, ngram_size: int): method __call__ (line 1127) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class EncoderNoRepeatNGramLogitsProcessor (line 1138) | class EncoderNoRepeatNGramLogitsProcessor(LogitsProcessor): method __init__ (line 1176) | def __init__(self, encoder_ngram_size: int, encoder_input_ids: torch.L... method __call__ (line 1188) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class SequenceBiasLogitsProcessor (line 1207) | class SequenceBiasLogitsProcessor(LogitsProcessor): method __init__ (line 1272) | def __init__(self, sequence_bias: list[list[list[int] | float]]): method __call__ (line 1284) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... method _prepare_bias_variables (line 1317) | def _prepare_bias_variables(self, scores: torch.FloatTensor): method _validate_arguments (line 1347) | def _validate_arguments(self): method _convert_list_arguments_into_dict (line 1384) | def _convert_list_arguments_into_dict(self): class NoBadWordsLogitsProcessor (line 1391) | class NoBadWordsLogitsProcessor(SequenceBiasLogitsProcessor): method __init__ (line 1446) | def __init__(self, bad_words_ids: list[list[int]], eos_token_id: int |... method _validate_arguments (line 1465) | def _validate_arguments(self): class PrefixConstrainedLogitsProcessor (line 1480) | class PrefixConstrainedLogitsProcessor(LogitsProcessor): method __init__ (line 1527) | def __init__(self, prefix_allowed_tokens_fn: Callable[[int, torch.Tens... method __call__ (line 1532) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class ForcedBOSTokenLogitsProcessor (line 1552) | class ForcedBOSTokenLogitsProcessor(LogitsProcessor): method __init__ (line 1584) | def __init__(self, bos_token_id: int): method __call__ (line 1588) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class ForcedEOSTokenLogitsProcessor (line 1597) | class ForcedEOSTokenLogitsProcessor(LogitsProcessor): method __init__ (line 1631) | def __init__(self, max_length: int, eos_token_id: int | list[int] | to... method __call__ (line 1644) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class InfNanRemoveLogitsProcessor (line 1653) | class InfNanRemoveLogitsProcessor(LogitsProcessor): method __call__ (line 1663) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class ExponentialDecayLengthPenalty (line 1674) | class ExponentialDecayLengthPenalty(LogitsProcessor): method __init__ (line 1742) | def __init__( method __call__ (line 1761) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class LogitNormalization (line 1775) | class LogitNormalization(LogitsProcessor): method __call__ (line 1807) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class SuppressTokensAtBeginLogitsProcessor (line 1812) | class SuppressTokensAtBeginLogitsProcessor(LogitsProcessor): method __init__ (line 1847) | def __init__(self, begin_suppress_tokens, begin_index, device: str = "... method set_begin_index (line 1851) | def set_begin_index(self, begin_index): method __call__ (line 1855) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class SuppressTokensLogitsProcessor (line 1865) | class SuppressTokensLogitsProcessor(LogitsProcessor): method __init__ (line 1894) | def __init__(self, suppress_tokens, device: str = "cpu"): method __call__ (line 1898) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class WhisperTimeStampLogitsProcessor (line 1905) | class WhisperTimeStampLogitsProcessor(LogitsProcessor): method __init__ (line 1963) | def __init__( method set_begin_index (line 1992) | def set_begin_index(self, begin_index): method __call__ (line 1996) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class WhisperNoSpeechDetection (line 2046) | class WhisperNoSpeechDetection(LogitsProcessor): method __init__ (line 2052) | def __init__(self, no_speech_token: int, begin_index: int, scores_is_l... method set_model (line 2067) | def set_model(self, model): method set_inputs (line 2070) | def set_inputs(self, inputs): method no_speech_prob (line 2080) | def no_speech_prob(self): method set_begin_index (line 2083) | def set_begin_index(self, begin_index): method __call__ (line 2087) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class ClassifierFreeGuidanceLogitsProcessor (line 2111) | class ClassifierFreeGuidanceLogitsProcessor(LogitsProcessor): method __init__ (line 2150) | def __init__(self, guidance_scale): method __call__ (line 2160) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class AlternatingCodebooksLogitsProcessor (line 2175) | class AlternatingCodebooksLogitsProcessor(LogitsProcessor): method __init__ (line 2196) | def __init__(self, input_start_len: int, semantic_vocab_size: int, cod... method __call__ (line 2204) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class UnbatchedClassifierFreeGuidanceLogitsProcessor (line 2220) | class UnbatchedClassifierFreeGuidanceLogitsProcessor(LogitsProcessor): method __init__ (line 2272) | def __init__( method get_unconditional_logits (line 2290) | def get_unconditional_logits(self, input_ids): method __call__ (line 2326) | def __call__(self, input_ids, scores): class BarkEosPrioritizerLogitsProcessor (line 2338) | class BarkEosPrioritizerLogitsProcessor(LogitsProcessor): method __init__ (line 2355) | def __init__(self, eos_token_id: int | list[int] | torch.Tensor, min_e... method __call__ (line 2370) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class WatermarkLogitsProcessor (line 2385) | class WatermarkLogitsProcessor(LogitsProcessor): method __init__ (line 2447) | def __init__( method set_seed (line 2476) | def set_seed(self, input_seq: torch.LongTensor): method _get_greenlist_ids (line 2486) | def _get_greenlist_ids(self, input_seq: torch.LongTensor) -> torch.Lon... method _score_rejection_sampling (line 2492) | def _score_rejection_sampling(self, input_seq: torch.LongTensor, score... method __call__ (line 2508) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class SynthIDTextWatermarkState (line 2527) | class SynthIDTextWatermarkState: method __init__ (line 2530) | def __init__( class SynthIDTextWatermarkLogitsProcessor (line 2558) | class SynthIDTextWatermarkLogitsProcessor(LogitsProcessor): method __init__ (line 2630) | def __init__( method _init_state (line 2663) | def _init_state(self, batch_size: int): method update_scores (line 2672) | def update_scores(self, scores: torch.FloatTensor, g_values: torch.Flo... method __call__ (line 2697) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... method accumulate_hash (line 2759) | def accumulate_hash( method compute_ngram_keys (line 2796) | def compute_ngram_keys(self, ngrams: torch.LongTensor) -> torch.LongTe... method _compute_keys (line 2829) | def _compute_keys( method sample_g_values (line 2869) | def sample_g_values(self, ngram_keys: torch.LongTensor) -> torch.LongT... method _check_input_ids_shape (line 2889) | def _check_input_ids_shape(self, input_ids: torch.LongTensor): method compute_g_values (line 2894) | def compute_g_values(self, input_ids: torch.LongTensor) -> torch.LongT... method compute_context_repetition_mask (line 2910) | def compute_context_repetition_mask(self, input_ids: torch.LongTensor)... method compute_eos_token_mask (line 2956) | def compute_eos_token_mask(self, input_ids: torch.LongTensor, eos_toke... method expected_mean_g_value (line 2982) | def expected_mean_g_value(self, vocab_size: int, coinflip_prob: float ... class DiaClassifierFreeGuidanceLogitsProcessor (line 3000) | class DiaClassifierFreeGuidanceLogitsProcessor(LogitsProcessor): method __init__ (line 3024) | def __init__(self, guidance_scale: float, guidance_top_k: int | None =... method __call__ (line 3040) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class DiaEOSChannelFilterLogitsProcessor (line 3066) | class DiaEOSChannelFilterLogitsProcessor(LogitsProcessor): method __init__ (line 3089) | def __init__(self, num_channels: int, eos_token_id: int): method __call__ (line 3099) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class DiaEOSDelayPatternLogitsProcessor (line 3138) | class DiaEOSDelayPatternLogitsProcessor(LogitsProcessor): method __init__ (line 3175) | def __init__(self, delay_pattern: list[int], eos_token_id: int, max_ge... method __call__ (line 3185) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... FILE: src/transformers/generation/stopping_criteria.py class StoppingCriteria (line 45) | class StoppingCriteria(ABC): method __call__ (line 53) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class MaxLengthCriteria (line 57) | class MaxLengthCriteria(StoppingCriteria): method __init__ (line 69) | def __init__(self, max_length: int, max_position_embeddings: int | Non... method __call__ (line 74) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class MaxTimeCriteria (line 86) | class MaxTimeCriteria(StoppingCriteria): method __init__ (line 99) | def __init__(self, max_time: float, initial_timestamp: float | None = ... method __call__ (line 104) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class StopStringCriteria (line 109) | class StopStringCriteria(StoppingCriteria): method __init__ (line 240) | def __init__(self, tokenizer: PreTrainedTokenizerBase, stop_strings: s... method clean_and_embed_tokens_with_cache (line 254) | def clean_and_embed_tokens_with_cache(self, token_list, token_indices,... method clean_tokenizer_vocab (line 276) | def clean_tokenizer_vocab(tokenizer, static_prefix="abcdef"): method _stop_string_get_matching_positions (line 297) | def _stop_string_get_matching_positions( method _stop_string_create_embedding_vec (line 338) | def _stop_string_create_embedding_vec(token_list, token_indices, stop_... method __call__ (line 389) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class EosTokenCriteria (line 450) | class EosTokenCriteria(StoppingCriteria): method __init__ (line 460) | def __init__(self, eos_token_id: int | list[int] | torch.Tensor): method __call__ (line 468) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class ConfidenceCriteria (line 474) | class ConfidenceCriteria(StoppingCriteria): method __init__ (line 484) | def __init__(self, assistant_confidence_threshold): method __call__ (line 487) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class StoppingCriteriaList (line 495) | class StoppingCriteriaList(list): method __call__ (line 497) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... method max_length (line 504) | def max_length(self) -> int | None: function validate_stopping_criteria (line 511) | def validate_stopping_criteria(stopping_criteria: StoppingCriteriaList, ... FILE: src/transformers/generation/streamers.py class BaseStreamer (line 27) | class BaseStreamer: method put (line 32) | def put(self, value): method end (line 36) | def end(self): class TextStreamer (line 41) | class TextStreamer(BaseStreamer): method __init__ (line 75) | def __init__(self, tokenizer: PreTrainedTokenizerBase, skip_prompt: bo... method put (line 85) | def put(self, value): method end (line 119) | def end(self): method on_finalized_text (line 133) | def on_finalized_text(self, text: str, stream_end: bool = False): method _is_chinese_char (line 137) | def _is_chinese_char(self, cp): class TextIteratorStreamer (line 162) | class TextIteratorStreamer(TextStreamer): method __init__ (line 208) | def __init__( method on_finalized_text (line 220) | def on_finalized_text(self, text: str, stream_end: bool = False): method __iter__ (line 226) | def __iter__(self): method __next__ (line 229) | def __next__(self): class AsyncTextIteratorStreamer (line 237) | class AsyncTextIteratorStreamer(TextStreamer): method __init__ (line 290) | def __init__( method on_finalized_text (line 306) | def on_finalized_text(self, text: str, stream_end: bool = False): method __aiter__ (line 312) | def __aiter__(self): method __anext__ (line 315) | async def __anext__(self): FILE: src/transformers/generation/utils.py class GenerateDecoderOnlyOutput (line 148) | class GenerateDecoderOnlyOutput(ModelOutput): class GenerateEncoderDecoderOutput (line 184) | class GenerateEncoderDecoderOutput(ModelOutput): class GenerateBeamDecoderOnlyOutput (line 232) | class GenerateBeamDecoderOnlyOutput(ModelOutput): class GenerateBeamEncoderDecoderOutput (line 276) | class GenerateBeamEncoderDecoderOutput(ModelOutput): class GenerationMixin (line 338) | class GenerationMixin(ContinuousMixin): method adjust_generation_fn (line 370) | def adjust_generation_fn( method load_custom_generate (line 433) | def load_custom_generate( method prepare_inputs_for_generation (line 494) | def prepare_inputs_for_generation( method _prepare_model_inputs (line 600) | def _prepare_model_inputs( method _maybe_initialize_input_ids_for_generation (line 665) | def _maybe_initialize_input_ids_for_generation( method _prepare_position_ids_for_generation (line 705) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _prepare_attention_mask_for_generation (line 729) | def _prepare_attention_mask_for_generation( method _prepare_encoder_decoder_kwargs_for_generation (line 763) | def _prepare_encoder_decoder_kwargs_for_generation( method _prepare_decoder_input_ids_for_generation (line 804) | def _prepare_decoder_input_ids_for_generation( method _expand_inputs_for_generation (line 864) | def _expand_inputs_for_generation( method _update_model_kwargs_for_generation (line 894) | def _update_model_kwargs_for_generation( method _get_candidate_generator (line 944) | def _get_candidate_generator( method _get_logits_processor (line 1029) | def _get_logits_processor( method _get_stopping_criteria (line 1252) | def _get_stopping_criteria( method _merge_criteria_processor_list (line 1290) | def _merge_criteria_processor_list( method compute_transition_scores (line 1327) | def compute_transition_scores( method _validate_generation_mode (line 1451) | def _validate_generation_mode( method _validate_model_kwargs (line 1499) | def _validate_model_kwargs(self: "GenerativePreTrainedModel", model_kw... method _validate_generated_length (line 1554) | def _validate_generated_length( method _prepare_generated_length (line 1600) | def _prepare_generated_length( method _prepare_generation_config (line 1656) | def _prepare_generation_config( method _prepare_static_cache (line 1723) | def _prepare_static_cache( method _supports_default_dynamic_cache (line 1775) | def _supports_default_dynamic_cache(cls: type["GenerativePreTrainedMod... method _prepare_cache_for_generation (line 1793) | def _prepare_cache_for_generation( method _supports_logits_to_keep (line 1902) | def _supports_logits_to_keep(self: "GenerativePreTrainedModel") -> bool: method _prepare_special_tokens (line 1909) | def _prepare_special_tokens( method _valid_auto_compile_criteria (line 1988) | def _valid_auto_compile_criteria( method _optimize_model_for_decode (line 2048) | def _optimize_model_for_decode(self: "GenerativePreTrainedModel"): method _get_deprecated_gen_repo (line 2065) | def _get_deprecated_gen_repo( method _extract_generation_mode_kwargs (line 2089) | def _extract_generation_mode_kwargs( method generate (line 2123) | def generate( method _has_unfinished_sequences (line 2547) | def _has_unfinished_sequences(self, this_peer_finished: bool, synced_g... method heal_tokens (line 2565) | def heal_tokens( method _sample (line 2650) | def _sample( method _flatten_beam_dim (line 2836) | def _flatten_beam_dim(tensor: torch.Tensor) -> torch.Tensor: method _unflatten_beam_dim (line 2842) | def _unflatten_beam_dim(tensor: torch.Tensor, batch_size: int, num_bea... method _gather_beams (line 2848) | def _gather_beams(tensor: torch.Tensor, beam_indices: torch.Tensor) ->... method _check_early_stop_heuristic (line 2868) | def _check_early_stop_heuristic( method _beam_search_has_unfinished_sequences (line 2915) | def _beam_search_has_unfinished_sequences( method _get_top_k_continuations (line 2937) | def _get_top_k_continuations( method _get_running_beams_for_next_iteration (line 2991) | def _get_running_beams_for_next_iteration( method _update_finished_beams (line 3013) | def _update_finished_beams( method _beam_search (line 3068) | def _beam_search( method _assisted_decoding (line 3417) | def _assisted_decoding( method _prefill (line 3716) | def _prefill( function _speculative_sampling (line 3804) | def _speculative_sampling( function _split_model_outputs (line 3860) | def _split_model_outputs(outputs, new_outputs, cur_len, added_len, is_de... FILE: src/transformers/generation/watermarking.py class WatermarkDetectorOutput (line 39) | class WatermarkDetectorOutput: class WatermarkDetector (line 71) | class WatermarkDetector: method __init__ (line 123) | def __init__( method _get_ngram_score (line 146) | def _get_ngram_score(self, prefix: torch.LongTensor, target: int): method _score_ngrams_in_passage (line 150) | def _score_ngrams_in_passage(self, input_ids: torch.LongTensor): method _compute_z_score (line 180) | def _compute_z_score(self, green_token_count: np.ndarray, total_num_to... method _compute_pval (line 187) | def _compute_pval(self, x, loc=0, scale=1): method __call__ (line 191) | def __call__( class BayesianDetectorConfig (line 243) | class BayesianDetectorConfig(PreTrainedConfig): method __init__ (line 258) | def __init__(self, watermarking_depth: int | None = None, base_rate: f... method set_detector_information (line 267) | def set_detector_information(self, model_name, watermarking_config): class BayesianWatermarkDetectorModelOutput (line 273) | class BayesianWatermarkDetectorModelOutput(ModelOutput): class BayesianDetectorWatermarkedLikelihood (line 288) | class BayesianDetectorWatermarkedLikelihood(nn.Module): method __init__ (line 294) | def __init__(self, watermarking_depth: int): method _compute_latents (line 301) | def _compute_latents(self, g_values: torch.Tensor) -> tuple[torch.Tens... method forward (line 333) | def forward(self, g_values: torch.Tensor) -> torch.Tensor: class BayesianDetectorModel (line 350) | class BayesianDetectorModel(PreTrainedModel): method __init__ (line 379) | def __init__(self, config): method _init_weights (line 390) | def _init_weights(self, module): method _compute_posterior (line 395) | def _compute_posterior( method forward (line 437) | def forward( class SynthIDTextWatermarkDetector (line 481) | class SynthIDTextWatermarkDetector: method __init__ (line 518) | def __init__( method __call__ (line 528) | def __call__(self, tokenized_outputs: torch.Tensor): FILE: src/transformers/hf_argparser.py function string_to_bool (line 36) | def string_to_bool(v): function make_choice_type_function (line 49) | def make_choice_type_function(choices: list) -> Callable[[str], Any]: function HfArg (line 64) | def HfArg( class HfArgumentParser (line 111) | class HfArgumentParser(ArgumentParser): method __init__ (line 128) | def __init__(self, dataclass_types: DataClassType | Iterable[DataClass... method _parse_dataclass_field (line 146) | def _parse_dataclass_field(parser: ArgumentParser, field: dataclasses.... method _add_dataclass_arguments (line 251) | def _add_dataclass_arguments(self, dtype: DataClassType): method parse_args_into_dataclasses (line 272) | def parse_args_into_dataclasses( method parse_dict (line 358) | def parse_dict(self, args: dict[str, Any], allow_extra_keys: bool = Fa... method parse_json_file (line 386) | def parse_json_file(self, json_file: str | os.PathLike, allow_extra_ke... method parse_yaml_file (line 408) | def parse_yaml_file(self, yaml_file: str | os.PathLike, allow_extra_ke... FILE: src/transformers/hyperparameter_search.py class HyperParamSearchBackendBase (line 35) | class HyperParamSearchBackendBase: method is_available (line 40) | def is_available(): method run (line 43) | def run(self, trainer, n_trials: int, direction: str, **kwargs): method default_hp_space (line 46) | def default_hp_space(self, trial): method ensure_available (line 49) | def ensure_available(self): method pip_install (line 56) | def pip_install(cls): class OptunaBackend (line 60) | class OptunaBackend(HyperParamSearchBackendBase): method is_available (line 64) | def is_available(): method run (line 67) | def run(self, trainer, n_trials: int, direction: str, **kwargs): method default_hp_space (line 70) | def default_hp_space(self, trial): class RayTuneBackend (line 74) | class RayTuneBackend(HyperParamSearchBackendBase): method is_available (line 79) | def is_available(): method run (line 82) | def run(self, trainer, n_trials: int, direction: str, **kwargs): method default_hp_space (line 85) | def default_hp_space(self, trial): class WandbBackend (line 89) | class WandbBackend(HyperParamSearchBackendBase): method is_available (line 93) | def is_available(): method run (line 96) | def run(self, trainer, n_trials: int, direction: str, **kwargs): method default_hp_space (line 99) | def default_hp_space(self, trial): function default_hp_search_backend (line 108) | def default_hp_search_backend() -> str: FILE: src/transformers/image_processing_backends.py class TorchvisionBackend (line 84) | class TorchvisionBackend(BaseImageProcessor): method __init__ (line 87) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method is_fast (line 92) | def is_fast(self) -> bool: method backend (line 105) | def backend(self) -> str: method process_image (line 111) | def process_image( method convert_to_rgb (line 146) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: method pad (line 150) | def pad( method resize (line 200) | def resize( method _compile_friendly_resize (line 254) | def _compile_friendly_resize( method rescale (line 272) | def rescale( method normalize (line 281) | def normalize( method _fuse_mean_std_and_rescale_factor (line 292) | def _fuse_mean_std_and_rescale_factor( method rescale_and_normalize (line 308) | def rescale_and_normalize( method center_crop (line 333) | def center_crop( method _preprocess (line 361) | def _preprocess( class PilBackend (line 410) | class PilBackend(BaseImageProcessor): method __init__ (line 413) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method is_fast (line 418) | def is_fast(self) -> bool: method backend (line 431) | def backend(self) -> str: method process_image (line 437) | def process_image( method convert_to_rgb (line 473) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: method pad (line 477) | def pad( method resize (line 528) | def resize( method rescale (line 579) | def rescale( method normalize (line 593) | def normalize( method center_crop (line 609) | def center_crop( method _preprocess (line 626) | def _preprocess( method to_dict (line 662) | def to_dict(self) -> dict[str, Any]: FILE: src/transformers/image_processing_base.py class BatchFeature (line 45) | class BatchFeature(BaseBatchFeature): class ImageProcessingMixin (line 61) | class ImageProcessingMixin(PushToHubMixin): method __init__ (line 69) | def __init__(self, **kwargs): method from_pretrained (line 85) | def from_pretrained( method save_pretrained (line 183) | def save_pretrained(self, save_directory: str | os.PathLike, push_to_h... method get_image_processor_dict (line 232) | def get_image_processor_dict( method from_dict (line 351) | def from_dict(cls, image_processor_dict: dict[str, Any], **kwargs): method to_dict (line 391) | def to_dict(self) -> dict[str, Any]: method from_json_file (line 404) | def from_json_file(cls, json_file: str | os.PathLike): method to_json_string (line 422) | def to_json_string(self) -> str: method to_json_file (line 437) | def to_json_file(self, json_file_path: str | os.PathLike): method __repr__ (line 448) | def __repr__(self): method register_for_auto_class (line 452) | def register_for_auto_class(cls, auto_class="AutoImageProcessor"): method fetch_images (line 473) | def fetch_images(self, image_url_or_urls: str | list[str] | list[list[... FILE: src/transformers/image_processing_utils.py class BaseImageProcessor (line 60) | class BaseImageProcessor(ImageProcessingMixin): method __init__ (line 195) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method _set_attributes (line 200) | def _set_attributes(self, **kwargs): method __call__ (line 215) | def __call__(self, images: ImageInput, *args, **kwargs: Unpack[ImagesK... method process_image (line 219) | def process_image(self, *args, **kwargs): method _preprocess (line 229) | def _preprocess(self, *args, **kwargs): method _prepare_images_structure (line 242) | def _prepare_images_structure( method _prepare_image_like_inputs (line 260) | def _prepare_image_like_inputs( method _preprocess_image_like_inputs (line 297) | def _preprocess_image_like_inputs( method _standardize_kwargs (line 314) | def _standardize_kwargs( method _validate_preprocess_kwargs (line 352) | def _validate_preprocess_kwargs( method preprocess (line 383) | def preprocess(self, images: ImageInput, *args, **kwargs: Unpack[Image... method to_dict (line 402) | def to_dict(self) -> dict[str, Any]: method rescale (line 422) | def rescale( method normalize (line 455) | def normalize( method center_crop (line 492) | def center_crop( function is_valid_size_dict (line 541) | def is_valid_size_dict(size_dict): function convert_to_size_dict (line 552) | def convert_to_size_dict( function get_size_dict (line 583) | def get_size_dict( function select_best_resolution (line 633) | def select_best_resolution(original_size: tuple, possible_resolutions: l... function get_patch_output_size (line 671) | def get_patch_output_size(image, target_resolution, input_data_format): FILE: src/transformers/image_transforms.py function to_channel_dimension_format (line 46) | def to_channel_dimension_format( function rescale (line 89) | def rescale( function _rescale_for_pil_conversion (line 127) | def _rescale_for_pil_conversion(image): function to_pil_image (line 154) | def to_pil_image( function get_size_with_aspect_ratio (line 206) | def get_size_with_aspect_ratio(image_size, size, max_size=None) -> tuple... function get_resize_output_image_size (line 246) | def get_resize_output_image_size( function resize (line 313) | def resize( function normalize (line 384) | def normalize( function center_crop (line 445) | def center_crop( function _center_to_corners_format_torch (line 529) | def _center_to_corners_format_torch(bboxes_center: "torch.Tensor") -> "t... function _center_to_corners_format_numpy (line 539) | def _center_to_corners_format_numpy(bboxes_center: np.ndarray) -> np.nda... function center_to_corners_format (line 550) | def center_to_corners_format(bboxes_center: TensorType) -> TensorType: function _corners_to_center_format_torch (line 568) | def _corners_to_center_format_torch(bboxes_corners: "torch.Tensor") -> "... function _corners_to_center_format_numpy (line 579) | def _corners_to_center_format_numpy(bboxes_corners: np.ndarray) -> np.nd... function corners_to_center_format (line 593) | def corners_to_center_format(bboxes_corners: TensorType) -> TensorType: function safe_squeeze (line 611) | def safe_squeeze( function rgb_to_id (line 629) | def rgb_to_id(color): function id_to_rgb (line 640) | def id_to_rgb(id_map): class PaddingMode (line 659) | class PaddingMode(ExplicitEnum): function pad (line 670) | def pad( function convert_to_rgb (line 757) | def convert_to_rgb(image: ImageInput) -> ImageInput: function flip_channel_order (line 777) | def flip_channel_order( function split_to_tiles (line 815) | def split_to_tiles(images: "torch.Tensor", num_tiles_height: int, num_ti... function divide_to_patches (line 839) | def divide_to_patches( function _group_images_by_shape (line 863) | def _group_images_by_shape(nested_images, *paired_inputs, is_nested: boo... function _reconstruct_nested_structure (line 912) | def _reconstruct_nested_structure(indices, processed_images): function _iterate_items (line 946) | def _iterate_items(items, is_nested: bool): function _get_device_from_images (line 962) | def _get_device_from_images(images, is_nested: bool) -> "torch.device": function group_images_by_shape (line 977) | def group_images_by_shape( function reorder_images (line 1042) | def reorder_images( FILE: src/transformers/image_utils.py class ChannelDimension (line 82) | class ChannelDimension(ExplicitEnum): class AnnotationFormat (line 87) | class AnnotationFormat(ExplicitEnum): function is_pil_image (line 95) | def is_pil_image(img): class ImageType (line 99) | class ImageType(ExplicitEnum): function get_image_type (line 105) | def get_image_type(image): function is_valid_image (line 115) | def is_valid_image(img): function is_valid_list_of_images (line 119) | def is_valid_list_of_images(images: list): function concatenate_list (line 123) | def concatenate_list(input_list): function valid_images (line 132) | def valid_images(imgs): function is_batched (line 144) | def is_batched(img): function is_scaled_image (line 150) | def is_scaled_image(image: np.ndarray) -> bool: function make_list_of_images (line 161) | def make_list_of_images(images, expected_ndims: int = 3) -> list[ImageIn... function make_flat_list_of_images (line 199) | def make_flat_list_of_images( function make_nested_list_of_images (line 237) | def make_nested_list_of_images( function to_numpy_array (line 276) | def to_numpy_array(img) -> np.ndarray: function infer_channel_dimension_format (line 285) | def infer_channel_dimension_format( function get_channel_dimension_axis (line 324) | def get_channel_dimension_axis(image: np.ndarray, input_data_format: Cha... function get_image_size (line 346) | def get_image_size(image: np.ndarray, channel_dim: ChannelDimension | No... function get_image_size_for_max_height_width (line 370) | def get_image_size_for_max_height_width( function max_across_indices (line 401) | def max_across_indices(values: Iterable[Any]) -> list[Any]: function get_max_height_width (line 408) | def get_max_height_width( function is_valid_annotation_coco_detection (line 423) | def is_valid_annotation_coco_detection(annotation: dict[str, list | tupl... function is_valid_annotation_coco_panoptic (line 438) | def is_valid_annotation_coco_panoptic(annotation: dict[str, list | tuple... function valid_coco_detection_annotations (line 454) | def valid_coco_detection_annotations(annotations: Iterable[dict[str, lis... function valid_coco_panoptic_annotations (line 458) | def valid_coco_panoptic_annotations(annotations: Iterable[dict[str, list... function load_image (line 462) | def load_image(image: Union[str, "PIL.Image.Image"], timeout: float | No... function load_images (line 504) | def load_images( function validate_preprocess_arguments (line 525) | def validate_preprocess_arguments( class ImageFeatureExtractionMixin (line 571) | class ImageFeatureExtractionMixin: method _ensure_format_supported (line 576) | def _ensure_format_supported(self, image): method to_pil_image (line 583) | def to_pil_image(self, image, rescale=None): method convert_rgb (line 613) | def convert_rgb(self, image): method rescale (line 627) | def rescale(self, image: np.ndarray, scale: float | int) -> np.ndarray: method to_numpy_array (line 634) | def to_numpy_array(self, image, rescale=None, channel_first=True): method expand_dims (line 666) | def expand_dims(self, image): method normalize (line 686) | def normalize(self, image, mean, std, rescale=False): method resize (line 738) | def resize(self, image, size, resample=None, default_to_square=True, m... method center_crop (line 805) | def center_crop(self, image, size): method flip_channel_order (line 880) | def flip_channel_order(self, image): method rotate (line 897) | def rotate(self, image, angle, resample=None, expand=0, center=None, t... function validate_annotations (line 922) | def validate_annotations( function validate_kwargs (line 947) | def validate_kwargs(valid_processor_keys: list[str], captured_kwargs: li... class SizeDict (line 956) | class SizeDict: method __getitem__ (line 968) | def __getitem__(self, key): method get (line 973) | def get(self, key, default=None): method __iter__ (line 978) | def __iter__(self): method __hash__ (line 985) | def __hash__(self): method __contains__ (line 988) | def __contains__(self, key): method __setitem__ (line 991) | def __setitem__(self, key, value): method __eq__ (line 996) | def __eq__(self, other): method __or__ (line 1005) | def __or__(self, other) -> "SizeDict": method __ror__ (line 1012) | def __ror__(self, other) -> dict: FILE: src/transformers/initialization.py function uniform_ (line 42) | def uniform_( function normal_ (line 50) | def normal_( function constant_ (line 58) | def constant_(tensor: torch.Tensor, val: float) -> torch.Tensor: function ones_ (line 64) | def ones_(tensor: torch.Tensor) -> torch.Tensor: function zeros_ (line 70) | def zeros_(tensor: torch.Tensor) -> torch.Tensor: function eye_ (line 76) | def eye_(tensor: torch.Tensor) -> torch.Tensor: function dirac_ (line 82) | def dirac_(tensor: torch.Tensor, groups: int = 1) -> torch.Tensor: function xavier_uniform_ (line 88) | def xavier_uniform_(tensor: torch.Tensor, gain: float = 1.0, generator: ... function xavier_normal_ (line 94) | def xavier_normal_(tensor: torch.Tensor, gain: float = 1.0, generator: t... function kaiming_uniform_ (line 100) | def kaiming_uniform_( function kaiming_normal_ (line 114) | def kaiming_normal_( function trunc_normal_ (line 128) | def trunc_normal_( function orthogonal_ (line 141) | def orthogonal_( function sparse_ (line 151) | def sparse_( function copy_ (line 159) | def copy_(tensor: torch.Tensor, other: torch.Tensor) -> torch.Tensor: function _variance_scaling (line 166) | def _variance_scaling(tensor, mode="fan_in", distribution="normal"): function lecun_normal_ (line 188) | def lecun_normal_(tensor): function default_flax_embed_init_ (line 194) | def default_flax_embed_init_(tensor): function guard_torch_init_functions (line 220) | def guard_torch_init_functions(): function no_init_weights (line 247) | def no_init_weights(): function no_tie_weights (line 284) | def no_tie_weights(): FILE: src/transformers/integrations/accelerate.py function get_module_size_with_ties (line 57) | def get_module_size_with_ties( function check_and_set_device_map (line 93) | def check_and_set_device_map(device_map: "torch.device | int | str | dic... function compute_module_sizes (line 141) | def compute_module_sizes( function compute_module_total_buffer_size (line 191) | def compute_module_total_buffer_size(model: nn.Module, hf_quantizer: "Hf... function get_max_memory (line 199) | def get_max_memory(max_memory: dict[int | str, int | str] | None = None): function get_balanced_memory (line 234) | def get_balanced_memory( function _get_device_map (line 339) | def _get_device_map( function accelerate_dispatch (line 378) | def accelerate_dispatch(model, hf_quantizer, device_map, offload_folder,... function expand_device_map (line 406) | def expand_device_map(device_map: dict | None, param_names: list[str]): function get_device (line 425) | def get_device(device_map: dict | None, param_name: str, valid_torch_dev... function accelerate_disk_offload (line 434) | def accelerate_disk_offload( function offload_weight (line 494) | def offload_weight(weight: torch.Tensor, weight_name: str, offload_folde... function load_offloaded_parameter (line 514) | def load_offloaded_parameter(model: "PreTrainedModel", param_name: str) ... function _init_infer_auto_device_map (line 540) | def _init_infer_auto_device_map( function infer_auto_device_map (line 610) | def infer_auto_device_map( function _get_param_device (line 891) | def _get_param_device(param, device_map): function check_tied_parameters_on_same_device (line 901) | def check_tied_parameters_on_same_device(tied_params, device_map): FILE: src/transformers/integrations/aqlm.py function replace_with_aqlm_linear (line 27) | def replace_with_aqlm_linear(model, modules_to_not_convert: list[str] | ... FILE: src/transformers/integrations/awq.py function replace_quantization_scales (line 39) | def replace_quantization_scales(model, model_type): function replace_with_awq_linear (line 56) | def replace_with_awq_linear( FILE: src/transformers/integrations/bitnet.py function pack_weights (line 17) | def pack_weights(quantized_weights: torch.Tensor) -> torch.Tensor: function unpack_weights (line 56) | def unpack_weights(packed: torch.Tensor, dtype: torch.dtype) -> torch.Te... class BitLinear (line 124) | class BitLinear(nn.Module): method __init__ (line 125) | def __init__( method activation_quant (line 168) | def activation_quant(self, input, num_bits=8): method post_quant_process (line 192) | def post_quant_process(self, input, input_scale, weight_scale): method forward (line 196) | def forward(self, input): class WeightQuant (line 211) | class WeightQuant(torch.autograd.Function): method forward (line 221) | def forward(ctx, weight): method backward (line 229) | def backward(ctx, grad_output): class ActQuant (line 234) | class ActQuant(torch.autograd.Function): method forward (line 244) | def forward(ctx, activation): method backward (line 252) | def backward(ctx, grad_output): class AutoBitLinear (line 257) | class AutoBitLinear(nn.Linear): method __init__ (line 258) | def __init__( method load_hook (line 288) | def load_hook( method forward (line 299) | def forward(self, input): function replace_with_bitnet_linear (line 315) | def replace_with_bitnet_linear(model, modules_to_not_convert: list[str] ... class BitNetDeserialize (line 373) | class BitNetDeserialize: method __init__ (line 374) | def __init__(self, hf_quantizer): method convert (line 377) | def convert( FILE: src/transformers/integrations/bitsandbytes.py class Bnb4bitQuantize (line 30) | class Bnb4bitQuantize(ConversionOps): method __init__ (line 31) | def __init__(self, hf_quantizer): method convert (line 34) | def convert( class Bnb4bitDeserialize (line 61) | class Bnb4bitDeserialize(ConversionOps): method __init__ (line 62) | def __init__(self, hf_quantizer): method convert (line 65) | def convert( class Bnb8bitQuantize (line 96) | class Bnb8bitQuantize(ConversionOps): method __init__ (line 97) | def __init__(self, hf_quantizer): method convert (line 100) | def convert( class Bnb8bitDeserialize (line 123) | class Bnb8bitDeserialize(ConversionOps): method __init__ (line 124) | def __init__(self, hf_quantizer): method convert (line 127) | def convert( function replace_with_bnb_linear (line 157) | def replace_with_bnb_linear( function dequantize_bnb_weight (line 235) | def dequantize_bnb_weight(weight: "torch.nn.Parameter", state=None): function _create_accelerate_new_hook (line 265) | def _create_accelerate_new_hook(old_hook): function dequantize_and_replace (line 282) | def dequantize_and_replace(model, quantization_config=None, dtype=None): function validate_bnb_backend_availability (line 327) | def validate_bnb_backend_availability(raise_exception=False): FILE: src/transformers/integrations/deepspeed.py function is_deepspeed_available (line 36) | def is_deepspeed_available(): class HfDeepSpeedConfig (line 57) | class HfDeepSpeedConfig(DeepSpeedConfig): # noqa UP004 method __init__ (line 74) | def __init__(self, config_file_or_dict): class HfTrainerDeepSpeedConfig (line 82) | class HfTrainerDeepSpeedConfig(HfDeepSpeedConfig): method __init__ (line 88) | def __init__(self, config_file_or_dict): method dtype (line 93) | def dtype(self): method is_auto (line 98) | def is_auto(self, ds_key_long): method fill_match (line 105) | def fill_match(self, ds_key_long, hf_val, hf_key=None, must_match=True): method trainer_config_process (line 133) | def trainer_config_process(self, args, auto_find_batch_size=False): method trainer_config_finalize (line 191) | def trainer_config_finalize(self, args, model, num_training_steps): function set_hf_deepspeed_config (line 265) | def set_hf_deepspeed_config(hf_deepspeed_config_obj): function unset_hf_deepspeed_config (line 273) | def unset_hf_deepspeed_config(): function is_deepspeed_zero3_enabled (line 279) | def is_deepspeed_zero3_enabled(): function deepspeed_config (line 286) | def deepspeed_config(): function initialize_weights_zero3 (line 293) | def initialize_weights_zero3(model): function _apply_weight_conversions_to_state_dict (line 328) | def _apply_weight_conversions_to_state_dict(model, state_dict, weight_ma... function _load_state_dict_into_zero3_model (line 435) | def _load_state_dict_into_zero3_model(model_to_load, state_dict, load_co... function deepspeed_optim_sched (line 516) | def deepspeed_optim_sched(trainer, hf_deepspeed_config, args, num_traini... function deepspeed_init (line 570) | def deepspeed_init(trainer, num_training_steps, inference=False): function deepspeed_load_checkpoint (line 637) | def deepspeed_load_checkpoint(deepspeed_engine, checkpoint_path, load_mo... function propagate_args_to_deepspeed (line 661) | def propagate_args_to_deepspeed(accelerator, args, auto_find_batch_size=... function deepspeed_sp_compute_loss (line 678) | def deepspeed_sp_compute_loss(accelerator, model, inputs, return_outputs... FILE: src/transformers/integrations/eager_paged.py function repeat_kv (line 7) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_paged_attention_forward (line 19) | def eager_paged_attention_forward( FILE: src/transformers/integrations/eetq.py class EetqQuantize (line 27) | class EetqQuantize(ConversionOps): method __init__ (line 28) | def __init__(self, hf_quantizer): method convert (line 31) | def convert( class EetqLinearMMFunction (line 47) | class EetqLinearMMFunction(torch.autograd.Function): method forward (line 49) | def forward(ctx, x, weight, scales, bias=None): method backward (line 57) | def backward(ctx, grad_output): class EetqLinear (line 71) | class EetqLinear(nn.Module): method __init__ (line 72) | def __init__(self, in_features, out_features, dtype=torch.int8, bias=F... method forward (line 81) | def forward(self, input): function replace_with_eetq_linear (line 86) | def replace_with_eetq_linear(model, modules_to_not_convert: list[str] | ... FILE: src/transformers/integrations/executorch.py class TorchExportableModuleForVLM (line 34) | class TorchExportableModuleForVLM: method __init__ (line 44) | def __init__(self, model, max_batch_size: int = 1, max_cache_len: int ... method export_vision_encoder (line 68) | def export_vision_encoder(self): method export_connector (line 92) | def export_connector(self): method export_text_decoder (line 117) | def export_text_decoder(self): method export (line 144) | def export(self, **kwargs): method forward (line 155) | def forward(self, pixel_values, input_ids, cache_position): method generate (line 168) | def generate( class TorchExportableModuleForDecoderOnlyLM (line 186) | class TorchExportableModuleForDecoderOnlyLM(torch.nn.Module): method __init__ (line 193) | def __init__( method forward (line 226) | def forward( method export (line 245) | def export( method generate (line 338) | def generate( class TorchExportableModuleWithStaticCache (line 446) | class TorchExportableModuleWithStaticCache(torch.nn.Module): method __init__ (line 457) | def __init__( method forward (line 539) | def forward( method generate (line 589) | def generate( class TorchExportableModuleWithHybridCache (line 642) | class TorchExportableModuleWithHybridCache(torch.nn.Module): method __init__ (line 649) | def __init__( method forward (line 718) | def forward( function convert_and_export_with_cache (line 754) | def convert_and_export_with_cache( class Seq2SeqLMEncoderExportableModule (line 820) | class Seq2SeqLMEncoderExportableModule(torch.nn.Module): method __init__ (line 826) | def __init__(self, encoder_model): method forward (line 830) | def forward(self, input_ids): class Seq2SeqLMDecoderExportableModuleWithStaticCache (line 834) | class Seq2SeqLMDecoderExportableModuleWithStaticCache(torch.nn.Module): method __init__ (line 841) | def __init__(self, model, max_static_cache_length, batch_size): method forward (line 873) | def forward(self, decoder_input_ids, encoder_hidden_states, cache_posi... class Seq2SeqLMExportableModule (line 894) | class Seq2SeqLMExportableModule(torch.nn.Module): method __init__ (line 895) | def __init__( method _export_encoder (line 917) | def _export_encoder(self, encoder_input_ids): method _export_decoder (line 931) | def _export_decoder(self, decoder_input_ids, encoder_hidden_states, ca... method export (line 966) | def export(self, encoder_input_ids=None, decoder_input_ids=None, encod... method generate (line 998) | def generate(self, prompt_token_ids, max_new_tokens): function export_with_dynamic_cache (line 1034) | def export_with_dynamic_cache( function register_dynamic_cache_export_support (line 1068) | def register_dynamic_cache_export_support(): function _get_cache_dict (line 1094) | def _get_cache_dict(cache: DynamicCache): function _unflatten_dynamic_cache (line 1108) | def _unflatten_dynamic_cache(values, context: torch.utils._pytree.Context): FILE: src/transformers/integrations/fbgemm_fp8.py class FbgemmFp8Quantize (line 44) | class FbgemmFp8Quantize(ConversionOps): method __init__ (line 45) | def __init__(self, hf_quantizer): method convert (line 48) | def convert( class FbgemmFp8Linear (line 101) | class FbgemmFp8Linear(torch.nn.Linear): method __init__ (line 102) | def __init__(self, in_features, out_features, bias, dtype=torch.float8... method forward (line 116) | def forward(self, x): class FbgemmFp8Llama4TextExperts (line 148) | class FbgemmFp8Llama4TextExperts(nn.Module): method __init__ (line 149) | def __init__(self, config, dtype=torch.float32): method forward (line 173) | def forward(self, hidden_states): function get_quantize_fp8_per_row (line 257) | def get_quantize_fp8_per_row(): function replace_with_fbgemm_fp8_linear (line 265) | def replace_with_fbgemm_fp8_linear( FILE: src/transformers/integrations/finegrained_fp8.py function _load_triton_kernel (line 56) | def _load_triton_kernel(): function _load_deepgemm_kernel (line 101) | def _load_deepgemm_kernel(): function w8a8_fp8_matmul (line 162) | def w8a8_fp8_matmul( class FP8Linear (line 211) | class FP8Linear(nn.Linear): method __init__ (line 212) | def __init__( method forward (line 248) | def forward(self, input: torch.Tensor) -> torch.Tensor: function fp8_batched_mm_experts_forward (line 287) | def fp8_batched_mm_experts_forward( function fp8_grouped_mm_experts_forward (line 351) | def fp8_grouped_mm_experts_forward( function _build_deepgemm_contiguous_layout (line 433) | def _build_deepgemm_contiguous_layout(expert_ids_sorted: torch.Tensor, n... function _pad_to_deepgemm_contiguous_layout (line 466) | def _pad_to_deepgemm_contiguous_layout( function _unpad_from_deepgemm_contiguous_layout (line 482) | def _unpad_from_deepgemm_contiguous_layout( function fp8_deepgemm_experts_forward (line 489) | def fp8_deepgemm_experts_forward( class FP8Experts (line 577) | class FP8Experts(nn.Module): method __init__ (line 578) | def __init__( method _apply_gate (line 638) | def _apply_gate(self, gate_up: torch.Tensor) -> torch.Tensor: method forward (line 642) | def forward( method linear (line 684) | def linear( class FP8ExpertsInterface (line 715) | class FP8ExpertsInterface(ExpertsInterface): function replace_with_fp8_linear (line 728) | def replace_with_fp8_linear( class Fp8Quantize (line 796) | class Fp8Quantize(ConversionOps): method __init__ (line 801) | def __init__(self, hf_quantizer): method convert (line 804) | def convert(self, input_dict: torch.Tensor, **kwargs) -> dict[str, tor... class Fp8Dequantize (line 870) | class Fp8Dequantize(ConversionOps): method __init__ (line 873) | def __init__(self, hf_quantizer): method convert (line 876) | def convert( method reverse_op (line 911) | def reverse_op(self) -> "ConversionOps": FILE: src/transformers/integrations/flash_attention.py function get_target_dtype (line 12) | def get_target_dtype(query: torch.Tensor, module: torch.nn.Module) -> to... function flash_attention_forward (line 25) | def flash_attention_forward( FILE: src/transformers/integrations/flash_paged.py function paged_attention_forward (line 8) | def paged_attention_forward( FILE: src/transformers/integrations/flex_attention.py class WrappedFlexAttention (line 59) | class WrappedFlexAttention: method __new__ (line 68) | def __new__(cls, *args, **kwargs): method __init__ (line 75) | def __init__(self, training): method __call__ (line 96) | def __call__(self): function get_flex_attention_lse_kwargs (line 100) | def get_flex_attention_lse_kwargs(return_lse: bool) -> dict[str, bool | ... function compile_friendly_flex_attention (line 114) | def compile_friendly_flex_attention( function make_flex_block_causal_mask (line 136) | def make_flex_block_causal_mask( function repeat_kv (line 250) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function flex_attention_forward (line 262) | def flex_attention_forward( FILE: src/transformers/integrations/fouroversix.py class FourOverSixQuantize (line 15) | class FourOverSixQuantize(ConversionOps): method __init__ (line 16) | def __init__(self, hf_quantizer): method convert (line 19) | def convert( function adapt_fouroversix_config (line 60) | def adapt_fouroversix_config(config: FourOverSixConfig): FILE: src/transformers/integrations/fp_quant.py class FpQuantQuantize (line 33) | class FpQuantQuantize(ConversionOps): method __init__ (line 34) | def __init__(self, hf_quantizer): method convert (line 37) | def convert( class FpQuantDeserialize (line 71) | class FpQuantDeserialize(ConversionOps): method __init__ (line 72) | def __init__(self, hf_quantizer): method convert (line 75) | def convert( function adapt_fp_quant_config (line 119) | def adapt_fp_quant_config(config: FPQuantConfig): FILE: src/transformers/integrations/fsdp.py function is_fsdp_managed_module (line 28) | def is_fsdp_managed_module(module: nn.Module) -> bool: function is_fsdp_enabled (line 44) | def is_fsdp_enabled(): function get_fsdp_ckpt_kwargs (line 58) | def get_fsdp_ckpt_kwargs(): function update_fsdp_plugin_peft (line 73) | def update_fsdp_plugin_peft(model, accelerator): FILE: src/transformers/integrations/ggml.py function _gguf_parse_value (line 350) | def _gguf_parse_value(_value, data_type): class GGUFTokenizerSkeleton (line 374) | class GGUFTokenizerSkeleton: method __init__ (line 375) | def __init__(self, dict_): class GGUFLlamaConverter (line 417) | class GGUFLlamaConverter(LlamaConverter): method __init__ (line 418) | def __init__(self, tokenizer_dict): method vocab (line 424) | def vocab(self, proto): method merges (line 427) | def merges(self, proto): method tokenizer (line 430) | def tokenizer(self, proto): method decoder (line 488) | def decoder(self, replacement, add_prefix_space): method converted (line 502) | def converted(self): class GGUFQwen2Converter (line 538) | class GGUFQwen2Converter(Qwen2Converter): method __init__ (line 539) | def __init__(self, tokenizer_dict): method converted (line 543) | def converted(self) -> Tokenizer: class GGUFPhi3Converter (line 558) | class GGUFPhi3Converter(LlamaConverter): method __init__ (line 559) | def __init__(self, tokenizer_dict): method vocab (line 564) | def vocab(self, proto): method merges (line 567) | def merges(self, proto): method tokenizer (line 570) | def tokenizer(self, proto): method decoder (line 609) | def decoder(self, replacement, add_prefix_space): method converted (line 620) | def converted(self) -> Tokenizer: class GGUFGPTConverter (line 633) | class GGUFGPTConverter(GPT2Converter): method __init__ (line 634) | def __init__(self, tokenizer_dict): method converted (line 638) | def converted(self) -> Tokenizer: class GGUFT5Converter (line 645) | class GGUFT5Converter(T5Converter): method __init__ (line 646) | def __init__(self, tokenizer_dict): method vocab (line 655) | def vocab(self, proto): method normalizer (line 658) | def normalizer(self, proto): method post_processor (line 667) | def post_processor(self): method converted (line 676) | def converted(self) -> Tokenizer: class GGUFGemmaConverter (line 708) | class GGUFGemmaConverter(GemmaConverter): method __init__ (line 709) | def __init__(self, tokenizer_dict): method vocab (line 717) | def vocab(self, proto): method normalizer (line 732) | def normalizer(self, proto): method decoder (line 735) | def decoder(self, replacement, add_prefix_space): method converted (line 746) | def converted(self) -> Tokenizer: function convert_gguf_tokenizer (line 797) | def convert_gguf_tokenizer(architecture: str, tokenizer_dict) -> tuple[T... FILE: src/transformers/integrations/higgs.py function pad_to_block (line 36) | def pad_to_block(tensor, dims, had_block_size, value=0): function get_higgs_grid (line 47) | def get_higgs_grid(p: int, n: int) -> "torch.Tensor": function quantize_with_higgs (line 439) | def quantize_with_higgs(weight, bits: int = 4, p: int = 2, group_size: i... class HiggsLinear (line 490) | class HiggsLinear(torch.nn.Module): method __init__ (line 491) | def __init__( method forward (line 532) | def forward(self, x): function replace_with_higgs_linear (line 550) | def replace_with_higgs_linear(model, modules_to_not_convert: list[str] |... function dequantize_higgs (line 593) | def dequantize_higgs(model, current_key_name=None): FILE: src/transformers/integrations/hqq.py function autoname_modules (line 26) | def autoname_modules(model): function name_to_linear_tag (line 32) | def name_to_linear_tag(name): function get_linear_tags (line 37) | def get_linear_tags(model): function _prepare_for_hqq_linear (line 48) | def _prepare_for_hqq_linear(model, patch_params, has_been_replaced, curr... function prepare_for_hqq_linear (line 85) | def prepare_for_hqq_linear(model, quantization_config=None, modules_to_n... FILE: src/transformers/integrations/hub_kernels.py function use_kernel_forward_from_hub (line 63) | def use_kernel_forward_from_hub(layer_name: str): function use_kernel_func_from_hub (line 72) | def use_kernel_func_from_hub(func_name: str): function has_key (line 234) | def has_key(d, key): function register_kernel_mapping_transformers (line 237) | def register_kernel_mapping_transformers(mapping=None): function use_kernel_forward_from_hub (line 253) | def use_kernel_forward_from_hub(*args, **kwargs): function use_kernel_func_from_hub (line 259) | def use_kernel_func_from_hub(*args, **kwargs): class LayerRepository (line 265) | class LayerRepository: method __init__ (line 266) | def __init__(self, *args, **kwargs): function replace_kernel_forward_from_hub (line 269) | def replace_kernel_forward_from_hub(*args, **kwargs): function register_kernel_mapping (line 274) | def register_kernel_mapping(*args, **kwargs): function register_kernel_mapping_transformers (line 277) | def register_kernel_mapping_transformers(*args, **kwargs): function is_kernel (line 294) | def is_kernel(attn_implementation: str | None) -> bool: function load_and_register_attn_kernel (line 302) | def load_and_register_attn_kernel( function lazy_load_kernel (line 363) | def lazy_load_kernel(kernel_name: str, mapping: dict[str, ModuleType | N... function get_kernel (line 410) | def get_kernel( function use_kernelized_func (line 439) | def use_kernelized_func(module_names: list[Callable] | Callable): function allow_all_hub_kernels (line 470) | def allow_all_hub_kernels(): FILE: src/transformers/integrations/integration_utils.py function is_wandb_available (line 103) | def is_wandb_available(): function is_trackio_available (line 114) | def is_trackio_available(): function is_clearml_available (line 118) | def is_clearml_available(): function is_comet_available (line 122) | def is_comet_available(): function is_tensorboard_available (line 148) | def is_tensorboard_available(): function is_optuna_available (line 152) | def is_optuna_available(): function is_ray_available (line 156) | def is_ray_available(): function is_ray_tune_available (line 160) | def is_ray_tune_available(): function is_azureml_available (line 166) | def is_azureml_available(): function is_mlflow_available (line 174) | def is_mlflow_available(): function is_dagshub_available (line 180) | def is_dagshub_available(): function is_neptune_available (line 184) | def is_neptune_available(): function is_codecarbon_available (line 188) | def is_codecarbon_available(): function is_flytekit_available (line 192) | def is_flytekit_available(): function is_flyte_deck_standard_available (line 196) | def is_flyte_deck_standard_available(): function is_dvclive_available (line 202) | def is_dvclive_available(): function is_swanlab_available (line 206) | def is_swanlab_available(): function is_kubeflow_available (line 210) | def is_kubeflow_available(): function hp_params (line 216) | def hp_params(trial): function run_hp_search_optuna (line 234) | def run_hp_search_optuna(trainer, n_trials: int, direction: str, **kwarg... function run_hp_search_ray (line 299) | def run_hp_search_ray(trainer, n_trials: int, direction: str, **kwargs) ... function run_hp_search_wandb (line 443) | def run_hp_search_wandb(trainer, n_trials: int, direction: str, **kwargs... function get_available_reporting_integrations (line 518) | def get_available_reporting_integrations(): function rewrite_logs (line 549) | def rewrite_logs(d): function default_logdir (line 565) | def default_logdir() -> str: class TensorBoardCallback (line 576) | class TensorBoardCallback(TrainerCallback): method __init__ (line 588) | def __init__(self, tb_writer=None): method _init_summary_writer (line 605) | def _init_summary_writer(self, args): method on_train_begin (line 609) | def on_train_begin(self, args, state, control, **kwargs): method on_log (line 633) | def on_log(self, args, state, control, logs=None, **kwargs): method on_train_end (line 656) | def on_train_end(self, args, state, control, **kwargs): function save_model_architecture_to_file (line 662) | def save_model_architecture_to_file(model: Any, output_dir: str): class WandbLogModel (line 672) | class WandbLogModel(str, Enum): method is_enabled (line 680) | def is_enabled(self) -> bool: method _missing_ (line 685) | def _missing_(cls, value: Any) -> "WandbLogModel": class WandbCallback (line 694) | class WandbCallback(TrainerCallback): method __init__ (line 699) | def __init__(self): method setup (line 710) | def setup(self, args, state, model, **kwargs): method on_train_begin (line 825) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_train_end (line 836) | def on_train_end(self, args: TrainingArguments, state, control, model=... method on_log (line 880) | def on_log(self, args, state, control, model=None, logs=None, **kwargs): method on_save (line 901) | def on_save(self, args, state, control, **kwargs): method on_predict (line 924) | def on_predict(self, args, state, control, metrics, **kwargs): class TrackioCallback (line 934) | class TrackioCallback(TrainerCallback): method __init__ (line 948) | def __init__(self): method setup (line 958) | def setup(self, args, state, model, **kwargs): method on_train_begin (line 992) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_train_end (line 996) | def on_train_end(self, args: TrainingArguments, state, control, model=... method on_log (line 1000) | def on_log(self, args, state, control, model=None, logs=None, **kwargs): method on_save (line 1016) | def on_save(self, args, state, control, **kwargs): method on_predict (line 1019) | def on_predict(self, args, state, control, metrics, **kwargs): method on_push_begin (line 1028) | def on_push_begin(self, args, state, control, model, **kwargs): class CometCallback (line 1062) | class CometCallback(TrainerCallback): method __init__ (line 1067) | def __init__(self): method setup (line 1076) | def setup(self, args, state, model): method on_train_begin (line 1154) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_log (line 1158) | def on_log(self, args, state, control, model=None, logs=None, **kwargs): method on_train_end (line 1168) | def on_train_end(self, args, state, control, **kwargs): method on_predict (line 1182) | def on_predict(self, args, state, control, metrics, **kwargs): class AzureMLCallback (line 1192) | class AzureMLCallback(TrainerCallback): method __init__ (line 1197) | def __init__(self, azureml_run=None): method on_init_end (line 1202) | def on_init_end(self, args, state, control, **kwargs): method on_log (line 1208) | def on_log(self, args, state, control, logs=None, **kwargs): class MLflowCallback (line 1215) | class MLflowCallback(TrainerCallback): method __init__ (line 1221) | def __init__(self): method setup (line 1234) | def setup(self, args, state, model): method on_train_begin (line 1341) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_log (line 1345) | def on_log(self, args, state, control, logs, model=None, **kwargs): method on_train_end (line 1369) | def on_train_end(self, args, state, control, **kwargs): method on_save (line 1374) | def on_save(self, args, state, control, **kwargs): method __del__ (line 1385) | def __del__(self): class DagsHubCallback (line 1396) | class DagsHubCallback(MLflowCallback): method __init__ (line 1401) | def __init__(self): method setup (line 1410) | def setup(self, *args, **kwargs): method on_train_end (line 1437) | def on_train_end(self, args, state, control, **kwargs): class NeptuneMissingConfiguration (line 1445) | class NeptuneMissingConfiguration(Exception): method __init__ (line 1446) | def __init__(self): class NeptuneCallback (line 1456) | class NeptuneCallback(TrainerCallback): method __init__ (line 1496) | def __init__( method _stop_run_if_exists (line 1556) | def _stop_run_if_exists(self): method _initialize_run (line 1562) | def _initialize_run(self, **additional_neptune_kwargs): method _use_initial_run (line 1580) | def _use_initial_run(self): method _ensure_run_with_monitoring (line 1586) | def _ensure_run_with_monitoring(self): method _ensure_at_least_run_without_monitoring (line 1600) | def _ensure_at_least_run_without_monitoring(self): method run (line 1615) | def run(self): method _metadata_namespace (line 1621) | def _metadata_namespace(self): method _log_integration_version (line 1624) | def _log_integration_version(self): method _log_trainer_parameters (line 1627) | def _log_trainer_parameters(self, args): method _log_model_parameters (line 1630) | def _log_model_parameters(self, model): method _log_hyper_param_search_parameters (line 1638) | def _log_hyper_param_search_parameters(self, state): method _log_model_checkpoint (line 1645) | def _log_model_checkpoint(self, source_directory: str, checkpoint: str): method on_init_end (line 1669) | def on_init_end(self, args, state, control, **kwargs): method on_train_begin (line 1677) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_train_end (line 1692) | def on_train_end(self, args, state, control, **kwargs): method __del__ (line 1695) | def __del__(self): method on_save (line 1701) | def on_save(self, args, state, control, **kwargs): method on_evaluate (line 1705) | def on_evaluate(self, args, state, control, metrics=None, **kwargs): method get_run (line 1718) | def get_run(cls, trainer): method on_log (line 1725) | def on_log(self, args, state, control, logs: dict[str, float] | None =... class CodeCarbonCallback (line 1738) | class CodeCarbonCallback(TrainerCallback): method __init__ (line 1743) | def __init__(self): method on_init_end (line 1758) | def on_init_end(self, args, state, control, **kwargs): method on_train_begin (line 1763) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_train_end (line 1767) | def on_train_end(self, args, state, control, **kwargs): class ClearMLCallback (line 1772) | class ClearMLCallback(TrainerCallback): method __init__ (line 1803) | def __init__(self): method setup (line 1817) | def setup(self, args, state, model, processing_class, **kwargs): method on_train_begin (line 1916) | def on_train_begin(self, args, state, control, model=None, processing_... method on_train_end (line 1925) | def on_train_end(self, args, state, control, **kwargs): method on_log (line 1930) | def on_log(self, args, state, control, model=None, processing_class=No... method on_save (line 1983) | def on_save(self, args, state, control, **kwargs): method _copy_training_args_as_hparams (line 2013) | def _copy_training_args_as_hparams(self, training_args, prefix): class FlyteCallback (line 2023) | class FlyteCallback(TrainerCallback): method __init__ (line 2050) | def __init__(self, save_log_history: bool = True, sync_checkpoints: bo... method on_save (line 2068) | def on_save(self, args, state, control, **kwargs): method on_train_end (line 2076) | def on_train_end(self, args, state, control, **kwargs): class DVCLiveCallback (line 2086) | class DVCLiveCallback(TrainerCallback): method __init__ (line 2102) | def __init__( method setup (line 2127) | def setup(self, args, state, model): method on_train_begin (line 2146) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_log (line 2150) | def on_log(self, args, state, control, model=None, logs=None, **kwargs): method on_save (line 2169) | def on_save(self, args, state, control, **kwargs): method on_train_end (line 2173) | def on_train_end(self, args, state, control, **kwargs): class SwanLabCallback (line 2191) | class SwanLabCallback(TrainerCallback): method __init__ (line 2196) | def __init__(self): method setup (line 2205) | def setup(self, args, state, model, **kwargs): method on_train_begin (line 2320) | def on_train_begin(self, args, state, control, model=None, **kwargs): method on_train_end (line 2324) | def on_train_end(self, args, state, control, model=None, processing_cl... method on_log (line 2331) | def on_log(self, args, state, control, model=None, logs=None, **kwargs): method on_save (line 2350) | def on_save(self, args, state, control, **kwargs): method on_predict (line 2357) | def on_predict(self, args, state, control, metrics, **kwargs): class KubeflowCallback (line 2365) | class KubeflowCallback(TrainerCallback): method __init__ (line 2401) | def __init__(self): method _get_ssl_context (line 2419) | def _get_ssl_context(self): method _get_token (line 2436) | def _get_token(self): method _update_status (line 2458) | def _update_status(self, progress_percent=None, estimated_time_remaini... method on_train_begin (line 2500) | def on_train_begin(self, args, state, control, **kwargs): method on_log (line 2517) | def on_log(self, args, state, control, logs=None, **kwargs): method on_step_end (line 2525) | def on_step_end(self, args, state, control, **kwargs): method on_train_end (line 2559) | def on_train_end(self, args, state, control, **kwargs): function get_reporting_integration_callbacks (line 2590) | def get_reporting_integration_callbacks(report_to): FILE: src/transformers/integrations/liger.py function apply_liger_kernel (line 28) | def apply_liger_kernel(model, kernel_config): FILE: src/transformers/integrations/metal_quantization.py function _get_metal_kernel (line 51) | def _get_metal_kernel(): class MetalLinear (line 73) | class MetalLinear(nn.Linear): method __init__ (line 81) | def __init__( method forward (line 115) | def forward(self, input: torch.Tensor) -> torch.Tensor: function replace_with_metal_linear (line 135) | def replace_with_metal_linear( function _affine_quantize_tensor (line 185) | def _affine_quantize_tensor(weight: torch.Tensor, group_size: int, bits:... function _affine_dequantize_tensor (line 218) | def _affine_dequantize_tensor( class MetalQuantize (line 241) | class MetalQuantize(ConversionOps): method __init__ (line 249) | def __init__(self, hf_quantizer): method convert (line 252) | def convert(self, input_dict: dict, **kwargs) -> dict: class MetalDequantize (line 273) | class MetalDequantize(ConversionOps): method __init__ (line 281) | def __init__(self, hf_quantizer): method convert (line 284) | def convert(self, input_dict: dict, full_layer_name: str | None = None... method reverse_op (line 299) | def reverse_op(self) -> "ConversionOps": FILE: src/transformers/integrations/mistral.py class MistralConverter (line 8) | class MistralConverter: method __init__ (line 13) | def __init__( method extract_vocab_merges_from_model (line 26) | def extract_vocab_merges_from_model(self, vocab: str): method tokenizer (line 53) | def tokenizer(self): method converted (line 60) | def converted(self) -> Tokenizer: function convert_tekken_tokenizer (line 76) | def convert_tekken_tokenizer(tokenizer_file: str): FILE: src/transformers/integrations/moe.py function _batched_linear (line 69) | def _batched_linear( function batched_mm_experts_forward (line 103) | def batched_mm_experts_forward( function _grouped_mm_fallback (line 174) | def _grouped_mm_fallback(input: torch.Tensor, weight: torch.Tensor, offs... function _grouped_mm_fallback_fake (line 200) | def _grouped_mm_fallback_fake(input: torch.Tensor, weight: torch.Tensor,... function _grouped_mm_fallback_setup_context (line 215) | def _grouped_mm_fallback_setup_context(ctx, inputs, output): function _grouped_mm_fallback_backward (line 221) | def _grouped_mm_fallback_backward(ctx, grad_output): function _can_use_grouped_mm (line 250) | def _can_use_grouped_mm(input: torch.Tensor, weight: torch.Tensor, offs:... function _grouped_mm (line 281) | def _grouped_mm( function _grouped_linear (line 312) | def _grouped_linear( function grouped_mm_experts_forward (line 350) | def grouped_mm_experts_forward( class ExpertsInterface (line 432) | class ExpertsInterface(GeneralInterface): method get_interface (line 440) | def get_interface(self, experts_implementation: str, default: Callable... function _default_apply_gate (line 458) | def _default_apply_gate(self, gate_up_out: torch.Tensor) -> torch.Tensor: function use_experts_implementation (line 472) | def use_experts_implementation( FILE: src/transformers/integrations/mxfp4.py function on_device (line 50) | def on_device(dev): class Mxfp4Quantize (line 71) | class Mxfp4Quantize(ConversionOps): method __init__ (line 72) | def __init__(self, hf_quantizer): method convert (line 75) | def convert( class Mxfp4Dequantize (line 119) | class Mxfp4Dequantize(ConversionOps): method __init__ (line 120) | def __init__(self, hf_quantizer): method convert (line 123) | def convert( method reverse_op (line 149) | def reverse_op(self) -> "ConversionOps": class Mxfp4Deserialize (line 153) | class Mxfp4Deserialize(ConversionOps): method __init__ (line 154) | def __init__(self, hf_quantizer): method convert (line 157) | def convert( method reverse_op (line 197) | def reverse_op(self) -> ConversionOps: class Mxfp4ReverseDeserialize (line 201) | class Mxfp4ReverseDeserialize(ConversionOps): method __init__ (line 202) | def __init__(self, hf_quantizer): method convert (line 205) | def convert( function quantize_to_mxfp4 (line 253) | def quantize_to_mxfp4(w, triton_kernels_hub): function swizzle_mxfp4 (line 259) | def swizzle_mxfp4(w, w_scale, triton_kernels_hub): function _convert_moe_packed_tensors (line 279) | def _convert_moe_packed_tensors( function convert_moe_packed_tensors (line 333) | def convert_moe_packed_tensors( class Mxfp4GptOssExperts (line 358) | class Mxfp4GptOssExperts(nn.Module): method __init__ (line 359) | def __init__(self, config): method forward (line 389) | def forward(self, hidden_states: torch.Tensor, routing_data, gather_id... function routing_torch_dist (line 425) | def routing_torch_dist( function mlp_forward (line 493) | def mlp_forward(self, hidden_states): function dequantize (line 513) | def dequantize(module, param_name, param_value, target_device, dq_param_... function dequantize_convertops (line 546) | def dequantize_convertops(blocks, scales): function load_and_swizzle_mxfp4 (line 551) | def load_and_swizzle_mxfp4(module, param_name, param_value, target_devic... function swizzle_mxfp4_convertops (line 622) | def swizzle_mxfp4_convertops(blocks, scales, module, proj, target_device... function replace_with_mxfp4_linear (line 671) | def replace_with_mxfp4_linear(model, quantization_config=None, modules_t... FILE: src/transformers/integrations/neftune.py function neftune_post_forward_hook (line 26) | def neftune_post_forward_hook(module, input, output): function activate_neftune (line 54) | def activate_neftune(model, neftune_noise_alpha, accelerator=None): function deactivate_neftune (line 89) | def deactivate_neftune(model, hook_handle, accelerator=None): FILE: src/transformers/integrations/npu_flash_attention.py function get_attn_mask_npu (line 40) | def get_attn_mask_npu(device): function is_npu_fa2_top_left_aligned_causal_mask (line 47) | def is_npu_fa2_top_left_aligned_causal_mask(): function npu_flash_attn_func (line 51) | def npu_flash_attn_func( function npu_flash_attn_varlen_func (line 86) | def npu_flash_attn_varlen_func( function npu_flash_attn_with_kvcache (line 142) | def npu_flash_attn_with_kvcache(): FILE: src/transformers/integrations/peft.py function _block_diag_3d (line 68) | def _block_diag_3d(tensors: list[torch.Tensor]) -> torch.Tensor: class PeftConcatenate (line 86) | class PeftConcatenate(Concatenate): method convert (line 124) | def convert( method reverse_op (line 161) | def reverse_op(self) -> ConversionOps: class FlattenDims (line 166) | class FlattenDims(ConversionOps): method __init__ (line 171) | def __init__(self, dims: int | tuple[int, ...]): method convert (line 177) | def convert( method reverse_op (line 189) | def reverse_op(self) -> ConversionOps: method __repr__ (line 192) | def __repr__(self): class PermuteDims (line 197) | class PermuteDims(ConversionOps): method __init__ (line 202) | def __init__(self, dims: tuple[int, ...]): method convert (line 206) | def convert( method reverse_op (line 218) | def reverse_op(self) -> ConversionOps: method __repr__ (line 221) | def __repr__(self): function build_peft_weight_mapping (line 226) | def build_peft_weight_mapping( function patch_moe_parameter_targeting (line 373) | def patch_moe_parameter_targeting(model, peft_config): class PeftAdapterMixin (line 401) | class PeftAdapterMixin: method load_adapter (line 423) | def load_adapter( method enable_peft_hotswap (line 653) | def enable_peft_hotswap( method add_adapter (line 690) | def add_adapter(self, adapter_config, adapter_name: str | None = None)... method set_adapter (line 730) | def set_adapter(self, adapter_name: list[str] | str) -> None: method disable_adapters (line 771) | def disable_adapters(self) -> None: method enable_adapters (line 790) | def enable_adapters(self) -> None: method active_adapters (line 808) | def active_adapters(self) -> list[str]: method get_adapter_state_dict (line 837) | def get_adapter_state_dict(self, adapter_name: str | None = None, stat... method _dispatch_accelerate_model (line 866) | def _dispatch_accelerate_model( method delete_adapter (line 922) | def delete_adapter(self, adapter_names: list[str] | str) -> None: function maybe_load_adapters (line 962) | def maybe_load_adapters( function _convert_peft_config_moe (line 1033) | def _convert_peft_config_moe(peft_config, model_type: str): function convert_peft_config_for_transformers (line 1093) | def convert_peft_config_for_transformers(peft_config, model: torch.nn.Mo... FILE: src/transformers/integrations/quanto.py class QuantoQuantize (line 27) | class QuantoQuantize(ConversionOps): method __init__ (line 28) | def __init__(self, hf_quantizer): method convert (line 31) | def convert( function replace_with_quanto_layers (line 62) | def replace_with_quanto_layers( FILE: src/transformers/integrations/quark.py class QuarkDeserialize (line 24) | class QuarkDeserialize(ConversionOps): method __init__ (line 25) | def __init__(self, hf_quantizer): method convert (line 28) | def convert( FILE: src/transformers/integrations/sdpa_attention.py function repeat_kv (line 16) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function use_gqa_in_sdpa (line 28) | def use_gqa_in_sdpa(attention_mask: torch.Tensor | None, key: torch.Tens... function sdpa_attention_forward (line 40) | def sdpa_attention_forward( FILE: src/transformers/integrations/sdpa_paged.py function repeat_kv (line 6) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function sdpa_attention_paged_forward (line 18) | def sdpa_attention_paged_forward( FILE: src/transformers/integrations/sinq.py function replace_with_sinq_linear (line 32) | def replace_with_sinq_linear( class SinqQuantize (line 83) | class SinqQuantize(ConversionOps): method __init__ (line 92) | def __init__(self, hf_quantizer): method convert (line 95) | def convert( class SinqDeserialize (line 118) | class SinqDeserialize(ConversionOps): method __init__ (line 135) | def __init__(self, hf_quantizer): method convert (line 138) | def convert( FILE: src/transformers/integrations/spqr.py function replace_with_spqr_linear (line 27) | def replace_with_spqr_linear(model, modules_to_not_convert: list[str] | ... FILE: src/transformers/integrations/tensor_parallel.py function initialize_tensor_parallelism (line 40) | def initialize_tensor_parallelism( function replace_layer_number_by_wildcard (line 105) | def replace_layer_number_by_wildcard(name: str) -> str: function _get_parameter_tp_plan (line 115) | def _get_parameter_tp_plan(parameter_name: str, tp_plan: dict[str, str],... function _blocks_to_block_sizes (line 154) | def _blocks_to_block_sizes(total_size: int, blocks: int | list[int]) -> ... function get_packed_weights (line 180) | def get_packed_weights(param, empty_param, device_mesh, rank, dim): function repack_weights (line 248) | def repack_weights( function get_tensor_shard (line 313) | def get_tensor_shard(param, empty_param, device_mesh, rank, dim, tensor_... function _split_along_last_dim (line 417) | def _split_along_last_dim(x, world_size): class _AllReduceBackward (line 443) | class _AllReduceBackward(torch.autograd.Function): method forward (line 447) | def forward(ctx, x, device_mesh): method backward (line 452) | def backward(ctx, grad_output): class _AllReduceForward (line 461) | class _AllReduceForward(torch.autograd.Function): method forward (line 465) | def forward(ctx, x, device_mesh): method backward (line 472) | def backward(ctx, grad_output): class _AllGather (line 476) | class _AllGather(torch.autograd.Function): method forward (line 480) | def forward(ctx, x, device_mesh): method backward (line 498) | def backward(ctx, grad_output): class _Split (line 510) | class _Split(torch.autograd.Function): method forward (line 514) | def forward(ctx, x, device_mesh): method backward (line 526) | def backward(ctx, grad_output): class _ReduceScatter (line 544) | class _ReduceScatter(torch.autograd.Function): method forward (line 548) | def forward(ctx, x, device_mesh): method backward (line 567) | def backward(ctx, grad_output): function all_reduce_backward (line 590) | def all_reduce_backward(x, device_mesh): function all_reduce_forward (line 595) | def all_reduce_forward(x, device_mesh): function all_gather (line 600) | def all_gather(x, device_mesh): function split (line 605) | def split(x, device_mesh): function reduce_scatter (line 610) | def reduce_scatter(x, device_mesh): function distribute_module (line 615) | def distribute_module( class TensorParallelLayer (line 632) | class TensorParallelLayer: method __init__ (line 639) | def __init__(self, device_mesh=None, rank=None, empty_param=None): method _prepare_input_fn (line 644) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 647) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 650) | def shard_tensor( method prepare_module_tp (line 655) | def prepare_module_tp(self, module: nn.Module, device_mesh, **kwargs) ... method get_expected_sharded_shape (line 663) | def get_expected_sharded_shape(self, full_shape: tuple[int, ...] | tor... method update_module_attributes (line 676) | def update_module_attributes(self, module: nn.Module): class ColwiseParallel (line 689) | class ColwiseParallel(TensorParallelLayer): method __init__ (line 696) | def __init__(self, gather_output: bool = False, **kwargs): method _prepare_input_fn (line 700) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 704) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 709) | def shard_tensor( method get_expected_sharded_shape (line 720) | def get_expected_sharded_shape(self, full_shape: tuple[int, ...] | tor... method update_module_attributes (line 732) | def update_module_attributes(self, module: nn.Module): class ReplicatedWithGradAllReduce (line 739) | class ReplicatedWithGradAllReduce(TensorParallelLayer): method _prepare_input_fn (line 749) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 752) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 755) | def shard_tensor(self, param, tensor_idx=None, device=None, dtype=None): method prepare_module_tp (line 758) | def prepare_module_tp(self, module, device_mesh, **kwargs): class MlaKvAProjParallel (line 769) | class MlaKvAProjParallel(TensorParallelLayer): method _prepare_output_fn (line 797) | def _prepare_output_fn(self, mod, output, device_mesh): method shard_tensor (line 809) | def shard_tensor(self, param, tensor_idx=None, device=None, dtype=None): method prepare_module_tp (line 812) | def prepare_module_tp(self, module, device_mesh, config=None, **kwargs): class RowwiseParallel (line 817) | class RowwiseParallel(TensorParallelLayer): method __init__ (line 828) | def __init__(self, split_input: bool = False, **kwargs): method _prepare_input_fn (line 832) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 844) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 850) | def shard_tensor( method get_expected_sharded_shape (line 861) | def get_expected_sharded_shape(self, full_shape: tuple[int, ...] | tor... method update_module_attributes (line 875) | def update_module_attributes(self, module: nn.Module): class PackedColwiseParallel (line 883) | class PackedColwiseParallel(ColwiseParallel): method shard_tensor (line 886) | def shard_tensor( class PackedRowwiseParallel (line 905) | class PackedRowwiseParallel(RowwiseParallel): method shard_tensor (line 908) | def shard_tensor( class EmbeddingParallel (line 931) | class EmbeddingParallel(TensorParallelLayer): method __init__ (line 934) | def __init__(self, *, embedding_dim_sharding: int = 0, **kwargs): method _prepare_input_fn (line 938) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 964) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 975) | def shard_tensor( method get_expected_sharded_shape (line 992) | def get_expected_sharded_shape(self, full_shape: tuple[int, ...] | tor... method update_module_attributes (line 1005) | def update_module_attributes(self, module: nn.Module): class SequenceParallel (line 1012) | class SequenceParallel(TensorParallelLayer): method __init__ (line 1018) | def __init__(self, sequence_dim: int = 1, use_local_output: bool = Fal... method _prepare_input_fn (line 1022) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 1028) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 1031) | def shard_tensor( class GroupedGemmParallel (line 1037) | class GroupedGemmParallel(TensorParallelLayer): method __init__ (line 1042) | def __init__(self, **kwargs): method shard_tensor (line 1045) | def shard_tensor( method get_expected_sharded_shape (line 1071) | def get_expected_sharded_shape(self, full_shape: tuple[int, ...] | tor... method update_module_attributes (line 1079) | def update_module_attributes(self, module: nn.Module): class RouterParallel (line 1084) | class RouterParallel(TensorParallelLayer): method __init__ (line 1089) | def __init__(self, **kwargs): method _prepare_input_fn (line 1092) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 1095) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 1148) | def shard_tensor( class MoeTensorParalellExperts (line 1154) | class MoeTensorParalellExperts(TensorParallelLayer): method __init__ (line 1162) | def __init__(self, **kwargs): method _prepare_input_fn (line 1165) | def _prepare_input_fn(self, mod, inputs, device_mesh): method _prepare_output_fn (line 1181) | def _prepare_output_fn(self, mod, outputs, device_mesh): method shard_tensor (line 1185) | def shard_tensor( class MoeIdentityExpertParallel (line 1193) | class MoeIdentityExpertParallel(TensorParallelLayer): method _prepare_input_fn (line 1203) | def _prepare_input_fn(self, mod, inputs, device_mesh): method shard_tensor (line 1208) | def shard_tensor(self, param, tensor_idx=None, device=None, dtype=None): method prepare_module_tp (line 1211) | def prepare_module_tp(self, module, device_mesh, **kwargs): class ParallelInterface (line 1215) | class ParallelInterface(GeneralInterface): method register_plan_to_weight_dim (line 1273) | def register_plan_to_weight_dim(cls, key: str, value: int | None): method register_plan_to_bias_dim (line 1277) | def register_plan_to_bias_dim(cls, key: str, value: int | None): function gather_full_tensor (line 1289) | def gather_full_tensor( function gather_state_dict_for_save (line 1319) | def gather_state_dict_for_save( function add_tensor_parallel_hooks_to_module (line 1390) | def add_tensor_parallel_hooks_to_module( function shard_and_distribute_module (line 1415) | def shard_and_distribute_module( function verify_tp_plan (line 1468) | def verify_tp_plan(expected_keys: list[str], tp_plan: dict[str, str] | N... function distribute_model (line 1497) | def distribute_model(model, tp_plan, distributed_config, device_mesh, tp... FILE: src/transformers/integrations/tiktoken.py function convert_tiktoken_to_fast (line 8) | def convert_tiktoken_to_fast(encoding: Any, output_dir: str): FILE: src/transformers/integrations/torchao.py function _quantization_type (line 38) | def _quantization_type(weight): function _linear_extra_repr (line 49) | def _linear_extra_repr(self): class TorchAoQuantize (line 57) | class TorchAoQuantize(ConversionOps): method __init__ (line 58) | def __init__(self, hf_quantizer): method _quantize (line 61) | def _quantize(self, module, config, *args, **kwargs): method convert (line 78) | def convert( class TorchAoDeserialize (line 173) | class TorchAoDeserialize(ConversionOps): method __init__ (line 174) | def __init__(self, hf_quantizer): method convert (line 177) | def convert( FILE: src/transformers/integrations/tpu.py function tpu_spmd_dataloader (line 27) | def tpu_spmd_dataloader(dataloader: DataLoader): function wrap_model_xla_fsdp (line 46) | def wrap_model_xla_fsdp(model, args, is_fsdp_xla_v2_enabled): function save_tpu_checkpoint (line 165) | def save_tpu_checkpoint(model, args, accelerator, processing_class, is_f... FILE: src/transformers/integrations/vptq.py function replace_with_vptq_linear (line 27) | def replace_with_vptq_linear(model, modules_to_not_convert: list[str] | ... FILE: src/transformers/loss/loss_d_fine.py function _set_aux_loss (line 29) | def _set_aux_loss(outputs_class, outputs_coord): function _set_aux_loss2 (line 33) | def _set_aux_loss2( function weighting_function (line 49) | def weighting_function(max_num_bins: int, up: torch.Tensor, reg_scale: i... function translate_gt (line 74) | def translate_gt(gt: torch.Tensor, max_num_bins: int, reg_scale: int, up... function bbox2distance (line 137) | def bbox2distance(points, bbox, max_num_bins, reg_scale, up, eps=0.1): class DFineLoss (line 165) | class DFineLoss(RTDetrLoss): method __init__ (line 189) | def __init__(self, config): method unimodal_distribution_focal_loss (line 205) | def unimodal_distribution_focal_loss( method loss_local (line 228) | def loss_local(self, outputs, targets, indices, num_boxes, T=5): method get_loss (line 303) | def get_loss(self, loss, outputs, targets, indices, num_boxes): function DFineForObjectDetectionLoss (line 316) | def DFineForObjectDetectionLoss( FILE: src/transformers/loss/loss_deformable_detr.py class DeformableDetrHungarianMatcher (line 19) | class DeformableDetrHungarianMatcher(HungarianMatcher): method forward (line 21) | def forward(self, outputs, targets): class DeformableDetrImageLoss (line 59) | class DeformableDetrImageLoss(ImageLoss): method __init__ (line 60) | def __init__(self, matcher, num_classes, focal_alpha, losses): method loss_cardinality (line 68) | def loss_cardinality(self, outputs, targets, indices, num_boxes): method loss_labels (line 84) | def loss_labels(self, outputs, targets, indices, num_boxes): function DeformableDetrForSegmentationLoss (line 118) | def DeformableDetrForSegmentationLoss( function DeformableDetrForObjectDetectionLoss (line 159) | def DeformableDetrForObjectDetectionLoss( FILE: src/transformers/loss/loss_for_object_detection.py function dice_loss (line 34) | def dice_loss(inputs, targets, num_boxes): function sigmoid_focal_loss (line 53) | def sigmoid_focal_loss(inputs, targets, num_boxes, alpha: float = 0.25, ... class ImageLoss (line 85) | class ImageLoss(nn.Module): method __init__ (line 110) | def __init__(self, matcher, num_classes, eos_coef, losses): method loss_labels (line 121) | def loss_labels(self, outputs, targets, indices, num_boxes): method loss_cardinality (line 143) | def loss_cardinality(self, outputs, targets, indices, num_boxes): method loss_boxes (line 158) | def loss_boxes(self, outputs, targets, indices, num_boxes): method loss_masks (line 182) | def loss_masks(self, outputs, targets, indices, num_boxes): method _get_source_permutation_idx (line 215) | def _get_source_permutation_idx(self, indices): method _get_target_permutation_idx (line 221) | def _get_target_permutation_idx(self, indices): method get_loss (line 227) | def get_loss(self, loss, outputs, targets, indices, num_boxes): method forward (line 238) | def forward(self, outputs, targets): class HungarianMatcher (line 285) | class HungarianMatcher(nn.Module): method __init__ (line 302) | def __init__(self, class_cost: float = 1, bbox_cost: float = 1, giou_c... method forward (line 313) | def forward(self, outputs, targets): function _upcast (line 366) | def _upcast(t: Tensor) -> Tensor: function box_area (line 374) | def box_area(boxes: Tensor) -> Tensor: function box_iou (line 391) | def box_iou(boxes1, boxes2): function generalized_box_iou (line 407) | def generalized_box_iou(boxes1, boxes2): function _max_by_axis (line 432) | def _max_by_axis(the_list): class NestedTensor (line 441) | class NestedTensor: method __init__ (line 442) | def __init__(self, tensors, mask: Tensor | None): method to (line 446) | def to(self, device): method decompose (line 455) | def decompose(self): method __repr__ (line 458) | def __repr__(self): function nested_tensor_from_tensor_list (line 462) | def nested_tensor_from_tensor_list(tensor_list: list[Tensor]): function _set_aux_loss (line 480) | def _set_aux_loss(outputs_class, outputs_coord): function ForSegmentationLoss (line 484) | def ForSegmentationLoss( function ForObjectDetectionLoss (line 524) | def ForObjectDetectionLoss( FILE: src/transformers/loss/loss_grounding_dino.py function sigmoid_focal_loss (line 28) | def sigmoid_focal_loss( class GroundingDinoHungarianMatcher (line 67) | class GroundingDinoHungarianMatcher(HungarianMatcher): method forward (line 69) | def forward(self, outputs, targets): class GroundingDinoImageLoss (line 128) | class GroundingDinoImageLoss(ImageLoss): method __init__ (line 143) | def __init__(self, matcher, focal_alpha, losses): method loss_cardinality (line 150) | def loss_cardinality(self, outputs, targets, indices, num_boxes): method _get_target_classes_one_hot (line 165) | def _get_target_classes_one_hot(self, outputs, targets, indices): method loss_labels (line 185) | def loss_labels(self, outputs, targets, indices, num_boxes): function GroundingDinoForObjectDetectionLoss (line 217) | def GroundingDinoForObjectDetectionLoss( FILE: src/transformers/loss/loss_lw_detr.py class LwDetrHungarianMatcher (line 42) | class LwDetrHungarianMatcher(HungarianMatcher): method forward (line 44) | def forward(self, outputs, targets, group_detr): class LwDetrImageLoss (line 101) | class LwDetrImageLoss(nn.Module): method __init__ (line 102) | def __init__(self, matcher, num_classes, focal_alpha, losses, group_de... method loss_labels (line 111) | def loss_labels(self, outputs, targets, indices, num_boxes): method loss_cardinality (line 148) | def loss_cardinality(self, outputs, targets, indices, num_boxes): method loss_boxes (line 164) | def loss_boxes(self, outputs, targets, indices, num_boxes): method loss_masks (line 189) | def loss_masks(self, outputs, targets, indices, num_boxes): method _get_source_permutation_idx (line 223) | def _get_source_permutation_idx(self, indices): method _get_target_permutation_idx (line 230) | def _get_target_permutation_idx(self, indices): method get_loss (line 236) | def get_loss(self, loss, outputs, targets, indices, num_boxes): method forward (line 247) | def forward(self, outputs, targets): function LwDetrForObjectDetectionLoss (line 305) | def LwDetrForObjectDetectionLoss( FILE: src/transformers/loss/loss_rt_detr.py function _set_aux_loss (line 38) | def _set_aux_loss(outputs_class, outputs_coord): class RTDetrHungarianMatcher (line 42) | class RTDetrHungarianMatcher(nn.Module): method __init__ (line 53) | def __init__(self, config): method forward (line 69) | def forward(self, outputs, targets): class RTDetrLoss (line 123) | class RTDetrLoss(nn.Module): method __init__ (line 147) | def __init__(self, config): method loss_labels_vfl (line 165) | def loss_labels_vfl(self, outputs, targets, indices, num_boxes, log=Tr... method loss_labels (line 198) | def loss_labels(self, outputs, targets, indices, num_boxes, log=True): method loss_cardinality (line 219) | def loss_cardinality(self, outputs, targets, indices, num_boxes): method loss_boxes (line 233) | def loss_boxes(self, outputs, targets, indices, num_boxes): method loss_masks (line 256) | def loss_masks(self, outputs, targets, indices, num_boxes): method loss_labels_bce (line 287) | def loss_labels_bce(self, outputs, targets, indices, num_boxes, log=Tr... method _get_source_permutation_idx (line 301) | def _get_source_permutation_idx(self, indices): method _get_target_permutation_idx (line 307) | def _get_target_permutation_idx(self, indices): method loss_labels_focal (line 313) | def loss_labels_focal(self, outputs, targets, indices, num_boxes, log=... method get_loss (line 331) | def get_loss(self, loss, outputs, targets, indices, num_boxes): method get_cdn_matched_indices (line 346) | def get_cdn_matched_indices(dn_meta, targets): method forward (line 368) | def forward(self, outputs, targets): function RTDetrForObjectDetectionLoss (line 433) | def RTDetrForObjectDetectionLoss( FILE: src/transformers/loss/loss_utils.py function fixed_cross_entropy (line 28) | def fixed_cross_entropy( function ForCausalLMLoss (line 45) | def ForCausalLMLoss( function ForMaskedLMLoss (line 70) | def ForMaskedLMLoss( function ForSequenceClassificationLoss (line 90) | def ForSequenceClassificationLoss(labels: torch.Tensor, pooled_logits: t... function ForQuestionAnsweringLoss (line 117) | def ForQuestionAnsweringLoss(start_logits, end_logits, start_positions, ... function ForTokenClassification (line 136) | def ForTokenClassification(logits: torch.Tensor, labels, config, **kwargs): FILE: src/transformers/masking_utils.py function and_masks (line 46) | def and_masks(*mask_functions: Callable) -> Callable: function or_masks (line 60) | def or_masks(*mask_functions: Callable) -> Callable: function causal_mask_function (line 74) | def causal_mask_function(batch_idx: int, head_idx: int, q_idx: int, kv_i... function bidirectional_mask_function (line 81) | def bidirectional_mask_function(batch_idx: int, head_idx: int, q_idx: in... function sliding_window_overlay (line 90) | def sliding_window_overlay(sliding_window: int) -> Callable: function chunked_overlay (line 102) | def chunked_overlay(chunk_size: int, left_padding: torch.Tensor) -> Call... function sliding_window_causal_mask_function (line 114) | def sliding_window_causal_mask_function(sliding_window: int) -> Callable: function sliding_window_bidirectional_overlay (line 121) | def sliding_window_bidirectional_overlay(sliding_window: int) -> Callable: function sliding_window_bidirectional_mask_function (line 134) | def sliding_window_bidirectional_mask_function(sliding_window: int) -> C... function chunked_causal_mask_function (line 141) | def chunked_causal_mask_function(chunk_size: int, left_padding: torch.Te... function padding_mask_function (line 148) | def padding_mask_function(padding_mask: torch.Tensor) -> Callable: function packed_sequence_mask_function (line 162) | def packed_sequence_mask_function(packed_sequence_mask: torch.Tensor) ->... function add_offsets_to_mask_function (line 173) | def add_offsets_to_mask_function(mask_function: Callable, q_offset: int,... function prepare_padding_mask (line 185) | def prepare_padding_mask(attention_mask: torch.Tensor | None, kv_length:... function _can_skip_causal_mask_xpu (line 197) | def _can_skip_causal_mask_xpu( function _ignore_causal_mask_sdpa (line 233) | def _ignore_causal_mask_sdpa( function _can_skip_bidirectional_mask_xpu (line 277) | def _can_skip_bidirectional_mask_xpu( function _ignore_bidirectional_mask_sdpa (line 304) | def _ignore_bidirectional_mask_sdpa( function _vmap_expansion_sdpa (line 335) | def _vmap_expansion_sdpa(mask_function: Callable) -> Callable: function _non_vmap_expansion_sdpa (line 348) | def _non_vmap_expansion_sdpa( function sdpa_mask (line 367) | def sdpa_mask( function eager_mask (line 545) | def eager_mask( function flash_attention_mask (line 616) | def flash_attention_mask( function flex_attention_mask (line 658) | def flex_attention_mask( class AttentionMaskInterface (line 727) | class AttentionMaskInterface(GeneralInterface): function find_packed_sequence_indices (line 744) | def find_packed_sequence_indices(position_ids: torch.Tensor) -> torch.Te... function _preprocess_mask_arguments (line 777) | def _preprocess_mask_arguments( function create_causal_mask (line 882) | def create_causal_mask( function create_bidirectional_mask (line 1001) | def create_bidirectional_mask( function create_sliding_window_causal_mask (line 1091) | def create_sliding_window_causal_mask( function create_bidirectional_sliding_window_mask (line 1211) | def create_bidirectional_sliding_window_mask( function create_chunked_causal_mask (line 1292) | def create_chunked_causal_mask( function create_masks_for_generate (line 1421) | def create_masks_for_generate( function get_style (line 1496) | def get_style(style): function tensor_to_mask_visual (line 1518) | def tensor_to_mask_visual(original_tensor: torch.Tensor, grid_size=(20, ... class AttentionMask (line 1570) | class AttentionMask(torch.Tensor): method __new__ (line 1571) | def __new__(cls, data, style=None): method __init__ (line 1576) | def __init__(self, data): method to_string (line 1580) | def to_string(self, grid_size=(20, 40), limit=4): method __repr__ (line 1598) | def __repr__(self): method __str__ (line 1601) | def __str__(self): method from_tensor (line 1605) | def from_tensor(cls, tensor: torch.Tensor, style: str | None = None) -... FILE: src/transformers/model_debugging_utils.py function _is_rank_zero (line 44) | def _is_rank_zero(): function _sanitize_repr_for_diff (line 54) | def _sanitize_repr_for_diff(x_str: str) -> str: function _dtensor_repr (line 62) | def _dtensor_repr(x): function _serialize_tensor_like_io (line 69) | def _serialize_tensor_like_io( function _serialize_io (line 118) | def _serialize_io(value, debug_path: str | None = None, use_repr: bool =... function _repr_to_list (line 161) | def _repr_to_list(value: torch.Tensor): function prune_outputs_if_children (line 178) | def prune_outputs_if_children(node): function is_layer_block (line 190) | def is_layer_block(node): function prune_intermediate_layers (line 207) | def prune_intermediate_layers(node): function log_model_debug_trace (line 227) | def log_model_debug_trace(debug_path: str | None, model): function _attach_debugger_logic (line 270) | def _attach_debugger_logic( function model_addition_debugger_context (line 399) | def model_addition_debugger_context( FILE: src/transformers/modelcard.py function _listify (line 112) | def _listify(obj): function _insert_values_as_list (line 121) | def _insert_values_as_list(metadata, name, values): function infer_metric_tags_from_eval_results (line 133) | def infer_metric_tags_from_eval_results(eval_results): function _insert_value (line 145) | def _insert_value(metadata, name, value): function is_hf_dataset (line 152) | def is_hf_dataset(dataset): function _get_mapping_values (line 161) | def _get_mapping_values(mapping): class TrainingSummary (line 172) | class TrainingSummary: method __post_init__ (line 188) | def __post_init__(self): method create_model_index (line 204) | def create_model_index(self, metric_mapping): method create_metadata (line 267) | def create_metadata(self): method to_model_card (line 283) | def to_model_card(self): method from_trainer (line 358) | def from_trainer( function parse_log_history (line 436) | def parse_log_history(log_history): function _maybe_round (line 496) | def _maybe_round(v, decimals=4): function _regular_table_line (line 502) | def _regular_table_line(values, col_widths): function _second_table_line (line 507) | def _second_table_line(col_widths): function make_markdown_table (line 512) | def make_markdown_table(lines): function extract_hyperparameters_from_trainer (line 539) | def extract_hyperparameters_from_trainer(trainer): FILE: src/transformers/modeling_attn_mask_utils.py class AttentionMaskConverter (line 36) | class AttentionMaskConverter: method __init__ (line 70) | def __init__(self, is_causal: bool, sliding_window: int | None = None): method to_causal_4d (line 81) | def to_causal_4d( method to_4d (line 114) | def to_4d( method _make_causal_mask (line 162) | def _make_causal_mask( method _expand_mask (line 198) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: int ... method _unmask_unattended (line 214) | def _unmask_unattended( method _ignore_causal_mask_sdpa (line 265) | def _ignore_causal_mask_sdpa( function _prepare_4d_causal_attention_mask (line 324) | def _prepare_4d_causal_attention_mask( function _prepare_4d_causal_attention_mask_for_sdpa (line 377) | def _prepare_4d_causal_attention_mask_for_sdpa( function _prepare_4d_attention_mask (line 435) | def _prepare_4d_attention_mask(mask: torch.Tensor, dtype: torch.dtype, t... function _prepare_4d_attention_mask_for_sdpa (line 451) | def _prepare_4d_attention_mask_for_sdpa(mask: torch.Tensor, dtype: torch... function _create_4d_causal_attention_mask (line 476) | def _create_4d_causal_attention_mask( FILE: src/transformers/modeling_flash_attention_utils.py function flash_attn_supports_top_left_mask (line 41) | def flash_attn_supports_top_left_mask(): function is_flash_attn_available (line 51) | def is_flash_attn_available(): function _lazy_imports (line 131) | def _lazy_imports( function _lazy_define_process_function (line 207) | def _lazy_define_process_function(flash_function): function lazy_import_flash_attention (line 231) | def lazy_import_flash_attention( function lazy_import_paged_flash_attention (line 256) | def lazy_import_paged_flash_attention(implementation: str | None, allow_... function _index_first_axis (line 268) | def _index_first_axis(tensor, indices): function _unpad_input (line 280) | def _unpad_input(hidden_states, attention_mask, unused_mask=None): function _pad_input (line 312) | def _pad_input(hidden_states, indices, batch, seqlen): function _get_unpad_data (line 331) | def _get_unpad_data(attention_mask: torch.Tensor) -> tuple[torch.Tensor,... function _upad_input (line 358) | def _upad_input( function prepare_fa_kwargs_from_position_ids (line 437) | def prepare_fa_kwargs_from_position_ids(position_ids): function _prepare_from_posids (line 475) | def _prepare_from_posids(query, key, value, position_ids): function _is_packed_sequence (line 513) | def _is_packed_sequence(position_ids, batch_size): function fa_peft_integration_check (line 529) | def fa_peft_integration_check( class FlashAttentionKwargs (line 547) | class FlashAttentionKwargs(TypedDict, total=False): function _process_flash_attention_kwargs (line 568) | def _process_flash_attention_kwargs( function _flash_attention_forward (line 671) | def _flash_attention_forward( FILE: src/transformers/modeling_gguf_pytorch_utils.py class GGUFTensor (line 56) | class GGUFTensor(NamedTuple): class TensorProcessor (line 62) | class TensorProcessor: method __init__ (line 63) | def __init__(self, config=None): method preprocess_name (line 66) | def preprocess_name(self, hf_name: str) -> str: method perform_fallback_tensor_mapping (line 72) | def perform_fallback_tensor_mapping( method process (line 84) | def process(self, weights, name, **kwargs): class LlamaTensorProcessor (line 88) | class LlamaTensorProcessor(TensorProcessor): method __init__ (line 89) | def __init__(self, config=None): method process (line 92) | def process(self, weights, name, **kwargs): method _reverse_permute_weights (line 105) | def _reverse_permute_weights( class Qwen2MoeTensorProcessor (line 118) | class Qwen2MoeTensorProcessor(TensorProcessor): method __init__ (line 123) | def __init__(self, config=None): method preprocess_name (line 126) | def preprocess_name(self, hf_name: str) -> str: method perform_fallback_tensor_mapping (line 129) | def perform_fallback_tensor_mapping( method process (line 138) | def process(self, weights, name: str, **kwargs): method _set_moe_expert_tensor (line 151) | def _set_moe_expert_tensor(self, weights: np.ndarray, parsed_parameter... class BloomTensorProcessor (line 174) | class BloomTensorProcessor(TensorProcessor): method __init__ (line 175) | def __init__(self, config=None): method process (line 178) | def process(self, weights, name, **kwargs): method _reverse_reshape_weights (line 188) | def _reverse_reshape_weights(self, weights: np.ndarray, n_head: int, n... method _reverse_reshape_bias (line 200) | def _reverse_reshape_bias(self, weights: np.ndarray, n_head: int, n_em... class T5TensorProcessor (line 213) | class T5TensorProcessor(TensorProcessor): method __init__ (line 214) | def __init__(self, config=None): method process (line 217) | def process(self, weights, name, **kwargs): class GPT2TensorProcessor (line 226) | class GPT2TensorProcessor(TensorProcessor): method __init__ (line 227) | def __init__(self, config=None): method process (line 230) | def process(self, weights, name, **kwargs): class MambaTensorProcessor (line 252) | class MambaTensorProcessor(TensorProcessor): method __init__ (line 253) | def __init__(self, config=None): method process (line 256) | def process(self, weights, name, **kwargs): class NemotronTensorProcessor (line 268) | class NemotronTensorProcessor(TensorProcessor): method __init__ (line 269) | def __init__(self, config=None): method process (line 273) | def process(self, weights, name, **kwargs): class Gemma2TensorProcessor (line 279) | class Gemma2TensorProcessor(TensorProcessor): method __init__ (line 280) | def __init__(self, config=None): method process (line 285) | def process(self, weights, name, **kwargs): class Lfm2TensorProcessor (line 291) | class Lfm2TensorProcessor(TensorProcessor): method __init__ (line 292) | def __init__(self, config=None): method process (line 295) | def process(self, weights, name, **kwargs): class MiniMaxM2TensorProcessor (line 302) | class MiniMaxM2TensorProcessor(TensorProcessor): method __init__ (line 308) | def __init__(self, config=None): method preprocess_name (line 311) | def preprocess_name(self, hf_name: str) -> str: method perform_fallback_tensor_mapping (line 314) | def perform_fallback_tensor_mapping( method process (line 326) | def process(self, weights, name: str, **kwargs): method _set_moe_expert_tensor (line 335) | def _set_moe_expert_tensor(self, weights: np.ndarray, parsed_parameter... function read_field (line 372) | def read_field(reader, field): function get_gguf_hf_weights_map (line 380) | def get_gguf_hf_weights_map( function load_gguf_checkpoint (line 466) | def load_gguf_checkpoint(gguf_checkpoint_path, return_tensors=False, mod... FILE: src/transformers/modeling_layers.py class GradientCheckpointingLayer (line 34) | class GradientCheckpointingLayer(nn.Module): method __call__ (line 59) | def __call__(self, *args, **kwargs): class GenericForSequenceClassification (line 97) | class GenericForSequenceClassification: method __init__ (line 100) | def __init__(self, config): method forward (line 112) | def forward( class GenericForQuestionAnswering (line 172) | class GenericForQuestionAnswering: method __init__ (line 175) | def __init__(self, config): method get_input_embeddings (line 184) | def get_input_embeddings(self): method set_input_embeddings (line 187) | def set_input_embeddings(self, value): method forward (line 192) | def forward( class GenericForTokenClassification (line 233) | class GenericForTokenClassification: method __init__ (line 236) | def __init__(self, config): method forward (line 255) | def forward( FILE: src/transformers/modeling_outputs.py class BaseModelOutput (line 24) | class BaseModelOutput(ModelOutput): class BaseModelOutputWithNoAttention (line 50) | class BaseModelOutputWithNoAttention(ModelOutput): class BaseModelOutputWithPooling (line 69) | class BaseModelOutputWithPooling(ModelOutput): class BaseModelOutputWithPoolingAndNoAttention (line 101) | class BaseModelOutputWithPoolingAndNoAttention(ModelOutput): class BaseModelOutputWithPast (line 123) | class BaseModelOutputWithPast(ModelOutput): class BaseModelOutputWithCrossAttentions (line 159) | class BaseModelOutputWithCrossAttentions(ModelOutput): class BaseModelOutputWithPoolingAndCrossAttentions (line 192) | class BaseModelOutputWithPoolingAndCrossAttentions(ModelOutput): class BaseModelOutputWithPastAndCrossAttentions (line 238) | class BaseModelOutputWithPastAndCrossAttentions(ModelOutput): class MoECausalLMOutputWithPast (line 281) | class MoECausalLMOutputWithPast(ModelOutput): class MoEModelOutput (line 329) | class MoEModelOutput(ModelOutput): class MoeModelOutputWithPast (line 362) | class MoeModelOutputWithPast(ModelOutput): class MoeCausalLMOutputWithPast (line 401) | class MoeCausalLMOutputWithPast(ModelOutput): class MoEModelOutputWithPastAndCrossAttentions (line 449) | class MoEModelOutputWithPastAndCrossAttentions(ModelOutput): class Seq2SeqModelOutput (line 500) | class Seq2SeqModelOutput(ModelOutput): class Seq2SeqMoEModelOutput (line 559) | class Seq2SeqMoEModelOutput(ModelOutput): class CausalLMOutput (line 629) | class CausalLMOutput(ModelOutput): class CausalLMOutputWithPast (line 658) | class CausalLMOutputWithPast(ModelOutput): class CausalLMOutputWithCrossAttentions (line 693) | class CausalLMOutputWithCrossAttentions(ModelOutput): class SequenceClassifierOutputWithPast (line 735) | class SequenceClassifierOutputWithPast(ModelOutput): class MaskedLMOutput (line 770) | class MaskedLMOutput(ModelOutput): class Seq2SeqLMOutput (line 799) | class Seq2SeqLMOutput(ModelOutput): class Seq2SeqMoEOutput (line 857) | class Seq2SeqMoEOutput(ModelOutput): class NextSentencePredictorOutput (line 930) | class NextSentencePredictorOutput(ModelOutput): class SequenceClassifierOutput (line 960) | class SequenceClassifierOutput(ModelOutput): class Seq2SeqSequenceClassifierOutput (line 989) | class Seq2SeqSequenceClassifierOutput(ModelOutput): class MultipleChoiceModelOutput (line 1047) | class MultipleChoiceModelOutput(ModelOutput): class TokenClassifierOutput (line 1078) | class TokenClassifierOutput(ModelOutput): class QuestionAnsweringModelOutput (line 1107) | class QuestionAnsweringModelOutput(ModelOutput): class Seq2SeqQuestionAnsweringModelOutput (line 1139) | class Seq2SeqQuestionAnsweringModelOutput(ModelOutput): class SemanticSegmenterOutput (line 1200) | class SemanticSegmenterOutput(ModelOutput): class ImageClassifierOutput (line 1238) | class ImageClassifierOutput(ModelOutput): class ImageClassifierOutputWithNoAttention (line 1266) | class ImageClassifierOutputWithNoAttention(ModelOutput): class DepthEstimatorOutput (line 1287) | class DepthEstimatorOutput(ModelOutput): class ImageSuperResolutionOutput (line 1317) | class ImageSuperResolutionOutput(ModelOutput): class Wav2Vec2BaseModelOutput (line 1345) | class Wav2Vec2BaseModelOutput(ModelOutput): class XVectorOutput (line 1374) | class XVectorOutput(ModelOutput): class BackboneOutput (line 1406) | class BackboneOutput(ModelOutput): class BaseModelOutputWithPoolingAndProjection (line 1433) | class BaseModelOutputWithPoolingAndProjection(ModelOutput): class Seq2SeqSpectrogramOutput (line 1470) | class Seq2SeqSpectrogramOutput(ModelOutput): class Seq2SeqTSModelOutput (line 1528) | class Seq2SeqTSModelOutput(ModelOutput): class Seq2SeqTSPredictionOutput (line 1598) | class Seq2SeqTSPredictionOutput(ModelOutput): class SampleTSPredictionOutput (line 1668) | class SampleTSPredictionOutput(ModelOutput): class MaskedImageModelingOutput (line 1682) | class MaskedImageModelingOutput(ModelOutput): FILE: src/transformers/modeling_rope_utils.py function dynamic_rope_update (line 33) | def dynamic_rope_update(rope_forward): function _compute_linear_scaling_rope_parameters (line 132) | def _compute_linear_scaling_rope_parameters( function _compute_dynamic_ntk_parameters (line 186) | def _compute_dynamic_ntk_parameters( function _compute_yarn_parameters (line 256) | def _compute_yarn_parameters( function _compute_longrope_parameters (line 391) | def _compute_longrope_parameters( function _compute_llama3_parameters (line 479) | def _compute_llama3_parameters( class RopeParameters (line 570) | class RopeParameters(TypedDict, total=False): class RotaryEmbeddingConfigMixin (line 625) | class RotaryEmbeddingConfigMixin: method convert_rope_params_to_dict (line 633) | def convert_rope_params_to_dict(self, **kwargs): method standardize_rope_params (line 654) | def standardize_rope_params(self): method validate_rope (line 702) | def validate_rope(self: "PreTrainedConfig"): method _validate_default_rope_parameters (line 731) | def _validate_default_rope_parameters(self, rope_parameters: dict, ign... method _validate_linear_rope_parameters (line 737) | def _validate_linear_rope_parameters(self, rope_parameters: dict, igno... method _validate_dynamic_rope_parameters (line 747) | def _validate_dynamic_rope_parameters(self, rope_parameters: dict, ign... method _validate_yarn_rope_parameters (line 757) | def _validate_yarn_rope_parameters(self, rope_parameters: dict, ignore... method _validate_longrope_rope_parameters (line 808) | def _validate_longrope_rope_parameters(self, rope_parameters: dict, ig... method _validate_llama3_rope_parameters (line 858) | def _validate_llama3_rope_parameters(self, rope_parameters: dict, igno... method _check_received_keys (line 900) | def _check_received_keys( function rope_config_validation (line 930) | def rope_config_validation(config: RotaryEmbeddingConfigMixin, ignore_ke... FILE: src/transformers/modeling_utils.py class LoadStateDictConfig (line 161) | class LoadStateDictConfig: method is_quantized (line 183) | def is_quantized(self) -> bool: function is_local_dist_rank_0 (line 187) | def is_local_dist_rank_0(): function set_quantized_state (line 196) | def set_quantized_state(): function set_zero3_state (line 209) | def set_zero3_state(): function local_torch_dtype (line 219) | def local_torch_dtype(dtype: torch.dtype, model_class_name: str | None =... function get_torch_context_manager_or_global_device (line 242) | def get_torch_context_manager_or_global_device(): function get_state_dict_dtype (line 257) | def get_state_dict_dtype(state_dict): function load_state_dict (line 291) | def load_state_dict( function _end_ptr (line 325) | def _end_ptr(tensor: torch.Tensor) -> int: function _get_tied_weight_keys (line 334) | def _get_tied_weight_keys(module: nn.Module) -> list[str]: function _find_disjoint (line 342) | def _find_disjoint(tensors: list[set[str]], state_dict: dict[str, torch.... function _find_identical (line 373) | def _find_identical(tensors: list[set[str]], state_dict: dict[str, torch... function remove_tied_weights_from_state_dict (line 392) | def remove_tied_weights_from_state_dict( function _load_parameter_into_model (line 472) | def _load_parameter_into_model(model: "PreTrainedModel", param_name: str... function _add_variant (line 482) | def _add_variant(weights_name: str, variant: str | None = None) -> str: function _get_resolved_checkpoint_files (line 489) | def _get_resolved_checkpoint_files( function _get_dtype (line 757) | def _get_dtype( class ModuleUtilsMixin (line 838) | class ModuleUtilsMixin: method device (line 844) | def device(self) -> torch.device: method dtype (line 852) | def dtype(self) -> torch.dtype: method invert_attention_mask (line 858) | def invert_attention_mask(self, encoder_attention_mask: Tensor) -> Ten... method create_extended_attention_mask_for_decoder (line 881) | def create_extended_attention_mask_for_decoder(input_shape, attention_... method get_extended_attention_mask (line 902) | def get_extended_attention_mask( method num_parameters (line 951) | def num_parameters(self, only_trainable: bool = False, exclude_embeddi... class EmbeddingAccessMixin (line 996) | class EmbeddingAccessMixin: method get_input_embeddings (line 1006) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1035) | def set_input_embeddings(self, value: nn.Module): method get_output_embeddings (line 1065) | def get_output_embeddings(self): method set_output_embeddings (line 1076) | def set_output_embeddings(self, new_embeddings): class PreTrainedModel (line 1084) | class PreTrainedModel(nn.Module, EmbeddingAccessMixin, ModuleUtilsMixin,... method can_record_outputs (line 1170) | def can_record_outputs(self) -> dict[str, OutputRecorder]: method dummy_inputs (line 1212) | def dummy_inputs(self) -> dict[str, torch.Tensor]: method __init_subclass__ (line 1218) | def __init_subclass__(cls, **kwargs): method __init__ (line 1242) | def __init__(self, config: PreTrainedConfig, *inputs, **kwargs): method post_init (line 1282) | def post_init(self): method tp_plan (line 1332) | def tp_plan(self) -> dict[str, str]: method pp_plan (line 1341) | def pp_plan(self) -> dict[str, tuple[str, str]]: method tp_plan (line 1345) | def tp_plan(self, plan: dict[str, str] | None): method pp_plan (line 1381) | def pp_plan(self, plan: dict[str, tuple[str, str]] | None): method dequantize (line 1390) | def dequantize(self, dtype=None): method _backward_compatibility_gradient_checkpointing (line 1402) | def _backward_compatibility_gradient_checkpointing(self): method add_model_tags (line 1408) | def add_model_tags(self, tags: list[str] | str) -> None: method _from_config (line 1441) | def _from_config(cls, config, **kwargs): method base_model (line 1513) | def base_model(self) -> nn.Module: method can_generate (line 1520) | def can_generate(cls) -> bool: method _flash_attn_import_error (line 1557) | def _flash_attn_import_error( method _flash_attn_can_dispatch (line 1623) | def _flash_attn_can_dispatch(self, flash_attn_version: int, is_init_ch... method _sdpa_can_dispatch (line 1698) | def _sdpa_can_dispatch(self, is_init_check: bool = False) -> bool: method _grouped_mm_can_dispatch (line 1728) | def _grouped_mm_can_dispatch(self) -> bool: method _flex_attn_can_dispatch (line 1739) | def _flex_attn_can_dispatch(self, is_init_check: bool = False) -> bool: method _check_and_adjust_attn_implementation (line 1766) | def _check_and_adjust_attn_implementation( method _check_and_adjust_experts_implementation (line 1875) | def _check_and_adjust_experts_implementation(self, experts_implementat... method get_correct_attn_implementation (line 1888) | def get_correct_attn_implementation(self, requested_attention: str | N... method get_correct_experts_implementation (line 1926) | def get_correct_experts_implementation(self, requested_experts: str | ... method _can_set_attn_implementation (line 1948) | def _can_set_attn_implementation(cls) -> bool: method _can_set_experts_implementation (line 1967) | def _can_set_experts_implementation(cls) -> bool: method set_attn_implementation (line 1981) | def set_attn_implementation(self, attn_implementation: str | dict, all... method set_experts_implementation (line 2083) | def set_experts_implementation(self, experts_implementation: str | dict): method enable_input_require_grads (line 2127) | def enable_input_require_grads(self): method disable_input_require_grads (line 2171) | def disable_input_require_grads(self): method get_encoder (line 2186) | def get_encoder(self, modality: str | None = None): method set_encoder (line 2218) | def set_encoder(self, encoder, modality: str | None = None): method get_decoder (line 2244) | def get_decoder(self): method set_decoder (line 2267) | def set_decoder(self, decoder): method _init_weights (line 2285) | def _init_weights(self, module): method _initialize_weights (line 2342) | def _initialize_weights(self, module, is_remote_code: bool = False): method initialize_weights (line 2369) | def initialize_weights(self): method get_expanded_tied_weights_keys (line 2395) | def get_expanded_tied_weights_keys(self, all_submodels: bool = False) ... method tie_weights (line 2509) | def tie_weights(self, missing_keys: set[str] | None = None, recompute_... method _adjust_bias (line 2592) | def _adjust_bias(self, output_embeddings, input_embeddings): method resize_token_embeddings (line 2604) | def resize_token_embeddings( method _resize_token_embeddings (line 2663) | def _resize_token_embeddings(self, new_num_tokens, pad_to_multiple_of=... method _get_resized_embeddings (line 2702) | def _get_resized_embeddings( method _get_resized_lm_head (line 2860) | def _get_resized_lm_head( method _init_added_embeddings_weights_with_mean (line 2989) | def _init_added_embeddings_weights_with_mean( method _init_added_lm_head_weights_with_mean (line 3014) | def _init_added_lm_head_weights_with_mean( method _init_added_lm_head_bias_with_mean (line 3036) | def _init_added_lm_head_bias_with_mean(self, old_lm_head, new_lm_head,... method _copy_lm_head_original_to_resized (line 3041) | def _copy_lm_head_original_to_resized( method resize_position_embeddings (line 3054) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 3060) | def get_position_embeddings(self) -> nn.Embedding | tuple[nn.Embedding]: method init_weights (line 3066) | def init_weights(self): method gradient_checkpointing_enable (line 3078) | def gradient_checkpointing_enable(self, gradient_checkpointing_kwargs=... method _set_gradient_checkpointing (line 3120) | def _set_gradient_checkpointing(self, enable: bool = True, gradient_ch... method gradient_checkpointing_disable (line 3142) | def gradient_checkpointing_disable(self): method is_gradient_checkpointing (line 3163) | def is_gradient_checkpointing(self) -> bool: method save_pretrained (line 3169) | def save_pretrained( method push_to_hub (line 3455) | def push_to_hub(self, *args, **kwargs): method get_memory_footprint (line 3470) | def get_memory_footprint(self, return_buffers=True): method cuda (line 3489) | def cuda(self, *args, **kwargs): method to (line 3515) | def to(self, *args, **kwargs): method half (line 3575) | def half(self, *args): method float (line 3585) | def float(self, *args): method get_init_context (line 3596) | def get_init_context( method _get_dtype_plan (line 3624) | def _get_dtype_plan(self, dtype: torch.dtype) -> dict: method set_use_kernels (line 3640) | def set_use_kernels(self, use_kernels, kernel_config: KernelConfig | N... method from_pretrained (line 3680) | def from_pretrained( method _load_pretrained_model (line 4174) | def _load_pretrained_model( method _finalize_model_loading (line 4266) | def _finalize_model_loading( method retrieve_modules_from_names (line 4304) | def retrieve_modules_from_names(self, names, add_prefix=False, remove_... method register_for_auto_class (line 4328) | def register_for_auto_class(cls, auto_class="AutoModel"): method warn_if_padding_and_no_attention_mask (line 4349) | def warn_if_padding_and_no_attention_mask(self, input_ids, attention_m... method supports_tp_plan (line 4387) | def supports_tp_plan(self): method tp_size (line 4403) | def tp_size(self): method supports_pp_plan (line 4411) | def supports_pp_plan(self): method loss_function (line 4424) | def loss_function(self): method loss_function (line 4439) | def loss_function(self, value): method kernelize (line 4442) | def kernelize(self, mode=None): method use_kernels (line 4454) | def use_kernels(self) -> bool: method use_kernels (line 4458) | def use_kernels(self, value: bool) -> None: method get_compiled_call (line 4472) | def get_compiled_call(self, compile_config: CompileConfig | None) -> C... method is_backend_compatible (line 4491) | def is_backend_compatible(cls): method _move_missing_keys_from_meta_to_device (line 4494) | def _move_missing_keys_from_meta_to_device( method _initialize_missing_keys (line 4543) | def _initialize_missing_keys(self, is_quantized: bool) -> None: method _adjust_missing_and_unexpected_keys (line 4579) | def _adjust_missing_and_unexpected_keys(self, loading_info: LoadStateD... method mark_tied_weights_as_initialized (line 4609) | def mark_tied_weights_as_initialized(self, loading_info): method get_parameter_or_buffer (line 4637) | def get_parameter_or_buffer(self, target: str): method named_non_persistent_buffers (line 4661) | def named_non_persistent_buffers( method train (line 4674) | def train(self, mode: bool = True): method eval (line 4680) | def eval(self): method is_remote_code (line 4684) | def is_remote_code(cls) -> bool: function unwrap_model (line 4695) | def unwrap_model(model: nn.Module, recursive: bool = False) -> nn.Module: function is_accelerator_device (line 4720) | def is_accelerator_device(device: str | int | torch.device) -> bool: function get_total_byte_count (line 4730) | def get_total_byte_count( function caching_allocator_warmup (line 4764) | def caching_allocator_warmup(model: PreTrainedModel, expanded_device_map... class AttentionInterface (line 4831) | class AttentionInterface(GeneralInterface): method get_interface (line 4853) | def get_interface(self, attn_implementation: str, default: Callable) -... class PreTrainedAudioTokenizerBase (line 4872) | class PreTrainedAudioTokenizerBase(PreTrainedModel): method encode (line 4883) | def encode(self, input_values: torch.Tensor, *args, **kwargs): method decode (line 4889) | def decode(self, audio_codes: torch.Tensor, *args, **kwargs): FILE: src/transformers/models/afmoe/configuration_afmoe.py class AfmoeConfig (line 31) | class AfmoeConfig(PreTrainedConfig): method __post_init__ (line 96) | def __post_init__(self, **kwargs): FILE: src/transformers/models/afmoe/modeling_afmoe.py class AfmoeRotaryEmbedding (line 49) | class AfmoeRotaryEmbedding(nn.Module): method __init__ (line 52) | def __init__(self, config: AfmoeConfig, device=None): method compute_default_rope_parameters (line 69) | def compute_default_rope_parameters( method forward (line 100) | def forward(self, x, position_ids): class AfmoeRMSNorm (line 115) | class AfmoeRMSNorm(nn.Module): method __init__ (line 116) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 124) | def forward(self, hidden_states) -> torch.Tensor: method extra_repr (line 131) | def extra_repr(self): class AfmoeMLP (line 135) | class AfmoeMLP(nn.Module): method __init__ (line 136) | def __init__(self, config, intermediate_size=None): method forward (line 146) | def forward(self, x): class AfmoeTokenChoiceRouter (line 151) | class AfmoeTokenChoiceRouter(nn.Module): method __init__ (line 158) | def __init__(self, config): method forward (line 166) | def forward(self, hidden_states: torch.Tensor, expert_bias: torch.Tens... class AfmoeExperts (line 182) | class AfmoeExperts(nn.Module): method __init__ (line 185) | def __init__(self, config): method forward (line 194) | def forward( class AfmoeSparseMoeBlock (line 221) | class AfmoeSparseMoeBlock(nn.Module): method __init__ (line 229) | def __init__(self, config): method forward (line 237) | def forward(self, hidden_states): function rotate_half (line 252) | def rotate_half(x): function apply_rotary_pos_emb (line 260) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 285) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 297) | def eager_attention_forward( class AfmoeAttention (line 323) | class AfmoeAttention(nn.Module): method __init__ (line 332) | def __init__(self, config: AfmoeConfig, layer_idx: int): method forward (line 363) | def forward( class AfmoeDecoderLayer (line 412) | class AfmoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 420) | def __init__(self, config: AfmoeConfig, layer_idx: int): method forward (line 442) | def forward( class AfmoePreTrainedModel (line 478) | class AfmoePreTrainedModel(PreTrainedModel): method _init_weights (line 512) | def _init_weights(self, module): class AfmoeModel (line 526) | class AfmoeModel(AfmoePreTrainedModel): method __init__ (line 534) | def __init__(self, config: AfmoeConfig): method forward (line 552) | def forward( class AfmoeForCausalLM (line 616) | class AfmoeForCausalLM(AfmoePreTrainedModel, GenerationMixin): method __init__ (line 621) | def __init__(self, config): method forward (line 630) | def forward( FILE: src/transformers/models/afmoe/modular_afmoe.py class AfmoeRotaryEmbedding (line 47) | class AfmoeRotaryEmbedding(LlamaRotaryEmbedding): class AfmoeRMSNorm (line 51) | class AfmoeRMSNorm(GptOssRMSNorm): class AfmoeMLP (line 55) | class AfmoeMLP(Qwen2MoeMLP): class AfmoeTokenChoiceRouter (line 59) | class AfmoeTokenChoiceRouter(nn.Module): method __init__ (line 66) | def __init__(self, config): method forward (line 74) | def forward(self, hidden_states: torch.Tensor, expert_bias: torch.Tens... class AfmoeExperts (line 89) | class AfmoeExperts(Qwen2MoeExperts): class AfmoeSparseMoeBlock (line 93) | class AfmoeSparseMoeBlock(nn.Module): method __init__ (line 101) | def __init__(self, config): method forward (line 109) | def forward(self, hidden_states): class AfmoeAttention (line 124) | class AfmoeAttention(LlamaAttention): method __init__ (line 133) | def __init__(self, config: AfmoeConfig, layer_idx: int): method forward (line 144) | def forward( class AfmoeDecoderLayer (line 193) | class AfmoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 201) | def __init__(self, config: AfmoeConfig, layer_idx: int): method forward (line 223) | def forward( class AfmoePreTrainedModel (line 259) | class AfmoePreTrainedModel(PreTrainedModel): method _init_weights (line 293) | def _init_weights(self, module): class AfmoeModel (line 307) | class AfmoeModel(AfmoePreTrainedModel): method __init__ (line 315) | def __init__(self, config: AfmoeConfig): method forward (line 333) | def forward( class AfmoeForCausalLM (line 396) | class AfmoeForCausalLM(LlamaForCausalLM, AfmoePreTrainedModel, Generatio... method __init__ (line 401) | def __init__(self, config): method forward (line 410) | def forward( FILE: src/transformers/models/aimv2/configuration_aimv2.py class Aimv2VisionConfig (line 32) | class Aimv2VisionConfig(PreTrainedConfig): class Aimv2TextConfig (line 76) | class Aimv2TextConfig(PreTrainedConfig): method __post_init__ (line 109) | def __post_init__(self, **kwargs): class Aimv2Config (line 115) | class Aimv2Config(PreTrainedConfig): method __post_init__ (line 155) | def __post_init__(self, **kwargs): FILE: src/transformers/models/aimv2/convert_aimv2_original_pytorch_to_hf.py function load_original_state_dict (line 91) | def load_original_state_dict(model_id: str, revision: str | None = None)... function convert_old_keys_to_new_keys (line 109) | def convert_old_keys_to_new_keys(state_dict_keys: dict, ORIGINAL_TO_CONV... function split_qkv_tensor (line 125) | def split_qkv_tensor(key, tensor): function get_model_config_mapping (line 135) | def get_model_config_mapping(model_id: str): function write_model (line 144) | def write_model( function write_image_processor (line 211) | def write_image_processor(hf_repo_id: str, output_dir: str): function main (line 220) | def main(): FILE: src/transformers/models/aimv2/modeling_aimv2.py class Aimv2Output (line 47) | class Aimv2Output(ModelOutput): method to_tuple (line 75) | def to_tuple(self) -> tuple[Any]: class Aimv2RMSNorm (line 80) | class Aimv2RMSNorm(nn.Module): method __init__ (line 81) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 89) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 96) | def extra_repr(self): class Aimv2MLP (line 100) | class Aimv2MLP(nn.Module): method __init__ (line 101) | def __init__(self, config): method forward (line 111) | def forward(self, x): class Aimv2VisionEmbeddings (line 116) | class Aimv2VisionEmbeddings(nn.Module): method __init__ (line 117) | def __init__(self, config: Aimv2VisionConfig): method build_2d_sincos_position_embedding (line 132) | def build_2d_sincos_position_embedding( method forward (line 148) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class Aimv2TextEmbeddings (line 168) | class Aimv2TextEmbeddings(nn.Module): method __init__ (line 169) | def __init__(self, config: Aimv2TextConfig): method forward (line 181) | def forward( function eager_attention_forward (line 208) | def eager_attention_forward( class Aimv2Attention (line 231) | class Aimv2Attention(nn.Module): method __init__ (line 234) | def __init__(self, config): method forward (line 253) | def forward( class Aimv2EncoderLayer (line 292) | class Aimv2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 293) | def __init__(self, config: Aimv2VisionConfig): method forward (line 300) | def forward( class Aimv2Encoder (line 317) | class Aimv2Encoder(nn.Module): method __init__ (line 326) | def __init__(self, config: Aimv2Config): method forward (line 334) | def forward( class Aimv2AttentionPoolingHead (line 351) | class Aimv2AttentionPoolingHead(nn.Module): method __init__ (line 352) | def __init__(self, config: Aimv2VisionConfig): method forward (line 363) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Aimv2PreTrainedModel (line 386) | class Aimv2PreTrainedModel(PreTrainedModel): method _init_weights (line 407) | def _init_weights(self, module): class Aimv2VisionModel (line 425) | class Aimv2VisionModel(Aimv2PreTrainedModel): method __init__ (line 433) | def __init__(self, config: Aimv2VisionConfig): method get_input_embeddings (line 447) | def get_input_embeddings(self) -> nn.Module: method forward (line 453) | def forward( class Aimv2TextModel (line 503) | class Aimv2TextModel(Aimv2PreTrainedModel): method __init__ (line 511) | def __init__(self, config: Aimv2TextConfig): method get_input_embeddings (line 522) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 525) | def set_input_embeddings(self, value): method forward (line 531) | def forward( function _get_vector_norm (line 572) | def _get_vector_norm(tensor: torch.Tensor) -> torch.Tensor: class Aimv2Model (line 584) | class Aimv2Model(Aimv2PreTrainedModel): method __init__ (line 589) | def __init__(self, config: Aimv2Config): method get_text_features (line 609) | def get_text_features( method get_image_features (line 645) | def get_image_features( method forward (line 683) | def forward( FILE: src/transformers/models/aimv2/modular_aimv2.py class Aimv2VisionConfig (line 42) | class Aimv2VisionConfig(SiglipVisionConfig): class Aimv2TextConfig (line 83) | class Aimv2TextConfig(SiglipTextConfig): method __post_init__ (line 100) | def __post_init__(self, **kwargs): class Aimv2Config (line 106) | class Aimv2Config(SiglipConfig): class Aimv2Output (line 140) | class Aimv2Output(SiglipOutput): class Aimv2RMSNorm (line 144) | class Aimv2RMSNorm(LlamaRMSNorm): class Aimv2MLP (line 148) | class Aimv2MLP(LlamaMLP): class Aimv2VisionEmbeddings (line 152) | class Aimv2VisionEmbeddings(nn.Module): method __init__ (line 153) | def __init__(self, config: Aimv2VisionConfig): method build_2d_sincos_position_embedding (line 168) | def build_2d_sincos_position_embedding( method forward (line 184) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class Aimv2TextEmbeddings (line 204) | class Aimv2TextEmbeddings(CLIPTextEmbeddings): class Aimv2Attention (line 208) | class Aimv2Attention(SiglipAttention): method __init__ (line 209) | def __init__(self, config): class Aimv2EncoderLayer (line 217) | class Aimv2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 218) | def __init__(self, config: Aimv2VisionConfig): method forward (line 225) | def forward( class Aimv2Encoder (line 242) | class Aimv2Encoder(SiglipEncoder): class Aimv2AttentionPoolingHead (line 246) | class Aimv2AttentionPoolingHead(nn.Module): method __init__ (line 247) | def __init__(self, config: Aimv2VisionConfig): method forward (line 258) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Aimv2PreTrainedModel (line 281) | class Aimv2PreTrainedModel(PreTrainedModel): method _init_weights (line 302) | def _init_weights(self, module): class Aimv2VisionModel (line 320) | class Aimv2VisionModel(Aimv2PreTrainedModel): method __init__ (line 328) | def __init__(self, config: Aimv2VisionConfig): method get_input_embeddings (line 342) | def get_input_embeddings(self) -> nn.Module: method forward (line 348) | def forward( class Aimv2TextModel (line 398) | class Aimv2TextModel(Aimv2PreTrainedModel): method __init__ (line 406) | def __init__(self, config: Aimv2TextConfig): method get_input_embeddings (line 417) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 420) | def set_input_embeddings(self, value): method forward (line 426) | def forward( class Aimv2Model (line 468) | class Aimv2Model(CLIPModel): method __init__ (line 471) | def __init__(self, config: Aimv2Config): method forward (line 491) | def forward( FILE: src/transformers/models/albert/configuration_albert.py class AlbertConfig (line 25) | class AlbertConfig(PreTrainedConfig): FILE: src/transformers/models/albert/convert_albert_original_tf_checkpoint_to_pytorch.py function convert_tf_checkpoint_to_pytorch (line 27) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, albert_config_f... FILE: src/transformers/models/albert/modeling_albert.py class AlbertEmbeddings (line 49) | class AlbertEmbeddings(nn.Module): method __init__ (line 54) | def __init__(self, config: AlbertConfig): method forward (line 71) | def forward( function eager_attention_forward (line 114) | def eager_attention_forward( class AlbertAttention (line 142) | class AlbertAttention(nn.Module): method __init__ (line 143) | def __init__(self, config: AlbertConfig): method forward (line 170) | def forward( class AlbertLayer (line 207) | class AlbertLayer(nn.Module): method __init__ (line 208) | def __init__(self, config: AlbertConfig): method forward (line 221) | def forward( method ff_chunk (line 238) | def ff_chunk(self, attention_output: torch.Tensor) -> torch.Tensor: class AlbertLayerGroup (line 245) | class AlbertLayerGroup(nn.Module): method __init__ (line 246) | def __init__(self, config: AlbertConfig): method forward (line 251) | def forward( class AlbertTransformer (line 262) | class AlbertTransformer(nn.Module): method __init__ (line 263) | def __init__(self, config: AlbertConfig): method forward (line 270) | def forward( class AlbertPreTrainedModel (line 292) | class AlbertPreTrainedModel(PreTrainedModel): method _init_weights (line 305) | def _init_weights(self, module): class AlbertForPreTrainingOutput (line 332) | class AlbertForPreTrainingOutput(ModelOutput): class AlbertModel (line 352) | class AlbertModel(AlbertPreTrainedModel): method __init__ (line 356) | def __init__(self, config: AlbertConfig, add_pooling_layer: bool = True): method get_input_embeddings (line 378) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 381) | def set_input_embeddings(self, value: nn.Embedding) -> None: method forward (line 387) | def forward( class AlbertForPreTraining (line 432) | class AlbertForPreTraining(AlbertPreTrainedModel): method __init__ (line 438) | def __init__(self, config: AlbertConfig): method get_output_embeddings (line 448) | def get_output_embeddings(self) -> nn.Linear: method set_output_embeddings (line 451) | def set_output_embeddings(self, new_embeddings: nn.Linear) -> None: method get_input_embeddings (line 454) | def get_input_embeddings(self) -> nn.Embedding: method forward (line 459) | def forward( class AlbertMLMHead (line 527) | class AlbertMLMHead(nn.Module): method __init__ (line 528) | def __init__(self, config: AlbertConfig): method forward (line 537) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class AlbertSOPHead (line 548) | class AlbertSOPHead(nn.Module): method __init__ (line 549) | def __init__(self, config: AlbertConfig): method forward (line 555) | def forward(self, pooled_output: torch.Tensor) -> torch.Tensor: class AlbertForMaskedLM (line 562) | class AlbertForMaskedLM(AlbertPreTrainedModel): method __init__ (line 568) | def __init__(self, config): method get_output_embeddings (line 577) | def get_output_embeddings(self) -> nn.Linear: method set_output_embeddings (line 580) | def set_output_embeddings(self, new_embeddings: nn.Linear) -> None: method get_input_embeddings (line 584) | def get_input_embeddings(self) -> nn.Embedding: method forward (line 589) | def forward( class AlbertForSequenceClassification (line 666) | class AlbertForSequenceClassification(AlbertPreTrainedModel): method __init__ (line 667) | def __init__(self, config: AlbertConfig): method forward (line 681) | def forward( class AlbertForTokenClassification (line 744) | class AlbertForTokenClassification(AlbertPreTrainedModel): method __init__ (line 745) | def __init__(self, config: AlbertConfig): method forward (line 763) | def forward( class AlbertForQuestionAnswering (line 806) | class AlbertForQuestionAnswering(AlbertPreTrainedModel): method __init__ (line 807) | def __init__(self, config: AlbertConfig): method forward (line 819) | def forward( class AlbertForMultipleChoice (line 874) | class AlbertForMultipleChoice(AlbertPreTrainedModel): method __init__ (line 875) | def __init__(self, config: AlbertConfig): method forward (line 887) | def forward( FILE: src/transformers/models/albert/tokenization_albert.py class AlbertTokenizer (line 28) | class AlbertTokenizer(TokenizersBackend): method __init__ (line 84) | def __init__( FILE: src/transformers/models/align/configuration_align.py class AlignTextConfig (line 27) | class AlignTextConfig(PreTrainedConfig): class AlignVisionConfig (line 66) | class AlignVisionConfig(PreTrainedConfig): method __post_init__ (line 139) | def __post_init__(self, **kwargs): class AlignConfig (line 157) | class AlignConfig(PreTrainedConfig): method __post_init__ (line 195) | def __post_init__(self, **kwargs): FILE: src/transformers/models/align/convert_align_tf_to_hf.py function preprocess (line 44) | def preprocess(image): function get_align_config (line 50) | def get_align_config(): function prepare_img (line 64) | def prepare_img(): function get_processor (line 71) | def get_processor(): function rename_keys (line 87) | def rename_keys(original_param_names): function replace_params (line 259) | def replace_params(hf_params, tf_params, key_mapping): function convert_align_checkpoint (line 287) | def convert_align_checkpoint(checkpoint_path, pytorch_dump_folder_path, ... FILE: src/transformers/models/align/modeling_align.py class AlignVisionModelOutput (line 51) | class AlignVisionModelOutput(ModelOutput): class AlignTextModelOutput (line 68) | class AlignTextModelOutput(ModelOutput): class AlignOutput (line 82) | class AlignOutput(ModelOutput): method to_tuple (line 110) | def to_tuple(self) -> tuple[Any]: function contrastive_loss (line 119) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function align_loss (line 123) | def align_loss(similarity: torch.Tensor) -> torch.Tensor: function round_filters (line 130) | def round_filters(config: AlignVisionConfig, num_channels: int): function correct_pad (line 146) | def correct_pad(kernel_size: int | tuple, adjust: bool = True): class AlignVisionEmbeddings (line 167) | class AlignVisionEmbeddings(nn.Module): method __init__ (line 172) | def __init__(self, config: AlignVisionConfig): method forward (line 183) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class AlignVisionDepthwiseConv2d (line 193) | class AlignVisionDepthwiseConv2d(nn.Conv2d): method __init__ (line 194) | def __init__( class AlignVisionExpansionLayer (line 220) | class AlignVisionExpansionLayer(nn.Module): method __init__ (line 225) | def __init__(self, config: AlignVisionConfig, in_dim: int, out_dim: in... method forward (line 237) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class AlignVisionDepthwiseLayer (line 247) | class AlignVisionDepthwiseLayer(nn.Module): method __init__ (line 252) | def __init__( method forward (line 274) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class AlignVisionSqueezeExciteLayer (line 287) | class AlignVisionSqueezeExciteLayer(nn.Module): method __init__ (line 292) | def __init__(self, config: AlignVisionConfig, in_dim: int, expand_dim:... method forward (line 313) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class AlignVisionFinalBlockLayer (line 326) | class AlignVisionFinalBlockLayer(nn.Module): method __init__ (line 331) | def __init__( method forward (line 348) | def forward(self, embeddings: torch.FloatTensor, hidden_states: torch.... class AlignVisionBlock (line 359) | class AlignVisionBlock(nn.Module): method __init__ (line 386) | def __init__( method forward (line 427) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class AlignVisionEncoder (line 440) | class AlignVisionEncoder(nn.Module): method __init__ (line 449) | def __init__(self, config: AlignVisionConfig): method forward (line 492) | def forward( class AlignTextEmbeddings (line 505) | class AlignTextEmbeddings(nn.Module): method __init__ (line 508) | def __init__(self, config): method forward (line 524) | def forward( function eager_attention_forward (line 565) | def eager_attention_forward( class AlignTextSelfAttention (line 587) | class AlignTextSelfAttention(nn.Module): method __init__ (line 588) | def __init__(self, config): method forward (line 609) | def forward( class AlignTextSelfOutput (line 642) | class AlignTextSelfOutput(nn.Module): method __init__ (line 643) | def __init__(self, config): method forward (line 649) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class AlignTextAttention (line 656) | class AlignTextAttention(nn.Module): method __init__ (line 657) | def __init__(self, config): method forward (line 662) | def forward( class AlignTextIntermediate (line 679) | class AlignTextIntermediate(nn.Module): method __init__ (line 680) | def __init__(self, config): method forward (line 688) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class AlignTextOutput (line 695) | class AlignTextOutput(nn.Module): method __init__ (line 696) | def __init__(self, config): method forward (line 702) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class AlignTextLayer (line 709) | class AlignTextLayer(GradientCheckpointingLayer): method __init__ (line 710) | def __init__(self, config): method forward (line 718) | def forward( method feed_forward_chunk (line 736) | def feed_forward_chunk(self, attention_output): class AlignTextEncoder (line 742) | class AlignTextEncoder(nn.Module): method __init__ (line 743) | def __init__(self, config): method forward (line 749) | def forward( class AlignTextPooler (line 768) | class AlignTextPooler(nn.Module): method __init__ (line 769) | def __init__(self, config): method forward (line 774) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class AlignPreTrainedModel (line 784) | class AlignPreTrainedModel(PreTrainedModel): method _init_weights (line 791) | def _init_weights(self, module: nn.Module): class AlignTextModel (line 824) | class AlignTextModel(AlignPreTrainedModel): method __init__ (line 833) | def __init__(self, config: AlignTextConfig, add_pooling_layer: bool = ... method get_input_embeddings (line 849) | def get_input_embeddings(self): method set_input_embeddings (line 852) | def set_input_embeddings(self, value): method forward (line 858) | def forward( class AlignVisionModel (line 927) | class AlignVisionModel(AlignPreTrainedModel): method __init__ (line 938) | def __init__(self, config: AlignVisionConfig): method forward (line 958) | def forward( class AlignModel (line 1004) | class AlignModel(AlignPreTrainedModel): method __init__ (line 1007) | def __init__(self, config: AlignConfig): method get_text_features (line 1039) | def get_text_features( method get_image_features (line 1077) | def get_image_features( method forward (line 1102) | def forward( FILE: src/transformers/models/align/processing_align.py class AlignProcessorKwargs (line 22) | class AlignProcessorKwargs(ProcessingKwargs, total=False): class AlignProcessor (line 33) | class AlignProcessor(ProcessorMixin): method __init__ (line 36) | def __init__(self, image_processor, tokenizer): FILE: src/transformers/models/altclip/configuration_altclip.py class AltCLIPTextConfig (line 27) | class AltCLIPTextConfig(PreTrainedConfig): class AltCLIPVisionConfig (line 70) | class AltCLIPVisionConfig(PreTrainedConfig): class AltCLIPConfig (line 107) | class AltCLIPConfig(PreTrainedConfig): method __post_init__ (line 140) | def __post_init__(self, **kwargs): FILE: src/transformers/models/altclip/modeling_altclip.py function contrastive_loss (line 46) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function clip_loss (line 50) | def clip_loss(similarity: torch.Tensor) -> torch.Tensor: class AltCLIPOutput (line 59) | class AltCLIPOutput(ModelOutput): method to_tuple (line 87) | def to_tuple(self) -> tuple[Any]: class AltRobertaEmbeddings (line 92) | class AltRobertaEmbeddings(nn.Module): method __init__ (line 95) | def __init__(self, config): method forward (line 115) | def forward( method create_position_ids_from_inputs_embeds (line 164) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 182) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class AltRobertaSelfAttention (line 198) | class AltRobertaSelfAttention(nn.Module): method __init__ (line 199) | def __init__(self, config): method forward (line 218) | def forward( class AltRobertaSelfOutput (line 256) | class AltRobertaSelfOutput(nn.Module): method __init__ (line 257) | def __init__(self, config): method forward (line 263) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class AltRobertaAttention (line 275) | class AltRobertaAttention(nn.Module): method __init__ (line 276) | def __init__(self, config): method forward (line 281) | def forward( class AltRobertaIntermediate (line 297) | class AltRobertaIntermediate(nn.Module): method __init__ (line 298) | def __init__(self, config): method forward (line 306) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class AltRobertaOutput (line 313) | class AltRobertaOutput(nn.Module): method __init__ (line 314) | def __init__(self, config): method forward (line 320) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class AltRobertaLayer (line 328) | class AltRobertaLayer(GradientCheckpointingLayer): method __init__ (line 329) | def __init__(self, config): method forward (line 337) | def forward( method feed_forward_chunk (line 355) | def feed_forward_chunk(self, attention_output): class AltRobertaEncoder (line 362) | class AltRobertaEncoder(nn.Module): method __init__ (line 363) | def __init__(self, config): method forward (line 369) | def forward( class AltRobertaPooler (line 388) | class AltRobertaPooler(nn.Module): method __init__ (line 389) | def __init__(self, config): method forward (line 394) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 404) | def eager_attention_forward( class AltCLIPAttention (line 427) | class AltCLIPAttention(nn.Module): method __init__ (line 430) | def __init__(self, config): method forward (line 450) | def forward( class AltCLIPMLP (line 489) | class AltCLIPMLP(nn.Module): method __init__ (line 490) | def __init__(self, config): method forward (line 497) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class AltCLIPEncoderLayer (line 504) | class AltCLIPEncoderLayer(GradientCheckpointingLayer): method __init__ (line 505) | def __init__(self, config: AltCLIPConfig): method forward (line 513) | def forward( class AltCLIPEncoder (line 537) | class AltCLIPEncoder(nn.Module): method __init__ (line 546) | def __init__(self, config: AltCLIPConfig): method forward (line 552) | def forward( class AltCLIPVisionEmbeddings (line 587) | class AltCLIPVisionEmbeddings(nn.Module): method __init__ (line 588) | def __init__(self, config: AltCLIPVisionConfig): method interpolate_pos_encoding (line 610) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 651) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class AltCLIPPreTrainedModel (line 671) | class AltCLIPPreTrainedModel(PreTrainedModel): method _init_weights (line 679) | def _init_weights(self, module): class AltCLIPVisionTransformer (line 728) | class AltCLIPVisionTransformer(nn.Module): method __init__ (line 729) | def __init__(self, config: AltCLIPVisionConfig): method forward (line 740) | def forward( class AltCLIPVisionModel (line 767) | class AltCLIPVisionModel(AltCLIPPreTrainedModel): method __init__ (line 776) | def __init__(self, config: AltCLIPVisionConfig): method get_input_embeddings (line 782) | def get_input_embeddings(self) -> nn.Module: method forward (line 788) | def forward( class AltRobertaModel (line 832) | class AltRobertaModel(AltCLIPPreTrainedModel): method __init__ (line 840) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 856) | def get_input_embeddings(self): method set_input_embeddings (line 859) | def set_input_embeddings(self, value): method forward (line 866) | def forward( class AltCLIPTextModel (line 915) | class AltCLIPTextModel(AltCLIPPreTrainedModel): method __init__ (line 919) | def __init__(self, config): method get_input_embeddings (line 926) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 929) | def set_input_embeddings(self, value: nn.Embedding) -> None: method resize_token_embeddings (line 932) | def resize_token_embeddings(self, new_num_tokens: int | None = None) -... method forward (line 937) | def forward( class AltCLIPModel (line 991) | class AltCLIPModel(AltCLIPPreTrainedModel): method __init__ (line 998) | def __init__(self, config: AltCLIPConfig): method get_text_features (line 1033) | def get_text_features( method get_image_features (line 1070) | def get_image_features( method forward (line 1106) | def forward( FILE: src/transformers/models/altclip/processing_altclip.py class AltCLIPProcessor (line 23) | class AltCLIPProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, image_processor=None, tokenizer=None): FILE: src/transformers/models/apertus/configuration_apertus.py class ApertusConfig (line 30) | class ApertusConfig(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): FILE: src/transformers/models/apertus/modeling_apertus.py class ApertusMLP (line 43) | class ApertusMLP(nn.Module): method __init__ (line 44) | def __init__(self, config): method forward (line 55) | def forward(self, x): class ApertusRMSNorm (line 60) | class ApertusRMSNorm(nn.Module): method __init__ (line 61) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 69) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 76) | def extra_repr(self): class ApertusRotaryEmbedding (line 80) | class ApertusRotaryEmbedding(nn.Module): method __init__ (line 83) | def __init__(self, config: ApertusConfig, device=None): method compute_default_rope_parameters (line 100) | def compute_default_rope_parameters( method forward (line 131) | def forward(self, x, position_ids): function rotate_half (line 145) | def rotate_half(x): function apply_rotary_pos_emb (line 153) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 178) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 190) | def eager_attention_forward( class ApertusAttention (line 216) | class ApertusAttention(nn.Module): method __init__ (line 219) | def __init__(self, config: ApertusConfig, layer_idx: int | None = None): method forward (line 244) | def forward( class ApertusDecoderLayer (line 287) | class ApertusDecoderLayer(GradientCheckpointingLayer): method __init__ (line 288) | def __init__(self, config: ApertusConfig, layer_idx: int): method forward (line 298) | def forward( class ApertusPreTrainedModel (line 330) | class ApertusPreTrainedModel(PreTrainedModel): class ApertusModel (line 349) | class ApertusModel(ApertusPreTrainedModel): method __init__ (line 350) | def __init__(self, config: ApertusConfig): method forward (line 369) | def forward( class ApertusForCausalLM (line 423) | class ApertusForCausalLM(ApertusPreTrainedModel, GenerationMixin): method __init__ (line 428) | def __init__(self, config): method forward (line 439) | def forward( class ApertusForTokenClassification (line 501) | class ApertusForTokenClassification(GenericForTokenClassification, Apert... FILE: src/transformers/models/apertus/modular_apertus.py class ApertusConfig (line 48) | class ApertusConfig(PreTrainedConfig): method __post_init__ (line 101) | def __post_init__(self, **kwargs): class ApertusMLP (line 117) | class ApertusMLP(NemotronMLP): method __init__ (line 118) | def __init__(self, config): class ApertusRMSNorm (line 126) | class ApertusRMSNorm(LlamaRMSNorm): class ApertusRotaryEmbedding (line 130) | class ApertusRotaryEmbedding(LlamaRotaryEmbedding): class ApertusAttention (line 134) | class ApertusAttention(LlamaAttention): method __init__ (line 135) | def __init__(self, config: ApertusConfig, layer_idx: int | None = None): method forward (line 140) | def forward( class ApertusDecoderLayer (line 183) | class ApertusDecoderLayer(LlamaDecoderLayer): method __init__ (line 184) | def __init__(self, config: ApertusConfig, layer_idx: int): method forward (line 192) | def forward( class ApertusPreTrainedModel (line 223) | class ApertusPreTrainedModel(LlamaPreTrainedModel): class ApertusModel (line 227) | class ApertusModel(LlamaModel): class ApertusForCausalLM (line 231) | class ApertusForCausalLM(LlamaForCausalLM): method forward (line 232) | def forward(self, **super_kwargs): class ApertusForTokenClassification (line 258) | class ApertusForTokenClassification(LlamaForTokenClassification): FILE: src/transformers/models/arcee/configuration_arcee.py class ArceeConfig (line 31) | class ArceeConfig(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): method validate_architecture (line 91) | def validate_architecture(self): FILE: src/transformers/models/arcee/modeling_arcee.py class ArceeMLP (line 50) | class ArceeMLP(nn.Module): method __init__ (line 51) | def __init__(self, config): method forward (line 60) | def forward(self, x): class ArceeRMSNorm (line 65) | class ArceeRMSNorm(nn.Module): method __init__ (line 66) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 74) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 81) | def extra_repr(self): class ArceeRotaryEmbedding (line 85) | class ArceeRotaryEmbedding(nn.Module): method __init__ (line 88) | def __init__(self, config: ArceeConfig, device=None): method compute_default_rope_parameters (line 105) | def compute_default_rope_parameters( method forward (line 136) | def forward(self, x, position_ids): function rotate_half (line 150) | def rotate_half(x): function apply_rotary_pos_emb (line 158) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 183) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 195) | def eager_attention_forward( class ArceeAttention (line 221) | class ArceeAttention(nn.Module): method __init__ (line 224) | def __init__(self, config: ArceeConfig, layer_idx: int): method forward (line 247) | def forward( class ArceeDecoderLayer (line 288) | class ArceeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 289) | def __init__(self, config: ArceeConfig, layer_idx: int): method forward (line 299) | def forward( class ArceePreTrainedModel (line 332) | class ArceePreTrainedModel(PreTrainedModel): class ArceeModel (line 351) | class ArceeModel(ArceePreTrainedModel): method __init__ (line 352) | def __init__(self, config: ArceeConfig): method forward (line 371) | def forward( class ArceeForCausalLM (line 425) | class ArceeForCausalLM(ArceePreTrainedModel, GenerationMixin): method __init__ (line 430) | def __init__(self, config): method forward (line 441) | def forward( class ArceeForSequenceClassification (line 499) | class ArceeForSequenceClassification(GenericForSequenceClassification, A... class ArceeForQuestionAnswering (line 504) | class ArceeForQuestionAnswering(GenericForQuestionAnswering, ArceePreTra... class ArceeForTokenClassification (line 509) | class ArceeForTokenClassification(GenericForTokenClassification, ArceePr... FILE: src/transformers/models/arcee/modular_arcee.py class ArceeConfig (line 36) | class ArceeConfig(LlamaConfig): class ArceeMLP (line 85) | class ArceeMLP(NemotronMLP): class ArceeForCausalLM (line 90) | class ArceeForCausalLM(LlamaForCausalLM): class ArceeForSequenceClassification (line 95) | class ArceeForSequenceClassification(LlamaForSequenceClassification): class ArceeForQuestionAnswering (line 100) | class ArceeForQuestionAnswering(LlamaForQuestionAnswering): class ArceeForTokenClassification (line 105) | class ArceeForTokenClassification(LlamaForTokenClassification): FILE: src/transformers/models/aria/configuration_aria.py class AriaTextConfig (line 31) | class AriaTextConfig(PreTrainedConfig): method __post_init__ (line 85) | def __post_init__(self, **kwargs): method validate_architecture (line 93) | def validate_architecture(self): class AriaConfig (line 104) | class AriaConfig(PreTrainedConfig): method __post_init__ (line 124) | def __post_init__(self, **kwargs): FILE: src/transformers/models/aria/convert_aria_weights_to_hf.py function load_original_state_dict (line 57) | def load_original_state_dict(model_id): function convert_state_dict_to_hf (line 70) | def convert_state_dict_to_hf(state_dict): function convert_aria_llama_to_hf (line 86) | def convert_aria_llama_to_hf(text_model_id, vision_model_id, output_hub_... function main (line 129) | def main(): FILE: src/transformers/models/aria/image_processing_aria.py class AriaImageProcessorKwargs (line 31) | class AriaImageProcessorKwargs(ImagesKwargs, total=False): class AriaImageProcessor (line 50) | class AriaImageProcessor(TorchvisionBackend): method __init__ (line 65) | def __init__(self, **kwargs: Unpack[AriaImageProcessorKwargs]): method _get_padding_size (line 71) | def _get_padding_size(self, original_resolution: tuple, target_resolut... method _resize_for_patching (line 79) | def _resize_for_patching( method _pad_for_patching (line 91) | def _pad_for_patching( method get_image_patches (line 101) | def get_image_patches( method _preprocess (line 134) | def _preprocess( method get_number_of_image_patches (line 203) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/aria/image_processing_pil_aria.py class AriaImageProcessorKwargs (line 32) | class AriaImageProcessorKwargs(ImagesKwargs, total=False): class AriaImageProcessorPil (line 51) | class AriaImageProcessorPil(PilBackend): method __init__ (line 66) | def __init__(self, **kwargs: Unpack[AriaImageProcessorKwargs]): method _get_padding_size (line 72) | def _get_padding_size(self, original_resolution: tuple, target_resolut... method _resize_for_patching (line 80) | def _resize_for_patching( method _pad_for_patching (line 92) | def _pad_for_patching( method get_image_patches (line 104) | def get_image_patches( method _preprocess (line 137) | def _preprocess( method get_number_of_image_patches (line 207) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/aria/modeling_aria.py class AriaTextRMSNorm (line 52) | class AriaTextRMSNorm(nn.Module): method __init__ (line 53) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 61) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 68) | def extra_repr(self): class AriaProjectorMLP (line 72) | class AriaProjectorMLP(nn.Module): method __init__ (line 85) | def __init__(self, in_features, hidden_features, output_dim): method forward (line 91) | def forward(self, hidden_states): class AriaCrossAttention (line 97) | class AriaCrossAttention(nn.Module): method __init__ (line 106) | def __init__(self, config: AriaConfig, dropout_rate: float = 0): method forward (line 123) | def forward(self, key_value_states, hidden_states, attn_mask=None): class AriaProjector (line 152) | class AriaProjector(nn.Module): method __init__ (line 163) | def __init__( method forward (line 183) | def forward(self, key_value_states: torch.Tensor, attn_mask: torch.Ten... class AriaSharedExpertsMLP (line 217) | class AriaSharedExpertsMLP(nn.Module): method __init__ (line 228) | def __init__(self, config: AriaTextConfig): method forward (line 238) | def forward(self, x): function sequential_experts_gemm (line 243) | def sequential_experts_gemm(token_states, expert_weights, tokens_per_exp... class AriaGroupedExpertsGemm (line 274) | class AriaGroupedExpertsGemm(nn.Module): method __init__ (line 291) | def __init__(self, in_features, out_features, groups): method forward (line 298) | def forward(self, input, tokens_per_expert): class AriaExperts (line 318) | class AriaExperts(nn.Module): method __init__ (line 319) | def __init__(self, config: AriaTextConfig) -> None: method route_tokens_to_experts (line 325) | def route_tokens_to_experts(self, router_logits): method forward (line 330) | def forward(self, hidden_states, router_logits) -> torch.Tensor: class AriaTextMoELayer (line 362) | class AriaTextMoELayer(nn.Module): method __init__ (line 363) | def __init__(self, config: AriaTextConfig): method forward (line 370) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function rotate_half (line 379) | def rotate_half(x): function apply_rotary_pos_emb (line 387) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 412) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 424) | def eager_attention_forward( class AriaTextAttention (line 450) | class AriaTextAttention(nn.Module): method __init__ (line 453) | def __init__(self, config: AriaTextConfig, layer_idx: int): method forward (line 476) | def forward( class AriaTextDecoderLayer (line 517) | class AriaTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 530) | def __init__(self, config: AriaTextConfig, layer_idx: int): method forward (line 539) | def forward( class AriaTextPreTrainedModel (line 572) | class AriaTextPreTrainedModel(PreTrainedModel): method _init_weights (line 589) | def _init_weights(self, module): class AriaPreTrainedModel (line 596) | class AriaPreTrainedModel(PreTrainedModel): method _init_weights (line 613) | def _init_weights(self, module): class AriaTextRotaryEmbedding (line 619) | class AriaTextRotaryEmbedding(nn.Module): method __init__ (line 622) | def __init__(self, config: AriaTextConfig, device=None): method compute_default_rope_parameters (line 639) | def compute_default_rope_parameters( method forward (line 670) | def forward(self, x, position_ids): class AriaTextModel (line 685) | class AriaTextModel(AriaTextPreTrainedModel): method __init__ (line 686) | def __init__(self, config: AriaTextConfig): method forward (line 705) | def forward( class AriaTextForCausalLM (line 759) | class AriaTextForCausalLM(AriaTextPreTrainedModel, GenerationMixin): method __init__ (line 764) | def __init__(self, config: AriaTextConfig): method forward (line 774) | def forward( class AriaCausalLMOutputWithPast (line 837) | class AriaCausalLMOutputWithPast(ModelOutput): class AriaModelOutputWithPast (line 867) | class AriaModelOutputWithPast(BaseModelOutputWithPast): class AriaModel (line 887) | class AriaModel(AriaPreTrainedModel): method __init__ (line 888) | def __init__(self, config: AriaConfig): method get_input_embeddings (line 895) | def get_input_embeddings(self): method set_input_embeddings (line 898) | def set_input_embeddings(self, value): method get_image_features (line 906) | def get_image_features( method get_placeholder_mask (line 932) | def get_placeholder_mask( method forward (line 958) | def forward( method _create_patch_attention_mask (line 1004) | def _create_patch_attention_mask(self, pixel_mask): class AriaForConditionalGeneration (line 1029) | class AriaForConditionalGeneration(AriaPreTrainedModel, GenerationMixin): method __init__ (line 1032) | def __init__(self, config: AriaConfig): method get_input_embeddings (line 1038) | def get_input_embeddings(self): method set_input_embeddings (line 1041) | def set_input_embeddings(self, value): method get_output_embeddings (line 1044) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 1048) | def get_image_features( method forward (line 1064) | def forward( method prepare_inputs_for_generation (line 1170) | def prepare_inputs_for_generation( FILE: src/transformers/models/aria/modular_aria.py function sequential_experts_gemm (line 67) | def sequential_experts_gemm(token_states, expert_weights, tokens_per_exp... class AriaTextConfig (line 100) | class AriaTextConfig(LlamaConfig): class AriaConfig (line 131) | class AriaConfig(PreTrainedConfig): method __post_init__ (line 151) | def __post_init__(self, **kwargs): class AriaTextRMSNorm (line 176) | class AriaTextRMSNorm(LlamaRMSNorm): class AriaProjectorMLP (line 180) | class AriaProjectorMLP(nn.Module): method __init__ (line 193) | def __init__(self, in_features, hidden_features, output_dim): method forward (line 199) | def forward(self, hidden_states): class AriaCrossAttention (line 205) | class AriaCrossAttention(nn.Module): method __init__ (line 214) | def __init__(self, config: AriaConfig, dropout_rate: float = 0): method forward (line 231) | def forward(self, key_value_states, hidden_states, attn_mask=None): class AriaProjector (line 260) | class AriaProjector(nn.Module): method __init__ (line 271) | def __init__( method forward (line 291) | def forward(self, key_value_states: torch.Tensor, attn_mask: torch.Ten... class AriaImageProcessorKwargs (line 325) | class AriaImageProcessorKwargs(ImagesKwargs, total=False): class AriaImageProcessor (line 344) | class AriaImageProcessor(TorchvisionBackend): method __init__ (line 359) | def __init__(self, **kwargs: Unpack[AriaImageProcessorKwargs]): method _get_padding_size (line 365) | def _get_padding_size(self, original_resolution: tuple, target_resolut... method _resize_for_patching (line 373) | def _resize_for_patching( method _pad_for_patching (line 385) | def _pad_for_patching( method get_image_patches (line 395) | def get_image_patches( method _preprocess (line 428) | def _preprocess( method get_number_of_image_patches (line 497) | def get_number_of_image_patches(self, height: int, width: int, images_... class AriaImagesKwargs (line 520) | class AriaImagesKwargs(ImagesKwargs, total=False): class AriaProcessorKwargs (line 541) | class AriaProcessorKwargs(ProcessingKwargs, total=False): class AriaProcessor (line 558) | class AriaProcessor(ProcessorMixin): method __init__ (line 559) | def __init__( method __call__ (line 582) | def __call__( method _get_num_multimodal_tokens (line 632) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 659) | def model_input_names(self): class AriaSharedExpertsMLP (line 669) | class AriaSharedExpertsMLP(LlamaMLP): method __init__ (line 680) | def __init__(self, config: AriaTextConfig): class AriaGroupedExpertsGemm (line 685) | class AriaGroupedExpertsGemm(nn.Module): method __init__ (line 702) | def __init__(self, in_features, out_features, groups): method forward (line 709) | def forward(self, input, tokens_per_expert): class AriaExperts (line 729) | class AriaExperts(nn.Module): method __init__ (line 730) | def __init__(self, config: AriaTextConfig) -> None: method route_tokens_to_experts (line 736) | def route_tokens_to_experts(self, router_logits): method forward (line 741) | def forward(self, hidden_states, router_logits) -> torch.Tensor: class AriaTextMoELayer (line 773) | class AriaTextMoELayer(nn.Module): method __init__ (line 774) | def __init__(self, config: AriaTextConfig): method forward (line 781) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class AriaTextAttention (line 790) | class AriaTextAttention(LlamaAttention): class AriaTextDecoderLayer (line 794) | class AriaTextDecoderLayer(LlamaDecoderLayer): method __init__ (line 807) | def __init__(self, config: AriaTextConfig, layer_idx: int): class AriaTextPreTrainedModel (line 813) | class AriaTextPreTrainedModel(PreTrainedModel): method _init_weights (line 830) | def _init_weights(self, module): class AriaPreTrainedModel (line 836) | class AriaPreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 843) | def _init_weights(self, module): class AriaTextModel (line 849) | class AriaTextModel(LlamaModel): method __init__ (line 850) | def __init__(self, config: AriaTextConfig): class AriaTextForCausalLM (line 859) | class AriaTextForCausalLM(AriaTextPreTrainedModel, LlamaForCausalLM): method __init__ (line 862) | def __init__(self, config: AriaTextConfig): method forward (line 872) | def forward(self, **super_kwargs): class AriaCausalLMOutputWithPast (line 876) | class AriaCausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class AriaModelOutputWithPast (line 880) | class AriaModelOutputWithPast(LlavaModelOutputWithPast): class AriaModel (line 884) | class AriaModel(LlavaModel): method __init__ (line 885) | def __init__(self, config: AriaConfig): method _create_patch_attention_mask (line 889) | def _create_patch_attention_mask(self, pixel_mask): method get_image_features (line 905) | def get_image_features( method forward (line 931) | def forward( class AriaForConditionalGeneration (line 986) | class AriaForConditionalGeneration(LlavaForConditionalGeneration): method get_image_features (line 990) | def get_image_features( method forward (line 1006) | def forward( method prepare_inputs_for_generation (line 1112) | def prepare_inputs_for_generation( FILE: src/transformers/models/aria/processing_aria.py class AriaImagesKwargs (line 28) | class AriaImagesKwargs(ImagesKwargs, total=False): class AriaProcessorKwargs (line 49) | class AriaProcessorKwargs(ProcessingKwargs, total=False): class AriaProcessor (line 66) | class AriaProcessor(ProcessorMixin): method __init__ (line 67) | def __init__( method __call__ (line 90) | def __call__( method _get_num_multimodal_tokens (line 140) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 167) | def model_input_names(self): FILE: src/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py class ASTConfig (line 24) | class ASTConfig(PreTrainedConfig): FILE: src/transformers/models/audio_spectrogram_transformer/convert_audio_spectrogram_transformer_original_to_pytorch.py function get_audio_spectrogram_transformer_config (line 33) | def get_audio_spectrogram_transformer_config(model_name): function rename_key (line 68) | def rename_key(name): function convert_state_dict (line 106) | def convert_state_dict(orig_state_dict, config): function remove_keys (line 140) | def remove_keys(state_dict): function convert_audio_spectrogram_transformer_checkpoint (line 152) | def convert_audio_spectrogram_transformer_checkpoint(model_name, pytorch... FILE: src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py class ASTFeatureExtractor (line 36) | class ASTFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 68) | def __init__( method _extract_fbank_features (line 104) | def _extract_fbank_features( method normalize (line 155) | def normalize(self, input_values: np.ndarray) -> np.ndarray: method __call__ (line 158) | def __call__( FILE: src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py class ASTEmbeddings (line 36) | class ASTEmbeddings(nn.Module): method __init__ (line 41) | def __init__(self, config: ASTConfig) -> None: method get_shape (line 54) | def get_shape(self, config): method forward (line 62) | def forward(self, input_values: torch.Tensor) -> torch.Tensor: class ASTPatchEmbeddings (line 75) | class ASTPatchEmbeddings(nn.Module): method __init__ (line 81) | def __init__(self, config: ASTConfig): method forward (line 92) | def forward(self, input_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 100) | def eager_attention_forward( class ASTSelfAttention (line 129) | class ASTSelfAttention(nn.Module): method __init__ (line 130) | def __init__(self, config: ASTConfig): method forward (line 150) | def forward( class ASTSelfOutput (line 185) | class ASTSelfOutput(nn.Module): method __init__ (line 191) | def __init__(self, config: ASTConfig): method forward (line 196) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ASTAttention (line 203) | class ASTAttention(nn.Module): method __init__ (line 204) | def __init__(self, config: ASTConfig): method forward (line 209) | def forward( class ASTIntermediate (line 220) | class ASTIntermediate(nn.Module): method __init__ (line 221) | def __init__(self, config: ASTConfig): method forward (line 229) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ASTOutput (line 236) | class ASTOutput(nn.Module): method __init__ (line 237) | def __init__(self, config: ASTConfig): method forward (line 242) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ASTLayer (line 250) | class ASTLayer(GradientCheckpointingLayer): method __init__ (line 253) | def __init__(self, config: ASTConfig): method forward (line 263) | def forward( class ASTEncoder (line 285) | class ASTEncoder(nn.Module): method __init__ (line 286) | def __init__(self, config: ASTConfig): method forward (line 292) | def forward( class ASTPreTrainedModel (line 304) | class ASTPreTrainedModel(PreTrainedModel): method _init_weights (line 320) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class ASTModel (line 336) | class ASTModel(ASTPreTrainedModel): method __init__ (line 337) | def __init__(self, config: ASTConfig) -> None: method get_input_embeddings (line 349) | def get_input_embeddings(self) -> ASTPatchEmbeddings: method forward (line 355) | def forward( class ASTMLPHead (line 385) | class ASTMLPHead(nn.Module): method __init__ (line 386) | def __init__(self, config: ASTConfig): method forward (line 391) | def forward(self, hidden_state): class ASTForAudioClassification (line 403) | class ASTForAudioClassification(ASTPreTrainedModel): method __init__ (line 404) | def __init__(self, config: ASTConfig) -> None: method forward (line 418) | def forward( FILE: src/transformers/models/audioflamingo3/configuration_audioflamingo3.py class AudioFlamingo3EncoderConfig (line 26) | class AudioFlamingo3EncoderConfig(PreTrainedConfig): class AudioFlamingo3Config (line 73) | class AudioFlamingo3Config(PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): FILE: src/transformers/models/audioflamingo3/convert_audioflamingo3_to_hf.py function _load_json (line 45) | def _load_json(p: Path): function write_processor (line 52) | def write_processor(src_root: Path, dst_root: Path): function _resolve_component_dir (line 116) | def _resolve_component_dir(dirpath: Path): function merge_and_shard_weights (line 133) | def merge_and_shard_weights(src_root: Path, dst_root: Path, processor: A... function main (line 250) | def main() -> None: FILE: src/transformers/models/audioflamingo3/modeling_audioflamingo3.py function eager_attention_forward (line 47) | def eager_attention_forward( class AudioFlamingo3Attention (line 73) | class AudioFlamingo3Attention(nn.Module): method __init__ (line 76) | def __init__( method forward (line 116) | def forward( class AudioFlamingo3EncoderLayer (line 192) | class AudioFlamingo3EncoderLayer(GradientCheckpointingLayer): method __init__ (line 193) | def __init__(self, config: AudioFlamingo3Config): method forward (line 211) | def forward( class AudioFlamingo3PreTrainedModel (line 249) | class AudioFlamingo3PreTrainedModel(PreTrainedModel): class AudioFlamingo3Encoder (line 265) | class AudioFlamingo3Encoder(AudioFlamingo3PreTrainedModel): method __init__ (line 281) | def __init__(self, config: AudioFlamingo3EncoderConfig): method _freeze_parameters (line 306) | def _freeze_parameters(self): method get_input_embeddings (line 311) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 314) | def set_input_embeddings(self, value: nn.Module): method forward (line 319) | def forward( method _get_feat_extract_output_lengths (line 373) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class AudioFlamingo3MultiModalProjector (line 382) | class AudioFlamingo3MultiModalProjector(nn.Module): method __init__ (line 388) | def __init__(self, config: AudioFlamingo3Config): method forward (line 398) | def forward(self, audio_features): class AudioFlamingo3ForConditionalGeneration (line 410) | class AudioFlamingo3ForConditionalGeneration(AudioFlamingo3PreTrainedMod... method __init__ (line 415) | def __init__(self, config): method get_input_embeddings (line 425) | def get_input_embeddings(self): method set_input_embeddings (line 428) | def set_input_embeddings(self, value): method get_output_embeddings (line 431) | def get_output_embeddings(self): method set_output_embeddings (line 434) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 437) | def set_decoder(self, decoder): method get_decoder (line 440) | def get_decoder(self): method get_audio_features (line 447) | def get_audio_features( method forward (line 479) | def forward( method prepare_inputs_for_generation (line 580) | def prepare_inputs_for_generation(self, *args, is_first_iteration: boo... FILE: src/transformers/models/audioflamingo3/modular_audioflamingo3.py class AudioFlamingo3Attention (line 39) | class AudioFlamingo3Attention(WhisperAttention): class AudioFlamingo3EncoderLayer (line 43) | class AudioFlamingo3EncoderLayer(WhisperEncoderLayer): class AudioFlamingo3PreTrainedModel (line 47) | class AudioFlamingo3PreTrainedModel(Qwen2AudioPreTrainedModel): class AudioFlamingo3Encoder (line 56) | class AudioFlamingo3Encoder(Qwen2AudioEncoder): method forward (line 68) | def forward( class AudioFlamingo3MultiModalProjector (line 122) | class AudioFlamingo3MultiModalProjector(VoxtralMultiModalProjector): method __init__ (line 128) | def __init__(self, config: AudioFlamingo3Config): class AudioFlamingo3ForConditionalGeneration (line 144) | class AudioFlamingo3ForConditionalGeneration(VoxtralForConditionalGenera... method __init__ (line 149) | def __init__(self, config): method get_audio_features (line 156) | def get_audio_features( method forward (line 188) | def forward( method prepare_inputs_for_generation (line 289) | def prepare_inputs_for_generation(self, *args, is_first_iteration: boo... FILE: src/transformers/models/audioflamingo3/processing_audioflamingo3.py class AudioFlamingo3ProcessorKwargs (line 34) | class AudioFlamingo3ProcessorKwargs(ProcessingKwargs, total=False): class AudioFlamingo3Processor (line 51) | class AudioFlamingo3Processor(ProcessorMixin): method __init__ (line 75) | def __init__( method _get_audio_token_length (line 90) | def _get_audio_token_length(self, audio_lengths): method _expand_audio_tokens (line 95) | def _expand_audio_tokens(self, text, padding_mask, per_sample_windows): method _get_audio_tokens_mask (line 103) | def _get_audio_tokens_mask(self, input_ids): method __call__ (line 106) | def __call__( method model_input_names (line 202) | def model_input_names(self) -> list[str]: method apply_transcription_request (line 207) | def apply_transcription_request( method decode (line 288) | def decode(self, *args, strip_prefix=False, **kwargs): method batch_decode (line 301) | def batch_decode(self, *args, **kwargs): method _strip_assistant_prefix_and_quotes (line 305) | def _strip_assistant_prefix_and_quotes(self, text: str) -> str: FILE: src/transformers/models/auto/auto_factory.py function _get_model_class (line 179) | def _get_model_class(config, model_mapping): class _BaseAutoModelClass (line 195) | class _BaseAutoModelClass: method __init__ (line 199) | def __init__(self, *args, **kwargs) -> None: method from_config (line 207) | def from_config(cls, config, **kwargs): method _prepare_config_for_auto_class (line 249) | def _prepare_config_for_auto_class(cls, config: PreTrainedConfig) -> P... method from_pretrained (line 254) | def from_pretrained(cls, pretrained_model_name_or_path: str | os.PathL... method register (line 396) | def register(cls, config_class, model_class, exist_ok=False) -> None: class _BaseAutoBackboneClass (line 415) | class _BaseAutoBackboneClass(_BaseAutoModelClass): method _load_timm_backbone_from_pretrained (line 420) | def _load_timm_backbone_from_pretrained(cls, pretrained_model_name_or_... method from_pretrained (line 446) | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, *... function insert_head_doc (line 454) | def insert_head_doc(docstring, head_doc: str = ""): function auto_class_update (line 465) | def auto_class_update(cls, checkpoint_for_example: str = "google-bert/be... function get_values (line 495) | def get_values(model_mapping): function getattribute_from_module (line 506) | def getattribute_from_module(module, attr): function add_generation_mixin_to_remote_model (line 528) | def add_generation_mixin_to_remote_model(model_class): class _LazyAutoMapping (line 560) | class _LazyAutoMapping(OrderedDict[type[PreTrainedConfig], _LazyAutoMapp... method __init__ (line 569) | def __init__(self, config_mapping, model_mapping) -> None: method __len__ (line 577) | def __len__(self) -> int: method __getitem__ (line 581) | def __getitem__(self, key: type[PreTrainedConfig]) -> _LazyAutoMapping... method _load_attr_from_module (line 597) | def _load_attr_from_module(self, model_type, attr): method keys (line 603) | def keys(self) -> list[type[PreTrainedConfig]]: method get (line 611) | def get(self, key: type[PreTrainedConfig], default: _T) -> _LazyAutoMa... method __bool__ (line 617) | def __bool__(self) -> bool: method values (line 620) | def values(self) -> list[_LazyAutoMappingValue]: method items (line 628) | def items(self) -> list[tuple[type[PreTrainedConfig], _LazyAutoMapping... method __iter__ (line 639) | def __iter__(self) -> Iterator[type[PreTrainedConfig]]: method __contains__ (line 642) | def __contains__(self, item: type) -> bool: method register (line 650) | def register(self, key: type[PreTrainedConfig], value: _LazyAutoMappin... FILE: src/transformers/models/auto/configuration_auto.py function model_type_to_module_name (line 1158) | def model_type_to_module_name(key) -> str: function config_class_to_model_type (line 1175) | def config_class_to_model_type(config) -> str | None: class _LazyConfigMapping (line 1187) | class _LazyConfigMapping(OrderedDict[str, type[PreTrainedConfig]]): method __init__ (line 1192) | def __init__(self, mapping) -> None: method __getitem__ (line 1197) | def __getitem__(self, key: str) -> type[PreTrainedConfig]: method keys (line 1214) | def keys(self) -> list[str]: method values (line 1217) | def values(self) -> list[type[PreTrainedConfig]]: method items (line 1220) | def items(self) -> list[tuple[str, type[PreTrainedConfig]]]: method __iter__ (line 1223) | def __iter__(self) -> Iterator[str]: method __contains__ (line 1226) | def __contains__(self, item: object) -> bool: method register (line 1229) | def register(self, key: str, value: type[PreTrainedConfig], exist_ok=F... class _LazyLoadAllMappings (line 1241) | class _LazyLoadAllMappings(OrderedDict[str, str]): method __init__ (line 1250) | def __init__(self, mapping): method _initialize (line 1255) | def _initialize(self): method __getitem__ (line 1267) | def __getitem__(self, key): method keys (line 1271) | def keys(self) -> KeysView[str]: method values (line 1275) | def values(self) -> ValuesView[str]: method items (line 1279) | def items(self) -> KeysView[str]: method __iter__ (line 1283) | def __iter__(self) -> Iterator[str]: method __contains__ (line 1287) | def __contains__(self, item: object) -> bool: function _get_class_name (line 1292) | def _get_class_name(model_class: str | list[str]): function _list_model_options (line 1298) | def _list_model_options(indent, config_to_class=None, use_model_types=Tr... function replace_list_option_in_docstrings (line 1331) | def replace_list_option_in_docstrings( class AutoConfig (line 1360) | class AutoConfig: method __init__ (line 1368) | def __init__(self) -> None: method for_model (line 1375) | def for_model(cls, model_type: str, *args, **kwargs) -> PreTrainedConfig: method from_pretrained (line 1385) | def from_pretrained(cls, pretrained_model_name_or_path: str | os.PathL... method register (line 1521) | def register(model_type, config, exist_ok=False) -> None: FILE: src/transformers/models/auto/feature_extraction_auto.py function feature_extractor_class_from_name (line 96) | def feature_extractor_class_from_name(class_name: str): function get_feature_extractor_config (line 120) | def get_feature_extractor_config( class AutoFeatureExtractor (line 230) | class AutoFeatureExtractor: method __init__ (line 238) | def __init__(self): method from_pretrained (line 246) | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): method register (line 373) | def register(config_class, feature_extractor_class, exist_ok=False): FILE: src/transformers/models/auto/image_processing_auto.py function get_image_processor_class_from_name (line 275) | def get_image_processor_class_from_name(class_name: str): function get_image_processor_config (line 308) | def get_image_processor_config( function _resolve_backend (line 419) | def _resolve_backend(backend: str | None, use_fast: bool | None, base_cl... function _load_class_with_fallback (line 446) | def _load_class_with_fallback(mapping, backend): function _find_mapping_for_image_processor (line 488) | def _find_mapping_for_image_processor(base_class_name: str) -> dict | None: function _load_backend_class (line 514) | def _load_backend_class(base_class_name, backend, is_legacy_fast=False): function _resolve_auto_map_class_ref (line 536) | def _resolve_auto_map_class_ref(auto_map, backend): class AutoImageProcessor (line 556) | class AutoImageProcessor: method __init__ (line 564) | def __init__(self): method from_pretrained (line 572) | def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwa... method register (line 761) | def register( FILE: src/transformers/models/auto/modeling_auto.py class _BaseModelWithGenerate (line 35) | class _BaseModelWithGenerate(PreTrainedModel, GenerationMixin): class AutoModelForMaskGeneration (line 1937) | class AutoModelForMaskGeneration(_BaseAutoModelClass): class AutoModelForKeypointDetection (line 1941) | class AutoModelForKeypointDetection(_BaseAutoModelClass): class AutoModelForKeypointMatching (line 1945) | class AutoModelForKeypointMatching(_BaseAutoModelClass): class AutoModelForTextEncoding (line 1949) | class AutoModelForTextEncoding(_BaseAutoModelClass): class AutoModelForImageToImage (line 1953) | class AutoModelForImageToImage(_BaseAutoModelClass): class AutoModel (line 1957) | class AutoModel(_BaseAutoModelClass): class AutoModelForPreTraining (line 1964) | class AutoModelForPreTraining(_BaseAutoModelClass): class AutoModelForCausalLM (line 1971) | class AutoModelForCausalLM(_BaseAutoModelClass): method from_pretrained (line 1976) | def from_pretrained( class AutoModelForMaskedLM (line 1988) | class AutoModelForMaskedLM(_BaseAutoModelClass): class AutoModelForSeq2SeqLM (line 1995) | class AutoModelForSeq2SeqLM(_BaseAutoModelClass): class AutoModelForSequenceClassification (line 2006) | class AutoModelForSequenceClassification(_BaseAutoModelClass): class AutoModelForQuestionAnswering (line 2015) | class AutoModelForQuestionAnswering(_BaseAutoModelClass): class AutoModelForTableQuestionAnswering (line 2022) | class AutoModelForTableQuestionAnswering(_BaseAutoModelClass): class AutoModelForVisualQuestionAnswering (line 2033) | class AutoModelForVisualQuestionAnswering(_BaseAutoModelClass): class AutoModelForDocumentQuestionAnswering (line 2044) | class AutoModelForDocumentQuestionAnswering(_BaseAutoModelClass): class AutoModelForTokenClassification (line 2055) | class AutoModelForTokenClassification(_BaseAutoModelClass): class AutoModelForMultipleChoice (line 2062) | class AutoModelForMultipleChoice(_BaseAutoModelClass): class AutoModelForNextSentencePrediction (line 2069) | class AutoModelForNextSentencePrediction(_BaseAutoModelClass): class AutoModelForImageClassification (line 2078) | class AutoModelForImageClassification(_BaseAutoModelClass): class AutoModelForZeroShotImageClassification (line 2085) | class AutoModelForZeroShotImageClassification(_BaseAutoModelClass): class AutoModelForImageSegmentation (line 2094) | class AutoModelForImageSegmentation(_BaseAutoModelClass): class AutoModelForSemanticSegmentation (line 2101) | class AutoModelForSemanticSegmentation(_BaseAutoModelClass): class AutoModelForTimeSeriesPrediction (line 2110) | class AutoModelForTimeSeriesPrediction(_BaseAutoModelClass): class AutoModelForUniversalSegmentation (line 2119) | class AutoModelForUniversalSegmentation(_BaseAutoModelClass): class AutoModelForInstanceSegmentation (line 2128) | class AutoModelForInstanceSegmentation(_BaseAutoModelClass): class AutoModelForObjectDetection (line 2137) | class AutoModelForObjectDetection(_BaseAutoModelClass): class AutoModelForZeroShotObjectDetection (line 2144) | class AutoModelForZeroShotObjectDetection(_BaseAutoModelClass): class AutoModelForDepthEstimation (line 2153) | class AutoModelForDepthEstimation(_BaseAutoModelClass): class AutoModelForTextRecognition (line 2160) | class AutoModelForTextRecognition(_BaseAutoModelClass): class AutoModelForTableRecognition (line 2167) | class AutoModelForTableRecognition(_BaseAutoModelClass): class AutoModelForVideoClassification (line 2174) | class AutoModelForVideoClassification(_BaseAutoModelClass): class AutoModelForImageTextToText (line 2181) | class AutoModelForImageTextToText(_BaseAutoModelClass): method from_pretrained (line 2186) | def from_pretrained( class AutoModelForMultimodalLM (line 2198) | class AutoModelForMultimodalLM(_BaseAutoModelClass): class AutoModelForAudioClassification (line 2205) | class AutoModelForAudioClassification(_BaseAutoModelClass): class AutoModelForCTC (line 2212) | class AutoModelForCTC(_BaseAutoModelClass): class AutoModelForSpeechSeq2Seq (line 2219) | class AutoModelForSpeechSeq2Seq(_BaseAutoModelClass): class AutoModelForAudioFrameClassification (line 2228) | class AutoModelForAudioFrameClassification(_BaseAutoModelClass): class AutoModelForAudioXVector (line 2237) | class AutoModelForAudioXVector(_BaseAutoModelClass): class AutoModelForTextToSpectrogram (line 2241) | class AutoModelForTextToSpectrogram(_BaseAutoModelClass): class AutoModelForTextToWaveform (line 2245) | class AutoModelForTextToWaveform(_BaseAutoModelClass): class AutoBackbone (line 2249) | class AutoBackbone(_BaseAutoBackboneClass): class AutoModelForMaskedImageModeling (line 2256) | class AutoModelForMaskedImageModeling(_BaseAutoModelClass): class AutoModelForAudioTokenization (line 2263) | class AutoModelForAudioTokenization(_BaseAutoModelClass): FILE: src/transformers/models/auto/processing_auto.py function processor_class_from_name (line 190) | def processor_class_from_name(class_name: str): class AutoProcessor (line 214) | class AutoProcessor: method __init__ (line 222) | def __init__(self): method from_pretrained (line 230) | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): method register (line 452) | def register(config_class, processor_class, exist_ok=False): FILE: src/transformers/models/auto/tokenization_auto.py function load_vocab (line 389) | def load_vocab(vocab_file): function load_merges (line 395) | def load_merges(merges_file): function tokenizer_class_from_name (line 406) | def tokenizer_class_from_name(class_name: str) -> type[Any] | None: function get_tokenizer_config (line 460) | def get_tokenizer_config( class AutoTokenizer (line 556) | class AutoTokenizer: method __init__ (line 564) | def __init__(self): method from_pretrained (line 572) | def from_pretrained( method register (line 838) | def register( FILE: src/transformers/models/auto/video_processing_auto.py function video_processor_class_from_name (line 97) | def video_processor_class_from_name(class_name: str): function get_video_processor_config (line 121) | def get_video_processor_config( class AutoVideoProcessor (line 242) | class AutoVideoProcessor: method __init__ (line 250) | def __init__(self): method from_pretrained (line 258) | def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwa... method register (line 406) | def register( FILE: src/transformers/models/autoformer/configuration_autoformer.py class AutoformerConfig (line 24) | class AutoformerConfig(PreTrainedConfig): method __post_init__ (line 124) | def __post_init__(self, **kwargs): method _number_of_features (line 139) | def _number_of_features(self) -> int: method validate_architecture (line 148) | def validate_architecture(self): FILE: src/transformers/models/autoformer/modeling_autoformer.py class AutoFormerDecoderOutput (line 49) | class AutoFormerDecoderOutput(ModelOutput): class AutoformerModelOutput (line 86) | class AutoformerModelOutput(ModelOutput): class AutoformerFeatureEmbedder (line 125) | class AutoformerFeatureEmbedder(nn.Module): method __init__ (line 136) | def __init__(self, cardinalities: list[int], embedding_dims: list[int]... method forward (line 142) | def forward(self, features: torch.Tensor) -> torch.Tensor: class AutoformerStdScaler (line 160) | class AutoformerStdScaler(nn.Module): method __init__ (line 166) | def __init__(self, config: AutoformerConfig): method forward (line 172) | def forward( class AutoformerMeanScaler (line 196) | class AutoformerMeanScaler(nn.Module): method __init__ (line 202) | def __init__(self, config: AutoformerConfig): method forward (line 209) | def forward( class AutoformerNOPScaler (line 251) | class AutoformerNOPScaler(nn.Module): method __init__ (line 256) | def __init__(self, config: AutoformerConfig): method forward (line 261) | def forward( function weighted_average (line 279) | def weighted_average(input_tensor: torch.Tensor, weights: torch.Tensor |... function nll (line 304) | def nll(input: torch.distributions.Distribution, target: torch.Tensor) -... class AutoformerSinusoidalPositionalEmbedding (line 312) | class AutoformerSinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 315) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method create_weight (line 318) | def create_weight(self): method forward (line 334) | def forward( class AutoformerValueEmbedding (line 347) | class AutoformerValueEmbedding(nn.Module): method __init__ (line 348) | def __init__(self, feature_size, d_model): method forward (line 352) | def forward(self, x): class AutoformerSeriesDecompositionLayer (line 359) | class AutoformerSeriesDecompositionLayer(nn.Module): method __init__ (line 366) | def __init__(self, config: AutoformerConfig): method forward (line 371) | def forward(self, x): class AutoformerLayernorm (line 388) | class AutoformerLayernorm(nn.Module): method __init__ (line 394) | def __init__(self, config: AutoformerConfig): method forward (line 398) | def forward(self, x): class AutoformerAttention (line 404) | class AutoformerAttention(nn.Module): method __init__ (line 411) | def __init__( method forward (line 443) | def forward( class AutoformerEncoderLayer (line 606) | class AutoformerEncoderLayer(GradientCheckpointingLayer): method __init__ (line 607) | def __init__(self, config: AutoformerConfig): method forward (line 626) | def forward( class AutoformerDecoderLayer (line 666) | class AutoformerDecoderLayer(GradientCheckpointingLayer): method __init__ (line 667) | def __init__(self, config: AutoformerConfig, layer_idx=None): method forward (line 712) | def forward( class AutoformerPreTrainedModel (line 788) | class AutoformerPreTrainedModel(PreTrainedModel): method _init_weights (line 800) | def _init_weights(self, module: nn.Module): class AutoformerEncoder (line 819) | class AutoformerEncoder(AutoformerPreTrainedModel): method __init__ (line 828) | def __init__(self, config: AutoformerConfig): method forward (line 849) | def forward( class AutoformerDecoder (line 901) | class AutoformerDecoder(AutoformerPreTrainedModel): method __init__ (line 915) | def __init__(self, config: AutoformerConfig): method forward (line 940) | def forward( class AutoformerModel (line 1037) | class AutoformerModel(AutoformerPreTrainedModel): method __init__ (line 1038) | def __init__(self, config: AutoformerConfig): method _past_length (line 1064) | def _past_length(self) -> int: method get_lagged_subsequences (line 1067) | def get_lagged_subsequences( method create_network_inputs (line 1105) | def create_network_inputs( method forward (line 1207) | def forward( class AutoformerForPrediction (line 1403) | class AutoformerForPrediction(AutoformerPreTrainedModel): method __init__ (line 1404) | def __init__(self, config: AutoformerConfig): method output_params (line 1427) | def output_params(self, decoder_output): method output_distribution (line 1431) | def output_distribution(self, params, loc=None, scale=None, trailing_n... method forward (line 1439) | def forward( method generate (line 1665) | def generate( FILE: src/transformers/models/aya_vision/configuration_aya_vision.py class AyaVisionConfig (line 25) | class AyaVisionConfig(PreTrainedConfig): method __post_init__ (line 48) | def __post_init__(self, **kwargs): method validate_architecture (line 71) | def validate_architecture(self): FILE: src/transformers/models/aya_vision/modeling_aya_vision.py class AyaVisionMultiModalProjector (line 38) | class AyaVisionMultiModalProjector(nn.Module): method __init__ (line 39) | def __init__(self, config: AyaVisionConfig): method forward (line 60) | def forward(self, image_features): method pixel_shuffle (line 72) | def pixel_shuffle(self, image_features): # B, S, D class AyaVisionPreTrainedModel (line 89) | class AyaVisionPreTrainedModel(PreTrainedModel): class AyaVisionCausalLMOutputWithPast (line 109) | class AyaVisionCausalLMOutputWithPast(ModelOutput): class AyaVisionModelOutputWithPast (line 139) | class AyaVisionModelOutputWithPast(BaseModelOutputWithPast): class AyaVisionModel (line 159) | class AyaVisionModel(AyaVisionPreTrainedModel): method __init__ (line 160) | def __init__(self, config: AyaVisionConfig): method get_input_embeddings (line 168) | def get_input_embeddings(self): method set_input_embeddings (line 171) | def set_input_embeddings(self, value): method get_image_features (line 179) | def get_image_features( method get_placeholder_mask (line 213) | def get_placeholder_mask( method forward (line 239) | def forward( class AyaVisionForConditionalGeneration (line 294) | class AyaVisionForConditionalGeneration(AyaVisionPreTrainedModel, Genera... method __init__ (line 297) | def __init__(self, config: AyaVisionConfig): method get_input_embeddings (line 303) | def get_input_embeddings(self): method set_input_embeddings (line 306) | def set_input_embeddings(self, value): method get_output_embeddings (line 309) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 313) | def get_image_features( method forward (line 329) | def forward( method prepare_inputs_for_generation (line 413) | def prepare_inputs_for_generation( FILE: src/transformers/models/aya_vision/modular_aya_vision.py class AyaVisionMultiModalProjector (line 39) | class AyaVisionMultiModalProjector(nn.Module): method __init__ (line 40) | def __init__(self, config: AyaVisionConfig): method forward (line 61) | def forward(self, image_features): method pixel_shuffle (line 73) | def pixel_shuffle(self, image_features): # B, S, D class AyaVisionPreTrainedModel (line 89) | class AyaVisionPreTrainedModel(LlavaPreTrainedModel): class AyaVisionCausalLMOutputWithPast (line 93) | class AyaVisionCausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class AyaVisionModelOutputWithPast (line 97) | class AyaVisionModelOutputWithPast(LlavaModelOutputWithPast): class AyaVisionModel (line 101) | class AyaVisionModel(LlavaModel): method get_image_features (line 108) | def get_image_features( method forward (line 144) | def forward( class AyaVisionForConditionalGeneration (line 194) | class AyaVisionForConditionalGeneration(LlavaForConditionalGeneration): method forward (line 195) | def forward( FILE: src/transformers/models/aya_vision/processing_aya_vision.py class AyaVisionProcessorKwargs (line 23) | class AyaVisionProcessorKwargs(ProcessingKwargs, total=False): class AyaVisionProcessor (line 37) | class AyaVisionProcessor(ProcessorMixin): method __init__ (line 38) | def __init__( method _prompt_split_image (line 94) | def _prompt_split_image(self, num_patches): method __call__ (line 116) | def __call__( method _get_num_multimodal_tokens (line 175) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/bamba/configuration_bamba.py class BambaConfig (line 31) | class BambaConfig(PreTrainedConfig): method __post_init__ (line 84) | def __post_init__(self, **kwargs): method layers_block_type (line 99) | def layers_block_type(self): method validate_architecture (line 105) | def validate_architecture(self): FILE: src/transformers/models/bamba/convert_mamba_ssm_checkpoint.py function convert_state_dict_from_mamba_ssm (line 32) | def convert_state_dict_from_mamba_ssm(original_sd: dict) -> dict[str, to... function convert_ssm_config_to_hf_config (line 85) | def convert_ssm_config_to_hf_config( function save_single_safetensor (line 129) | def save_single_safetensor( function save_sharded_safetensors (line 141) | def save_sharded_safetensors( function convert_mamba_ssm_checkpoint_file_to_huggingface_model_file (line 169) | def convert_mamba_ssm_checkpoint_file_to_huggingface_model_file( FILE: src/transformers/models/bamba/modeling_bamba.py class BambaFlashAttentionKwargs (line 54) | class BambaFlashAttentionKwargs(TypedDict, total=False): class BambaRotaryEmbedding (line 78) | class BambaRotaryEmbedding(nn.Module): method __init__ (line 81) | def __init__(self, config: BambaConfig, device=None): method compute_default_rope_parameters (line 98) | def compute_default_rope_parameters( method forward (line 129) | def forward(self, x, position_ids): function rotate_half (line 143) | def rotate_half(x): function repeat_kv (line 150) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 162) | def eager_attention_forward( function apply_rotary_pos_emb (line 188) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class BambaAttention (line 227) | class BambaAttention(nn.Module): method __init__ (line 230) | def __init__(self, config: BambaConfig, layer_idx: int): method forward (line 253) | def forward( class BambaRMSNormGated (line 294) | class BambaRMSNormGated(torch.nn.Module): method __init__ (line 295) | def __init__(self, hidden_size, eps=1e-6): method forward (line 300) | def forward(self, hidden_states, gate=None): function pad_tensor_by_size (line 315) | def pad_tensor_by_size(input_tensor: torch.Tensor, pad_size: int): function reshape_into_chunks (line 326) | def reshape_into_chunks(input_tensor, pad_size, chunk_size): function segment_sum (line 346) | def segment_sum(input_tensor): function apply_mask_to_padding_states (line 366) | def apply_mask_to_padding_states(hidden_states, attention_mask): class BambaMixer (line 379) | class BambaMixer(nn.Module): method __init__ (line 393) | def __init__(self, config: BambaConfig, layer_idx: int): method cuda_kernels_forward (line 485) | def cuda_kernels_forward( method torch_forward (line 647) | def torch_forward( method forward (line 836) | def forward( class BambaMLP (line 858) | class BambaMLP(nn.Module): method __init__ (line 859) | def __init__(self, config): method forward (line 869) | def forward(self, x): class BambaRMSNorm (line 875) | class BambaRMSNorm(nn.Module): method __init__ (line 876) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 884) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 891) | def extra_repr(self): class BambaDecoderLayer (line 895) | class BambaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 896) | def __init__(self, config: BambaConfig, layer_idx: int, layer_type: st... method forward (line 913) | def forward( class BambaPreTrainedModel (line 957) | class BambaPreTrainedModel(PreTrainedModel): method _init_weights (line 972) | def _init_weights(self, module): class BambaModel (line 981) | class BambaModel(BambaPreTrainedModel): method __init__ (line 982) | def __init__(self, config: BambaConfig): method forward (line 1004) | def forward( method _update_mamba_mask (line 1057) | def _update_mamba_mask(self, attention_mask, past_key_values): class BambaForCausalLM (line 1072) | class BambaForCausalLM(BambaPreTrainedModel, GenerationMixin): method __init__ (line 1077) | def __init__(self, config): method forward (line 1089) | def forward( method prepare_inputs_for_generation (line 1152) | def prepare_inputs_for_generation( FILE: src/transformers/models/bamba/modular_bamba.py class BambaFlashAttentionKwargs (line 60) | class BambaFlashAttentionKwargs(TypedDict, total=False): class BambaRotaryEmbedding (line 84) | class BambaRotaryEmbedding(LlamaRotaryEmbedding): function apply_rotary_pos_emb (line 89) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class BambaAttention (line 127) | class BambaAttention(LlamaAttention): class BambaRMSNormGated (line 131) | class BambaRMSNormGated(MambaRMSNormGated): class BambaMixer (line 136) | class BambaMixer(nn.Module): method __init__ (line 150) | def __init__(self, config: BambaConfig, layer_idx: int): method cuda_kernels_forward (line 242) | def cuda_kernels_forward( method torch_forward (line 404) | def torch_forward( method forward (line 593) | def forward( class BambaMLP (line 615) | class BambaMLP(LlamaMLP): class BambaRMSNorm (line 619) | class BambaRMSNorm(LlamaRMSNorm): class BambaDecoderLayer (line 623) | class BambaDecoderLayer(JambaAttentionDecoderLayer): method __init__ (line 624) | def __init__(self, config: BambaConfig, layer_idx: int, layer_type: st... method forward (line 641) | def forward( class BambaPreTrainedModel (line 685) | class BambaPreTrainedModel(PreTrainedModel): method _init_weights (line 700) | def _init_weights(self, module): class BambaModel (line 709) | class BambaModel(BambaPreTrainedModel): method __init__ (line 710) | def __init__(self, config: BambaConfig): method forward (line 732) | def forward( method _update_mamba_mask (line 785) | def _update_mamba_mask(self, attention_mask, past_key_values): class BambaForCausalLM (line 799) | class BambaForCausalLM(LlamaForCausalLM): method __init__ (line 800) | def __init__(self, config): method forward (line 809) | def forward( method prepare_inputs_for_generation (line 872) | def prepare_inputs_for_generation( FILE: src/transformers/models/bark/configuration_bark.py class BarkSubModelConfig (line 28) | class BarkSubModelConfig(PreTrainedConfig): class BarkSemanticConfig (line 68) | class BarkSemanticConfig(BarkSubModelConfig): class BarkCoarseConfig (line 105) | class BarkCoarseConfig(BarkSubModelConfig): class BarkFineConfig (line 142) | class BarkFineConfig(BarkSubModelConfig): class BarkConfig (line 188) | class BarkConfig(PreTrainedConfig): method __post_init__ (line 244) | def __post_init__(self, **kwargs): FILE: src/transformers/models/bark/convert_suno_to_hf.py function _get_ckpt_path (line 80) | def _get_ckpt_path(model_type, use_small=False): function _download (line 87) | def _download(from_hf_path, file_name): function _load_model (line 92) | def _load_model(ckpt_path, device, use_small=False, model_type="text"): function load_model (line 161) | def load_model(pytorch_dump_folder_path, use_small=False, model_type="te... function load_whole_bark_model (line 212) | def load_whole_bark_model( FILE: src/transformers/models/bark/generation_configuration_bark.py class BarkSemanticGenerationConfig (line 25) | class BarkSemanticGenerationConfig(GenerationConfig): method __init__ (line 28) | def __init__( class BarkCoarseGenerationConfig (line 116) | class BarkCoarseGenerationConfig(GenerationConfig): method __init__ (line 119) | def __init__( class BarkFineGenerationConfig (line 196) | class BarkFineGenerationConfig(GenerationConfig): method __init__ (line 199) | def __init__( method validate (line 231) | def validate(self, **kwargs): class BarkGenerationConfig (line 238) | class BarkGenerationConfig(GenerationConfig): method __init__ (line 243) | def __init__( method from_sub_model_configs (line 293) | def from_sub_model_configs( method to_dict (line 313) | def to_dict(self): FILE: src/transformers/models/bark/modeling_bark.py class BarkSelfAttention (line 66) | class BarkSelfAttention(nn.Module): method __init__ (line 70) | def __init__(self, config, is_causal=False, layer_idx=None): method _split_heads (line 102) | def _split_heads(self, tensor, num_heads, attn_head_size): method _merge_heads (line 110) | def _merge_heads(self, tensor, num_heads, attn_head_size): method _attn (line 122) | def _attn(self, query, key, value, attention_mask=None): method forward (line 149) | def forward( class BarkSelfFlashAttention2 (line 177) | class BarkSelfFlashAttention2(BarkSelfAttention): method __init__ (line 184) | def __init__(self, *args, **kwargs): method _split_heads (line 192) | def _split_heads(self, tensor, num_heads, attn_head_size): method _merge_heads (line 202) | def _merge_heads(self, tensor, num_heads, attn_head_size): method forward (line 211) | def forward( class BarkMLP (line 259) | class BarkMLP(nn.Module): method __init__ (line 260) | def __init__(self, config): method forward (line 267) | def forward(self, hidden_states): class BarkBlock (line 275) | class BarkBlock(GradientCheckpointingLayer): method __init__ (line 276) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 294) | def forward( class BarkPreTrainedModel (line 325) | class BarkPreTrainedModel(PreTrainedModel): method device (line 331) | def device(self) -> torch.device: method _init_weights (line 350) | def _init_weights(self, module): class BarkCausalModel (line 360) | class BarkCausalModel(BarkPreTrainedModel, GenerationMixin): method __init__ (line 364) | def __init__(self, config): method get_output_embeddings (line 384) | def get_output_embeddings(self): method get_input_embeddings (line 389) | def get_input_embeddings(self): method set_input_embeddings (line 392) | def set_input_embeddings(self, new_embeddings): method forward (line 397) | def forward( class BarkSemanticModel (line 526) | class BarkSemanticModel(BarkCausalModel): method generate (line 530) | def generate( class BarkCoarseModel (line 642) | class BarkCoarseModel(BarkCausalModel): method preprocess_histories (line 646) | def preprocess_histories( method generate (line 720) | def generate( class BarkFineModel (line 866) | class BarkFineModel(BarkPreTrainedModel): method __init__ (line 871) | def __init__(self, config): method get_input_embeddings (line 906) | def get_input_embeddings(self): method set_input_embeddings (line 910) | def set_input_embeddings(self, new_embeddings): method get_output_embeddings (line 914) | def get_output_embeddings(self): method set_output_embeddings (line 918) | def set_output_embeddings(self, new_output_embeddings): method _resize_token_embeddings (line 922) | def _resize_token_embeddings(self, new_num_tokens, pad_to_multiple_of=... method resize_token_embeddings (line 943) | def resize_token_embeddings( method forward (line 995) | def forward( method generate (line 1106) | def generate( class BarkModel (line 1261) | class BarkModel(BarkPreTrainedModel, GenerationMixin): method __init__ (line 1264) | def __init__(self, config): method can_generate (line 1278) | def can_generate(cls) -> bool: method device (line 1286) | def device(self) -> torch.device: method enable_cpu_offload (line 1303) | def enable_cpu_offload( method codec_decode (line 1349) | def codec_decode(self, fine_output, output_lengths=None): method generate (line 1368) | def generate( FILE: src/transformers/models/bark/processing_bark.py class BarkProcessor (line 35) | class BarkProcessor(ProcessorMixin): method __init__ (line 42) | def __init__(self, tokenizer, speaker_embeddings=None): method from_pretrained (line 56) | def from_pretrained( method save_pretrained (line 113) | def save_pretrained( method _load_voice_preset (line 169) | def _load_voice_preset(self, voice_preset: str | None = None, **kwargs): method _validate_voice_preset_dict (line 205) | def _validate_voice_preset_dict(self, voice_preset: dict | None = None): method available_voice_presets (line 217) | def available_voice_presets(self) -> list: method _verify_speaker_embeddings (line 232) | def _verify_speaker_embeddings(self, remove_unavailable: bool = True): method __call__ (line 256) | def __call__( FILE: src/transformers/models/bart/configuration_bart.py class BartConfig (line 24) | class BartConfig(PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): FILE: src/transformers/models/bart/convert_bart_original_pytorch_checkpoint_to_pytorch.py function remove_ignore_keys_ (line 54) | def remove_ignore_keys_(state_dict): function rename_key (line 66) | def rename_key(dct, old, new): function load_xsum_checkpoint (line 71) | def load_xsum_checkpoint(checkpoint_path): function make_linear_from_emb (line 79) | def make_linear_from_emb(emb): function convert_bart_checkpoint (line 87) | def convert_bart_checkpoint(checkpoint_path, pytorch_dump_folder_path, h... FILE: src/transformers/models/bart/modeling_bart.py function shift_tokens_right (line 58) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class BartLearnedPositionalEmbedding (line 74) | class BartLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 79) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 85) | def forward( class BartScaledWordEmbedding (line 101) | class BartScaledWordEmbedding(nn.Embedding): method __init__ (line 106) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 110) | def forward(self, input_ids: torch.Tensor): function eager_attention_forward (line 115) | def eager_attention_forward( class BartAttention (line 143) | class BartAttention(nn.Module): method __init__ (line 146) | def __init__( method forward (line 185) | def forward( class BartEncoderLayer (line 261) | class BartEncoderLayer(GradientCheckpointingLayer): method __init__ (line 262) | def __init__(self, config: BartConfig, layer_idx: int | None = None): method forward (line 281) | def forward( class BartDecoderLayer (line 312) | class BartDecoderLayer(GradientCheckpointingLayer): method __init__ (line 313) | def __init__(self, config: BartConfig, layer_idx: int | None = None): method forward (line 344) | def forward( class BartClassificationHead (line 394) | class BartClassificationHead(nn.Module): method __init__ (line 397) | def __init__( method forward (line 409) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BartPreTrainedModel (line 419) | class BartPreTrainedModel(PreTrainedModel): method _init_weights (line 432) | def _init_weights(self, module): method dummy_inputs (line 438) | def dummy_inputs(self): class PretrainedBartModel (line 448) | class PretrainedBartModel(BartPreTrainedModel): method __init_subclass__ (line 449) | def __init_subclass__(self): class BartPretrainedModel (line 456) | class BartPretrainedModel(BartPreTrainedModel): method __init_subclass__ (line 457) | def __init_subclass__(self): class BartEncoder (line 464) | class BartEncoder(BartPreTrainedModel): method __init__ (line 479) | def __init__(self, config: BartConfig): method forward (line 508) | def forward( class BartDecoder (line 553) | class BartDecoder(BartPreTrainedModel): method __init__ (line 568) | def __init__(self, config: BartConfig): method forward (line 595) | def forward( class BartModel (line 681) | class BartModel(BartPreTrainedModel): method __init__ (line 687) | def __init__(self, config: BartConfig): method get_input_embeddings (line 700) | def get_input_embeddings(self): method set_input_embeddings (line 703) | def set_input_embeddings(self, value): method forward (line 710) | def forward( class BartForConditionalGeneration (line 802) | class BartForConditionalGeneration(BartPreTrainedModel, GenerationMixin): method __init__ (line 809) | def __init__(self, config: BartConfig): method resize_token_embeddings (line 818) | def resize_token_embeddings( method _resize_final_logits_bias (line 825) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 836) | def forward( method prepare_decoder_input_ids_from_labels (line 961) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class BartForSequenceClassification (line 971) | class BartForSequenceClassification(BartPreTrainedModel): method __init__ (line 972) | def __init__(self, config: BartConfig, **kwargs): method forward (line 987) | def forward( class BartForQuestionAnswering (line 1096) | class BartForQuestionAnswering(BartPreTrainedModel): method __init__ (line 1097) | def __init__(self, config): method forward (line 1111) | def forward( class BartDecoderWrapper (line 1201) | class BartDecoderWrapper(BartPreTrainedModel): method __init__ (line 1207) | def __init__(self, config): method forward (line 1212) | def forward(self, *args, **kwargs): class BartForCausalLM (line 1221) | class BartForCausalLM(BartPreTrainedModel, GenerationMixin): method __init__ (line 1226) | def __init__(self, config): method get_input_embeddings (line 1237) | def get_input_embeddings(self): method set_input_embeddings (line 1240) | def set_input_embeddings(self, value): method forward (line 1245) | def forward( FILE: src/transformers/models/barthez/tokenization_barthez.py class BarthezTokenizer (line 32) | class BarthezTokenizer(TokenizersBackend): method __init__ (line 90) | def __init__( FILE: src/transformers/models/bartpho/tokenization_bartpho.py class BartphoTokenizer (line 32) | class BartphoTokenizer(SentencePieceBackend): method __init__ (line 106) | def __init__( method build_inputs_with_special_tokens (line 160) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 186) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 214) | def create_token_type_ids_from_sequences( method vocab_size (line 240) | def vocab_size(self): method get_vocab (line 244) | def get_vocab(self): method _convert_token_to_id (line 253) | def _convert_token_to_id(self, token): method _convert_token_to_id_with_added_voc (line 260) | def _convert_token_to_id_with_added_voc(self, token): method _convert_id_to_token (line 269) | def _convert_id_to_token(self, index): method _align_added_tokens_with_fairseq_vocab (line 273) | def _align_added_tokens_with_fairseq_vocab(self): method save_vocabulary (line 291) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/beit/configuration_beit.py class BeitConfig (line 25) | class BeitConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): FILE: src/transformers/models/beit/convert_beit_unilm_to_pytorch.py function create_rename_keys (line 43) | def create_rename_keys(config, has_lm_head=False, is_semantic=False): function read_in_q_k_v (line 115) | def read_in_q_k_v(state_dict, config, has_lm_head=False, is_semantic=Fal... function rename_key (line 157) | def rename_key(dct, old, new): function prepare_img (line 163) | def prepare_img(): function convert_beit_checkpoint (line 171) | def convert_beit_checkpoint(checkpoint_url, pytorch_dump_folder_path): FILE: src/transformers/models/beit/image_processing_beit.py class BeitImageProcessorKwargs (line 37) | class BeitImageProcessorKwargs(ImagesKwargs, total=False): class BeitImageProcessor (line 49) | class BeitImageProcessor(TorchvisionBackend): method __init__ (line 66) | def __init__(self, **kwargs: Unpack[BeitImageProcessorKwargs]): method preprocess (line 70) | def preprocess( method _preprocess_image_like_inputs (line 82) | def _preprocess_image_like_inputs( method reduce_label (line 126) | def reduce_label(self, labels: list["torch.Tensor"]) -> list["torch.Te... method _preprocess (line 136) | def _preprocess( method post_process_semantic_segmentation (line 182) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/beit/image_processing_pil_beit.py class BeitImageProcessorKwargs (line 34) | class BeitImageProcessorKwargs(ImagesKwargs, total=False): class BeitImageProcessorPil (line 46) | class BeitImageProcessorPil(PilBackend): method __init__ (line 63) | def __init__(self, **kwargs: Unpack[BeitImageProcessorKwargs]): method preprocess (line 67) | def preprocess( method _preprocess_image_like_inputs (line 79) | def _preprocess_image_like_inputs( method reduce_label (line 121) | def reduce_label(self, image: np.ndarray) -> np.ndarray: method _preprocess (line 129) | def _preprocess( method post_process_semantic_segmentation (line 163) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/beit/modeling_beit.py class BeitModelOutputWithPooling (line 52) | class BeitModelOutputWithPooling(BaseModelOutputWithPooling): function drop_path (line 61) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class BeitDropPath (line 76) | class BeitDropPath(nn.Module): method __init__ (line 79) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 83) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 86) | def extra_repr(self) -> str: class BeitEmbeddings (line 92) | class BeitEmbeddings(nn.Module): method __init__ (line 98) | def __init__(self, config: BeitConfig) -> None: method interpolate_pos_encoding (line 121) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 161) | def forward( class BeitPatchEmbeddings (line 187) | class BeitPatchEmbeddings(nn.Module): method __init__ (line 194) | def __init__(self, config): method forward (line 211) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class BeitSelfAttention (line 225) | class BeitSelfAttention(nn.Module): method __init__ (line 226) | def __init__(self, config: BeitConfig, window_size: tuple | None = Non... method forward (line 249) | def forward( class BeitSdpaSelfAttention (line 309) | class BeitSdpaSelfAttention(BeitSelfAttention): method forward (line 310) | def forward( class BeitSelfOutput (line 371) | class BeitSelfOutput(nn.Module): method __init__ (line 377) | def __init__(self, config: BeitConfig) -> None: method forward (line 382) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BeitAttention (line 395) | class BeitAttention(nn.Module): method __init__ (line 396) | def __init__(self, config: BeitConfig, window_size: tuple | None = Non... method forward (line 401) | def forward( class BeitIntermediate (line 419) | class BeitIntermediate(nn.Module): method __init__ (line 420) | def __init__(self, config: BeitConfig) -> None: method forward (line 428) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BeitOutput (line 435) | class BeitOutput(nn.Module): method __init__ (line 436) | def __init__(self, config: BeitConfig) -> None: method forward (line 441) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BeitLayer (line 448) | class BeitLayer(GradientCheckpointingLayer): method __init__ (line 451) | def __init__(self, config: BeitConfig, window_size: tuple | None = Non... method forward (line 469) | def forward( class BeitRelativePositionBias (line 511) | class BeitRelativePositionBias(nn.Module): method __init__ (line 512) | def __init__(self, config: BeitConfig, window_size: tuple) -> None: method generate_relative_position_index (line 522) | def generate_relative_position_index(self, window_size: tuple[int, int... method forward (line 546) | def forward(self, window_size, interpolate_pos_encoding: bool = False,... class BeitEncoder (line 594) | class BeitEncoder(nn.Module): method __init__ (line 595) | def __init__(self, config: BeitConfig, window_size: tuple | None = Non... method forward (line 616) | def forward( class BeitPreTrainedModel (line 667) | class BeitPreTrainedModel(PreTrainedModel): method _init_weights (line 678) | def _init_weights(self, module): class BeitModel (line 696) | class BeitModel(BeitPreTrainedModel): method __init__ (line 697) | def __init__(self, config: BeitConfig, add_pooling_layer: bool = True)... method get_input_embeddings (line 716) | def get_input_embeddings(self): method forward (line 720) | def forward( class BeitPooler (line 767) | class BeitPooler(nn.Module): method __init__ (line 768) | def __init__(self, config: BeitConfig) -> None: method forward (line 774) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BeitForMaskedImageModeling (line 794) | class BeitForMaskedImageModeling(BeitPreTrainedModel): method __init__ (line 795) | def __init__(self, config: BeitConfig) -> None: method get_output_embeddings (line 808) | def get_output_embeddings(self): method forward (line 812) | def forward( class BeitForImageClassification (line 895) | class BeitForImageClassification(BeitPreTrainedModel): method __init__ (line 896) | def __init__(self, config: BeitConfig) -> None: method forward (line 909) | def forward( class BeitConvModule (line 954) | class BeitConvModule(nn.Module): method __init__ (line 962) | def __init__( method forward (line 983) | def forward(self, input: torch.Tensor) -> torch.Tensor: class BeitPyramidPoolingBlock (line 991) | class BeitPyramidPoolingBlock(nn.Module): method __init__ (line 992) | def __init__(self, pool_scale: int, in_channels: int, channels: int) -... method forward (line 1001) | def forward(self, input: torch.Tensor) -> torch.Tensor: class BeitPyramidPoolingModule (line 1008) | class BeitPyramidPoolingModule(nn.Module): method __init__ (line 1022) | def __init__(self, pool_scales: tuple[int, ...], in_channels: int, cha... method forward (line 1034) | def forward(self, x: torch.Tensor) -> list[torch.Tensor]: class BeitUperHead (line 1045) | class BeitUperHead(nn.Module): method __init__ (line 1053) | def __init__(self, config: BeitConfig) -> None: method psp_forward (line 1091) | def psp_forward(self, inputs): method forward (line 1100) | def forward(self, encoder_hidden_states: torch.Tensor) -> torch.Tensor: class BeitFCNHead (line 1130) | class BeitFCNHead(nn.Module): method __init__ (line 1145) | def __init__( method forward (line 1179) | def forward(self, encoder_hidden_states: torch.Tensor) -> torch.Tensor: class BeitForSemanticSegmentation (line 1190) | class BeitForSemanticSegmentation(BeitPreTrainedModel): method __init__ (line 1191) | def __init__(self, config: BeitConfig) -> None: method compute_loss (line 1223) | def compute_loss(self, logits, auxiliary_logits, labels): method forward (line 1243) | def forward( class BeitBackbone (line 1340) | class BeitBackbone(BackboneMixin, BeitPreTrainedModel): method __init__ (line 1341) | def __init__(self, config): method get_input_embeddings (line 1370) | def get_input_embeddings(self): method forward (line 1376) | def forward( FILE: src/transformers/models/bert/configuration_bert.py class BertConfig (line 25) | class BertConfig(PreTrainedConfig): FILE: src/transformers/models/bert/convert_bert_original_tf2_checkpoint_to_pytorch.py function load_tf2_weights_in_bert (line 43) | def load_tf2_weights_in_bert(model, tf_checkpoint_path, config): function convert_tf2_checkpoint_to_pytorch (line 213) | def convert_tf2_checkpoint_to_pytorch(tf_checkpoint_path, config_path, p... FILE: src/transformers/models/bert/convert_bert_original_tf_checkpoint_to_pytorch.py function convert_tf_checkpoint_to_pytorch (line 27) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_fil... FILE: src/transformers/models/bert/convert_bert_token_dropping_original_tf2_checkpoint_to_pytorch.py function convert_checkpoint_to_pytorch (line 42) | def convert_checkpoint_to_pytorch(tf_checkpoint_path: str, config_path: ... FILE: src/transformers/models/bert/modeling_bert.py class BertEmbeddings (line 53) | class BertEmbeddings(nn.Module): method __init__ (line 56) | def __init__(self, config): method forward (line 72) | def forward( function eager_attention_forward (line 115) | def eager_attention_forward( class BertSelfAttention (line 143) | class BertSelfAttention(nn.Module): method __init__ (line 144) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 168) | def forward( class BertCrossAttention (line 210) | class BertCrossAttention(nn.Module): method __init__ (line 211) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 234) | def forward( class BertSelfOutput (line 287) | class BertSelfOutput(nn.Module): method __init__ (line 288) | def __init__(self, config): method forward (line 294) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BertAttention (line 301) | class BertAttention(nn.Module): method __init__ (line 302) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 309) | def forward( class BertIntermediate (line 330) | class BertIntermediate(nn.Module): method __init__ (line 331) | def __init__(self, config): method forward (line 339) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BertOutput (line 345) | class BertOutput(nn.Module): method __init__ (line 346) | def __init__(self, config): method forward (line 352) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BertLayer (line 359) | class BertLayer(GradientCheckpointingLayer): method __init__ (line 360) | def __init__(self, config, layer_idx=None): method forward (line 379) | def forward( method feed_forward_chunk (line 418) | def feed_forward_chunk(self, attention_output): class BertEncoder (line 424) | class BertEncoder(nn.Module): method __init__ (line 425) | def __init__(self, config): method forward (line 430) | def forward( class BertPooler (line 456) | class BertPooler(nn.Module): method __init__ (line 457) | def __init__(self, config): method forward (line 462) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BertPredictionHeadTransform (line 471) | class BertPredictionHeadTransform(nn.Module): method __init__ (line 472) | def __init__(self, config): method forward (line 481) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BertLMPredictionHead (line 488) | class BertLMPredictionHead(nn.Module): method __init__ (line 489) | def __init__(self, config): method forward (line 498) | def forward(self, hidden_states): class BertOnlyMLMHead (line 504) | class BertOnlyMLMHead(nn.Module): method __init__ (line 505) | def __init__(self, config): method forward (line 509) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class BertOnlyNSPHead (line 514) | class BertOnlyNSPHead(nn.Module): method __init__ (line 515) | def __init__(self, config): method forward (line 519) | def forward(self, pooled_output): class BertPreTrainingHeads (line 524) | class BertPreTrainingHeads(nn.Module): method __init__ (line 525) | def __init__(self, config): method forward (line 530) | def forward(self, sequence_output, pooled_output): class BertPreTrainedModel (line 537) | class BertPreTrainedModel(PreTrainedModel): method _init_weights (line 552) | def _init_weights(self, module): class BertForPreTrainingOutput (line 568) | class BertForPreTrainingOutput(ModelOutput): class BertModel (line 599) | class BertModel(BertPreTrainedModel): method __init__ (line 602) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 619) | def get_input_embeddings(self): method set_input_embeddings (line 622) | def set_input_embeddings(self, value): method forward (line 628) | def forward( method _create_attention_masks (line 693) | def _create_attention_masks( class BertForPreTraining (line 732) | class BertForPreTraining(BertPreTrainedModel): method __init__ (line 738) | def __init__(self, config): method get_output_embeddings (line 747) | def get_output_embeddings(self): method set_output_embeddings (line 750) | def set_output_embeddings(self, new_embeddings): method forward (line 756) | def forward( class BertLMHeadModel (line 829) | class BertLMHeadModel(BertPreTrainedModel, GenerationMixin): method __init__ (line 835) | def __init__(self, config): method get_output_embeddings (line 847) | def get_output_embeddings(self): method set_output_embeddings (line 850) | def set_output_embeddings(self, new_embeddings): method forward (line 856) | def forward( class BertForMaskedLM (line 914) | class BertForMaskedLM(BertPreTrainedModel): method __init__ (line 920) | def __init__(self, config): method get_output_embeddings (line 935) | def get_output_embeddings(self): method set_output_embeddings (line 938) | def set_output_embeddings(self, new_embeddings): method forward (line 944) | def forward( class BertForNextSentencePrediction (line 995) | class BertForNextSentencePrediction(BertPreTrainedModel): method __init__ (line 996) | def __init__(self, config): method forward (line 1007) | def forward( class BertForSequenceClassification (line 1077) | class BertForSequenceClassification(BertPreTrainedModel): method __init__ (line 1078) | def __init__(self, config): method forward (line 1095) | def forward( class BertForMultipleChoice (line 1158) | class BertForMultipleChoice(BertPreTrainedModel): method __init__ (line 1159) | def __init__(self, config): method forward (line 1174) | def forward( class BertForTokenClassification (line 1256) | class BertForTokenClassification(BertPreTrainedModel): method __init__ (line 1257) | def __init__(self, config): method forward (line 1273) | def forward( class BertForQuestionAnswering (line 1316) | class BertForQuestionAnswering(BertPreTrainedModel): method __init__ (line 1317) | def __init__(self, config): method forward (line 1329) | def forward( FILE: src/transformers/models/bert/tokenization_bert.py function load_vocab (line 30) | def load_vocab(vocab_file): class BertTokenizer (line 41) | class BertTokenizer(TokenizersBackend): method __init__ (line 79) | def __init__( FILE: src/transformers/models/bert/tokenization_bert_legacy.py function load_vocab (line 29) | def load_vocab(vocab_file): function whitespace_tokenize (line 40) | def whitespace_tokenize(text): class BertTokenizerLegacy (line 49) | class BertTokenizerLegacy(PreTrainedTokenizer): method __init__ (line 96) | def __init__( method do_lower_case (line 146) | def do_lower_case(self): method vocab_size (line 150) | def vocab_size(self): method get_vocab (line 153) | def get_vocab(self): method _tokenize (line 156) | def _tokenize(self, text, split_special_tokens=False): method _convert_token_to_id (line 171) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 175) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 179) | def convert_tokens_to_string(self, tokens): method build_inputs_with_special_tokens (line 184) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 209) | def get_special_tokens_mask( method save_vocabulary (line 237) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... class BasicTokenizer (line 258) | class BasicTokenizer: method __init__ (line 281) | def __init__( method tokenize (line 297) | def tokenize(self, text, never_split=None): method _run_strip_accents (line 335) | def _run_strip_accents(self, text): method _run_split_on_punc (line 346) | def _run_split_on_punc(self, text, never_split=None): method _tokenize_chinese_chars (line 368) | def _tokenize_chinese_chars(self, text): method _is_chinese_char (line 381) | def _is_chinese_char(self, cp): method _clean_text (line 405) | def _clean_text(self, text): class WordpieceTokenizer (line 419) | class WordpieceTokenizer: method __init__ (line 422) | def __init__(self, vocab, unk_token, max_input_chars_per_word=100): method tokenize (line 427) | def tokenize(self, text): FILE: src/transformers/models/bert_generation/configuration_bert_generation.py class BertGenerationConfig (line 24) | class BertGenerationConfig(PreTrainedConfig): FILE: src/transformers/models/bert_generation/modeling_bert_generation.py class BertGenerationSelfOutput (line 45) | class BertGenerationSelfOutput(nn.Module): method __init__ (line 46) | def __init__(self, config): method forward (line 52) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... function eager_attention_forward (line 60) | def eager_attention_forward( class BertGenerationSelfAttention (line 89) | class BertGenerationSelfAttention(nn.Module): method __init__ (line 90) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 114) | def forward( class BertGenerationCrossAttention (line 157) | class BertGenerationCrossAttention(nn.Module): method __init__ (line 158) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 181) | def forward( class BertGenerationAttention (line 235) | class BertGenerationAttention(nn.Module): method __init__ (line 236) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 243) | def forward( class BertGenerationIntermediate (line 265) | class BertGenerationIntermediate(nn.Module): method __init__ (line 266) | def __init__(self, config): method forward (line 274) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BertGenerationOutput (line 281) | class BertGenerationOutput(nn.Module): method __init__ (line 282) | def __init__(self, config): method forward (line 288) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BertGenerationLayer (line 296) | class BertGenerationLayer(GradientCheckpointingLayer): method __init__ (line 297) | def __init__(self, config, layer_idx=None): method forward (line 316) | def forward( method feed_forward_chunk (line 355) | def feed_forward_chunk(self, attention_output): class BertEncoder (line 362) | class BertEncoder(nn.Module): method __init__ (line 363) | def __init__(self, config): method forward (line 369) | def forward( class BertGenerationEmbeddings (line 395) | class BertGenerationEmbeddings(nn.Module): method __init__ (line 398) | def __init__(self, config): method forward (line 410) | def forward(self, input_ids=None, position_ids=None, inputs_embeds=Non... class BertGenerationPreTrainedModel (line 432) | class BertGenerationPreTrainedModel(PreTrainedModel): method _init_weights (line 447) | def _init_weights(self, module): class BertGenerationEncoder (line 461) | class BertGenerationEncoder(BertGenerationPreTrainedModel): method __init__ (line 478) | def __init__(self, config): method get_input_embeddings (line 489) | def get_input_embeddings(self): method set_input_embeddings (line 492) | def set_input_embeddings(self, value): method forward (line 498) | def forward( method _create_attention_masks (line 560) | def _create_attention_masks( class BertGenerationOnlyLMHead (line 593) | class BertGenerationOnlyLMHead(nn.Module): method __init__ (line 594) | def __init__(self, config): method forward (line 599) | def forward(self, hidden_states): class BertGenerationDecoder (line 609) | class BertGenerationDecoder(BertGenerationPreTrainedModel, GenerationMix... method __init__ (line 615) | def __init__(self, config): method get_output_embeddings (line 627) | def get_output_embeddings(self): method set_output_embeddings (line 630) | def set_output_embeddings(self, new_embeddings): method forward (line 636) | def forward( FILE: src/transformers/models/bert_generation/tokenization_bert_generation.py class BertGenerationTokenizer (line 29) | class BertGenerationTokenizer(SentencePieceBackend): method __init__ (line 75) | def __init__( FILE: src/transformers/models/bert_japanese/tokenization_bert_japanese.py function load_vocab (line 38) | def load_vocab(vocab_file): function whitespace_tokenize (line 49) | def whitespace_tokenize(text): class BertJapaneseTokenizer (line 58) | class BertJapaneseTokenizer(PreTrainedTokenizer): method __init__ (line 91) | def __init__( method do_lower_case (line 188) | def do_lower_case(self): method __getstate__ (line 191) | def __getstate__(self): method __setstate__ (line 197) | def __setstate__(self, state): method _tokenize (line 212) | def _tokenize(self, text): method vocab_size (line 226) | def vocab_size(self): method get_vocab (line 231) | def get_vocab(self): method _convert_token_to_id (line 244) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 250) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 256) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 263) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... class MecabTokenizer (line 296) | class MecabTokenizer: method __init__ (line 299) | def __init__( method tokenize (line 385) | def tokenize(self, text, never_split=None, **kwargs): class SudachiTokenizer (line 404) | class SudachiTokenizer: method __init__ (line 407) | def __init__( method tokenize (line 476) | def tokenize(self, text, never_split=None, **kwargs): class JumanppTokenizer (line 501) | class JumanppTokenizer: method __init__ (line 504) | def __init__( method tokenize (line 541) | def tokenize(self, text, never_split=None, **kwargs): class CharacterTokenizer (line 568) | class CharacterTokenizer: method __init__ (line 571) | def __init__(self, vocab, unk_token, normalize_text=True): method tokenize (line 587) | def tokenize(self, text): class BasicTokenizer (line 614) | class BasicTokenizer: method __init__ (line 637) | def __init__( method tokenize (line 653) | def tokenize(self, text, never_split=None): method _run_strip_accents (line 691) | def _run_strip_accents(self, text): method _run_split_on_punc (line 702) | def _run_split_on_punc(self, text, never_split=None): method _tokenize_chinese_chars (line 724) | def _tokenize_chinese_chars(self, text): method _is_chinese_char (line 737) | def _is_chinese_char(self, cp): method _clean_text (line 761) | def _clean_text(self, text): class WordpieceTokenizer (line 775) | class WordpieceTokenizer: method __init__ (line 778) | def __init__(self, vocab, unk_token, max_input_chars_per_word=100): method tokenize (line 783) | def tokenize(self, text): class SentencepieceTokenizer (line 832) | class SentencepieceTokenizer: method __init__ (line 837) | def __init__( method preprocess_text (line 856) | def preprocess_text(self, inputs): method tokenize (line 871) | def tokenize(self, text): FILE: src/transformers/models/bertweet/tokenization_bertweet.py function get_pairs (line 35) | def get_pairs(word): class BertweetTokenizer (line 51) | class BertweetTokenizer(PreTrainedTokenizer): method __init__ (line 104) | def __init__( method vocab_size (line 169) | def vocab_size(self): method get_vocab (line 172) | def get_vocab(self): method bpe (line 175) | def bpe(self, token): method _tokenize (line 219) | def _tokenize(self, text): method normalizeTweet (line 230) | def normalizeTweet(self, tweet): method normalizeToken (line 264) | def normalizeToken(self, token): method _convert_token_to_id (line 283) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 287) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 291) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 302) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method add_from_file (line 332) | def add_from_file(self, f): function _str_to_unicode (line 534) | def _str_to_unicode(text, encoding=None, errors="strict"): function _replace_html_entities (line 542) | def _replace_html_entities(text, keep=(), remove_illegal=True, encoding=... class TweetTokenizer (line 606) | class TweetTokenizer: method __init__ (line 626) | def __init__(self, preserve_case=True, reduce_len=False, strip_handles... method tokenize (line 631) | def tokenize(self, text): function reduce_lengthening (line 662) | def reduce_lengthening(text): function remove_handles (line 670) | def remove_handles(text): function casual_tokenize (line 686) | def casual_tokenize(text, preserve_case=True, reduce_len=False, strip_ha... FILE: src/transformers/models/big_bird/configuration_big_bird.py class BigBirdConfig (line 24) | class BigBirdConfig(PreTrainedConfig): FILE: src/transformers/models/big_bird/convert_bigbird_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_big_bird (line 49) | def load_tf_weights_in_big_bird(model, tf_checkpoint_path, is_trivia_qa=... function convert_tf_checkpoint_to_pytorch (line 208) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, big_bird_config... FILE: src/transformers/models/big_bird/modeling_big_bird.py class BigBirdEmbeddings (line 69) | class BigBirdEmbeddings(nn.Module): method __init__ (line 73) | def __init__(self, config): method forward (line 93) | def forward( class BigBirdSelfAttention (line 135) | class BigBirdSelfAttention(nn.Module): method __init__ (line 136) | def __init__(self, config, layer_idx=None): method forward (line 156) | def forward( class BigBirdBlockSparseAttention (line 223) | class BigBirdBlockSparseAttention(nn.Module): method __init__ (line 224) | def __init__(self, config, seed=None): method forward (line 247) | def forward( method torch_bmm_nd (line 309) | def torch_bmm_nd(inp_1, inp_2, ndim=None): method torch_bmm_nd_transpose (line 317) | def torch_bmm_nd_transpose(inp_1, inp_2, ndim=None): method bigbird_block_sparse_attention (line 324) | def bigbird_block_sparse_attention( method torch_gather_b2 (line 760) | def torch_gather_b2(params, indices): method _create_rand_mask_from_inputs (line 781) | def _create_rand_mask_from_inputs( method _get_rand_attn_plan (line 818) | def _get_rand_attn_plan(from_seq_length, from_block_size, num_rand_blo... method _bigbird_block_rand_mask (line 850) | def _bigbird_block_rand_mask( method _bigbird_block_rand_mask_with_head (line 908) | def _bigbird_block_rand_mask_with_head( method _get_single_block_row_attention (line 1048) | def _get_single_block_row_attention( class BigBirdSelfOutput (line 1105) | class BigBirdSelfOutput(nn.Module): method __init__ (line 1106) | def __init__(self, config): method forward (line 1112) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BigBirdAttention (line 1119) | class BigBirdAttention(nn.Module): method __init__ (line 1120) | def __init__(self, config, seed=None): method set_attention_type (line 1137) | def set_attention_type(self, value: str, layer_idx=None): method forward (line 1161) | def forward( class BigBirdIntermediate (line 1204) | class BigBirdIntermediate(nn.Module): method __init__ (line 1205) | def __init__(self, config): method forward (line 1213) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BigBirdOutput (line 1220) | class BigBirdOutput(nn.Module): method __init__ (line 1221) | def __init__(self, config): method forward (line 1227) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BigBirdLayer (line 1234) | class BigBirdLayer(GradientCheckpointingLayer): method __init__ (line 1235) | def __init__(self, config, seed=None): method set_attention_type (line 1251) | def set_attention_type(self, value: str, layer_idx=None): method forward (line 1265) | def forward( method feed_forward_chunk (line 1314) | def feed_forward_chunk(self, attention_output): class BigBirdEncoder (line 1320) | class BigBirdEncoder(nn.Module): method __init__ (line 1321) | def __init__(self, config): method set_attention_type (line 1331) | def set_attention_type(self, value: str): method forward (line 1343) | def forward( class BigBirdPredictionHeadTransform (line 1381) | class BigBirdPredictionHeadTransform(nn.Module): method __init__ (line 1382) | def __init__(self, config): method forward (line 1391) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BigBirdLMPredictionHead (line 1399) | class BigBirdLMPredictionHead(nn.Module): method __init__ (line 1400) | def __init__(self, config): method forward (line 1409) | def forward(self, hidden_states): class BigBirdOnlyMLMHead (line 1416) | class BigBirdOnlyMLMHead(nn.Module): method __init__ (line 1417) | def __init__(self, config): method forward (line 1421) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class BigBirdOnlyNSPHead (line 1427) | class BigBirdOnlyNSPHead(nn.Module): method __init__ (line 1428) | def __init__(self, config): method forward (line 1432) | def forward(self, pooled_output): class BigBirdPreTrainingHeads (line 1438) | class BigBirdPreTrainingHeads(nn.Module): method __init__ (line 1439) | def __init__(self, config): method forward (line 1444) | def forward(self, sequence_output, pooled_output): class BigBirdPreTrainedModel (line 1451) | class BigBirdPreTrainedModel(PreTrainedModel): method _init_weights (line 1461) | def _init_weights(self, module): class BigBirdForPreTrainingOutput (line 1477) | class BigBirdForPreTrainingOutput(ModelOutput): class BigBirdForQuestionAnsweringModelOutput (line 1502) | class BigBirdForQuestionAnsweringModelOutput(ModelOutput): class BigBirdModel (line 1519) | class BigBirdModel(BigBirdPreTrainedModel): method __init__ (line 1532) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 1563) | def get_input_embeddings(self): method set_input_embeddings (line 1566) | def set_input_embeddings(self, value): method set_attention_type (line 1569) | def set_attention_type(self, value: str): method forward (line 1583) | def forward( method create_masks_for_block_sparse_attn (line 1731) | def create_masks_for_block_sparse_attn(attention_mask: torch.Tensor, b... method _pad_to_block_size (line 1768) | def _pad_to_block_size( class BigBirdForPreTraining (line 1812) | class BigBirdForPreTraining(BigBirdPreTrainedModel): method __init__ (line 1818) | def __init__(self, config): method get_output_embeddings (line 1827) | def get_output_embeddings(self): method set_output_embeddings (line 1830) | def set_output_embeddings(self, new_embeddings): method forward (line 1836) | def forward( class BigBirdForMaskedLM (line 1907) | class BigBirdForMaskedLM(BigBirdPreTrainedModel): method __init__ (line 1913) | def __init__(self, config): method get_output_embeddings (line 1928) | def get_output_embeddings(self): method set_output_embeddings (line 1931) | def set_output_embeddings(self, new_embeddings): method forward (line 1937) | def forward( class BigBirdForCausalLM (line 2028) | class BigBirdForCausalLM(BigBirdPreTrainedModel, GenerationMixin): method __init__ (line 2034) | def __init__(self, config): method get_output_embeddings (line 2046) | def get_output_embeddings(self): method set_output_embeddings (line 2049) | def set_output_embeddings(self, new_embeddings): method forward (line 2055) | def forward( class BigBirdClassificationHead (line 2108) | class BigBirdClassificationHead(nn.Module): method __init__ (line 2111) | def __init__(self, config): method forward (line 2122) | def forward(self, features, **kwargs): class BigBirdForSequenceClassification (line 2138) | class BigBirdForSequenceClassification(BigBirdPreTrainedModel): method __init__ (line 2139) | def __init__(self, config): method forward (line 2151) | def forward( class BigBirdForMultipleChoice (line 2246) | class BigBirdForMultipleChoice(BigBirdPreTrainedModel): method __init__ (line 2247) | def __init__(self, config): method forward (line 2259) | def forward( class BigBirdForTokenClassification (line 2340) | class BigBirdForTokenClassification(BigBirdPreTrainedModel): method __init__ (line 2341) | def __init__(self, config): method forward (line 2357) | def forward( class BigBirdForQuestionAnsweringHead (line 2398) | class BigBirdForQuestionAnsweringHead(nn.Module): method __init__ (line 2401) | def __init__(self, config): method forward (line 2408) | def forward(self, encoder_output): class BigBirdForQuestionAnswering (line 2417) | class BigBirdForQuestionAnswering(BigBirdPreTrainedModel): method __init__ (line 2418) | def __init__(self, config, add_pooling_layer=False): method forward (line 2437) | def forward( method prepare_question_mask (line 2553) | def prepare_question_mask(q_lengths: torch.Tensor, maxlen: int): FILE: src/transformers/models/big_bird/tokenization_big_bird.py class BigBirdTokenizer (line 31) | class BigBirdTokenizer(TokenizersBackend): method __init__ (line 84) | def __init__( FILE: src/transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py class BigBirdPegasusConfig (line 24) | class BigBirdPegasusConfig(PreTrainedConfig): FILE: src/transformers/models/bigbird_pegasus/convert_bigbird_pegasus_tf_to_pytorch.py function rename_state_dict_key (line 81) | def rename_state_dict_key(k, patterns): function convert_bigbird_pegasus (line 87) | def convert_bigbird_pegasus(tf_weights: dict, config_update: dict) -> Bi... function get_tf_weights_as_numpy (line 143) | def get_tf_weights_as_numpy(path) -> dict: function convert_bigbird_pegasus_ckpt_to_pytorch (line 156) | def convert_bigbird_pegasus_ckpt_to_pytorch(ckpt_path: str, save_dir: st... FILE: src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py function shift_tokens_right (line 60) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class BigBirdPegasusLearnedPositionalEmbedding (line 76) | class BigBirdPegasusLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 81) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 84) | def forward( class BigBirdPegasusScaledWordEmbedding (line 98) | class BigBirdPegasusScaledWordEmbedding(nn.Embedding): method __init__ (line 103) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 107) | def forward(self, input_ids: torch.Tensor): class BigBirdPegasusSelfAttention (line 112) | class BigBirdPegasusSelfAttention(nn.Module): method __init__ (line 113) | def __init__(self, config, layer_idx=None): method forward (line 133) | def forward( class BigBirdPegasusBlockSparseAttention (line 201) | class BigBirdPegasusBlockSparseAttention(nn.Module): method __init__ (line 202) | def __init__(self, config, seed=None): method forward (line 225) | def forward( method torch_bmm_nd (line 287) | def torch_bmm_nd(inp_1, inp_2, ndim=None): method torch_bmm_nd_transpose (line 295) | def torch_bmm_nd_transpose(inp_1, inp_2, ndim=None): method bigbird_block_sparse_attention (line 302) | def bigbird_block_sparse_attention( method torch_gather_b2 (line 738) | def torch_gather_b2(params, indices): method _create_rand_mask_from_inputs (line 759) | def _create_rand_mask_from_inputs( method _get_rand_attn_plan (line 796) | def _get_rand_attn_plan(from_seq_length, from_block_size, num_rand_blo... method _bigbird_block_rand_mask (line 828) | def _bigbird_block_rand_mask( method _bigbird_block_rand_mask_with_head (line 886) | def _bigbird_block_rand_mask_with_head( method _get_single_block_row_attention (line 1026) | def _get_single_block_row_attention( class BigBirdPegasusEncoderAttention (line 1082) | class BigBirdPegasusEncoderAttention(nn.Module): method __init__ (line 1083) | def __init__(self, config, seed=None): method set_attention_type (line 1101) | def set_attention_type(self, value: str): method forward (line 1126) | def forward( function eager_attention_forward (line 1158) | def eager_attention_forward( class BigBirdPegasusDecoderAttention (line 1187) | class BigBirdPegasusDecoderAttention(nn.Module): method __init__ (line 1190) | def __init__( method forward (line 1229) | def forward( class BigBirdPegasusEncoderLayer (line 1305) | class BigBirdPegasusEncoderLayer(GradientCheckpointingLayer): method __init__ (line 1306) | def __init__(self, config: BigBirdPegasusConfig, seed=None): method forward (line 1319) | def forward( method set_attention_type (line 1361) | def set_attention_type(self, value: str): class BigBirdPegasusDecoderLayer (line 1373) | class BigBirdPegasusDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1374) | def __init__(self, config: BigBirdPegasusConfig, layer_idx: int | None... method forward (line 1406) | def forward( class BigBirdPegasusClassificationHead (line 1468) | class BigBirdPegasusClassificationHead(nn.Module): method __init__ (line 1471) | def __init__( method forward (line 1483) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BigBirdPegasusPreTrainedModel (line 1493) | class BigBirdPegasusPreTrainedModel(PreTrainedModel): method _init_weights (line 1501) | def _init_weights(self, module): method dummy_inputs (line 1507) | def dummy_inputs(self): class BigBirdPegasusEncoder (line 1517) | class BigBirdPegasusEncoder(BigBirdPegasusPreTrainedModel): method __init__ (line 1532) | def __init__(self, config: BigBirdPegasusConfig): method forward (line 1564) | def forward( method set_attention_type (line 1662) | def set_attention_type(self, value: str): method create_masks_for_block_sparse_attn (line 1675) | def create_masks_for_block_sparse_attn(attention_mask: torch.Tensor, b... method _pad_to_block_size (line 1712) | def _pad_to_block_size(self, hidden_states: torch.Tensor, attention_ma... class BigBirdPegasusDecoder (line 1737) | class BigBirdPegasusDecoder(BigBirdPegasusPreTrainedModel): method __init__ (line 1752) | def __init__(self, config: BigBirdPegasusConfig): method forward (line 1780) | def forward( class BigBirdPegasusModel (line 1867) | class BigBirdPegasusModel(BigBirdPegasusPreTrainedModel): method __init__ (line 1873) | def __init__(self, config: BigBirdPegasusConfig): method get_input_embeddings (line 1888) | def get_input_embeddings(self): method set_input_embeddings (line 1891) | def set_input_embeddings(self, value): method forward (line 1898) | def forward( class BigBirdPegasusForConditionalGeneration (line 1979) | class BigBirdPegasusForConditionalGeneration(BigBirdPegasusPreTrainedMod... method __init__ (line 1987) | def __init__(self, config: BigBirdPegasusConfig): method resize_token_embeddings (line 1997) | def resize_token_embeddings( method _resize_final_logits_bias (line 2005) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 2016) | def forward( method prepare_decoder_input_ids_from_labels (line 2114) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class BigBirdPegasusForSequenceClassification (line 2124) | class BigBirdPegasusForSequenceClassification(BigBirdPegasusPreTrainedMo... method __init__ (line 2125) | def __init__(self, config: BigBirdPegasusConfig, **kwargs): method forward (line 2140) | def forward( class BigBirdPegasusForQuestionAnswering (line 2238) | class BigBirdPegasusForQuestionAnswering(BigBirdPegasusPreTrainedModel): method __init__ (line 2239) | def __init__(self, config): method forward (line 2253) | def forward( class BigBirdPegasusDecoderWrapper (line 2333) | class BigBirdPegasusDecoderWrapper(BigBirdPegasusPreTrainedModel): method __init__ (line 2339) | def __init__(self, config): method forward (line 2344) | def forward(self, *args, **kwargs): class BigBirdPegasusForCausalLM (line 2348) | class BigBirdPegasusForCausalLM(BigBirdPegasusPreTrainedModel, Generatio... method __init__ (line 2349) | def __init__(self, config): method get_input_embeddings (line 2360) | def get_input_embeddings(self): method set_input_embeddings (line 2363) | def set_input_embeddings(self, value): method forward (line 2368) | def forward( FILE: src/transformers/models/biogpt/configuration_biogpt.py class BioGptConfig (line 24) | class BioGptConfig(PreTrainedConfig): FILE: src/transformers/models/biogpt/convert_biogpt_original_pytorch_checkpoint_to_pytorch.py class Dictionary (line 36) | class Dictionary: method __init__ (line 39) | def __init__( method __eq__ (line 61) | def __eq__(self, other): method __getitem__ (line 64) | def __getitem__(self, idx): method __len__ (line 69) | def __len__(self): method __contains__ (line 73) | def __contains__(self, sym): method load (line 77) | def load(cls, f): method add_symbol (line 90) | def add_symbol(self, word, n=1, overwrite=False): method _load_meta (line 103) | def _load_meta(self, lines): method add_from_file (line 106) | def add_from_file(self, f): function rewrite_dict_keys (line 146) | def rewrite_dict_keys(d): function convert_biogpt_checkpoint_to_pytorch (line 158) | def convert_biogpt_checkpoint_to_pytorch(biogpt_checkpoint_path, pytorch... FILE: src/transformers/models/biogpt/modeling_biogpt.py class BioGptLearnedPositionalEmbedding (line 51) | class BioGptLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 56) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 62) | def forward( class BioGptScaledWordEmbedding (line 79) | class BioGptScaledWordEmbedding(nn.Embedding): method __init__ (line 84) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 88) | def forward(self, input_ids: torch.Tensor): function eager_attention_forward (line 92) | def eager_attention_forward( class BioGptAttention (line 120) | class BioGptAttention(nn.Module): method __init__ (line 123) | def __init__( method forward (line 162) | def forward( class BioGptDecoderLayer (line 238) | class BioGptDecoderLayer(GradientCheckpointingLayer): method __init__ (line 239) | def __init__(self, config: BioGptConfig, layer_idx: int | None = None): method forward (line 262) | def forward( class BioGptPreTrainedModel (line 307) | class BioGptPreTrainedModel(PreTrainedModel): class BioGptModel (line 322) | class BioGptModel(BioGptPreTrainedModel): method __init__ (line 323) | def __init__(self, config: BioGptConfig): method forward (line 347) | def forward( class BioGptForCausalLM (line 421) | class BioGptForCausalLM(BioGptPreTrainedModel, GenerationMixin): method __init__ (line 424) | def __init__(self, config): method get_output_embeddings (line 433) | def get_output_embeddings(self): method set_output_embeddings (line 436) | def set_output_embeddings(self, new_embeddings): method forward (line 441) | def forward( class BioGptForTokenClassification (line 488) | class BioGptForTokenClassification(BioGptPreTrainedModel): method __init__ (line 489) | def __init__(self, config): method forward (line 505) | def forward( class BioGptForSequenceClassification (line 572) | class BioGptForSequenceClassification(BioGptPreTrainedModel): method __init__ (line 573) | def __init__(self, config: BioGptConfig): method forward (line 584) | def forward( method get_input_embeddings (line 665) | def get_input_embeddings(self): method set_input_embeddings (line 668) | def set_input_embeddings(self, value): FILE: src/transformers/models/biogpt/modular_biogpt.py class BioGptLearnedPositionalEmbedding (line 51) | class BioGptLearnedPositionalEmbedding(OPTLearnedPositionalEmbedding): method forward (line 52) | def forward( class BioGptScaledWordEmbedding (line 62) | class BioGptScaledWordEmbedding(BartScaledWordEmbedding): class BioGptAttention (line 66) | class BioGptAttention(BartAttention): class BioGptDecoderLayer (line 70) | class BioGptDecoderLayer(BartDecoderLayer): method __init__ (line 71) | def __init__(self, config: BioGptConfig, layer_idx: int | None = None): method forward (line 93) | def forward( class BioGptPreTrainedModel (line 138) | class BioGptPreTrainedModel(PreTrainedModel): class BioGptModel (line 153) | class BioGptModel(BioGptPreTrainedModel): method __init__ (line 154) | def __init__(self, config: BioGptConfig): method forward (line 178) | def forward( class BioGptForCausalLM (line 252) | class BioGptForCausalLM(BioGptPreTrainedModel, GenerationMixin): method __init__ (line 255) | def __init__(self, config): method get_output_embeddings (line 264) | def get_output_embeddings(self): method set_output_embeddings (line 267) | def set_output_embeddings(self, new_embeddings): method forward (line 272) | def forward( class BioGptForTokenClassification (line 319) | class BioGptForTokenClassification(BioGptPreTrainedModel): method __init__ (line 320) | def __init__(self, config): method forward (line 336) | def forward( class BioGptForSequenceClassification (line 403) | class BioGptForSequenceClassification(BioGptPreTrainedModel): method __init__ (line 404) | def __init__(self, config: BioGptConfig): method forward (line 415) | def forward( method get_input_embeddings (line 496) | def get_input_embeddings(self): method set_input_embeddings (line 499) | def set_input_embeddings(self, value): FILE: src/transformers/models/biogpt/tokenization_biogpt.py function get_pairs (line 31) | def get_pairs(word): class BioGptTokenizer (line 44) | class BioGptTokenizer(PreTrainedTokenizer): method __init__ (line 90) | def __init__( method vocab_size (line 135) | def vocab_size(self): method get_vocab (line 139) | def get_vocab(self): method moses_tokenize (line 142) | def moses_tokenize(self, text, lang): method moses_detokenize (line 150) | def moses_detokenize(self, tokens, lang): method bpe (line 156) | def bpe(self, token): method _tokenize (line 200) | def _tokenize(self, text, bypass_tokenizer=False): method _convert_token_to_id (line 214) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 218) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 222) | def convert_tokens_to_string(self, tokens): method build_inputs_with_special_tokens (line 231) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 255) | def get_special_tokens_mask( method save_vocabulary (line 282) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method __getstate__ (line 310) | def __getstate__(self): method __setstate__ (line 315) | def __setstate__(self, d): FILE: src/transformers/models/bit/configuration_bit.py class BitConfig (line 25) | class BitConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 72) | def __post_init__(self, **kwargs): method validate_architecture (line 86) | def validate_architecture(self): FILE: src/transformers/models/bit/convert_bit_to_pytorch.py function get_config (line 38) | def get_config(model_name): function rename_key (line 60) | def rename_key(name): function prepare_img (line 76) | def prepare_img(): function convert_bit_checkpoint (line 84) | def convert_bit_checkpoint(model_name, pytorch_dump_folder_path, push_to... FILE: src/transformers/models/bit/image_processing_bit.py class BitImageProcessor (line 22) | class BitImageProcessor(TorchvisionBackend): FILE: src/transformers/models/bit/image_processing_pil_bit.py class BitImageProcessorPil (line 22) | class BitImageProcessorPil(PilBackend): FILE: src/transformers/models/bit/modeling_bit.py function get_padding_value (line 41) | def get_padding_value(padding=None, kernel_size=7, stride=1, dilation=1)... class WeightStandardizedConv2d (line 82) | class WeightStandardizedConv2d(nn.Conv2d): method __init__ (line 89) | def __init__( method forward (line 118) | def forward(self, hidden_state): class BitGroupNormActivation (line 130) | class BitGroupNormActivation(nn.GroupNorm): method __init__ (line 135) | def __init__(self, config, num_channels, eps=1e-5, affine=True, apply_... method forward (line 142) | def forward(self, hidden_state): class DynamicPad2d (line 148) | class DynamicPad2d(nn.Module): method __init__ (line 154) | def __init__(self, kernel_size, stride, dilation, value=0): method forward (line 176) | def forward(self, input): class BitMaxPool2d (line 199) | class BitMaxPool2d(nn.MaxPool2d): method __init__ (line 200) | def __init__( method forward (line 219) | def forward(self, hidden_states): class BitEmbeddings (line 226) | class BitEmbeddings(nn.Module): method __init__ (line 231) | def __init__(self, config: BitConfig): method forward (line 258) | def forward(self, pixel_values: Tensor) -> Tensor: function drop_path (line 277) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class BitDropPath (line 293) | class BitDropPath(nn.Module): method __init__ (line 296) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 300) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 303) | def extra_repr(self) -> str: function make_div (line 307) | def make_div(value, divisor=8): class BitPreActivationBottleneckLayer (line 315) | class BitPreActivationBottleneckLayer(nn.Module): method __init__ (line 323) | def __init__( method forward (line 367) | def forward(self, hidden_states): class BitBottleneckLayer (line 383) | class BitBottleneckLayer(nn.Module): method __init__ (line 386) | def __init__( method forward (line 435) | def forward(self, hidden_states): class BitDownsampleConv (line 456) | class BitDownsampleConv(nn.Module): method __init__ (line 457) | def __init__( method forward (line 475) | def forward(self, x): class BitStage (line 479) | class BitStage(nn.Module): method __init__ (line 484) | def __init__( method _get_updated_hyperparameters (line 530) | def _get_updated_hyperparameters(self, layer_idx, stride, layer_dropout): method forward (line 546) | def forward(self, input: Tensor) -> Tensor: class BitEncoder (line 553) | class BitEncoder(nn.Module): method __init__ (line 554) | def __init__(self, config: BitConfig): method _get_updated_hyperparameters (line 592) | def _get_updated_hyperparameters(self, stage_idx, current_stride, curr... method forward (line 600) | def forward( class BitPreTrainedModel (line 624) | class BitPreTrainedModel(PreTrainedModel): method _init_weights (line 632) | def _init_weights(self, module): class BitModel (line 652) | class BitModel(BitPreTrainedModel): method __init__ (line 653) | def __init__(self, config): method forward (line 671) | def forward( class BitForImageClassification (line 711) | class BitForImageClassification(BitPreTrainedModel): method __init__ (line 712) | def __init__(self, config): method forward (line 725) | def forward( class BitBackbone (line 763) | class BitBackbone(BackboneMixin, BitPreTrainedModel): method __init__ (line 766) | def __init__(self, config): method forward (line 778) | def forward( FILE: src/transformers/models/bitnet/configuration_bitnet.py class BitNetConfig (line 24) | class BitNetConfig(PreTrainedConfig): method __post_init__ (line 63) | def __post_init__(self, **kwargs): FILE: src/transformers/models/bitnet/modeling_bitnet.py class BitNetRMSNorm (line 44) | class BitNetRMSNorm(nn.Module): method __init__ (line 45) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 53) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 60) | def extra_repr(self): class BitNetMLP (line 64) | class BitNetMLP(nn.Module): method __init__ (line 65) | def __init__(self, config: BitNetConfig): method forward (line 76) | def forward(self, x): function rotate_half (line 81) | def rotate_half(x): function apply_rotary_pos_emb (line 89) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 114) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 126) | def eager_attention_forward( class BitNetAttention (line 152) | class BitNetAttention(nn.Module): method __init__ (line 155) | def __init__(self, config: BitNetConfig, layer_idx: int): method forward (line 179) | def forward( class BitNetDecoderLayer (line 221) | class BitNetDecoderLayer(GradientCheckpointingLayer): method __init__ (line 222) | def __init__(self, config: BitNetConfig, layer_idx: int): method forward (line 232) | def forward( class BitNetRotaryEmbedding (line 264) | class BitNetRotaryEmbedding(nn.Module): method __init__ (line 267) | def __init__(self, config: BitNetConfig, device=None): method compute_default_rope_parameters (line 284) | def compute_default_rope_parameters( method forward (line 315) | def forward(self, x, position_ids): class BitNetPreTrainedModel (line 330) | class BitNetPreTrainedModel(PreTrainedModel): class BitNetModel (line 349) | class BitNetModel(BitNetPreTrainedModel): method __init__ (line 350) | def __init__(self, config: BitNetConfig): method forward (line 369) | def forward( class BitNetForCausalLM (line 423) | class BitNetForCausalLM(BitNetPreTrainedModel, GenerationMixin): method __init__ (line 428) | def __init__(self, config): method forward (line 439) | def forward( FILE: src/transformers/models/bitnet/modular_bitnet.py class BitNetRMSNorm (line 41) | class BitNetRMSNorm(LlamaRMSNorm): class BitNetMLP (line 45) | class BitNetMLP(GemmaMLP): method __init__ (line 46) | def __init__(self, config: BitNetConfig): method forward (line 50) | def forward(self, x): class BitNetAttention (line 55) | class BitNetAttention(LlamaAttention): method __init__ (line 56) | def __init__(self, config: BitNetConfig, layer_idx: int): method forward (line 60) | def forward( class BitNetDecoderLayer (line 102) | class BitNetDecoderLayer(LlamaDecoderLayer): class BitNetModel (line 106) | class BitNetModel(LlamaModel): class BitNetForCausalLM (line 110) | class BitNetForCausalLM(LlamaForCausalLM): method forward (line 115) | def forward( FILE: src/transformers/models/blenderbot/configuration_blenderbot.py class BlenderbotConfig (line 24) | class BlenderbotConfig(PreTrainedConfig): FILE: src/transformers/models/blenderbot/convert_blenderbot_original_pytorch_checkpoint_to_pytorch.py function rename_state_dict_key (line 41) | def rename_state_dict_key(k): function rename_layernorm_keys (line 59) | def rename_layernorm_keys(sd): function convert_parlai_checkpoint (line 77) | def convert_parlai_checkpoint(checkpoint_path, pytorch_dump_folder_path,... FILE: src/transformers/models/blenderbot/modeling_blenderbot.py function shift_tokens_right (line 49) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class BlenderbotLearnedPositionalEmbedding (line 65) | class BlenderbotLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 70) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 73) | def forward( class BlenderbotScaledWordEmbedding (line 86) | class BlenderbotScaledWordEmbedding(nn.Embedding): method __init__ (line 91) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 95) | def forward(self, input_ids: torch.Tensor): function eager_attention_forward (line 100) | def eager_attention_forward( class BlenderbotAttention (line 129) | class BlenderbotAttention(nn.Module): method __init__ (line 132) | def __init__( method forward (line 171) | def forward( class BlenderbotEncoderLayer (line 248) | class BlenderbotEncoderLayer(GradientCheckpointingLayer): method __init__ (line 249) | def __init__(self, config: BlenderbotConfig): method forward (line 267) | def forward( class BlenderbotDecoderLayer (line 305) | class BlenderbotDecoderLayer(GradientCheckpointingLayer): method __init__ (line 306) | def __init__(self, config: BlenderbotConfig, layer_idx: int | None = N... method forward (line 337) | def forward( class BlenderbotPreTrainedModel (line 399) | class BlenderbotPreTrainedModel(PreTrainedModel): method _init_weights (line 408) | def _init_weights(self, module): method dummy_inputs (line 414) | def dummy_inputs(self): class BlenderbotEncoder (line 425) | class BlenderbotEncoder(BlenderbotPreTrainedModel): method __init__ (line 440) | def __init__(self, config: BlenderbotConfig): method forward (line 469) | def forward( class BlenderbotDecoder (line 516) | class BlenderbotDecoder(BlenderbotPreTrainedModel): method __init__ (line 531) | def __init__(self, config: BlenderbotConfig): method forward (line 559) | def forward( class BlenderbotModel (line 648) | class BlenderbotModel(BlenderbotPreTrainedModel): method __init__ (line 654) | def __init__(self, config: BlenderbotConfig): method get_input_embeddings (line 666) | def get_input_embeddings(self): method set_input_embeddings (line 669) | def set_input_embeddings(self, value): method forward (line 676) | def forward( class BlenderbotForConditionalGeneration (line 764) | class BlenderbotForConditionalGeneration(BlenderbotPreTrainedModel, Gene... method __init__ (line 771) | def __init__(self, config: BlenderbotConfig): method resize_token_embeddings (line 780) | def resize_token_embeddings( method _resize_final_logits_bias (line 787) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 798) | def forward( class BlenderbotDecoderWrapper (line 909) | class BlenderbotDecoderWrapper(BlenderbotPreTrainedModel): method __init__ (line 915) | def __init__(self, config): method forward (line 920) | def forward(self, *args, **kwargs): class BlenderbotForCausalLM (line 925) | class BlenderbotForCausalLM(BlenderbotPreTrainedModel, GenerationMixin): method __init__ (line 930) | def __init__(self, config): method get_input_embeddings (line 941) | def get_input_embeddings(self): method set_input_embeddings (line 944) | def set_input_embeddings(self, value): method forward (line 949) | def forward( FILE: src/transformers/models/blenderbot/tokenization_blenderbot.py class BlenderbotTokenizer (line 34) | class BlenderbotTokenizer(TokenizersBackend): method __init__ (line 114) | def __init__( FILE: src/transformers/models/blenderbot_small/configuration_blenderbot_small.py class BlenderbotSmallConfig (line 24) | class BlenderbotSmallConfig(PreTrainedConfig): FILE: src/transformers/models/blenderbot_small/modeling_blenderbot_small.py function shift_tokens_right (line 49) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class BlenderbotSmallLearnedPositionalEmbedding (line 66) | class BlenderbotSmallLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 71) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 74) | def forward( function eager_attention_forward (line 87) | def eager_attention_forward( class BlenderbotSmallAttention (line 116) | class BlenderbotSmallAttention(nn.Module): method __init__ (line 119) | def __init__( method forward (line 158) | def forward( class BlenderbotSmallEncoderLayer (line 235) | class BlenderbotSmallEncoderLayer(GradientCheckpointingLayer): method __init__ (line 236) | def __init__(self, config: BlenderbotSmallConfig, layer_idx: int | Non... method forward (line 255) | def forward( class BlenderbotSmallDecoderLayer (line 287) | class BlenderbotSmallDecoderLayer(GradientCheckpointingLayer): method __init__ (line 288) | def __init__(self, config: BlenderbotSmallConfig, layer_idx: int | Non... method forward (line 319) | def forward( class BlenderbotSmallPreTrainedModel (line 370) | class BlenderbotSmallPreTrainedModel(PreTrainedModel): method _init_weights (line 379) | def _init_weights(self, module): method dummy_inputs (line 385) | def dummy_inputs(self): class BlenderbotSmallEncoder (line 396) | class BlenderbotSmallEncoder(BlenderbotSmallPreTrainedModel): method __init__ (line 411) | def __init__(self, config: BlenderbotSmallConfig): method forward (line 438) | def forward( class BlenderbotSmallDecoder (line 484) | class BlenderbotSmallDecoder(BlenderbotSmallPreTrainedModel): method __init__ (line 499) | def __init__(self, config: BlenderbotSmallConfig): method forward (line 525) | def forward( class BlenderbotSmallModel (line 612) | class BlenderbotSmallModel(BlenderbotSmallPreTrainedModel): method __init__ (line 618) | def __init__(self, config: BlenderbotSmallConfig): method get_input_embeddings (line 630) | def get_input_embeddings(self): method set_input_embeddings (line 633) | def set_input_embeddings(self, value): method forward (line 640) | def forward( class BlenderbotSmallForConditionalGeneration (line 728) | class BlenderbotSmallForConditionalGeneration(BlenderbotSmallPreTrainedM... method __init__ (line 735) | def __init__(self, config: BlenderbotSmallConfig): method resize_token_embeddings (line 744) | def resize_token_embeddings( method _resize_final_logits_bias (line 751) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 762) | def forward( class BlenderbotSmallDecoderWrapper (line 873) | class BlenderbotSmallDecoderWrapper(BlenderbotSmallPreTrainedModel): method __init__ (line 879) | def __init__(self, config): method forward (line 884) | def forward(self, *args, **kwargs): class BlenderbotSmallForCausalLM (line 889) | class BlenderbotSmallForCausalLM(BlenderbotSmallPreTrainedModel, Generat... method __init__ (line 894) | def __init__(self, config): method get_input_embeddings (line 905) | def get_input_embeddings(self): method set_input_embeddings (line 908) | def set_input_embeddings(self, value): method forward (line 913) | def forward( FILE: src/transformers/models/blenderbot_small/tokenization_blenderbot_small.py function get_pairs (line 35) | def get_pairs(word): class BlenderbotSmallTokenizer (line 51) | class BlenderbotSmallTokenizer(PreTrainedTokenizer): method __init__ (line 79) | def __init__( method vocab_size (line 102) | def vocab_size(self) -> int: method get_vocab (line 105) | def get_vocab(self) -> dict: method bpe (line 108) | def bpe(self, token: str) -> str: method _tokenize (line 168) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 178) | def _convert_token_to_id(self, token: str) -> int: method _convert_id_to_token (line 183) | def _convert_id_to_token(self, index: int) -> str: method convert_tokens_to_string (line 187) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method save_vocabulary (line 192) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/blip/configuration_blip.py class BlipTextConfig (line 27) | class BlipTextConfig(PreTrainedConfig): class BlipVisionConfig (line 76) | class BlipVisionConfig(PreTrainedConfig): class BlipConfig (line 111) | class BlipConfig(PreTrainedConfig): method __post_init__ (line 156) | def __post_init__(self, **kwargs): FILE: src/transformers/models/blip/convert_blip_original_pytorch_to_hf.py function load_demo_image (line 39) | def load_demo_image(image_size, device): function rename_key (line 55) | def rename_key(key): function convert_blip_checkpoint (line 83) | def convert_blip_checkpoint(pytorch_dump_folder_path, config_path=None): FILE: src/transformers/models/blip/image_processing_blip.py class BlipImageProcessorPil (line 22) | class BlipImageProcessorPil(PilBackend): FILE: src/transformers/models/blip/image_processing_pil_blip.py class BlipImageProcessor (line 22) | class BlipImageProcessor(TorchvisionBackend): FILE: src/transformers/models/blip/modeling_blip.py function contrastive_loss (line 45) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function blip_loss (line 50) | def blip_loss(similarity: torch.Tensor) -> torch.Tensor: class BlipForConditionalGenerationModelOutput (line 63) | class BlipForConditionalGenerationModelOutput(ModelOutput): class BlipTextVisionModelOutput (line 99) | class BlipTextVisionModelOutput(ModelOutput): class BlipImageTextMatchingModelOutput (line 122) | class BlipImageTextMatchingModelOutput(ModelOutput): class BlipOutput (line 148) | class BlipOutput(ModelOutput): method to_tuple (line 176) | def to_tuple(self) -> tuple[Any]: class BlipVisionEmbeddings (line 183) | class BlipVisionEmbeddings(nn.Module): method __init__ (line 184) | def __init__(self, config: BlipVisionConfig): method interpolate_pos_encoding (line 202) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 242) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class BlipTextEmbeddings (line 258) | class BlipTextEmbeddings(nn.Module): method __init__ (line 259) | def __init__(self, config: BlipTextConfig): method forward (line 271) | def forward( class BlipAttention (line 298) | class BlipAttention(nn.Module): method __init__ (line 301) | def __init__(self, config): method _shape (line 319) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 322) | def forward( class BlipMLP (line 361) | class BlipMLP(nn.Module): method __init__ (line 362) | def __init__(self, config): method forward (line 369) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BlipEncoderLayer (line 376) | class BlipEncoderLayer(GradientCheckpointingLayer): method __init__ (line 377) | def __init__(self, config: BlipConfig): method forward (line 386) | def forward( class BlipPreTrainedModel (line 409) | class BlipPreTrainedModel(PreTrainedModel): method _init_weights (line 418) | def _init_weights(self, module): class BlipEncoder (line 431) | class BlipEncoder(nn.Module): method __init__ (line 441) | def __init__(self, config: BlipConfig): method forward (line 448) | def forward( class BlipVisionModel (line 463) | class BlipVisionModel(BlipPreTrainedModel): method __init__ (line 472) | def __init__(self, config: BlipVisionConfig): method forward (line 486) | def forward( method get_input_embeddings (line 513) | def get_input_embeddings(self): class BlipModel (line 522) | class BlipModel(BlipPreTrainedModel): method __init__ (line 525) | def __init__(self, config: BlipConfig): method get_input_embeddings (line 561) | def get_input_embeddings(self): method set_input_embeddings (line 564) | def set_input_embeddings(self, value): method get_text_features (line 569) | def get_text_features( method get_image_features (line 602) | def get_image_features( method get_multimodal_features (line 641) | def get_multimodal_features( method forward (line 693) | def forward( class BlipForConditionalGeneration (line 782) | class BlipForConditionalGeneration(BlipPreTrainedModel, GenerationMixin): method __init__ (line 790) | def __init__(self, config: BlipConfig): method get_input_embeddings (line 803) | def get_input_embeddings(self): method set_input_embeddings (line 806) | def set_input_embeddings(self, value): method forward (line 811) | def forward( method generate (line 871) | def generate( class BlipForQuestionAnswering (line 955) | class BlipForQuestionAnswering(BlipPreTrainedModel, GenerationMixin): method __init__ (line 962) | def __init__(self, config: BlipConfig): method set_input_embeddings (line 976) | def set_input_embeddings(self, value): method get_input_embeddings (line 979) | def get_input_embeddings(self): method forward (line 985) | def forward( method generate (line 1084) | def generate( class BlipForImageTextRetrieval (line 1178) | class BlipForImageTextRetrieval(BlipPreTrainedModel): method __init__ (line 1181) | def __init__(self, config: BlipConfig): method get_input_embeddings (line 1211) | def get_input_embeddings(self): method set_input_embeddings (line 1214) | def set_input_embeddings(self, value): method forward (line 1219) | def forward( FILE: src/transformers/models/blip/modeling_blip_text.py class BlipTextEmbeddings (line 45) | class BlipTextEmbeddings(nn.Module): method __init__ (line 48) | def __init__(self, config): method forward (line 63) | def forward( class BlipTextSelfAttention (line 94) | class BlipTextSelfAttention(nn.Module): method __init__ (line 95) | def __init__(self, config, is_cross_attention, layer_idx=None): method save_attn_gradients (line 119) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 122) | def get_attn_gradients(self): method save_attention_map (line 125) | def save_attention_map(self, attention_map): method get_attention_map (line 128) | def get_attention_map(self): method forward (line 131) | def forward( class BlipTextSelfOutput (line 213) | class BlipTextSelfOutput(nn.Module): method __init__ (line 214) | def __init__(self, config): method forward (line 220) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BlipTextAttention (line 228) | class BlipTextAttention(nn.Module): method __init__ (line 229) | def __init__(self, config, is_cross_attention=False, layer_idx=None): method forward (line 234) | def forward( class BlipTextIntermediate (line 253) | class BlipTextIntermediate(nn.Module): method __init__ (line 254) | def __init__(self, config): method forward (line 262) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BlipTextOutput (line 269) | class BlipTextOutput(nn.Module): method __init__ (line 270) | def __init__(self, config): method forward (line 276) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BlipTextLayer (line 283) | class BlipTextLayer(GradientCheckpointingLayer): method __init__ (line 284) | def __init__(self, config, layer_num): method forward (line 298) | def forward( method feed_forward_chunk (line 325) | def feed_forward_chunk(self, attention_output): class BlipTextEncoder (line 332) | class BlipTextEncoder(nn.Module): method __init__ (line 333) | def __init__(self, config): method forward (line 339) | def forward( class BlipTextPooler (line 383) | class BlipTextPooler(nn.Module): method __init__ (line 384) | def __init__(self, config): method forward (line 389) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BlipTextPredictionHeadTransform (line 399) | class BlipTextPredictionHeadTransform(nn.Module): method __init__ (line 400) | def __init__(self, config): method forward (line 409) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BlipTextLMPredictionHead (line 417) | class BlipTextLMPredictionHead(nn.Module): method __init__ (line 418) | def __init__(self, config): method forward (line 427) | def forward(self, hidden_states): class BlipTextOnlyMLMHead (line 434) | class BlipTextOnlyMLMHead(nn.Module): method __init__ (line 435) | def __init__(self, config): method forward (line 439) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class BlipTextPreTrainedModel (line 445) | class BlipTextPreTrainedModel(PreTrainedModel): method _init_weights (line 464) | def _init_weights(self, module): class BlipTextModel (line 471) | class BlipTextModel(BlipTextPreTrainedModel): method __init__ (line 480) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 490) | def get_input_embeddings(self): method set_input_embeddings (line 493) | def set_input_embeddings(self, value): method get_extended_attention_mask (line 496) | def get_extended_attention_mask( method forward (line 560) | def forward( class BlipTextLMHeadModel (line 676) | class BlipTextLMHeadModel(BlipTextPreTrainedModel, GenerationMixin): method __init__ (line 682) | def __init__(self, config): method get_input_embeddings (line 691) | def get_input_embeddings(self): method set_input_embeddings (line 694) | def set_input_embeddings(self, new_embeddings): method get_output_embeddings (line 697) | def get_output_embeddings(self): method set_output_embeddings (line 700) | def set_output_embeddings(self, new_embeddings): method forward (line 705) | def forward( method prepare_inputs_for_generation (line 787) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... FILE: src/transformers/models/blip/processing_blip.py class BlipProcessorKwargs (line 24) | class BlipProcessorKwargs(ProcessingKwargs, total=False): class BlipProcessor (line 41) | class BlipProcessor(ProcessorMixin): method __init__ (line 42) | def __init__(self, image_processor, tokenizer, **kwargs): method __call__ (line 47) | def __call__( method model_input_names (line 77) | def model_input_names(self): FILE: src/transformers/models/blip_2/configuration_blip_2.py class Blip2VisionConfig (line 29) | class Blip2VisionConfig(PreTrainedConfig): class Blip2QFormerConfig (line 64) | class Blip2QFormerConfig(PreTrainedConfig): class Blip2Config (line 107) | class Blip2Config(PreTrainedConfig): method __post_init__ (line 161) | def __post_init__(self, **kwargs): FILE: src/transformers/models/blip_2/convert_blip_2_original_to_pytorch.py function load_demo_image (line 49) | def load_demo_image(): function create_rename_keys (line 58) | def create_rename_keys(config, model_name): function rename_key (line 98) | def rename_key(dct, old, new): function read_in_q_v_bias (line 103) | def read_in_q_v_bias(state_dict, config): function get_blip2_config (line 114) | def get_blip2_config(model_name, eos_token_id): function convert_blip2_checkpoint (line 145) | def convert_blip2_checkpoint( FILE: src/transformers/models/blip_2/modeling_blip_2.py class BaseModelOutputWithVisionQformerOutputs (line 61) | class BaseModelOutputWithVisionQformerOutputs(BaseModelOutputWithPooling): class Blip2ForConditionalGenerationModelOutput (line 79) | class Blip2ForConditionalGenerationModelOutput(ModelOutput): method to_tuple (line 99) | def to_tuple(self) -> tuple[Any]: class Blip2ImageTextMatchingModelOutput (line 110) | class Blip2ImageTextMatchingModelOutput(ModelOutput): method to_tuple (line 138) | def to_tuple(self) -> tuple[Any]: class Blip2TextModelOutput (line 152) | class Blip2TextModelOutput(ModelOutput): class Blip2VisionModelOutput (line 171) | class Blip2VisionModelOutput(ModelOutput): class Blip2VisionEmbeddings (line 184) | class Blip2VisionEmbeddings(nn.Module): method __init__ (line 185) | def __init__(self, config: Blip2VisionConfig): method interpolate_pos_encoding (line 203) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 243) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... function eager_attention_forward (line 259) | def eager_attention_forward( class Blip2Attention (line 282) | class Blip2Attention(nn.Module): method __init__ (line 285) | def __init__(self, config): method _shape (line 316) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 319) | def forward( class Blip2MLP (line 357) | class Blip2MLP(nn.Module): method __init__ (line 358) | def __init__(self, config): method forward (line 365) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Blip2EncoderLayer (line 373) | class Blip2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 374) | def __init__(self, config: Blip2Config): method forward (line 383) | def forward( class Blip2PreTrainedModel (line 406) | class Blip2PreTrainedModel(PreTrainedModel): method _init_weights (line 427) | def _init_weights(self, module): class Blip2Encoder (line 450) | class Blip2Encoder(nn.Module): method __init__ (line 460) | def __init__(self, config: Blip2Config): method forward (line 467) | def forward( class Blip2VisionModel (line 483) | class Blip2VisionModel(Blip2PreTrainedModel): method __init__ (line 492) | def __init__(self, config: Blip2VisionConfig): method forward (line 506) | def forward( method get_input_embeddings (line 533) | def get_input_embeddings(self): class Blip2QFormerMultiHeadAttention (line 537) | class Blip2QFormerMultiHeadAttention(nn.Module): method __init__ (line 538) | def __init__(self, config, is_cross_attention=False): method save_attn_gradients (line 562) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 565) | def get_attn_gradients(self): method save_attention_map (line 568) | def save_attention_map(self, attention_map): method get_attention_map (line 571) | def get_attention_map(self): method transpose_for_scores (line 574) | def transpose_for_scores(self, x): method forward (line 579) | def forward( class Blip2QFormerSelfOutput (line 637) | class Blip2QFormerSelfOutput(nn.Module): method __init__ (line 638) | def __init__(self, config): method forward (line 644) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Blip2QFormerAttention (line 651) | class Blip2QFormerAttention(nn.Module): method __init__ (line 652) | def __init__(self, config, is_cross_attention=False): method forward (line 657) | def forward( class Blip2QFormerIntermediate (line 677) | class Blip2QFormerIntermediate(nn.Module): method __init__ (line 678) | def __init__(self, config): method forward (line 686) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Blip2QFormerOutput (line 693) | class Blip2QFormerOutput(nn.Module): method __init__ (line 694) | def __init__(self, config): method forward (line 700) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Blip2QFormerLayer (line 707) | class Blip2QFormerLayer(GradientCheckpointingLayer): method __init__ (line 708) | def __init__(self, config, layer_idx): method forward (line 729) | def forward( method feed_forward_chunk (line 782) | def feed_forward_chunk(self, attention_output): method feed_forward_chunk_query (line 787) | def feed_forward_chunk_query(self, attention_output): class Blip2QFormerEncoder (line 793) | class Blip2QFormerEncoder(nn.Module): method __init__ (line 794) | def __init__(self, config): method forward (line 803) | def forward( class Blip2TextEmbeddings (line 829) | class Blip2TextEmbeddings(nn.Module): method __init__ (line 832) | def __init__(self, config): method forward (line 842) | def forward( class Blip2QFormerModel (line 879) | class Blip2QFormerModel(Blip2PreTrainedModel): method __init__ (line 897) | def __init__(self, config: Blip2QFormerConfig): method get_input_embeddings (line 908) | def get_input_embeddings(self): method set_input_embeddings (line 913) | def set_input_embeddings(self, value): method get_extended_attention_mask (line 916) | def get_extended_attention_mask( method forward (line 962) | def forward( class Blip2Model (line 1045) | class Blip2Model(Blip2PreTrainedModel): method __init__ (line 1051) | def __init__(self, config: Blip2Config): method get_input_embeddings (line 1070) | def get_input_embeddings(self): method set_input_embeddings (line 1073) | def set_input_embeddings(self, value): method set_output_embeddings (line 1076) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 1079) | def get_output_embeddings(self) -> nn.Module: method get_encoder (line 1082) | def get_encoder(self, modality=None): method get_text_features (line 1090) | def get_text_features( method get_image_features (line 1152) | def get_image_features( method get_qformer_features (line 1183) | def get_qformer_features( method get_placeholder_mask (line 1231) | def get_placeholder_mask(self, input_ids: torch.LongTensor, inputs_emb... method forward (line 1248) | def forward( class Blip2TextModelWithProjection (line 1373) | class Blip2TextModelWithProjection(Blip2PreTrainedModel): method __init__ (line 1378) | def __init__(self, config: Blip2Config): method get_input_embeddings (line 1391) | def get_input_embeddings(self): method set_input_embeddings (line 1394) | def set_input_embeddings(self, value): method forward (line 1399) | def forward( class Blip2VisionModelWithProjection (line 1458) | class Blip2VisionModelWithProjection(Blip2PreTrainedModel): method __init__ (line 1464) | def __init__(self, config: Blip2Config): method get_input_embeddings (line 1478) | def get_input_embeddings(self) -> nn.Module: method forward (line 1483) | def forward( class Blip2ForConditionalGeneration (line 1559) | class Blip2ForConditionalGeneration(Blip2PreTrainedModel, GenerationMixin): method __init__ (line 1567) | def __init__(self, config: Blip2Config): method get_input_embeddings (line 1586) | def get_input_embeddings(self): method set_input_embeddings (line 1589) | def set_input_embeddings(self, value): method set_output_embeddings (line 1592) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 1595) | def get_output_embeddings(self) -> nn.Module: method get_encoder (line 1598) | def get_encoder(self, modality=None): method _preprocess_accelerate (line 1604) | def _preprocess_accelerate(self): method get_image_features (line 1626) | def get_image_features( method get_placeholder_mask (line 1677) | def get_placeholder_mask(self, input_ids: torch.LongTensor, inputs_emb... method forward (line 1694) | def forward( method generate (line 1843) | def generate( class Blip2ForImageTextRetrieval (line 1936) | class Blip2ForImageTextRetrieval(Blip2PreTrainedModel): method __init__ (line 1942) | def __init__(self, config: Blip2Config): method get_input_embeddings (line 1964) | def get_input_embeddings(self): method set_input_embeddings (line 1967) | def set_input_embeddings(self, value): method forward (line 1971) | def forward( FILE: src/transformers/models/blip_2/processing_blip_2.py class Blip2ProcessorKwargs (line 28) | class Blip2ProcessorKwargs(ProcessingKwargs, total=False): class Blip2Processor (line 45) | class Blip2Processor(ProcessorMixin): method __init__ (line 46) | def __init__(self, image_processor, tokenizer, num_query_tokens=None, ... method __call__ (line 62) | def __call__( FILE: src/transformers/models/bloom/configuration_bloom.py class BloomConfig (line 24) | class BloomConfig(PreTrainedConfig): method __post_init__ (line 75) | def __post_init__(self, **kwargs): FILE: src/transformers/models/bloom/convert_bloom_original_checkpoint_to_pytorch.py function layer_name_mapping (line 49) | def layer_name_mapping(key, file): function get_dtype_size (line 69) | def get_dtype_size(dtype): function convert_bloom_checkpoint_to_pytorch (line 79) | def convert_bloom_checkpoint_to_pytorch( FILE: src/transformers/models/bloom/modeling_bloom.py function build_alibi_tensor (line 45) | def build_alibi_tensor(attention_mask: torch.Tensor, num_heads: int, dty... function dropout_add (line 89) | def dropout_add(x: torch.Tensor, residual: torch.Tensor, prob: float, tr... function bloom_gelu_forward (line 108) | def bloom_gelu_forward(x: torch.Tensor) -> torch.Tensor: function bloom_gelu_back (line 120) | def bloom_gelu_back(g: torch.Tensor, x: torch.Tensor) -> torch.Tensor: class GeLUFunction (line 138) | class GeLUFunction(torch.autograd.Function): method forward (line 140) | def forward(ctx, input: torch.Tensor) -> torch.Tensor: method backward (line 145) | def backward(ctx, grad_output: torch.Tensor) -> torch.Tensor: class BloomGelu (line 151) | class BloomGelu(nn.Module): method __init__ (line 156) | def __init__(self): method forward (line 159) | def forward(self, x: torch.Tensor) -> torch.Tensor: class BloomAttention (line 163) | class BloomAttention(nn.Module): method __init__ (line 164) | def __init__(self, config: BloomConfig, layer_idx: int | None = None): method _reshape (line 197) | def _reshape(self, fused_qkv: torch.Tensor) -> tuple[torch.Tensor, tor... method _merge_heads (line 217) | def _merge_heads(self, x: torch.Tensor) -> torch.Tensor: method forward (line 242) | def forward( class BloomMLP (line 310) | class BloomMLP(nn.Module): method __init__ (line 311) | def __init__(self, config: BloomConfig): method forward (line 322) | def forward(self, hidden_states: torch.Tensor, residual: torch.Tensor)... class BloomBlock (line 341) | class BloomBlock(GradientCheckpointingLayer): method __init__ (line 342) | def __init__(self, config: BloomConfig, layer_idx: int | None = None): method forward (line 356) | def forward( class BloomPreTrainedModel (line 403) | class BloomPreTrainedModel(PreTrainedModel): class BloomModel (line 413) | class BloomModel(BloomPreTrainedModel): method __init__ (line 414) | def __init__(self, config: BloomConfig): method build_alibi_tensor (line 435) | def build_alibi_tensor(self, attention_mask: torch.Tensor, num_heads: ... method get_input_embeddings (line 438) | def get_input_embeddings(self): method set_input_embeddings (line 441) | def set_input_embeddings(self, new_embeddings: torch.Tensor): method forward (line 445) | def forward( class BloomForCausalLM (line 557) | class BloomForCausalLM(BloomPreTrainedModel, GenerationMixin): method __init__ (line 560) | def __init__(self, config: BloomConfig): method set_output_embeddings (line 568) | def set_output_embeddings(self, new_embeddings: torch.Tensor): method prepare_inputs_for_generation (line 571) | def prepare_inputs_for_generation( method forward (line 607) | def forward( class BloomForSequenceClassification (line 692) | class BloomForSequenceClassification(BloomPreTrainedModel): method __init__ (line 693) | def __init__(self, config: BloomConfig): method forward (line 703) | def forward( class BloomForTokenClassification (line 808) | class BloomForTokenClassification(BloomPreTrainedModel): method __init__ (line 809) | def __init__(self, config: BloomConfig): method forward (line 827) | def forward( class BloomForQuestionAnswering (line 897) | class BloomForQuestionAnswering(BloomPreTrainedModel): method __init__ (line 898) | def __init__(self, config): method forward (line 907) | def forward( FILE: src/transformers/models/blt/configuration_blt.py class BltLocalEncoderConfig (line 28) | class BltLocalEncoderConfig(PreTrainedConfig): method __post_init__ (line 57) | def __post_init__(self, **kwargs): class BltLocalDecoderConfig (line 66) | class BltLocalDecoderConfig(PreTrainedConfig): method __post_init__ (line 99) | def __post_init__(self, **kwargs): class BltGlobalTransformerConfig (line 109) | class BltGlobalTransformerConfig(PreTrainedConfig): method __post_init__ (line 126) | def __post_init__(self, **kwargs): class BltPatcherConfig (line 137) | class BltPatcherConfig(PreTrainedConfig): method __post_init__ (line 153) | def __post_init__(self, **kwargs): class BltConfig (line 165) | class BltConfig(PreTrainedConfig): method __post_init__ (line 239) | def __post_init__(self, **kwargs): FILE: src/transformers/models/blt/convert_blt_weights_to_hf.py function merge_configurations (line 22) | def merge_configurations(config_path: str, entropy_params_path: str) -> ... function apply_weight_mapping (line 177) | def apply_weight_mapping(state_dict: dict[str, torch.Tensor]) -> dict[st... function convert_hash_embeddings_to_fused (line 210) | def convert_hash_embeddings_to_fused( function merge_weights (line 243) | def merge_weights(weights_path: str, entropy_weights_path: str) -> dict[... function create_tokenizer_config (line 280) | def create_tokenizer_config(output_dir: str, config: dict[str, Any]): function create_tokenizer_json (line 299) | def create_tokenizer_json(output_dir: str, config: dict[str, Any]): function push_to_hub (line 340) | def push_to_hub( function convert_hf_blt_to_unified (line 362) | def convert_hf_blt_to_unified( function main (line 413) | def main(): FILE: src/transformers/models/blt/modeling_blt.py class BltMLP (line 53) | class BltMLP(nn.Module): method __init__ (line 54) | def __init__(self, config): method forward (line 65) | def forward(self, x): class BltRMSNorm (line 70) | class BltRMSNorm(nn.Module): method __init__ (line 71) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 79) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 86) | def extra_repr(self): class BltRotaryEmbedding (line 90) | class BltRotaryEmbedding(nn.Module): method __init__ (line 93) | def __init__(self, config: BltConfig, device=None): method compute_default_rope_parameters (line 110) | def compute_default_rope_parameters( method forward (line 141) | def forward(self, x, position_ids): class BltTransformerLayer (line 156) | class BltTransformerLayer(GradientCheckpointingLayer): method __init__ (line 157) | def __init__(self, config, layer_idx: int): method forward (line 168) | def forward( function repeat_kv (line 224) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 236) | def eager_attention_forward( function rotate_half (line 261) | def rotate_half(x): function apply_rotary_pos_emb (line 269) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class BltSelfAttention (line 294) | class BltSelfAttention(nn.Module): method __init__ (line 295) | def __init__(self, config: BltConfig, layer_idx: int): method forward (line 314) | def forward( class BltCrossAttention (line 359) | class BltCrossAttention(nn.Module): method __init__ (line 362) | def __init__(self, config: BltConfig, layer_idx: int, hidden_size: int... method forward (line 382) | def forward( class BltPreTrainedModel (line 422) | class BltPreTrainedModel(PreTrainedModel): method _init_weights (line 439) | def _init_weights(self, module): class BltLocalEncoder (line 596) | class BltLocalEncoder(BltPreTrainedModel): method __init__ (line 602) | def __init__(self, config: BltLocalEncoderConfig): method forward (line 625) | def forward( method patch_reduce (line 677) | def patch_reduce(self, hidden_states, max_num_patches, patch_ids): class BltLocalDecoder (line 709) | class BltLocalDecoder(BltPreTrainedModel): method __init__ (line 712) | def __init__(self, config: BltLocalDecoderConfig): method forward (line 736) | def forward( class BltGlobalTransformer (line 785) | class BltGlobalTransformer(BltPreTrainedModel): method __init__ (line 791) | def __init__(self, config: BltGlobalTransformerConfig): method forward (line 810) | def forward( function process_patch_lengths (line 837) | def process_patch_lengths(patch_lengths: torch.Tensor, max_patch_length:... class BltPatcher (line 881) | class BltPatcher(BltPreTrainedModel): method __init__ (line 884) | def __init__(self, config: BltPatcherConfig): method forward (line 900) | def forward( method patch_lengths_from_entropies (line 960) | def patch_lengths_from_entropies( function rolling_polynomial_hash (line 1014) | def rolling_polynomial_hash(token_tensor, prime: int = 1000000007): function byte_group_hash_function (line 1043) | def byte_group_hash_function( function compute_hash_embeddings (line 1061) | def compute_hash_embeddings( function _prepare_patch_cross_attention_mask (line 1099) | def _prepare_patch_cross_attention_mask( class BltModel (line 1177) | class BltModel(BltPreTrainedModel): method __init__ (line 1178) | def __init__(self, config: BltConfig): method forward (line 1200) | def forward( method get_input_embeddings (line 1333) | def get_input_embeddings(self): method set_input_embeddings (line 1336) | def set_input_embeddings(self, value): method _patch_ids_from_lengths (line 1339) | def _patch_ids_from_lengths(self, patch_lengths: torch.Tensor, seq_len... class BltForCausalLM (line 1357) | class BltForCausalLM(BltPreTrainedModel, GenerationMixin): method __init__ (line 1363) | def __init__(self, config: BltConfig): method forward (line 1374) | def forward( FILE: src/transformers/models/blt/modular_blt.py function rolling_polynomial_hash (line 58) | def rolling_polynomial_hash(token_tensor, prime: int = 1000000007): function byte_group_hash_function (line 87) | def byte_group_hash_function( function compute_hash_embeddings (line 105) | def compute_hash_embeddings( function _prepare_patch_cross_attention_mask (line 143) | def _prepare_patch_cross_attention_mask( function process_patch_lengths (line 221) | def process_patch_lengths(patch_lengths: torch.Tensor, max_patch_length:... class BltMLP (line 265) | class BltMLP(MllamaTextMLP): class BltRMSNorm (line 269) | class BltRMSNorm(MllamaTextRMSNorm): class BltRotaryEmbedding (line 273) | class BltRotaryEmbedding(LlamaRotaryEmbedding): method forward (line 276) | def forward(self, x, position_ids): class BltTransformerLayer (line 290) | class BltTransformerLayer(MllamaSelfAttentionDecoderLayer): method __init__ (line 291) | def __init__(self, config, layer_idx: int): class BltSelfAttention (line 300) | class BltSelfAttention(MllamaTextSelfAttention): method __init__ (line 301) | def __init__(self, config: BltConfig, layer_idx: int): class BltCrossAttention (line 305) | class BltCrossAttention(MllamaTextCrossAttention): method __init__ (line 308) | def __init__(self, config: BltConfig, layer_idx: int, hidden_size: int... method forward (line 314) | def forward( class BltPreTrainedModel (line 353) | class BltPreTrainedModel(MllamaPreTrainedModel): method _init_weights (line 373) | def _init_weights(self, module): class BltLocalEncoder (line 530) | class BltLocalEncoder(BltPreTrainedModel): method __init__ (line 536) | def __init__(self, config: BltLocalEncoderConfig): method forward (line 559) | def forward( method patch_reduce (line 611) | def patch_reduce(self, hidden_states, max_num_patches, patch_ids): class BltLocalDecoder (line 643) | class BltLocalDecoder(BltPreTrainedModel): method __init__ (line 646) | def __init__(self, config: BltLocalDecoderConfig): method forward (line 670) | def forward( class BltGlobalTransformer (line 719) | class BltGlobalTransformer(BltPreTrainedModel): method __init__ (line 725) | def __init__(self, config: BltGlobalTransformerConfig): method forward (line 744) | def forward( class BltPatcher (line 771) | class BltPatcher(BltPreTrainedModel): method __init__ (line 774) | def __init__(self, config: BltPatcherConfig): method forward (line 790) | def forward( method patch_lengths_from_entropies (line 850) | def patch_lengths_from_entropies( class BltModel (line 904) | class BltModel(BltPreTrainedModel): method __init__ (line 905) | def __init__(self, config: BltConfig): method forward (line 927) | def forward( method get_input_embeddings (line 1060) | def get_input_embeddings(self): method set_input_embeddings (line 1063) | def set_input_embeddings(self, value): method _patch_ids_from_lengths (line 1066) | def _patch_ids_from_lengths(self, patch_lengths: torch.Tensor, seq_len... class BltForCausalLM (line 1084) | class BltForCausalLM(BltPreTrainedModel, GenerationMixin): method __init__ (line 1090) | def __init__(self, config: BltConfig): method forward (line 1101) | def forward( FILE: src/transformers/models/bridgetower/configuration_bridgetower.py class BridgeTowerVisionConfig (line 27) | class BridgeTowerVisionConfig(PreTrainedConfig): class BridgeTowerTextConfig (line 65) | class BridgeTowerTextConfig(PreTrainedConfig): class BridgeTowerConfig (line 104) | class BridgeTowerConfig(PreTrainedConfig): method __post_init__ (line 147) | def __post_init__(self, **kwargs): FILE: src/transformers/models/bridgetower/image_processing_bridgetower.py function get_resize_output_image_size (line 37) | def get_resize_output_image_size( class BridgeTowerImageProcessorKwargs (line 71) | class BridgeTowerImageProcessorKwargs(ImagesKwargs, total=False): class BridgeTowerImageProcessor (line 81) | class BridgeTowerImageProcessor(TorchvisionBackend): method __init__ (line 100) | def __init__(self, **kwargs: Unpack[BridgeTowerImageProcessorKwargs]): method resize (line 103) | def resize( method _preprocess (line 126) | def _preprocess( FILE: src/transformers/models/bridgetower/image_processing_pil_bridgetower.py class BridgeTowerImageProcessorKwargs (line 33) | class BridgeTowerImageProcessorKwargs(ImagesKwargs, total=False): function get_resize_output_image_size (line 43) | def get_resize_output_image_size( class BridgeTowerImageProcessorPil (line 75) | class BridgeTowerImageProcessorPil(PilBackend): method __init__ (line 94) | def __init__(self, **kwargs: Unpack[BridgeTowerImageProcessorKwargs]): method resize (line 97) | def resize( method _preprocess (line 121) | def _preprocess( FILE: src/transformers/models/bridgetower/modeling_bridgetower.py class BridgeTowerModelOutput (line 56) | class BridgeTowerModelOutput(ModelOutput): class BridgeTowerContrastiveOutput (line 80) | class BridgeTowerContrastiveOutput(ModelOutput): class BridgeTowerResidualAttention (line 106) | class BridgeTowerResidualAttention(nn.Module): method __init__ (line 107) | def __init__(self, config): method attention (line 124) | def attention(self, hidden_state: torch.Tensor, attention_mask: torch.... method forward (line 141) | def forward(self, hidden_state: torch.Tensor, attention_mask: torch.Te... class BridgeTowerTransformer (line 150) | class BridgeTowerTransformer(nn.Module): method __init__ (line 151) | def __init__(self, config): method forward (line 165) | def forward(self, hidden_state: torch.Tensor, attention_mask: torch.Te... class BridgeTowerVisionEmbeddings (line 177) | class BridgeTowerVisionEmbeddings(nn.Module): method __init__ (line 178) | def __init__(self, config: BridgeTowerVisionConfig): method interpolate_pos_encoding (line 200) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 241) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class BridgeTowerVisionTransformer (line 260) | class BridgeTowerVisionTransformer(nn.Module): method __init__ (line 261) | def __init__(self, config): method forward (line 274) | def forward( method forward_pre (line 301) | def forward_pre( method forward_post (line 312) | def forward_post(self, hidden_state: torch.Tensor): class BridgeTowerLinkTower (line 318) | class BridgeTowerLinkTower(nn.Module): method __init__ (line 319) | def __init__(self, config): method forward (line 332) | def forward(self, hidden_states, cross_modal_hidden_states, attention_... class BridgeTowerSelfOutput (line 344) | class BridgeTowerSelfOutput(nn.Module): method __init__ (line 345) | def __init__(self, config): method forward (line 351) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BridgeTowerIntermediate (line 359) | class BridgeTowerIntermediate(nn.Module): method __init__ (line 360) | def __init__(self, config): method forward (line 368) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BridgeTowerOutput (line 375) | class BridgeTowerOutput(nn.Module): method __init__ (line 376) | def __init__(self, config): method forward (line 382) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BridgeTowerPooler (line 390) | class BridgeTowerPooler(nn.Module): method __init__ (line 391) | def __init__(self, config): method forward (line 396) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 406) | def eager_attention_forward( class BridgeTowerSelfAttention (line 435) | class BridgeTowerSelfAttention(nn.Module): method __init__ (line 436) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 460) | def forward( class BridgeTowerCrossAttention (line 503) | class BridgeTowerCrossAttention(nn.Module): method __init__ (line 504) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 527) | def forward( class BridgeTowerAttention (line 581) | class BridgeTowerAttention(nn.Module): method __init__ (line 582) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 589) | def forward( class BridgeTowerBertCrossLayer (line 610) | class BridgeTowerBertCrossLayer(nn.Module): method __init__ (line 611) | def __init__(self, config, layer_idx=None): method forward (line 627) | def forward( method feed_forward_chunk (line 663) | def feed_forward_chunk(self, attention_output): class BridgeTowerTextLayer (line 669) | class BridgeTowerTextLayer(GradientCheckpointingLayer): method __init__ (line 670) | def __init__(self, config, layer_idx=None): method forward (line 690) | def forward( method feed_forward_chunk (line 729) | def feed_forward_chunk(self, attention_output): class BridgeTowerTextEncoder (line 736) | class BridgeTowerTextEncoder(nn.Module): method __init__ (line 737) | def __init__(self, config): method forward (line 744) | def forward( class BridgeTowerTextEmbeddings (line 771) | class BridgeTowerTextEmbeddings(nn.Module): method __init__ (line 774) | def __init__(self, config): method forward (line 794) | def forward( method create_position_ids_from_inputs_embeds (line 843) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 861) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class BridgeTowerPreTrainedModel (line 878) | class BridgeTowerPreTrainedModel(PreTrainedModel): method _init_weights (line 892) | def _init_weights(self, module: nn.Module): class BridgeTowerVisionModel (line 924) | class BridgeTowerVisionModel(BridgeTowerPreTrainedModel): method __init__ (line 928) | def __init__(self, config): method dtype (line 934) | def dtype(self): method forward (line 937) | def forward(self, image, image_mask=None, interpolate_pos_encoding=Fal... class BridgeTowerTextModel (line 955) | class BridgeTowerTextModel(BridgeTowerPreTrainedModel): method __init__ (line 959) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 976) | def get_input_embeddings(self): method set_input_embeddings (line 979) | def set_input_embeddings(self, value): method forward (line 988) | def forward( method _create_attention_masks (line 1048) | def _create_attention_masks( class BridgeTowerModel (line 1086) | class BridgeTowerModel(BridgeTowerPreTrainedModel): method __init__ (line 1087) | def __init__(self, config): method get_input_embeddings (line 1143) | def get_input_embeddings(self): method set_input_embeddings (line 1146) | def set_input_embeddings(self, value): method _apply_text_transform (line 1149) | def _apply_text_transform(self, hidden_states: torch.Tensor, layer_idx... method _apply_image_transform (line 1154) | def _apply_image_transform(self, hidden_states: torch.Tensor, layer_id... method forward (line 1161) | def forward( method get_cls_features (line 1364) | def get_cls_features(self, text_features, image_features): class BridgeTowerPredictionHeadTransform (line 1371) | class BridgeTowerPredictionHeadTransform(nn.Module): method __init__ (line 1372) | def __init__(self, config): method forward (line 1381) | def forward(self, hidden_states): class BridgeTowerMLMHead (line 1388) | class BridgeTowerMLMHead(nn.Module): method __init__ (line 1389) | def __init__(self, config, weight=None): method forward (line 1398) | def forward(self, x): class BridgeTowerITMHead (line 1404) | class BridgeTowerITMHead(nn.Module): method __init__ (line 1405) | def __init__(self, hidden_size): method forward (line 1409) | def forward(self, x): class BridgeTowerForMaskedLM (line 1419) | class BridgeTowerForMaskedLM(BridgeTowerPreTrainedModel): method __init__ (line 1422) | def __init__(self, config): method get_output_embeddings (line 1431) | def get_output_embeddings(self): method set_output_embeddings (line 1434) | def set_output_embeddings(self, new_embeddings): method forward (line 1439) | def forward( class BridgeTowerForImageAndTextRetrieval (line 1520) | class BridgeTowerForImageAndTextRetrieval(BridgeTowerPreTrainedModel): method __init__ (line 1521) | def __init__(self, config): method forward (line 1533) | def forward( class BridgeTowerContrastiveHead (line 1607) | class BridgeTowerContrastiveHead(nn.Module): method __init__ (line 1608) | def __init__(self, hidden_size, embed_size): method forward (line 1612) | def forward(self, x): class BridgeTowerForContrastiveLearning (line 1622) | class BridgeTowerForContrastiveLearning(BridgeTowerPreTrainedModel): method __init__ (line 1623) | def __init__(self, config): method forward (line 1638) | def forward( FILE: src/transformers/models/bridgetower/processing_bridgetower.py class BridgeTowerProcessorKwargs (line 22) | class BridgeTowerProcessorKwargs(ProcessingKwargs, total=False): class BridgeTowerProcessor (line 42) | class BridgeTowerProcessor(ProcessorMixin): method __init__ (line 45) | def __init__(self, image_processor, tokenizer): FILE: src/transformers/models/bros/configuration_bros.py class BrosConfig (line 24) | class BrosConfig(PreTrainedConfig): method __post_init__ (line 70) | def __post_init__(self, **kwargs): FILE: src/transformers/models/bros/convert_bros_to_pytorch.py function get_configs (line 29) | def get_configs(model_name): function remove_ignore_keys_ (line 34) | def remove_ignore_keys_(state_dict): function rename_key (line 42) | def rename_key(name): function convert_state_dict (line 55) | def convert_state_dict(orig_state_dict, model): function convert_bros_checkpoint (line 67) | def convert_bros_checkpoint(model_name, pytorch_dump_folder_path=None, p... FILE: src/transformers/models/bros/modeling_bros.py class BrosSpadeOutput (line 49) | class BrosSpadeOutput(ModelOutput): class BrosPositionalEmbedding1D (line 66) | class BrosPositionalEmbedding1D(nn.Module): method __init__ (line 69) | def __init__(self, config): method forward (line 79) | def forward(self, pos_seq: torch.Tensor) -> torch.Tensor: class BrosPositionalEmbedding2D (line 87) | class BrosPositionalEmbedding2D(nn.Module): method __init__ (line 88) | def __init__(self, config): method forward (line 95) | def forward(self, bbox: torch.Tensor) -> torch.Tensor: class BrosBboxEmbeddings (line 106) | class BrosBboxEmbeddings(nn.Module): method __init__ (line 107) | def __init__(self, config): method forward (line 112) | def forward(self, bbox: torch.Tensor): class BrosTextEmbeddings (line 121) | class BrosTextEmbeddings(nn.Module): method __init__ (line 124) | def __init__(self, config): method forward (line 145) | def forward( class BrosSelfAttention (line 183) | class BrosSelfAttention(nn.Module): method __init__ (line 184) | def __init__(self, config): method forward (line 204) | def forward( class BrosSelfOutput (line 261) | class BrosSelfOutput(nn.Module): method __init__ (line 262) | def __init__(self, config): method forward (line 268) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BrosAttention (line 275) | class BrosAttention(nn.Module): method __init__ (line 276) | def __init__(self, config): method forward (line 281) | def forward( class BrosIntermediate (line 302) | class BrosIntermediate(nn.Module): method __init__ (line 303) | def __init__(self, config): method forward (line 311) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BrosOutput (line 317) | class BrosOutput(nn.Module): method __init__ (line 318) | def __init__(self, config): method forward (line 324) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class BrosLayer (line 331) | class BrosLayer(GradientCheckpointingLayer): method __init__ (line 332) | def __init__(self, config): method forward (line 346) | def forward( method feed_forward_chunk (line 384) | def feed_forward_chunk(self, attention_output): class BrosPooler (line 391) | class BrosPooler(nn.Module): method __init__ (line 392) | def __init__(self, config): method forward (line 397) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class BrosRelationExtractor (line 406) | class BrosRelationExtractor(nn.Module): method __init__ (line 407) | def __init__(self, config): method forward (line 421) | def forward(self, query_layer: torch.Tensor, key_layer: torch.Tensor): class BrosPreTrainedModel (line 441) | class BrosPreTrainedModel(PreTrainedModel): method _init_weights (line 451) | def _init_weights(self, module: nn.Module): class BrosEncoder (line 467) | class BrosEncoder(BrosPreTrainedModel): method __init__ (line 468) | def __init__(self, config): method forward (line 475) | def forward( class BrosModel (line 500) | class BrosModel(BrosPreTrainedModel): method __init__ (line 501) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 517) | def get_input_embeddings(self): method set_input_embeddings (line 520) | def set_input_embeddings(self, value): method forward (line 525) | def forward( class BrosForTokenClassification (line 621) | class BrosForTokenClassification(BrosPreTrainedModel): method __init__ (line 624) | def __init__(self, config): method forward (line 639) | def forward( class BrosSpadeEEForTokenClassification (line 721) | class BrosSpadeEEForTokenClassification(BrosPreTrainedModel): method __init__ (line 724) | def __init__(self, config): method forward (line 751) | def forward( class BrosSpadeELForTokenClassification (line 862) | class BrosSpadeELForTokenClassification(BrosPreTrainedModel): method __init__ (line 865) | def __init__(self, config): method forward (line 881) | def forward( FILE: src/transformers/models/bros/processing_bros.py class BrosProcessorKwargs (line 22) | class BrosProcessorKwargs(ProcessingKwargs, total=False): class BrosProcessor (line 38) | class BrosProcessor(ProcessorMixin): method __init__ (line 41) | def __init__(self, tokenizer=None, **kwargs): FILE: src/transformers/models/byt5/convert_byt5_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_t5 (line 29) | def load_tf_weights_in_t5(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 134) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, py... FILE: src/transformers/models/byt5/tokenization_byt5.py class ByT5Tokenizer (line 25) | class ByT5Tokenizer(PreTrainedTokenizer): method __init__ (line 60) | def __init__( method vocab_size (line 100) | def vocab_size(self): method get_vocab (line 103) | def get_vocab(self): method get_special_tokens_mask (line 108) | def get_special_tokens_mask( method _add_eos_if_not_present (line 136) | def _add_eos_if_not_present(self, token_ids: list[int]) -> list[int]: method create_token_type_ids_from_sequences (line 147) | def create_token_type_ids_from_sequences( method build_inputs_with_special_tokens (line 169) | def build_inputs_with_special_tokens( method _tokenize (line 195) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 200) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 210) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 215) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 230) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/camembert/configuration_camembert.py class CamembertConfig (line 25) | class CamembertConfig(PreTrainedConfig): FILE: src/transformers/models/camembert/modeling_camembert.py class CamembertEmbeddings (line 56) | class CamembertEmbeddings(nn.Module): method __init__ (line 59) | def __init__(self, config): method forward (line 79) | def forward( method create_position_ids_from_inputs_embeds (line 128) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 146) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 162) | def eager_attention_forward( class CamembertSelfAttention (line 190) | class CamembertSelfAttention(nn.Module): method __init__ (line 191) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 215) | def forward( class CamembertCrossAttention (line 257) | class CamembertCrossAttention(nn.Module): method __init__ (line 258) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 281) | def forward( class CamembertSelfOutput (line 334) | class CamembertSelfOutput(nn.Module): method __init__ (line 335) | def __init__(self, config): method forward (line 341) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class CamembertAttention (line 348) | class CamembertAttention(nn.Module): method __init__ (line 349) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 356) | def forward( class CamembertIntermediate (line 377) | class CamembertIntermediate(nn.Module): method __init__ (line 378) | def __init__(self, config): method forward (line 386) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class CamembertOutput (line 392) | class CamembertOutput(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 399) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class CamembertLayer (line 406) | class CamembertLayer(GradientCheckpointingLayer): method __init__ (line 407) | def __init__(self, config, layer_idx=None): method forward (line 426) | def forward( method feed_forward_chunk (line 465) | def feed_forward_chunk(self, attention_output): class CamembertLMHead (line 471) | class CamembertLMHead(nn.Module): method __init__ (line 474) | def __init__(self, config): method forward (line 482) | def forward(self, features, **kwargs): class CamembertPreTrainedModel (line 494) | class CamembertPreTrainedModel(PreTrainedModel): method _init_weights (line 509) | def _init_weights(self, module): class CamembertEncoder (line 519) | class CamembertEncoder(nn.Module): method __init__ (line 520) | def __init__(self, config): method forward (line 525) | def forward( class CamembertPooler (line 551) | class CamembertPooler(nn.Module): method __init__ (line 552) | def __init__(self, config): method forward (line 557) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class CamembertModel (line 578) | class CamembertModel(CamembertPreTrainedModel): method __init__ (line 581) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 598) | def get_input_embeddings(self): method set_input_embeddings (line 601) | def set_input_embeddings(self, value): method forward (line 607) | def forward( method _create_attention_masks (line 672) | def _create_attention_masks( class CamembertForMaskedLM (line 706) | class CamembertForMaskedLM(CamembertPreTrainedModel): method __init__ (line 712) | def __init__(self, config): method get_output_embeddings (line 727) | def get_output_embeddings(self): method set_output_embeddings (line 730) | def set_output_embeddings(self, new_embeddings): method forward (line 735) | def forward( class CamembertClassificationHead (line 791) | class CamembertClassificationHead(nn.Module): method __init__ (line 794) | def __init__(self, config): method forward (line 803) | def forward(self, features, **kwargs): class CamembertForSequenceClassification (line 819) | class CamembertForSequenceClassification(CamembertPreTrainedModel): method __init__ (line 820) | def __init__(self, config): method forward (line 833) | def forward( class CamembertForMultipleChoice (line 904) | class CamembertForMultipleChoice(CamembertPreTrainedModel): method __init__ (line 905) | def __init__(self, config): method forward (line 917) | def forward( class CamembertForTokenClassification (line 1001) | class CamembertForTokenClassification(CamembertPreTrainedModel): method __init__ (line 1002) | def __init__(self, config): method forward (line 1018) | def forward( class CamembertForQuestionAnswering (line 1072) | class CamembertForQuestionAnswering(CamembertPreTrainedModel): method __init__ (line 1073) | def __init__(self, config): method forward (line 1085) | def forward( class CamembertForCausalLM (line 1155) | class CamembertForCausalLM(CamembertPreTrainedModel, GenerationMixin): method __init__ (line 1161) | def __init__(self, config): method get_output_embeddings (line 1173) | def get_output_embeddings(self): method set_output_embeddings (line 1176) | def set_output_embeddings(self, new_embeddings): method forward (line 1181) | def forward( FILE: src/transformers/models/camembert/modular_camembert.py class CamembertPreTrainedModel (line 44) | class CamembertPreTrainedModel(RobertaPreTrainedModel): class CamembertModel (line 48) | class CamembertModel(RobertaModel): class CamembertForMaskedLM (line 52) | class CamembertForMaskedLM(RobertaForMaskedLM): method __init__ (line 58) | def __init__(self, config): method forward (line 66) | def forward( class CamembertForSequenceClassification (line 122) | class CamembertForSequenceClassification(RobertaForSequenceClassification): method __init__ (line 123) | def __init__(self, config): method forward (line 131) | def forward( class CamembertForMultipleChoice (line 201) | class CamembertForMultipleChoice(RobertaForMultipleChoice): method __init__ (line 202) | def __init__(self, config): method forward (line 210) | def forward( class CamembertForTokenClassification (line 293) | class CamembertForTokenClassification(RobertaForTokenClassification): method __init__ (line 294) | def __init__(self, config): method forward (line 302) | def forward( class CamembertForQuestionAnswering (line 355) | class CamembertForQuestionAnswering(RobertaForQuestionAnswering): method __init__ (line 356) | def __init__(self, config): method forward (line 364) | def forward( class CamembertForCausalLM (line 429) | class CamembertForCausalLM(RobertaForCausalLM): method __init__ (line 435) | def __init__(self, config): method forward (line 443) | def forward( FILE: src/transformers/models/camembert/tokenization_camembert.py class CamembertTokenizer (line 32) | class CamembertTokenizer(TokenizersBackend): method __init__ (line 93) | def __init__( FILE: src/transformers/models/canine/configuration_canine.py class CanineConfig (line 24) | class CanineConfig(PreTrainedConfig): FILE: src/transformers/models/canine/convert_canine_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_canine (line 29) | def load_tf_weights_in_canine(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 126) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, pytorch_dump_pa... FILE: src/transformers/models/canine/modeling_canine.py class CanineModelOutputWithPooling (line 56) | class CanineModelOutputWithPooling(ModelOutput): class CanineEmbeddings (line 85) | class CanineEmbeddings(nn.Module): method __init__ (line 88) | def __init__(self, config): method _hash_bucket_tensors (line 109) | def _hash_bucket_tensors(self, input_ids, num_hashes: int, num_buckets... method _embed_hash_buckets (line 132) | def _embed_hash_buckets(self, input_ids, embedding_size: int, num_hash... method forward (line 146) | def forward( class CharactersToMolecules (line 182) | class CharactersToMolecules(nn.Module): method __init__ (line 185) | def __init__(self, config): method forward (line 198) | def forward(self, char_encoding: torch.Tensor) -> torch.Tensor: class ConvProjection (line 226) | class ConvProjection(nn.Module): method __init__ (line 232) | def __init__(self, config): method forward (line 245) | def forward( class CanineSelfAttention (line 282) | class CanineSelfAttention(nn.Module): method __init__ (line 283) | def __init__(self, config): method forward (line 301) | def forward( class CanineSelfOutput (line 363) | class CanineSelfOutput(nn.Module): method __init__ (line 364) | def __init__(self, config): method forward (line 370) | def forward( class CanineAttention (line 379) | class CanineAttention(nn.Module): method __init__ (line 396) | def __init__( method forward (line 428) | def forward( class CanineIntermediate (line 502) | class CanineIntermediate(nn.Module): method __init__ (line 503) | def __init__(self, config): method forward (line 511) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class CanineOutput (line 517) | class CanineOutput(nn.Module): method __init__ (line 518) | def __init__(self, config): method forward (line 524) | def forward(self, hidden_states: tuple[torch.FloatTensor], input_tenso... class CanineLayer (line 531) | class CanineLayer(GradientCheckpointingLayer): method __init__ (line 532) | def __init__( method forward (line 559) | def forward( method feed_forward_chunk (line 581) | def feed_forward_chunk(self, attention_output): class CanineEncoder (line 587) | class CanineEncoder(nn.Module): method __init__ (line 588) | def __init__( method forward (line 618) | def forward( class CaninePooler (line 651) | class CaninePooler(nn.Module): method __init__ (line 652) | def __init__(self, config): method forward (line 657) | def forward(self, hidden_states: tuple[torch.FloatTensor]) -> torch.Fl... class CaninePredictionHeadTransform (line 666) | class CaninePredictionHeadTransform(nn.Module): method __init__ (line 667) | def __init__(self, config): method forward (line 676) | def forward(self, hidden_states: tuple[torch.FloatTensor]) -> torch.Fl... class CanineLMPredictionHead (line 683) | class CanineLMPredictionHead(nn.Module): method __init__ (line 684) | def __init__(self, config): method forward (line 696) | def forward(self, hidden_states: tuple[torch.FloatTensor]) -> torch.Fl... class CanineOnlyMLMHead (line 702) | class CanineOnlyMLMHead(nn.Module): method __init__ (line 703) | def __init__(self, config): method forward (line 707) | def forward( class CaninePreTrainedModel (line 716) | class CaninePreTrainedModel(PreTrainedModel): method _init_weights (line 721) | def _init_weights(self, module): class CanineModel (line 728) | class CanineModel(CaninePreTrainedModel): method __init__ (line 729) | def __init__(self, config, add_pooling_layer=True): method _create_3d_attention_mask_from_input_mask (line 763) | def _create_3d_attention_mask_from_input_mask(self, from_tensor, to_ma... method _downsample_attention_mask (line 790) | def _downsample_attention_mask(self, char_attention_mask: torch.Tensor... method _repeat_molecules (line 807) | def _repeat_molecules(self, molecules: torch.Tensor, char_seq_length: ... method forward (line 833) | def forward( class CanineForSequenceClassification (line 990) | class CanineForSequenceClassification(CaninePreTrainedModel): method __init__ (line 991) | def __init__(self, config): method forward (line 1003) | def forward( class CanineForMultipleChoice (line 1075) | class CanineForMultipleChoice(CaninePreTrainedModel): method __init__ (line 1076) | def __init__(self, config): method forward (line 1087) | def forward( class CanineForTokenClassification (line 1178) | class CanineForTokenClassification(CaninePreTrainedModel): method __init__ (line 1179) | def __init__(self, config): method forward (line 1191) | def forward( class CanineForQuestionAnswering (line 1274) | class CanineForQuestionAnswering(CaninePreTrainedModel): method __init__ (line 1275) | def __init__(self, config): method forward (line 1286) | def forward( FILE: src/transformers/models/canine/tokenization_canine.py class CanineTokenizer (line 55) | class CanineTokenizer(PreTrainedTokenizer): method __init__ (line 71) | def __init__( method vocab_size (line 121) | def vocab_size(self) -> int: method get_vocab (line 124) | def get_vocab(self): method _tokenize (line 129) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 133) | def _convert_token_to_id(self, token: str) -> int: method _convert_id_to_token (line 140) | def _convert_id_to_token(self, index: int) -> str: method convert_tokens_to_string (line 152) | def convert_tokens_to_string(self, tokens): FILE: src/transformers/models/chameleon/configuration_chameleon.py class ChameleonVQVAEConfig (line 28) | class ChameleonVQVAEConfig(PreTrainedConfig): class ChameleonConfig (line 66) | class ChameleonConfig(PreTrainedConfig): method __post_init__ (line 118) | def __post_init__(self, **kwargs): FILE: src/transformers/models/chameleon/convert_chameleon_weights_to_hf.py function compute_intermediate_size (line 70) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 74) | def read_json(path): function write_json (line 79) | def write_json(text, path): function write_model (line 84) | def write_model(model_path, input_base_path, model_size, chameleon_versi... function main (line 437) | def main(): FILE: src/transformers/models/chameleon/image_processing_chameleon.py class ChameleonImageProcessor (line 35) | class ChameleonImageProcessor(TorchvisionBackend): method __init__ (line 51) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method convert_to_rgb (line 54) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: method resize (line 75) | def resize( FILE: src/transformers/models/chameleon/image_processing_pil_chameleon.py class ChameleonImageProcessorPil (line 29) | class ChameleonImageProcessorPil(PilBackend): method __init__ (line 45) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method convert_to_rgb (line 48) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: FILE: src/transformers/models/chameleon/modeling_chameleon.py class ChameleonVQVAEModelOutput (line 52) | class ChameleonVQVAEModelOutput(BaseModelOutputWithPooling): class ChameleonRMSNorm (line 68) | class ChameleonRMSNorm(nn.Module): method __init__ (line 69) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 77) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 84) | def extra_repr(self): class ChameleonRotaryEmbedding (line 89) | class ChameleonRotaryEmbedding(nn.Module): method __init__ (line 92) | def __init__(self, config: ChameleonConfig, device=None): method compute_default_rope_parameters (line 109) | def compute_default_rope_parameters( method forward (line 140) | def forward(self, x, position_ids): function rotate_half (line 155) | def rotate_half(x): function apply_rotary_pos_emb (line 163) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class ChameleonMLP (line 189) | class ChameleonMLP(nn.Module): method __init__ (line 190) | def __init__(self, config): method forward (line 201) | def forward(self, x): class ChameleonLayerNorm (line 206) | class ChameleonLayerNorm(nn.LayerNorm): method __init__ (line 214) | def __init__(self, hidden_size, *args, **kwargs): method forward (line 218) | def forward(self, hidden_states): function repeat_kv (line 225) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 238) | def eager_attention_forward( class ChameleonAttention (line 263) | class ChameleonAttention(nn.Module): method __init__ (line 266) | def __init__(self, config: ChameleonConfig, layer_idx: int | None = No... method forward (line 302) | def forward( class ChameleonDecoderLayer (line 357) | class ChameleonDecoderLayer(GradientCheckpointingLayer): method __init__ (line 358) | def __init__(self, config: ChameleonConfig, layer_idx: int): method forward (line 368) | def forward( class ChameleonSwinDecoderLayer (line 427) | class ChameleonSwinDecoderLayer(GradientCheckpointingLayer): method __init__ (line 428) | def __init__(self, config: ChameleonConfig, layer_idx: int): method forward (line 438) | def forward( class ChameleonVQVAEVectorQuantizer (line 495) | class ChameleonVQVAEVectorQuantizer(nn.Module): method __init__ (line 506) | def __init__(self, config): method forward (line 514) | def forward(self, hidden_state: torch.Tensor): class ChameleonVQVAEEncoderConvDownsample (line 542) | class ChameleonVQVAEEncoderConvDownsample(nn.Module): method __init__ (line 543) | def __init__(self, in_channels): method forward (line 547) | def forward(self, hidden_states): class ChameleonVQVAEEncoderResnetBlock (line 554) | class ChameleonVQVAEEncoderResnetBlock(nn.Module): method __init__ (line 555) | def __init__( method forward (line 578) | def forward(self, hidden_states): class ChameleonVQVAEEncoderAttnBlock (line 598) | class ChameleonVQVAEEncoderAttnBlock(nn.Module): method __init__ (line 599) | def __init__(self, in_channels): method forward (line 609) | def forward(self, hidden_states): class ChameleonVQVAEEncoder (line 633) | class ChameleonVQVAEEncoder(nn.Module): method __init__ (line 634) | def __init__(self, config): method forward (line 703) | def forward(self, pixel_values: torch.LongTensor): class ChameleonImageVocabularyMapping (line 730) | class ChameleonImageVocabularyMapping: method __init__ (line 735) | def __init__(self, vocab_map): method val2name (line 740) | def val2name(self): method image_tokens (line 744) | def image_tokens(self): method bpe2img (line 748) | def bpe2img(self): method img2bpe (line 757) | def img2bpe(self): method bpe2img_search_tensors (line 761) | def bpe2img_search_tensors(self): method img2bpe_mapping_tensor (line 765) | def img2bpe_mapping_tensor(self): method convert_img2bpe (line 771) | def convert_img2bpe(self, img_batch: torch.Tensor) -> torch.Tensor: class ChameleonPreTrainedModel (line 778) | class ChameleonPreTrainedModel(PreTrainedModel): class ChameleonVQVAE (line 805) | class ChameleonVQVAE(ChameleonPreTrainedModel): method __init__ (line 817) | def __init__(self, config: ChameleonVQVAEConfig): method encode (line 829) | def encode( class ChameleonModel (line 844) | class ChameleonModel(ChameleonPreTrainedModel): method __init__ (line 845) | def __init__(self, config: ChameleonConfig): method get_image_tokens (line 864) | def get_image_tokens(self, pixel_values: torch.FloatTensor): method get_image_features (line 884) | def get_image_features( method get_placeholder_mask (line 897) | def get_placeholder_mask( method forward (line 924) | def forward( class ChameleonForConditionalGeneration (line 996) | class ChameleonForConditionalGeneration(ChameleonPreTrainedModel, Genera... method __init__ (line 999) | def __init__(self, config): method get_image_tokens (line 1008) | def get_image_tokens(self, pixel_values): method get_image_features (line 1012) | def get_image_features( method forward (line 1019) | def forward( method prepare_inputs_for_generation (line 1096) | def prepare_inputs_for_generation( FILE: src/transformers/models/chameleon/processing_chameleon.py class ChameleonTextKwargs (line 31) | class ChameleonTextKwargs(TextKwargs, total=False): class ChameleonProcessorKwargs (line 42) | class ChameleonProcessorKwargs(ProcessingKwargs, total=False): class ChameleonProcessor (line 57) | class ChameleonProcessor(ProcessorMixin): method __init__ (line 58) | def __init__(self, image_processor, tokenizer, image_seq_length: int =... method __call__ (line 80) | def __call__( method _get_num_multimodal_tokens (line 133) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/chinese_clip/configuration_chinese_clip.py class ChineseCLIPTextConfig (line 27) | class ChineseCLIPTextConfig(PreTrainedConfig): class ChineseCLIPVisionConfig (line 70) | class ChineseCLIPVisionConfig(PreTrainedConfig): class ChineseCLIPConfig (line 106) | class ChineseCLIPConfig(PreTrainedConfig): method __post_init__ (line 141) | def __post_init__(self, **kwargs): FILE: src/transformers/models/chinese_clip/convert_chinese_clip_original_pytorch_to_hf.py function copy_attn_layer (line 22) | def copy_attn_layer(hf_attn_layer, pt_weights, prefix): function copy_mlp (line 42) | def copy_mlp(hf_mlp, pt_weights, prefix): function copy_linear (line 47) | def copy_linear(hf_linear, pt_weights, prefix): function copy_layer (line 52) | def copy_layer(hf_layer, pt_weights, prefix): function copy_layers (line 64) | def copy_layers(hf_layers, pt_weights, prefix): function copy_text_model_and_projection (line 69) | def copy_text_model_and_projection(hf_model, pt_weights): function copy_vision_model_and_projection (line 78) | def copy_vision_model_and_projection(hf_model, pt_weights): function convert_chinese_clip_checkpoint (line 96) | def convert_chinese_clip_checkpoint(checkpoint_path, pytorch_dump_folder... FILE: src/transformers/models/chinese_clip/image_processing_chinese_clip.py class ChineseCLIPImageProcessor (line 22) | class ChineseCLIPImageProcessor(TorchvisionBackend): FILE: src/transformers/models/chinese_clip/image_processing_chinese_pil_clip.py class ChineseCLIPImageProcessorPil (line 22) | class ChineseCLIPImageProcessorPil(PilBackend): FILE: src/transformers/models/chinese_clip/modeling_chinese_clip.py function contrastive_loss (line 46) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function chinese_clip_loss (line 50) | def chinese_clip_loss(similarity: torch.Tensor) -> torch.Tensor: class ChineseCLIPOutput (line 58) | class ChineseCLIPOutput(ModelOutput): method to_tuple (line 88) | def to_tuple(self) -> tuple[Any]: class ChineseCLIPTextEmbeddings (line 96) | class ChineseCLIPTextEmbeddings(nn.Module): method __init__ (line 99) | def __init__(self, config): method forward (line 115) | def forward( class ChineseCLIPVisionEmbeddings (line 157) | class ChineseCLIPVisionEmbeddings(nn.Module): method __init__ (line 158) | def __init__(self, config: ChineseCLIPVisionConfig): method interpolate_pos_encoding (line 180) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 221) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... function eager_attention_forward (line 241) | def eager_attention_forward( class ChineseCLIPTextSelfAttention (line 264) | class ChineseCLIPTextSelfAttention(nn.Module): method __init__ (line 265) | def __init__(self, config): method forward (line 286) | def forward( class ChineseCLIPTextSelfOutput (line 319) | class ChineseCLIPTextSelfOutput(nn.Module): method __init__ (line 320) | def __init__(self, config): method forward (line 326) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ChineseCLIPTextAttention (line 334) | class ChineseCLIPTextAttention(nn.Module): method __init__ (line 335) | def __init__(self, config): method forward (line 340) | def forward( class ChineseCLIPVisionAttention (line 356) | class ChineseCLIPVisionAttention(nn.Module): method __init__ (line 359) | def __init__(self, config): method forward (line 378) | def forward( class ChineseCLIPTextIntermediate (line 414) | class ChineseCLIPTextIntermediate(nn.Module): method __init__ (line 415) | def __init__(self, config): method forward (line 423) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ChineseCLIPTextOutput (line 430) | class ChineseCLIPTextOutput(nn.Module): method __init__ (line 431) | def __init__(self, config): method forward (line 437) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ChineseCLIPVisionMLP (line 445) | class ChineseCLIPVisionMLP(nn.Module): method __init__ (line 446) | def __init__(self, config): method forward (line 453) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ChineseCLIPTextLayer (line 461) | class ChineseCLIPTextLayer(GradientCheckpointingLayer): method __init__ (line 462) | def __init__(self, config): method forward (line 470) | def forward( method feed_forward_chunk (line 488) | def feed_forward_chunk(self, attention_output): class ChineseCLIPVisionLayer (line 494) | class ChineseCLIPVisionLayer(GradientCheckpointingLayer): method __init__ (line 495) | def __init__(self, config: ChineseCLIPConfig): method forward (line 503) | def forward( class ChineseCLIPTextPooler (line 526) | class ChineseCLIPTextPooler(nn.Module): method __init__ (line 527) | def __init__(self, config): method forward (line 532) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ChineseCLIPPreTrainedModel (line 542) | class ChineseCLIPPreTrainedModel(PreTrainedModel): method _init_weights (line 549) | def _init_weights(self, module): class ChineseCLIPTextEncoder (line 601) | class ChineseCLIPTextEncoder(nn.Module): method __init__ (line 602) | def __init__(self, config): method forward (line 608) | def forward( class ChineseCLIPVisionEncoder (line 626) | class ChineseCLIPVisionEncoder(nn.Module): method __init__ (line 635) | def __init__(self, config: ChineseCLIPConfig): method forward (line 641) | def forward( class ChineseCLIPVisionTransformer (line 665) | class ChineseCLIPVisionTransformer(nn.Module): method __init__ (line 666) | def __init__(self, config: ChineseCLIPVisionConfig): method forward (line 677) | def forward( class ChineseCLIPTextModel (line 709) | class ChineseCLIPTextModel(ChineseCLIPPreTrainedModel): method __init__ (line 730) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 746) | def get_input_embeddings(self): method set_input_embeddings (line 749) | def set_input_embeddings(self, value): method forward (line 755) | def forward( class ChineseCLIPVisionModel (line 819) | class ChineseCLIPVisionModel(ChineseCLIPPreTrainedModel): method __init__ (line 829) | def __init__(self, config: ChineseCLIPVisionConfig): method get_input_embeddings (line 835) | def get_input_embeddings(self) -> nn.Module: method forward (line 841) | def forward( class ChineseCLIPModel (line 877) | class ChineseCLIPModel(ChineseCLIPPreTrainedModel): method __init__ (line 884) | def __init__(self, config: ChineseCLIPConfig): method get_text_features (line 920) | def get_text_features( method get_image_features (line 957) | def get_image_features( method forward (line 995) | def forward( FILE: src/transformers/models/chinese_clip/processing_chinese_clip.py class ChineseCLIPProcessor (line 23) | class ChineseCLIPProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): FILE: src/transformers/models/chmv2/configuration_chmv2.py class CHMv2Config (line 33) | class CHMv2Config(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/chmv2/convert_chmv2_to_hf.py function convert_head_keys_to_new_keys (line 82) | def convert_head_keys_to_new_keys(state_dict_keys: list[str]) -> dict[st... function load_original_state_dict (line 93) | def load_original_state_dict(checkpoint_path: str) -> dict: function get_chmv2_config (line 103) | def get_chmv2_config(model_name: str, backbone_repo_id: str | None = Non... function convert_backbone_keys (line 138) | def convert_backbone_keys(state_dict: dict) -> dict: function convert_head_keys (line 162) | def convert_head_keys(state_dict: dict) -> dict: function convert_chmv2_checkpoint (line 176) | def convert_chmv2_checkpoint( function main (line 258) | def main(): FILE: src/transformers/models/chmv2/image_processing_chmv2.py class CHMv2ImageProcessorKwargs (line 38) | class CHMv2ImageProcessorKwargs(ImagesKwargs, total=False): function get_resize_output_image_size (line 58) | def get_resize_output_image_size( class CHMv2ImageProcessor (line 98) | class CHMv2ImageProcessor(TorchvisionBackend): method __init__ (line 121) | def __init__(self, **kwargs: Unpack[CHMv2ImageProcessorKwargs]): method preprocess (line 125) | def preprocess( method _preprocess_image_like_inputs (line 137) | def _preprocess_image_like_inputs( method reduce_label (line 181) | def reduce_label(self, labels: list["torch.Tensor"]) -> list["torch.Te... method _preprocess (line 191) | def _preprocess( method post_process_semantic_segmentation (line 250) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... method resize (line 295) | def resize( method pad_image (line 335) | def pad_image( method post_process_depth_estimation (line 363) | def post_process_depth_estimation( FILE: src/transformers/models/chmv2/modeling_chmv2.py function _get_backbone_hidden_size (line 34) | def _get_backbone_hidden_size(config): class CHMv2ReassembleLayer (line 41) | class CHMv2ReassembleLayer(nn.Module): method __init__ (line 42) | def __init__(self, config: CHMv2Config, channels: int, factor: int): method forward (line 57) | def forward(self, hidden_state): class CHMv2ReassembleStage (line 63) | class CHMv2ReassembleStage(nn.Module): method __init__ (line 69) | def __init__(self, config: CHMv2Config): method forward (line 90) | def forward(self, hidden_states: list[torch.Tensor], patch_height=None... class CHMv2PreActResidualLayer (line 119) | class CHMv2PreActResidualLayer(nn.Module): method __init__ (line 128) | def __init__(self, config): method forward (line 151) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class CHMv2FeatureFusionLayer (line 161) | class CHMv2FeatureFusionLayer(nn.Module): method __init__ (line 162) | def __init__(self, config: CHMv2Config, is_first_layer: bool = False): method forward (line 173) | def forward(self, hidden_state, residual=None, size=None): class CHMv2UpsampleConvHead (line 198) | class CHMv2UpsampleConvHead(nn.Module): method __init__ (line 205) | def __init__(self, features, number_output_channels, n_hidden_channels... method forward (line 217) | def forward(self, hidden_states): class CHMv2Head (line 223) | class CHMv2Head(nn.Module): method __init__ (line 230) | def __init__(self, config: CHMv2Config): method forward_features (line 250) | def forward_features(self, hidden_states: list[torch.Tensor], patch_he... method forward (line 262) | def forward(self, hidden_states: list[torch.Tensor], patch_height: int... class CHMv2FeaturesToDepth (line 268) | class CHMv2FeaturesToDepth(nn.Module): method __init__ (line 271) | def __init__(self, config: CHMv2Config): method _create_mixlog_bins (line 281) | def _create_mixlog_bins(self, n_bins: int, device: torch.device) -> to... method _create_outputs_with_mixlog_norm (line 302) | def _create_outputs_with_mixlog_norm(self, input: torch.Tensor, bins: ... method forward (line 321) | def forward(self, x: torch.Tensor) -> torch.Tensor: class CHMv2PreTrainedModel (line 359) | class CHMv2PreTrainedModel(PreTrainedModel): method _init_weights (line 370) | def _init_weights(self, module) -> None: class CHMv2ForDepthEstimation (line 384) | class CHMv2ForDepthEstimation(CHMv2PreTrainedModel): method __init__ (line 385) | def __init__(self, config: CHMv2Config): method get_input_embeddings (line 394) | def get_input_embeddings(self): method forward (line 399) | def forward( FILE: src/transformers/models/chmv2/modular_chmv2.py class CHMv2Config (line 39) | class CHMv2Config(PreTrainedConfig): method __post_init__ (line 92) | def __post_init__(self, **kwargs): class CHMv2ImageProcessorKwargs (line 123) | class CHMv2ImageProcessorKwargs(ImagesKwargs, total=False): class CHMv2ImageProcessor (line 143) | class CHMv2ImageProcessor(DPTImageProcessor): method post_process_depth_estimation (line 153) | def post_process_depth_estimation( class CHMv2ReassembleLayer (line 195) | class CHMv2ReassembleLayer(DPTReassembleLayer): class CHMv2ReassembleStage (line 199) | class CHMv2ReassembleStage(nn.Module): method __init__ (line 205) | def __init__(self, config: CHMv2Config): method forward (line 226) | def forward(self, hidden_states: list[torch.Tensor], patch_height=None... class CHMv2PreActResidualLayer (line 255) | class CHMv2PreActResidualLayer(DepthAnythingPreActResidualLayer): class CHMv2FeatureFusionLayer (line 259) | class CHMv2FeatureFusionLayer(nn.Module): method __init__ (line 260) | def __init__(self, config: CHMv2Config, is_first_layer: bool = False): method forward (line 271) | def forward(self, hidden_state, residual=None, size=None): class CHMv2UpsampleConvHead (line 296) | class CHMv2UpsampleConvHead(nn.Module): method __init__ (line 303) | def __init__(self, features, number_output_channels, n_hidden_channels... method forward (line 315) | def forward(self, hidden_states): class CHMv2Head (line 321) | class CHMv2Head(nn.Module): method __init__ (line 328) | def __init__(self, config: CHMv2Config): method forward_features (line 348) | def forward_features(self, hidden_states: list[torch.Tensor], patch_he... method forward (line 360) | def forward(self, hidden_states: list[torch.Tensor], patch_height: int... class CHMv2FeaturesToDepth (line 366) | class CHMv2FeaturesToDepth(nn.Module): method __init__ (line 369) | def __init__(self, config: CHMv2Config): method _create_mixlog_bins (line 379) | def _create_mixlog_bins(self, n_bins: int, device: torch.device) -> to... method _create_outputs_with_mixlog_norm (line 400) | def _create_outputs_with_mixlog_norm(self, input: torch.Tensor, bins: ... method forward (line 419) | def forward(self, x: torch.Tensor) -> torch.Tensor: class CHMv2PreTrainedModel (line 457) | class CHMv2PreTrainedModel(PreTrainedModel): method _init_weights (line 468) | def _init_weights(self, module) -> None: class CHMv2ForDepthEstimation (line 482) | class CHMv2ForDepthEstimation(CHMv2PreTrainedModel): method __init__ (line 483) | def __init__(self, config: CHMv2Config): method get_input_embeddings (line 492) | def get_input_embeddings(self): method forward (line 497) | def forward( FILE: src/transformers/models/clap/configuration_clap.py class ClapTextConfig (line 27) | class ClapTextConfig(PreTrainedConfig): class ClapAudioConfig (line 68) | class ClapAudioConfig(PreTrainedConfig): class ClapConfig (line 145) | class ClapConfig(PreTrainedConfig): method __post_init__ (line 181) | def __post_init__(self, **kwargs): FILE: src/transformers/models/clap/convert_clap_original_pytorch_to_hf.py function init_clap (line 39) | def init_clap(checkpoint_path, model_type, enable_fusion=False): function get_config_from_original (line 48) | def get_config_from_original(clap_model): function rename_state_dict (line 60) | def rename_state_dict(state_dict): function convert_clap_checkpoint (line 103) | def convert_clap_checkpoint(checkpoint_path, pytorch_dump_folder_path, c... FILE: src/transformers/models/clap/feature_extraction_clap.py class ClapFeatureExtractor (line 33) | class ClapFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 85) | def __init__( method to_dict (line 138) | def to_dict(self) -> dict[str, Any]: method _np_extract_fbank_features (line 154) | def _np_extract_fbank_features(self, waveform: np.ndarray, mel_filters... method _random_mel_fusion (line 176) | def _random_mel_fusion(self, mel, total_frames, chunk_frames): method _get_input_mel (line 201) | def _get_input_mel(self, waveform: np.ndarray, max_length, truncation,... method __call__ (line 259) | def __call__( FILE: src/transformers/models/clap/modeling_clap.py function interpolate (line 46) | def interpolate(hidden_states, ratio): function window_partition (line 63) | def window_partition(hidden_states, window_size): function window_reverse (line 84) | def window_reverse(windows, window_size, height, width): function contrastive_loss (line 105) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: class ClapTextModelOutput (line 117) | class ClapTextModelOutput(ModelOutput): class ClapAudioModelOutput (line 135) | class ClapAudioModelOutput(ModelOutput): class ClapOutput (line 150) | class ClapOutput(ModelOutput): method to_tuple (line 178) | def to_tuple(self) -> tuple[Any]: class ClapDropPath (line 183) | class ClapDropPath(nn.Module): method __init__ (line 189) | def __init__(self, drop_prob=None): method forward (line 193) | def forward(self, hidden_states): class ClapAudioAFFBlock (line 208) | class ClapAudioAFFBlock(nn.Module): method __init__ (line 214) | def __init__(self, config: ClapAudioConfig): method forward (line 238) | def forward(self, hidden_states, residual): class ClapAudioPatchEmbed (line 248) | class ClapAudioPatchEmbed(nn.Module): method __init__ (line 254) | def __init__(self, config: ClapAudioConfig): method forward (line 296) | def forward(self, hidden_states, is_longer_idx=None): class ClapAudioSelfAttention (line 347) | class ClapAudioSelfAttention(nn.Module): method __init__ (line 348) | def __init__(self, config, dim, num_heads, window_size): method forward (line 374) | def forward( method create_relative_position_index (line 425) | def create_relative_position_index(self): class ClapAudioSelfOutput (line 441) | class ClapAudioSelfOutput(nn.Module): method __init__ (line 442) | def __init__(self, config, dim): method forward (line 447) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ClapAudioAttention (line 455) | class ClapAudioAttention(nn.Module): method __init__ (line 456) | def __init__(self, config, dim, num_heads, window_size): method forward (line 461) | def forward( class ClapAudioIntermediate (line 474) | class ClapAudioIntermediate(nn.Module): method __init__ (line 475) | def __init__(self, config, dim): method forward (line 483) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ClapAudioOutput (line 490) | class ClapAudioOutput(nn.Module): method __init__ (line 491) | def __init__(self, config, dim): method forward (line 496) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ClapAudioLayer (line 503) | class ClapAudioLayer(nn.Module): method __init__ (line 504) | def __init__(self, config, dim, input_resolution, num_heads, drop_path... method set_shift_and_window_size (line 517) | def set_shift_and_window_size(self, input_resolution): method get_attn_mask (line 525) | def get_attn_mask(self, height, width, dtype, device): method maybe_pad (line 553) | def maybe_pad(self, hidden_states, height, width): method forward (line 560) | def forward( class ClapAudioStage (line 626) | class ClapAudioStage(GradientCheckpointingLayer): method __init__ (line 627) | def __init__(self, config, dim, input_resolution, depth, num_heads, dr... method forward (line 653) | def forward( class ClapAudioPatchMerging (line 682) | class ClapAudioPatchMerging(nn.Module): method __init__ (line 695) | def __init__(self, input_resolution: tuple[int], dim: int, norm_layer:... method maybe_pad (line 702) | def maybe_pad(self, input_feature, height, width): method forward (line 710) | def forward(self, input_feature: torch.Tensor, input_dimensions: tuple... class ClapAudioEncoder (line 736) | class ClapAudioEncoder(nn.Module): method __init__ (line 737) | def __init__(self, config): method reshape_mel2img (line 777) | def reshape_mel2img(self, normalized_input_features): method forward (line 814) | def forward( class ClapProjectionLayer (line 921) | class ClapProjectionLayer(nn.Module): method __init__ (line 922) | def __init__(self, config: ClapAudioConfig | ClapTextConfig): method forward (line 932) | def forward(self, hidden_states): class ClapTextEmbeddings (line 940) | class ClapTextEmbeddings(nn.Module): method __init__ (line 943) | def __init__(self, config): method forward (line 963) | def forward( method create_position_ids_from_inputs_embeds (line 1012) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 1030) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 1047) | def eager_attention_forward( class ClapTextSelfAttention (line 1070) | class ClapTextSelfAttention(nn.Module): method __init__ (line 1071) | def __init__(self, config): method forward (line 1092) | def forward( class ClapTextSelfOutput (line 1125) | class ClapTextSelfOutput(nn.Module): method __init__ (line 1126) | def __init__(self, config): method forward (line 1132) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ClapTextAttention (line 1140) | class ClapTextAttention(nn.Module): method __init__ (line 1141) | def __init__(self, config): method forward (line 1146) | def forward( class ClapTextIntermediate (line 1163) | class ClapTextIntermediate(nn.Module): method __init__ (line 1164) | def __init__(self, config): method forward (line 1172) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ClapTextOutput (line 1179) | class ClapTextOutput(nn.Module): method __init__ (line 1180) | def __init__(self, config): method forward (line 1186) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ClapTextLayer (line 1194) | class ClapTextLayer(GradientCheckpointingLayer): method __init__ (line 1195) | def __init__(self, config): method forward (line 1203) | def forward( method feed_forward_chunk (line 1221) | def feed_forward_chunk(self, attention_output): class ClapTextEncoder (line 1228) | class ClapTextEncoder(nn.Module): method __init__ (line 1229) | def __init__(self, config): method forward (line 1235) | def forward( class ClapTextPooler (line 1254) | class ClapTextPooler(nn.Module): method __init__ (line 1255) | def __init__(self, config): method forward (line 1260) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ClapPreTrainedModel (line 1270) | class ClapPreTrainedModel(PreTrainedModel): method _init_weights (line 1277) | def _init_weights(self, module: nn.Module): class ClapAudioModel (line 1308) | class ClapAudioModel(ClapPreTrainedModel): method __init__ (line 1313) | def __init__(self, config: ClapAudioConfig): method get_input_embeddings (line 1319) | def get_input_embeddings(self) -> nn.Module: method forward (line 1323) | def forward( class ClapTextModel (line 1372) | class ClapTextModel(ClapPreTrainedModel): method __init__ (line 1380) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 1396) | def get_input_embeddings(self): method set_input_embeddings (line 1399) | def set_input_embeddings(self, value): method forward (line 1405) | def forward( class ClapModel (line 1455) | class ClapModel(ClapPreTrainedModel): method __init__ (line 1458) | def __init__(self, config: ClapConfig): method get_text_features (line 1492) | def get_text_features( method get_audio_features (line 1526) | def get_audio_features( method forward (line 1562) | def forward( class ClapTextModelWithProjection (line 1646) | class ClapTextModelWithProjection(ClapPreTrainedModel): method __init__ (line 1654) | def __init__(self, config: ClapTextConfig): method get_input_embeddings (line 1661) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1664) | def set_input_embeddings(self, value): method forward (line 1669) | def forward( class ClapAudioModelWithProjection (line 1708) | class ClapAudioModelWithProjection(ClapPreTrainedModel): method __init__ (line 1713) | def __init__(self, config: ClapAudioConfig): method get_input_embeddings (line 1720) | def get_input_embeddings(self) -> nn.Module: method forward (line 1725) | def forward( FILE: src/transformers/models/clap/processing_clap.py class ClapProcessor (line 26) | class ClapProcessor(ProcessorMixin): method __init__ (line 27) | def __init__(self, feature_extractor, tokenizer): FILE: src/transformers/models/clip/configuration_clip.py class CLIPTextConfig (line 27) | class CLIPTextConfig(PreTrainedConfig): method validate_architecture (line 66) | def validate_architecture(self): class CLIPVisionConfig (line 77) | class CLIPVisionConfig(PreTrainedConfig): method validate_architecture (line 111) | def validate_architecture(self): class CLIPConfig (line 122) | class CLIPConfig(PreTrainedConfig): method __post_init__ (line 164) | def __post_init__(self, **kwargs): FILE: src/transformers/models/clip/convert_clip_original_pytorch_to_hf.py function copy_attn_layer (line 23) | def copy_attn_layer(hf_attn_layer, pt_attn_layer): function copy_mlp (line 43) | def copy_mlp(hf_mlp, pt_mlp): function copy_linear (line 48) | def copy_linear(hf_linear, pt_linear): function copy_layer (line 53) | def copy_layer(hf_layer, pt_layer): function copy_layers (line 65) | def copy_layers(hf_layers, pt_layers): function copy_encoder (line 70) | def copy_encoder(hf_encoder, pt_model): function copy_text_model_and_projection (line 82) | def copy_text_model_and_projection(hf_model, pt_model): function copy_vison_model_and_projection (line 90) | def copy_vison_model_and_projection(hf_model, pt_model): function convert_clip_checkpoint (line 108) | def convert_clip_checkpoint(checkpoint_path, pytorch_dump_folder_path, c... FILE: src/transformers/models/clip/image_processing_clip.py class CLIPImageProcessor (line 23) | class CLIPImageProcessor(TorchvisionBackend): method __init__ (line 36) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): FILE: src/transformers/models/clip/image_processing_pil_clip.py class CLIPImageProcessorPil (line 23) | class CLIPImageProcessorPil(PilBackend): method __init__ (line 36) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): FILE: src/transformers/models/clip/modeling_clip.py function contrastive_loss (line 47) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function clip_loss (line 51) | def clip_loss(similarity: torch.Tensor) -> torch.Tensor: function _get_vector_norm (line 57) | def _get_vector_norm(tensor: torch.Tensor) -> torch.Tensor: class CLIPVisionModelOutput (line 74) | class CLIPVisionModelOutput(ModelOutput): class CLIPTextModelOutput (line 92) | class CLIPTextModelOutput(ModelOutput): class CLIPOutput (line 106) | class CLIPOutput(ModelOutput): method to_tuple (line 134) | def to_tuple(self) -> tuple[Any]: class CLIPVisionEmbeddings (line 138) | class CLIPVisionEmbeddings(nn.Module): method __init__ (line 139) | def __init__(self, config: CLIPVisionConfig): method interpolate_pos_encoding (line 161) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 202) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class CLIPTextEmbeddings (line 221) | class CLIPTextEmbeddings(nn.Module): method __init__ (line 222) | def __init__(self, config: CLIPTextConfig): method forward (line 234) | def forward( function eager_attention_forward (line 261) | def eager_attention_forward( class CLIPAttention (line 282) | class CLIPAttention(nn.Module): method __init__ (line 285) | def __init__(self, config: CLIPVisionConfig | CLIPTextConfig): method forward (line 300) | def forward( class CLIPMLP (line 339) | class CLIPMLP(nn.Module): method __init__ (line 340) | def __init__(self, config): method forward (line 347) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class CLIPEncoderLayer (line 354) | class CLIPEncoderLayer(GradientCheckpointingLayer): method __init__ (line 355) | def __init__(self, config: CLIPVisionConfig | CLIPTextConfig): method forward (line 363) | def forward( class CLIPPreTrainedModel (line 388) | class CLIPPreTrainedModel(PreTrainedModel): method _init_weights (line 403) | def _init_weights(self, module): class CLIPEncoder (line 462) | class CLIPEncoder(nn.Module): method __init__ (line 471) | def __init__(self, config: CLIPConfig): method forward (line 477) | def forward( class CLIPTextTransformer (line 510) | class CLIPTextTransformer(CLIPPreTrainedModel): method __init__ (line 516) | def __init__(self, config: CLIPTextConfig): method forward (line 531) | def forward( class CLIPTextModel (line 597) | class CLIPTextModel(CLIPPreTrainedModel): method __init__ (line 603) | def __init__(self, config: CLIPTextConfig): method get_input_embeddings (line 609) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 612) | def set_input_embeddings(self, value): method forward (line 616) | def forward( class CLIPVisionTransformer (line 647) | class CLIPVisionTransformer(CLIPPreTrainedModel): method __init__ (line 653) | def __init__(self, config: CLIPVisionConfig): method forward (line 667) | def forward( class CLIPVisionModel (line 699) | class CLIPVisionModel(CLIPPreTrainedModel): method __init__ (line 705) | def __init__(self, config: CLIPVisionConfig): method get_input_embeddings (line 711) | def get_input_embeddings(self) -> nn.Module: method forward (line 715) | def forward( class CLIPModel (line 752) | class CLIPModel(CLIPPreTrainedModel): method __init__ (line 756) | def __init__(self, config: CLIPConfig): method get_text_features (line 793) | def get_text_features( method get_image_features (line 829) | def get_image_features( method forward (line 867) | def forward( class CLIPTextModelWithProjection (line 948) | class CLIPTextModelWithProjection(CLIPPreTrainedModel): method __init__ (line 954) | def __init__(self, config: CLIPTextConfig): method get_input_embeddings (line 965) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 968) | def set_input_embeddings(self, value): method forward (line 973) | def forward( class CLIPVisionModelWithProjection (line 1015) | class CLIPVisionModelWithProjection(CLIPPreTrainedModel): method __init__ (line 1020) | def __init__(self, config: CLIPVisionConfig): method get_input_embeddings (line 1031) | def get_input_embeddings(self) -> nn.Module: method forward (line 1036) | def forward( class CLIPForImageClassification (line 1085) | class CLIPForImageClassification(CLIPPreTrainedModel): method __init__ (line 1089) | def __init__(self, config: CLIPConfig) -> None: method forward (line 1106) | def forward( FILE: src/transformers/models/clip/processing_clip.py class CLIPProcessor (line 23) | class CLIPProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): FILE: src/transformers/models/clip/tokenization_clip.py class CLIPTokenizer (line 28) | class CLIPTokenizer(TokenizersBackend): method __init__ (line 56) | def __init__( method _wrap_decode_method_backend_tokenizer (line 127) | def _wrap_decode_method_backend_tokenizer(self): FILE: src/transformers/models/clipseg/configuration_clipseg.py class CLIPSegTextConfig (line 27) | class CLIPSegTextConfig(PreTrainedConfig): class CLIPSegVisionConfig (line 65) | class CLIPSegVisionConfig(PreTrainedConfig): class CLIPSegConfig (line 101) | class CLIPSegConfig(PreTrainedConfig): method __post_init__ (line 154) | def __post_init__(self, **kwargs): FILE: src/transformers/models/clipseg/convert_clipseg_original_pytorch_to_hf.py function get_clipseg_config (line 35) | def get_clipseg_config(model_name): function rename_key (line 51) | def rename_key(name): function convert_state_dict (line 114) | def convert_state_dict(orig_state_dict, config): function prepare_img (line 161) | def prepare_img(): function convert_clipseg_checkpoint (line 168) | def convert_clipseg_checkpoint(model_name, checkpoint_path, pytorch_dump... FILE: src/transformers/models/clipseg/modeling_clipseg.py function contrastive_loss (line 43) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function clipseg_loss (line 48) | def clipseg_loss(similarity: torch.Tensor) -> torch.Tensor: class CLIPSegOutput (line 57) | class CLIPSegOutput(ModelOutput): method to_tuple (line 85) | def to_tuple(self) -> tuple[Any]: class CLIPSegDecoderOutput (line 91) | class CLIPSegDecoderOutput(ModelOutput): class CLIPSegImageSegmentationOutput (line 104) | class CLIPSegImageSegmentationOutput(ModelOutput): method to_tuple (line 127) | def to_tuple(self) -> tuple[Any]: class CLIPSegVisionEmbeddings (line 131) | class CLIPSegVisionEmbeddings(nn.Module): method __init__ (line 133) | def __init__(self, config: CLIPSegVisionConfig): method interpolate_pos_encoding (line 155) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 196) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class CLIPSegTextEmbeddings (line 215) | class CLIPSegTextEmbeddings(nn.Module): method __init__ (line 216) | def __init__(self, config: CLIPSegTextConfig): method forward (line 228) | def forward( function eager_attention_forward (line 256) | def eager_attention_forward( class CLIPSegAttention (line 279) | class CLIPSegAttention(nn.Module): method __init__ (line 282) | def __init__(self, config: CLIPSegVisionConfig | CLIPSegTextConfig): method forward (line 302) | def forward( class CLIPSegMLP (line 341) | class CLIPSegMLP(nn.Module): method __init__ (line 342) | def __init__(self, config): method forward (line 349) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class CLIPSegEncoderLayer (line 357) | class CLIPSegEncoderLayer(GradientCheckpointingLayer): method __init__ (line 358) | def __init__(self, config: CLIPSegConfig): method forward (line 366) | def forward( class CLIPSegDecoderLayer (line 390) | class CLIPSegDecoderLayer(nn.Module): method __init__ (line 397) | def __init__(self, config: CLIPSegConfig): method forward (line 405) | def forward( class CLIPSegPreTrainedModel (line 441) | class CLIPSegPreTrainedModel(PreTrainedModel): method _init_weights (line 452) | def _init_weights(self, module): class CLIPSegEncoder (line 497) | class CLIPSegEncoder(nn.Module): method __init__ (line 506) | def __init__(self, config: CLIPSegConfig): method forward (line 512) | def forward( class CLIPSegDecoder (line 546) | class CLIPSegDecoder(CLIPSegPreTrainedModel): method __init__ (line 547) | def __init__(self, config: CLIPSegConfig): method forward (line 593) | def forward( class CLIPSegTextTransformer (line 629) | class CLIPSegTextTransformer(CLIPSegPreTrainedModel): method __init__ (line 630) | def __init__(self, config: CLIPSegTextConfig): method forward (line 644) | def forward( class CLIPSegTextModel (line 722) | class CLIPSegTextModel(CLIPSegPreTrainedModel): method __init__ (line 728) | def __init__(self, config: CLIPSegTextConfig): method get_input_embeddings (line 734) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 737) | def set_input_embeddings(self, value): method forward (line 743) | def forward( class CLIPSegVisionTransformer (line 774) | class CLIPSegVisionTransformer(nn.Module): method __init__ (line 776) | def __init__(self, config: CLIPSegVisionConfig): method forward (line 787) | def forward( class CLIPSegVisionModel (line 826) | class CLIPSegVisionModel(CLIPSegPreTrainedModel): method __init__ (line 831) | def __init__(self, config: CLIPSegVisionConfig): method get_input_embeddings (line 837) | def get_input_embeddings(self) -> nn.Module: method forward (line 843) | def forward( class CLIPSegModel (line 879) | class CLIPSegModel(CLIPSegPreTrainedModel): method __init__ (line 882) | def __init__(self, config: CLIPSegConfig): method get_text_features (line 921) | def get_text_features( method get_image_features (line 956) | def get_image_features( method forward (line 993) | def forward( class CLIPSegForImageSegmentation (line 1075) | class CLIPSegForImageSegmentation(CLIPSegPreTrainedModel): method __init__ (line 1078) | def __init__(self, config: CLIPSegConfig): method get_conditional_embeddings (line 1091) | def get_conditional_embeddings( method forward (line 1122) | def forward( FILE: src/transformers/models/clipseg/processing_clipseg.py class CLIPSegProcessor (line 24) | class CLIPSegProcessor(ProcessorMixin): method __init__ (line 25) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 29) | def __call__(self, text=None, images=None, visual_prompt=None, return_... FILE: src/transformers/models/clvp/configuration_clvp.py class ClvpEncoderConfig (line 29) | class ClvpEncoderConfig(PreTrainedConfig): method from_pretrained (line 76) | def from_pretrained( class ClvpDecoderConfig (line 103) | class ClvpDecoderConfig(PreTrainedConfig): class ClvpConfig (line 185) | class ClvpConfig(PreTrainedConfig): method __post_init__ (line 231) | def __post_init__(self, **kwargs): FILE: src/transformers/models/clvp/convert_clvp_to_hf.py function update_index (line 74) | def update_index(present_index): function convert_encoder_weights (line 81) | def convert_encoder_weights(original_weights): function convert_decoder_weights (line 110) | def convert_decoder_weights(original_weights): function _download (line 182) | def _download(url: str, root: str): function convert_clvp_weights (line 193) | def convert_clvp_weights(checkpoint_path, pytorch_dump_folder_path): FILE: src/transformers/models/clvp/feature_extraction_clvp.py class ClvpFeatureExtractor (line 30) | class ClvpFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 68) | def __init__( method _np_extract_fbank_features (line 106) | def _np_extract_fbank_features(self, waveform: np.ndarray) -> np.ndarray: method __call__ (line 128) | def __call__( FILE: src/transformers/models/clvp/modeling_clvp.py function contrastive_loss (line 59) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function clvp_loss (line 64) | def clvp_loss(similarity: torch.Tensor) -> torch.Tensor: function rotate_half (line 71) | def rotate_half(x): function apply_rotary_pos_emb (line 78) | def apply_rotary_pos_emb(q, k, v, cos, sin, position_ids, unsqueeze_dim=1): function _pad_extra_bos_eos_tokens (line 107) | def _pad_extra_bos_eos_tokens( class ClvpEncoderOutput (line 157) | class ClvpEncoderOutput(ModelOutput): class ClvpOutput (line 176) | class ClvpOutput(ModelOutput): class ClvpRMSNorm (line 220) | class ClvpRMSNorm(nn.Module): method __init__ (line 221) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 229) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 236) | def extra_repr(self): class ClvpRotaryPositionalEmbedding (line 240) | class ClvpRotaryPositionalEmbedding(nn.Module): method __init__ (line 246) | def __init__(self, config): method forward (line 255) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class ClvpSelfAttention (line 270) | class ClvpSelfAttention(nn.Module): method __init__ (line 275) | def __init__(self, config, layer_idx=None): method _shape (line 301) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 304) | def forward( class ClvpGatedLinearUnit (line 384) | class ClvpGatedLinearUnit(nn.Module): method __init__ (line 390) | def __init__(self, config): method forward (line 395) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class ClvpEncoderMLP (line 400) | class ClvpEncoderMLP(nn.Module): method __init__ (line 405) | def __init__(self, config): method forward (line 413) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class ClvpEncoderLayer (line 420) | class ClvpEncoderLayer(nn.Module): method __init__ (line 421) | def __init__(self, config: ClvpConfig): method forward (line 431) | def forward( class ClvpSequenceSummary (line 462) | class ClvpSequenceSummary(nn.Module): method __init__ (line 488) | def __init__(self, config: ClvpConfig): method forward (line 517) | def forward( class ClvpDecoderMLP (line 562) | class ClvpDecoderMLP(nn.Module): method __init__ (line 563) | def __init__(self, intermediate_size, config): method forward (line 571) | def forward(self, hidden_states: tuple[torch.FloatTensor] | None) -> t... class ClvpDecoderLayer (line 579) | class ClvpDecoderLayer(nn.Module): method __init__ (line 580) | def __init__(self, config, layer_idx=None): method forward (line 591) | def forward( class ClvpConditioningEncoder (line 622) | class ClvpConditioningEncoder(nn.Module): method __init__ (line 635) | def __init__(self, config: ClvpConfig): method compute_groupnorm_groups (line 664) | def compute_groupnorm_groups(self, channels: int, groups: int = 32): method forward (line 685) | def forward( class ClvpPreTrainedModel (line 761) | class ClvpPreTrainedModel(PreTrainedModel): method _init_weights (line 772) | def _init_weights(self, module: nn.Module): class ClvpEncoder (line 818) | class ClvpEncoder(ClvpPreTrainedModel): method __init__ (line 829) | def __init__(self, config: ClvpConfig): method get_input_embeddings (line 846) | def get_input_embeddings(self): method set_input_embeddings (line 849) | def set_input_embeddings(self, value): method forward (line 855) | def forward( class ClvpDecoder (line 908) | class ClvpDecoder(ClvpPreTrainedModel): method __init__ (line 915) | def __init__(self, config): method get_input_embeddings (line 934) | def get_input_embeddings(self): method set_input_embeddings (line 937) | def set_input_embeddings(self, new_embeddings): method forward (line 943) | def forward( class ClvpModel (line 1016) | class ClvpModel(ClvpPreTrainedModel): method __init__ (line 1019) | def __init__(self, config: ClvpDecoderConfig): method get_input_embeddings (line 1027) | def get_input_embeddings(self): method set_input_embeddings (line 1030) | def set_input_embeddings(self, value): method forward (line 1035) | def forward( class ClvpForCausalLM (line 1072) | class ClvpForCausalLM(ClvpPreTrainedModel, GenerationMixin): method __init__ (line 1075) | def __init__(self, config): method get_output_embeddings (line 1087) | def get_output_embeddings(self): method get_input_embeddings (line 1090) | def get_input_embeddings(self): method set_input_embeddings (line 1093) | def set_input_embeddings(self, new_embeddings): method _prepare_model_inputs (line 1096) | def _prepare_model_inputs( method prepare_inputs_for_generation (line 1163) | def prepare_inputs_for_generation( method forward (line 1190) | def forward( class ClvpModelForConditionalGeneration (line 1250) | class ClvpModelForConditionalGeneration(ClvpPreTrainedModel, GenerationM... method __init__ (line 1251) | def __init__(self, config: ClvpConfig): method fix_speech_decoder_output (line 1286) | def fix_speech_decoder_output(self, speech_ids: torch.LongTensor) -> t... method get_text_features (line 1323) | def get_text_features( method get_speech_features (line 1358) | def get_speech_features( method forward (line 1455) | def forward( method generate (line 1563) | def generate( FILE: src/transformers/models/clvp/number_normalizer.py class EnglishNormalizer (line 27) | class EnglishNormalizer: method __init__ (line 28) | def __init__(self): method number_to_words (line 69) | def number_to_words(self, num: int) -> str: method convert_to_ascii (line 128) | def convert_to_ascii(self, text: str) -> str: method _expand_dollars (line 134) | def _expand_dollars(self, m: str) -> str: method _remove_commas (line 158) | def _remove_commas(self, m: str) -> str: method _expand_decimal_point (line 164) | def _expand_decimal_point(self, m: str) -> str: method _expand_ordinal (line 170) | def _expand_ordinal(self, num: str) -> str: method _expand_number (line 183) | def _expand_number(self, m: str) -> str: method normalize_numbers (line 203) | def normalize_numbers(self, text: str) -> str: method expand_abbreviations (line 216) | def expand_abbreviations(self, text: str) -> str: method collapse_whitespace (line 224) | def collapse_whitespace(self, text: str) -> str: method __call__ (line 230) | def __call__(self, text): FILE: src/transformers/models/clvp/processing_clvp.py class ClvpProcessor (line 27) | class ClvpProcessor(ProcessorMixin): method __init__ (line 28) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 32) | def __call__(self, *args, **kwargs): FILE: src/transformers/models/clvp/tokenization_clvp.py function bytes_to_unicode (line 35) | def bytes_to_unicode(): function get_pairs (line 59) | def get_pairs(word): class ClvpTokenizer (line 73) | class ClvpTokenizer(PreTrainedTokenizer): method __init__ (line 131) | def __init__( method vocab_size (line 177) | def vocab_size(self): method normalizer (line 181) | def normalizer(self): method get_vocab (line 186) | def get_vocab(self): method bpe (line 189) | def bpe(self, token): method _tokenize (line 231) | def _tokenize(self, text): method _convert_token_to_id (line 248) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 252) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 256) | def convert_tokens_to_string(self, tokens): method clean_up_tokenization (line 262) | def clean_up_tokenization(self, text): FILE: src/transformers/models/code_llama/tokenization_code_llama.py class CodeLlamaTokenizer (line 41) | class CodeLlamaTokenizer(TokenizersBackend): method __init__ (line 112) | def __init__( method prefix_token (line 190) | def prefix_token(self): method prefix_id (line 194) | def prefix_id(self): method middle_token (line 200) | def middle_token(self): method middle_id (line 204) | def middle_id(self): method suffix_token (line 210) | def suffix_token(self): method suffix_id (line 214) | def suffix_id(self): method eot_id (line 220) | def eot_id(self): method eot_token (line 226) | def eot_token(self): method set_infilling_processor (line 229) | def set_infilling_processor(self, reset, suffix_first=False, add_speci... method tokenize (line 277) | def tokenize(self, text, suffix=None, suffix_first=False, **kwargs): method _encode_plus (line 311) | def _encode_plus(self, text, text_pair=None, suffix=None, suffix_first... FILE: src/transformers/models/codegen/configuration_codegen.py class CodeGenConfig (line 24) | class CodeGenConfig(PreTrainedConfig): FILE: src/transformers/models/codegen/modeling_codegen.py function create_sinusoidal_positions (line 40) | def create_sinusoidal_positions(num_pos: int, dim: int) -> torch.Tensor: function rotate_every_two (line 47) | def rotate_every_two(x: torch.Tensor) -> torch.Tensor: function apply_rotary_pos_emb (line 55) | def apply_rotary_pos_emb(tensor: torch.Tensor, sin: torch.Tensor, cos: t... class CodeGenAttention (line 61) | class CodeGenAttention(nn.Module): method __init__ (line 62) | def __init__(self, config, layer_idx=None): method _split_heads (line 94) | def _split_heads(self, x, n_head, dim_head, mp_num): method _merge_heads (line 99) | def _merge_heads(self, tensor, num_attention_heads, attn_head_size): method _attn (line 112) | def _attn( method forward (line 137) | def forward( class CodeGenMLP (line 205) | class CodeGenMLP(nn.Module): method __init__ (line 206) | def __init__(self, intermediate_size, config): # in MLP: intermediate... method forward (line 216) | def forward(self, hidden_states: torch.FloatTensor | None) -> torch.Fl... class CodeGenBlock (line 225) | class CodeGenBlock(GradientCheckpointingLayer): method __init__ (line 227) | def __init__(self, config, layer_idx=None): method forward (line 234) | def forward( class CodeGenPreTrainedModel (line 261) | class CodeGenPreTrainedModel(PreTrainedModel): method _init_weights (line 269) | def _init_weights(self, module): class CodeGenModel (line 276) | class CodeGenModel(CodeGenPreTrainedModel): method __init__ (line 277) | def __init__(self, config): method get_input_embeddings (line 293) | def get_input_embeddings(self): method set_input_embeddings (line 296) | def set_input_embeddings(self, new_embeddings): method forward (line 300) | def forward( class CodeGenForCausalLM (line 411) | class CodeGenForCausalLM(CodeGenPreTrainedModel, GenerationMixin): method __init__ (line 414) | def __init__(self, config): method forward (line 423) | def forward( FILE: src/transformers/models/codegen/tokenization_codegen.py class CodeGenTokenizer (line 37) | class CodeGenTokenizer(TokenizersBackend): method __init__ (line 93) | def __init__( method decode (line 141) | def decode( method truncate (line 186) | def truncate(self, completion, truncate_before_pattern): FILE: src/transformers/models/cohere/configuration_cohere.py class CohereConfig (line 30) | class CohereConfig(PreTrainedConfig): method __post_init__ (line 87) | def __post_init__(self, **kwargs): FILE: src/transformers/models/cohere/modeling_cohere.py class CohereLayerNorm (line 52) | class CohereLayerNorm(nn.Module): method __init__ (line 53) | def __init__(self, hidden_size=None, eps=1e-5, bias=False): method forward (line 59) | def forward(self, hidden_states): class CohereRotaryEmbedding (line 69) | class CohereRotaryEmbedding(nn.Module): method __init__ (line 72) | def __init__(self, config: CohereConfig, device=None): method compute_default_rope_parameters (line 89) | def compute_default_rope_parameters( method forward (line 120) | def forward(self, x, position_ids): class CohereMLP (line 134) | class CohereMLP(nn.Module): method __init__ (line 135) | def __init__(self, config): method forward (line 145) | def forward(self, x): function repeat_kv (line 150) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 162) | def eager_attention_forward( function rotate_half (line 187) | def rotate_half(x): function apply_rotary_pos_emb (line 195) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class CohereAttention (line 224) | class CohereAttention(nn.Module): method __init__ (line 227) | def __init__(self, config: CohereConfig, layer_idx: int | None = None): method forward (line 259) | def forward( class CohereDecoderLayer (line 308) | class CohereDecoderLayer(GradientCheckpointingLayer): method __init__ (line 309) | def __init__(self, config: CohereConfig, layer_idx: int): method forward (line 316) | def forward( class CoherePreTrainedModel (line 362) | class CoherePreTrainedModel(PreTrainedModel): class CohereModel (line 381) | class CohereModel(CoherePreTrainedModel): method __init__ (line 382) | def __init__(self, config: CohereConfig): method forward (line 401) | def forward( class CohereForCausalLM (line 455) | class CohereForCausalLM(CoherePreTrainedModel, GenerationMixin): method __init__ (line 460) | def __init__(self, config): method forward (line 473) | def forward( FILE: src/transformers/models/cohere/modular_cohere.py class CohereLayerNorm (line 52) | class CohereLayerNorm(nn.Module): method __init__ (line 53) | def __init__(self, hidden_size=None, eps=1e-5, bias=False): method forward (line 59) | def forward(self, hidden_states): class CohereRotaryEmbedding (line 69) | class CohereRotaryEmbedding(LlamaRotaryEmbedding): method forward (line 72) | def forward(self, x, position_ids): function rotate_half (line 86) | def rotate_half(x): function apply_rotary_pos_emb (line 94) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class CohereMLP (line 122) | class CohereMLP(LlamaMLP): method __init__ (line 123) | def __init__(self, config): class CohereAttention (line 130) | class CohereAttention(LlamaAttention): method __init__ (line 133) | def __init__(self, config: CohereConfig, layer_idx: int | None = None): method forward (line 145) | def forward( class CohereDecoderLayer (line 194) | class CohereDecoderLayer(GradientCheckpointingLayer): method __init__ (line 195) | def __init__(self, config: CohereConfig, layer_idx: int): method forward (line 202) | def forward( class CohereModel (line 247) | class CohereModel(LlamaModel): method __init__ (line 248) | def __init__(self, config: CohereConfig): class CohereForCausalLM (line 256) | class CohereForCausalLM(LlamaForCausalLM): method __init__ (line 257) | def __init__(self, config): method forward (line 265) | def forward( FILE: src/transformers/models/cohere/tokenization_cohere.py class CohereTokenizer (line 45) | class CohereTokenizer(TokenizersBackend): method __init__ (line 115) | def __init__( method apply_tool_use_template (line 186) | def apply_tool_use_template( method apply_grounded_generation_template (line 297) | def apply_grounded_generation_template( FILE: src/transformers/models/cohere2/configuration_cohere2.py class Cohere2Config (line 30) | class Cohere2Config(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): FILE: src/transformers/models/cohere2/modeling_cohere2.py class Cohere2RotaryEmbedding (line 43) | class Cohere2RotaryEmbedding(nn.Module): method __init__ (line 46) | def __init__(self, config: Cohere2Config, device=None): method compute_default_rope_parameters (line 63) | def compute_default_rope_parameters( method forward (line 94) | def forward(self, x, position_ids): class Cohere2LayerNorm (line 108) | class Cohere2LayerNorm(nn.Module): method __init__ (line 109) | def __init__(self, hidden_size=None, eps=1e-5, bias=False): method forward (line 115) | def forward(self, hidden_states): function repeat_kv (line 125) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 137) | def eager_attention_forward( function rotate_half (line 162) | def rotate_half(x): function apply_rotary_pos_emb (line 170) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Cohere2Attention (line 199) | class Cohere2Attention(nn.Module): method __init__ (line 202) | def __init__(self, config: Cohere2Config, layer_idx: int | None = None): method forward (line 227) | def forward( class Cohere2MLP (line 270) | class Cohere2MLP(nn.Module): method __init__ (line 271) | def __init__(self, config): method forward (line 281) | def forward(self, x): class Cohere2DecoderLayer (line 286) | class Cohere2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 287) | def __init__(self, config: Cohere2Config, layer_idx: int): method forward (line 294) | def forward( class Cohere2PreTrainedModel (line 337) | class Cohere2PreTrainedModel(PreTrainedModel): class Cohere2Model (line 356) | class Cohere2Model(Cohere2PreTrainedModel): method __init__ (line 357) | def __init__(self, config: Cohere2Config): method forward (line 375) | def forward( class Cohere2ForCausalLM (line 434) | class Cohere2ForCausalLM(Cohere2PreTrainedModel, GenerationMixin): method __init__ (line 439) | def __init__(self, config): method forward (line 452) | def forward( FILE: src/transformers/models/cohere2/modular_cohere2.py class Cohere2Config (line 51) | class Cohere2Config(PreTrainedConfig): method __post_init__ (line 109) | def __post_init__(self, **kwargs): class Cohere2RotaryEmbedding (line 128) | class Cohere2RotaryEmbedding(CohereRotaryEmbedding): method forward (line 131) | def forward(self, x, position_ids): class Cohere2LayerNorm (line 145) | class Cohere2LayerNorm(CohereLayerNorm): class Cohere2Attention (line 149) | class Cohere2Attention(CohereAttention): method __init__ (line 152) | def __init__(self, config: Cohere2Config, layer_idx: int | None = None): method forward (line 177) | def forward( class Cohere2DecoderLayer (line 220) | class Cohere2DecoderLayer(CohereDecoderLayer): method __init__ (line 221) | def __init__(self, config: Cohere2Config, layer_idx: int): method forward (line 224) | def forward( class Cohere2PreTrainedModel (line 249) | class Cohere2PreTrainedModel(CoherePreTrainedModel): class Cohere2Model (line 257) | class Cohere2Model(Gemma2Model): method __init__ (line 258) | def __init__(self, config: Cohere2Config): method forward (line 263) | def forward( class Cohere2ForCausalLM (line 321) | class Cohere2ForCausalLM(CohereForCausalLM): FILE: src/transformers/models/cohere2_vision/configuration_cohere2_vision.py class Cohere2VisionConfig (line 25) | class Cohere2VisionConfig(PreTrainedConfig): method __post_init__ (line 43) | def __post_init__(self, **kwargs): FILE: src/transformers/models/cohere2_vision/image_processing_cohere2_vision.py class Cohere2VisionImageProcessorKwargs (line 35) | class Cohere2VisionImageProcessorKwargs(ImagesKwargs, total=False): function get_all_supported_aspect_ratios (line 54) | def get_all_supported_aspect_ratios(max_image_tiles: int) -> list[tuple[... function get_optimal_tiled_canvas (line 83) | def get_optimal_tiled_canvas( class Cohere2VisionImageProcessor (line 110) | class Cohere2VisionImageProcessor(TorchvisionBackend): method __init__ (line 125) | def __init__(self, **kwargs: Unpack[Cohere2VisionImageProcessorKwargs]): method crop_image_to_patches (line 128) | def crop_image_to_patches( method _preprocess (line 194) | def _preprocess( method get_number_of_image_patches (line 257) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/cohere2_vision/modeling_cohere2_vision.py class Cohere2VisionMultiModalProjector (line 36) | class Cohere2VisionMultiModalProjector(nn.Module): method __init__ (line 37) | def __init__(self, config: Cohere2VisionConfig): method pixel_shuffle (line 48) | def pixel_shuffle(self, image_features): # B, S, D method forward (line 63) | def forward(self, image_features): class Cohere2VisionModelOutputWithPast (line 81) | class Cohere2VisionModelOutputWithPast(BaseModelOutputWithPast): class Cohere2VisionCausalLMOutputWithPast (line 102) | class Cohere2VisionCausalLMOutputWithPast(ModelOutput): class Cohere2VisionPreTrainedModel (line 127) | class Cohere2VisionPreTrainedModel(PreTrainedModel): class Cohere2VisionModel (line 146) | class Cohere2VisionModel(Cohere2VisionPreTrainedModel): method __init__ (line 147) | def __init__(self, config: Cohere2VisionConfig): method get_input_embeddings (line 155) | def get_input_embeddings(self): method set_input_embeddings (line 158) | def set_input_embeddings(self, value): method get_image_features (line 165) | def get_image_features( method get_placeholder_mask (line 174) | def get_placeholder_mask( method forward (line 200) | def forward( class Cohere2VisionForConditionalGeneration (line 248) | class Cohere2VisionForConditionalGeneration(Cohere2VisionPreTrainedModel... method __init__ (line 251) | def __init__(self, config: Cohere2VisionConfig): method get_input_embeddings (line 257) | def get_input_embeddings(self): method set_input_embeddings (line 260) | def set_input_embeddings(self, value): method get_output_embeddings (line 263) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 267) | def get_image_features( method forward (line 274) | def forward( method prepare_inputs_for_generation (line 355) | def prepare_inputs_for_generation( FILE: src/transformers/models/cohere2_vision/modular_cohere2_vision.py class Cohere2VisionMultiModalProjector (line 42) | class Cohere2VisionMultiModalProjector(nn.Module): method __init__ (line 43) | def __init__(self, config: Cohere2VisionConfig): method pixel_shuffle (line 54) | def pixel_shuffle(self, image_features): # B, S, D method forward (line 69) | def forward(self, image_features): class Cohere2VisionModelOutputWithPast (line 81) | class Cohere2VisionModelOutputWithPast(AyaVisionModelOutputWithPast): class Cohere2VisionCausalLMOutputWithPast (line 85) | class Cohere2VisionCausalLMOutputWithPast(AyaVisionCausalLMOutputWithPast): class Cohere2VisionPreTrainedModel (line 89) | class Cohere2VisionPreTrainedModel(AyaVisionPreTrainedModel): class Cohere2VisionModel (line 93) | class Cohere2VisionModel(AyaVisionModel): method get_image_features (line 98) | def get_image_features( method forward (line 107) | def forward( class Cohere2VisionForConditionalGeneration (line 150) | class Cohere2VisionForConditionalGeneration(AyaVisionForConditionalGener... method get_image_features (line 152) | def get_image_features( method forward (line 157) | def forward( function get_all_supported_aspect_ratios (line 240) | def get_all_supported_aspect_ratios(max_image_tiles: int) -> list[tuple[... function get_optimal_tiled_canvas (line 269) | def get_optimal_tiled_canvas( class Cohere2VisionImageProcessorKwargs (line 295) | class Cohere2VisionImageProcessorKwargs(ImagesKwargs, total=False): class Cohere2VisionImageProcessor (line 314) | class Cohere2VisionImageProcessor(GotOcr2ImageProcessor): FILE: src/transformers/models/cohere2_vision/processing_cohere2_vision.py class Cohere2VisionProcessorKwargs (line 23) | class Cohere2VisionProcessorKwargs(ProcessingKwargs, total=False): class Cohere2VisionProcessor (line 34) | class Cohere2VisionProcessor(ProcessorMixin): method __init__ (line 35) | def __init__( method __call__ (line 61) | def __call__( method _get_num_multimodal_tokens (line 117) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method batch_decode (line 148) | def batch_decode(self, *args, **kwargs): method decode (line 155) | def decode(self, *args, **kwargs): method model_input_names (line 163) | def model_input_names(self): FILE: src/transformers/models/cohere_asr/configuration_cohere_asr.py class CohereAsrConfig (line 25) | class CohereAsrConfig(PreTrainedConfig): method __post_init__ (line 84) | def __post_init__(self, **kwargs): FILE: src/transformers/models/cohere_asr/feature_extraction_cohere_asr.py class CohereAsrFeatureExtractor (line 36) | class CohereAsrFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 77) | def __init__( method _find_split_point_energy (line 110) | def _find_split_point_energy(self, waveform: torch.Tensor, start_idx: ... method _split_audio_chunks_energy (line 126) | def _split_audio_chunks_energy(self, waveform: torch.Tensor) -> list[t... method _apply_dither (line 154) | def _apply_dither(self, waveform: torch.Tensor, audio_lengths: torch.T... method _torch_extract_fbank_features (line 167) | def _torch_extract_fbank_features(self, waveform, device="cpu"): method __call__ (line 194) | def __call__( FILE: src/transformers/models/cohere_asr/modeling_cohere_asr.py class CohereAsrDecoderMLP (line 46) | class CohereAsrDecoderMLP(nn.Module): method __init__ (line 47) | def __init__(self, config): method forward (line 54) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function repeat_kv (line 61) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 73) | def eager_attention_forward( class CohereAsrSelfAttention (line 99) | class CohereAsrSelfAttention(nn.Module): method __init__ (line 100) | def __init__(self, config: CohereAsrConfig, layer_idx: int): method forward (line 123) | def forward( class CohereAsrCrossAttention (line 166) | class CohereAsrCrossAttention(nn.Module): method __init__ (line 167) | def __init__(self, config: CohereAsrConfig, layer_idx: int): method forward (line 190) | def forward( class CohereAsrDecoderLayer (line 244) | class CohereAsrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 245) | def __init__(self, config, layer_idx=None): method forward (line 255) | def forward( class CohereAsrPreTrainedModel (line 297) | class CohereAsrPreTrainedModel(PreTrainedModel): method _get_feat_extract_output_lengths (line 311) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class CohereAsrDecoder (line 323) | class CohereAsrDecoder(CohereAsrPreTrainedModel): method __init__ (line 331) | def __init__(self, config): method forward (line 349) | def forward( class CohereAsrModel (line 425) | class CohereAsrModel(CohereAsrPreTrainedModel): method __init__ (line 426) | def __init__(self, config): method get_input_embeddings (line 433) | def get_input_embeddings(self): method set_input_embeddings (line 436) | def set_input_embeddings(self, value): method freeze_encoder (line 439) | def freeze_encoder(self): method _mask_input_features (line 446) | def _mask_input_features(self): method forward (line 455) | def forward( function shift_tokens_right (line 526) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class CohereAsrForConditionalGeneration (line 547) | class CohereAsrForConditionalGeneration(CohereAsrPreTrainedModel, Genera... method __init__ (line 550) | def __init__(self, config): method get_output_embeddings (line 558) | def get_output_embeddings(self): method set_output_embeddings (line 561) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 564) | def get_input_embeddings(self) -> nn.Module: method forward (line 569) | def forward( method prepare_inputs_for_generation (line 653) | def prepare_inputs_for_generation(self, *args, audio_chunk_index=None,... FILE: src/transformers/models/cohere_asr/modular_cohere_asr.py class CohereAsrDecoderMLP (line 48) | class CohereAsrDecoderMLP(CLIPMLP): class CohereAsrSelfAttention (line 53) | class CohereAsrSelfAttention(nn.Module): method __init__ (line 54) | def __init__(self, config: CohereAsrConfig, layer_idx: int): method forward (line 77) | def forward( class CohereAsrCrossAttention (line 120) | class CohereAsrCrossAttention(nn.Module): method __init__ (line 121) | def __init__(self, config: CohereAsrConfig, layer_idx: int): method forward (line 144) | def forward( class CohereAsrDecoderLayer (line 198) | class CohereAsrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 199) | def __init__(self, config, layer_idx=None): method forward (line 209) | def forward( class CohereAsrPreTrainedModel (line 250) | class CohereAsrPreTrainedModel(MoonshinePreTrainedModel): class CohereAsrDecoder (line 255) | class CohereAsrDecoder(MoonshineDecoder): method __init__ (line 262) | def __init__(self, config): method forward (line 271) | def forward( class CohereAsrModel (line 346) | class CohereAsrModel(MoonshineModel): method __init__ (line 347) | def __init__(self, config): method forward (line 353) | def forward( class CohereAsrForConditionalGeneration (line 424) | class CohereAsrForConditionalGeneration(MoonshineForConditionalGeneration): method __init__ (line 425) | def __init__(self, config): method forward (line 432) | def forward( method prepare_inputs_for_generation (line 516) | def prepare_inputs_for_generation(self, *args, audio_chunk_index=None,... FILE: src/transformers/models/cohere_asr/processing_cohere_asr.py class CohereAsrProcessorKwargs (line 33) | class CohereAsrProcessorKwargs(ProcessingKwargs, total=False): class CohereAsrProcessor (line 51) | class CohereAsrProcessor(ProcessorMixin): method __init__ (line 52) | def __init__(self, feature_extractor, tokenizer): method get_decoder_prompt_ids (line 55) | def get_decoder_prompt_ids(self, language: str, punctuation: bool = Tr... method __call__ (line 77) | def __call__( method decode (line 127) | def decode(self, *args, audio_chunk_index=None, language=None, **kwargs): method _reassemble_chunk_texts (line 137) | def _reassemble_chunk_texts( method model_input_names (line 183) | def model_input_names(self): FILE: src/transformers/models/colmodernvbert/configuration_colmodernvbert.py class ColModernVBertConfig (line 34) | class ColModernVBertConfig(PreTrainedConfig): method __post_init__ (line 53) | def __post_init__(self, **kwargs): method get_text_config (line 77) | def get_text_config(self, *args, **kwargs) -> PreTrainedConfig: FILE: src/transformers/models/colmodernvbert/modeling_colmodernvbert.py class ColModernVBertPreTrainedModel (line 36) | class ColModernVBertPreTrainedModel(PreTrainedModel): method _init_weights (line 46) | def _init_weights(self, module): class ColModernVBertForRetrievalOutput (line 70) | class ColModernVBertForRetrievalOutput(ModelOutput): class ColModernVBertForRetrieval (line 106) | class ColModernVBertForRetrieval(ColModernVBertPreTrainedModel): method __init__ (line 109) | def __init__(self, config: ColModernVBertConfig): method forward (line 125) | def forward( FILE: src/transformers/models/colmodernvbert/modular_colmodernvbert.py class ColModernVBertConfig (line 41) | class ColModernVBertConfig(ColQwen2Config): method __post_init__ (line 60) | def __post_init__(self, **kwargs): class ColModernVBertProcessorKwargs (line 75) | class ColModernVBertProcessorKwargs(Idefics3ProcessorKwargs, total=False): class ColModernVBertProcessor (line 91) | class ColModernVBertProcessor(Idefics3Processor): method __init__ (line 107) | def __init__( method process_images (line 141) | def process_images( method process_queries (line 207) | def process_queries( method score_retrieval (line 264) | def score_retrieval( class ColModernVBertPreTrainedModel (line 330) | class ColModernVBertPreTrainedModel(ColPaliPreTrainedModel): class ColModernVBertForRetrievalOutput (line 340) | class ColModernVBertForRetrievalOutput(ModelOutput): class ColModernVBertForRetrieval (line 376) | class ColModernVBertForRetrieval(ColPaliForRetrieval): method __init__ (line 377) | def __init__(self, config: ColModernVBertConfig): method forward (line 384) | def forward( FILE: src/transformers/models/colmodernvbert/processing_colmodernvbert.py class ColModernVBertProcessorKwargs (line 40) | class ColModernVBertProcessorKwargs(ProcessingKwargs, total=False): function is_url (line 54) | def is_url(val) -> bool: function is_image_or_image_url (line 58) | def is_image_or_image_url(elem): function _prompt_split_image (line 62) | def _prompt_split_image(image_seq_len, image_rows, image_cols, fake_toke... function _prompt_single_image (line 81) | def _prompt_single_image(image_seq_len, fake_token_around_image, image_t... function get_image_prompt_string (line 91) | def get_image_prompt_string( class ColModernVBertProcessor (line 108) | class ColModernVBertProcessor(ProcessorMixin): method __init__ (line 124) | def __init__( method _extract_images_from_prompts (line 177) | def _extract_images_from_prompts(self, prompts): method __call__ (line 190) | def __call__( method create_mm_token_type_ids (line 320) | def create_mm_token_type_ids(self, input_ids: list, batch_image_seq_le... method _get_num_multimodal_tokens (line 341) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method process_images (line 378) | def process_images( method process_queries (line 444) | def process_queries( method score_retrieval (line 501) | def score_retrieval( FILE: src/transformers/models/colpali/configuration_colpali.py class ColPaliConfig (line 28) | class ColPaliConfig(PreTrainedConfig): method __post_init__ (line 47) | def __post_init__(self, **kwargs): FILE: src/transformers/models/colpali/convert_colpali_weights_to_hf.py function rename_state_dict_keys (line 60) | def rename_state_dict_keys(state_dict: dict[str, Any]) -> dict[str, Any]: function load_original_state_dict (line 72) | def load_original_state_dict(model_id: str, revision: str | None = None)... function convert_colpali_weights_to_hf (line 96) | def convert_colpali_weights_to_hf( FILE: src/transformers/models/colpali/modeling_colpali.py class ColPaliPreTrainedModel (line 32) | class ColPaliPreTrainedModel(PreTrainedModel): method _init_weights (line 42) | def _init_weights(self, module): class ColPaliForRetrievalOutput (line 66) | class ColPaliForRetrievalOutput(ModelOutput): class ColPaliForRetrieval (line 104) | class ColPaliForRetrieval(ColPaliPreTrainedModel): method __init__ (line 107) | def __init__(self, config: ColPaliConfig): method forward (line 124) | def forward( FILE: src/transformers/models/colpali/modular_colpali.py class ColPaliProcessorKwargs (line 33) | class ColPaliProcessorKwargs(ProcessingKwargs, total=False): class ColPaliProcessor (line 46) | class ColPaliProcessor(PaliGemmaProcessor): method __init__ (line 47) | def __init__( method query_augmentation_token (line 66) | def query_augmentation_token(self) -> str: method __call__ (line 74) | def __call__( method process_images (line 164) | def process_images( method process_queries (line 197) | def process_queries( method score_retrieval (line 229) | def score_retrieval( FILE: src/transformers/models/colpali/processing_colpali.py class ColPaliProcessorKwargs (line 35) | class ColPaliProcessorKwargs(ProcessingKwargs, total=False): function build_string_from_input (line 52) | def build_string_from_input(prompt, bos_token, image_seq_len, image_toke... class ColPaliProcessor (line 75) | class ColPaliProcessor(ProcessorMixin): method __init__ (line 76) | def __init__( method __call__ (line 114) | def __call__( method _get_num_multimodal_tokens (line 204) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 223) | def model_input_names(self): method query_augmentation_token (line 229) | def query_augmentation_token(self) -> str: method process_images (line 237) | def process_images( method process_queries (line 270) | def process_queries( method score_retrieval (line 302) | def score_retrieval( FILE: src/transformers/models/colqwen2/configuration_colqwen2.py class ColQwen2Config (line 28) | class ColQwen2Config(PreTrainedConfig): method __post_init__ (line 47) | def __post_init__(self, **kwargs): method get_text_config (line 61) | def get_text_config(self, *args, **kwargs) -> PreTrainedConfig: FILE: src/transformers/models/colqwen2/convert_colqwen2_weights_to_hf.py function load_original_state_dict (line 57) | def load_original_state_dict(model_id: str, revision: str | None = None)... function rename_state_dict_keys (line 78) | def rename_state_dict_keys(state_dict: dict[str, Any]) -> dict[str, Any]: function convert_colqwen2_weights_to_hf (line 96) | def convert_colqwen2_weights_to_hf( FILE: src/transformers/models/colqwen2/modeling_colqwen2.py class ColQwen2PreTrainedModel (line 39) | class ColQwen2PreTrainedModel(PreTrainedModel): method _init_weights (line 49) | def _init_weights(self, module): class ColQwen2ForRetrievalOutput (line 73) | class ColQwen2ForRetrievalOutput(ModelOutput): class ColQwen2ForRetrieval (line 107) | class ColQwen2ForRetrieval(ColQwen2PreTrainedModel): method __init__ (line 110) | def __init__(self, config: ColQwen2Config): method forward (line 127) | def forward( FILE: src/transformers/models/colqwen2/modular_colqwen2.py class ColQwen2ProcessorKwargs (line 34) | class ColQwen2ProcessorKwargs(ProcessingKwargs, total=False): class ColQwen2Processor (line 47) | class ColQwen2Processor(ColPaliProcessor): method __init__ (line 48) | def __init__( method __call__ (line 72) | def __call__( method _get_num_multimodal_tokens (line 176) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 203) | def model_input_names(self): class ColQwen2PreTrainedModel (line 215) | class ColQwen2PreTrainedModel(ColPaliPreTrainedModel): class ColQwen2ForRetrievalOutput (line 225) | class ColQwen2ForRetrievalOutput(ModelOutput): class ColQwen2ForRetrieval (line 259) | class ColQwen2ForRetrieval(ColPaliForRetrieval): method __init__ (line 260) | def __init__(self, config: ColQwen2Config): method forward (line 266) | def forward( FILE: src/transformers/models/colqwen2/processing_colqwen2.py class ColQwen2ProcessorKwargs (line 34) | class ColQwen2ProcessorKwargs(ProcessingKwargs, total=False): class ColQwen2Processor (line 48) | class ColQwen2Processor(ProcessorMixin): method __init__ (line 49) | def __init__( method __call__ (line 74) | def __call__( method _get_num_multimodal_tokens (line 178) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 205) | def model_input_names(self): method query_augmentation_token (line 217) | def query_augmentation_token(self) -> str: method process_images (line 225) | def process_images( method process_queries (line 258) | def process_queries( method score_retrieval (line 290) | def score_retrieval( FILE: src/transformers/models/conditional_detr/configuration_conditional_detr.py class ConditionalDetrConfig (line 26) | class ConditionalDetrConfig(PreTrainedConfig): method __post_init__ (line 95) | def __post_init__(self, **kwargs): FILE: src/transformers/models/conditional_detr/convert_conditional_detr_original_pytorch_checkpoint_to_pytorch.py function rename_key (line 215) | def rename_key(state_dict, old, new): function rename_backbone_keys (line 220) | def rename_backbone_keys(state_dict): function read_in_q_k_v (line 232) | def read_in_q_k_v(state_dict, is_panoptic=False): function prepare_img (line 252) | def prepare_img(): function convert_conditional_detr_checkpoint (line 261) | def convert_conditional_detr_checkpoint(model_name, pytorch_dump_folder_... FILE: src/transformers/models/conditional_detr/image_processing_conditional_detr.py class ConditionalDetrImageProcessorKwargs (line 59) | class ConditionalDetrImageProcessorKwargs(ImagesKwargs, total=False): function binary_mask_to_rle (line 76) | def binary_mask_to_rle(mask): function convert_segmentation_to_rle (line 100) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 121) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... function check_segment_validity (line 149) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 167) | def compute_segments( function convert_coco_poly_to_mask (line 228) | def convert_coco_poly_to_mask(segmentations, height: int, width: int, de... function prepare_coco_detection_annotation (line 263) | def prepare_coco_detection_annotation( function masks_to_boxes (line 327) | def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor: function rgb_to_id (line 364) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 375) | def prepare_coco_panoptic_annotation( class ConditionalDetrImageProcessor (line 425) | class ConditionalDetrImageProcessor(TorchvisionBackend): method __init__ (line 439) | def __init__(self, **kwargs: Unpack[ConditionalDetrImageProcessorKwarg... method prepare_annotation (line 456) | def prepare_annotation( method resize (line 488) | def resize( method resize_annotation (line 533) | def resize_annotation( method normalize_annotation (line 590) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 605) | def _update_annotation_for_padded_image( method pad (line 640) | def pad( method preprocess (line 671) | def preprocess( method _preprocess (line 689) | def _preprocess( method post_process_object_detection (line 805) | def post_process_object_detection( method post_process_semantic_segmentation (line 864) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... method post_process_instance_segmentation (line 911) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 994) | def post_process_panoptic_segmentation( FILE: src/transformers/models/conditional_detr/image_processing_pil_conditional_detr.py class ConditionalDetrImageProcessorKwargs (line 65) | class ConditionalDetrImageProcessorKwargs(ImagesKwargs, total=False): function convert_coco_poly_to_mask (line 83) | def convert_coco_poly_to_mask(segmentations, height: int, width: int) ->... function prepare_coco_detection_annotation (line 118) | def prepare_coco_detection_annotation( function masks_to_boxes (line 178) | def masks_to_boxes(masks: np.ndarray) -> np.ndarray: function rgb_to_id (line 215) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 226) | def prepare_coco_panoptic_annotation( function binary_mask_to_rle (line 268) | def binary_mask_to_rle(mask): function check_segment_validity (line 293) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 312) | def compute_segments( function convert_segmentation_to_rle (line 376) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 400) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... class ConditionalDetrImageProcessorPil (line 429) | class ConditionalDetrImageProcessorPil(PilBackend): method __init__ (line 443) | def __init__(self, **kwargs: Unpack[ConditionalDetrImageProcessorKwarg... method prepare_annotation (line 463) | def prepare_annotation( method resize (line 495) | def resize( method resize_annotation (line 549) | def resize_annotation( method normalize_annotation (line 602) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 615) | def _update_annotation_for_padded_image( method pad (line 659) | def pad( method preprocess (line 698) | def preprocess( method _preprocess (line 716) | def _preprocess( method post_process_object_detection (line 843) | def post_process_object_detection( method post_process_semantic_segmentation (line 904) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... method post_process_instance_segmentation (line 953) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 1042) | def post_process_panoptic_segmentation( FILE: src/transformers/models/conditional_detr/modeling_conditional_detr.py class ConditionalDetrDecoderOutput (line 50) | class ConditionalDetrDecoderOutput(BaseModelOutputWithCrossAttentions): class ConditionalDetrModelOutput (line 76) | class ConditionalDetrModelOutput(Seq2SeqModelOutput): class ConditionalDetrObjectDetectionOutput (line 98) | class ConditionalDetrObjectDetectionOutput(ModelOutput): class ConditionalDetrSegmentationOutput (line 141) | class ConditionalDetrSegmentationOutput(ModelOutput): class ConditionalDetrFrozenBatchNorm2d (line 185) | class ConditionalDetrFrozenBatchNorm2d(nn.Module): method __init__ (line 193) | def __init__(self, n): method _load_from_state_dict (line 200) | def _load_from_state_dict( method forward (line 211) | def forward(self, x): function replace_batch_norm (line 224) | def replace_batch_norm(model): class ConditionalDetrConvEncoder (line 248) | class ConditionalDetrConvEncoder(nn.Module): method __init__ (line 256) | def __init__(self, config): method forward (line 286) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class ConditionalDetrSinePositionEmbedding (line 300) | class ConditionalDetrSinePositionEmbedding(nn.Module): method __init__ (line 306) | def __init__( method forward (line 322) | def forward( class ConditionalDetrLearnedPositionEmbedding (line 352) | class ConditionalDetrLearnedPositionEmbedding(nn.Module): method __init__ (line 357) | def __init__(self, embedding_dim=256): method forward (line 363) | def forward( function eager_attention_forward (line 385) | def eager_attention_forward( class ConditionalDetrSelfAttention (line 413) | class ConditionalDetrSelfAttention(nn.Module): method __init__ (line 420) | def __init__( method forward (line 440) | def forward( class ConditionalDetrDecoderSelfAttention (line 479) | class ConditionalDetrDecoderSelfAttention(nn.Module): method __init__ (line 487) | def __init__( method forward (line 510) | def forward( class ConditionalDetrDecoderCrossAttention (line 562) | class ConditionalDetrDecoderCrossAttention(nn.Module): method __init__ (line 573) | def __init__( method forward (line 604) | def forward( class ConditionalDetrMLP (line 685) | class ConditionalDetrMLP(nn.Module): method __init__ (line 686) | def __init__(self, config: ConditionalDetrConfig, hidden_size: int, in... method forward (line 694) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ConditionalDetrEncoderLayer (line 702) | class ConditionalDetrEncoderLayer(GradientCheckpointingLayer): method __init__ (line 703) | def __init__(self, config: ConditionalDetrConfig): method forward (line 717) | def forward( class ConditionalDetrDecoderLayer (line 759) | class ConditionalDetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 760) | def __init__(self, config: ConditionalDetrConfig): method forward (line 782) | def forward( class ConditionalDetrMLPPredictionHead (line 854) | class ConditionalDetrMLPPredictionHead(nn.Module): method __init__ (line 861) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 867) | def forward(self, x): class ConditionalDetrConvBlock (line 873) | class ConditionalDetrConvBlock(nn.Module): method __init__ (line 876) | def __init__(self, in_channels: int, out_channels: int, activation: st... method forward (line 882) | def forward(self, x: torch.Tensor) -> torch.Tensor: class ConditionalDetrFPNFusionStage (line 886) | class ConditionalDetrFPNFusionStage(nn.Module): method __init__ (line 889) | def __init__(self, fpn_channels: int, current_channels: int, output_ch... method forward (line 894) | def forward(self, features: torch.Tensor, fpn_features: torch.Tensor) ... class ConditionalDetrMaskHeadSmallConv (line 908) | class ConditionalDetrMaskHeadSmallConv(nn.Module): method __init__ (line 916) | def __init__( method forward (line 947) | def forward( class ConditionalDetrMHAttentionMap (line 981) | class ConditionalDetrMHAttentionMap(nn.Module): method __init__ (line 984) | def __init__( method forward (line 999) | def forward( class ConditionalDetrPreTrainedModel (line 1033) | class ConditionalDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 1049) | def _init_weights(self, module): class ConditionalDetrEncoder (line 1082) | class ConditionalDetrEncoder(ConditionalDetrPreTrainedModel): method __init__ (line 1093) | def __init__(self, config: ConditionalDetrConfig): method forward (line 1104) | def forward( function gen_sine_position_embeddings (line 1144) | def gen_sine_position_embeddings(pos_tensor, d_model): class ConditionalDetrDecoder (line 1159) | class ConditionalDetrDecoder(ConditionalDetrPreTrainedModel): method __init__ (line 1180) | def __init__(self, config: ConditionalDetrConfig): method forward (line 1203) | def forward( class ConditionalDetrModel (line 1311) | class ConditionalDetrModel(ConditionalDetrPreTrainedModel): method __init__ (line 1312) | def __init__(self, config: ConditionalDetrConfig): method freeze_backbone (line 1332) | def freeze_backbone(self): method unfreeze_backbone (line 1336) | def unfreeze_backbone(self): method forward (line 1342) | def forward( function inverse_sigmoid (line 1466) | def inverse_sigmoid(x, eps=1e-5): class ConditionalDetrForObjectDetection (line 1479) | class ConditionalDetrForObjectDetection(ConditionalDetrPreTrainedModel): method __init__ (line 1480) | def __init__(self, config: ConditionalDetrConfig): method forward (line 1495) | def forward( method _set_aux_loss (line 1613) | def _set_aux_loss(self, outputs_class, outputs_coord): class ConditionalDetrForSegmentation (line 1623) | class ConditionalDetrForSegmentation(ConditionalDetrPreTrainedModel): method __init__ (line 1624) | def __init__(self, config: ConditionalDetrConfig): method forward (line 1647) | def forward( FILE: src/transformers/models/conditional_detr/modular_conditional_detr.py class ConditionalDetrImageProcessorKwargs (line 69) | class ConditionalDetrImageProcessorKwargs(ImagesKwargs, total=False): class ConditionalDetrImageProcessor (line 83) | class ConditionalDetrImageProcessor(DetrImageProcessor): method post_process_object_detection (line 84) | def post_process_object_detection( method post_process_semantic_segmentation (line 143) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... class ConditionalDetrImageProcessorPil (line 191) | class ConditionalDetrImageProcessorPil(DetrImageProcessorPil): method post_process_object_detection (line 193) | def post_process_object_detection( method post_process_semantic_segmentation (line 254) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... class ConditionalDetrDecoderOutput (line 303) | class ConditionalDetrDecoderOutput(DetrDecoderOutput): class ConditionalDetrModelOutput (line 319) | class ConditionalDetrModelOutput(DetrModelOutput): function gen_sine_position_embeddings (line 334) | def gen_sine_position_embeddings(pos_tensor, d_model): class ConditionalDetrObjectDetectionOutput (line 349) | class ConditionalDetrObjectDetectionOutput(DetrObjectDetectionOutput): class ConditionalDetrSegmentationOutput (line 353) | class ConditionalDetrSegmentationOutput(DetrSegmentationOutput): class ConditionalDetrConvEncoder (line 357) | class ConditionalDetrConvEncoder(DetrConvEncoder): class ConditionalDetrSinePositionEmbedding (line 361) | class ConditionalDetrSinePositionEmbedding(DetrSinePositionEmbedding): class ConditionalDetrLearnedPositionEmbedding (line 365) | class ConditionalDetrLearnedPositionEmbedding(DetrLearnedPositionEmbeddi... class ConditionalDetrSelfAttention (line 369) | class ConditionalDetrSelfAttention(DetrSelfAttention): class ConditionalDetrDecoderSelfAttention (line 373) | class ConditionalDetrDecoderSelfAttention(nn.Module): method __init__ (line 381) | def __init__( method forward (line 404) | def forward( class ConditionalDetrDecoderCrossAttention (line 456) | class ConditionalDetrDecoderCrossAttention(nn.Module): method __init__ (line 467) | def __init__( method forward (line 498) | def forward( class ConditionalDetrMLP (line 579) | class ConditionalDetrMLP(DetrMLP): class ConditionalDetrEncoderLayer (line 583) | class ConditionalDetrEncoderLayer(DetrEncoderLayer): class ConditionalDetrDecoderLayer (line 587) | class ConditionalDetrDecoderLayer(DetrDecoderLayer): method __init__ (line 588) | def __init__(self, config: ConditionalDetrConfig): method forward (line 603) | def forward( class ConditionalDetrMLPPredictionHead (line 675) | class ConditionalDetrMLPPredictionHead(DetrMLPPredictionHead): class ConditionalDetrPreTrainedModel (line 679) | class ConditionalDetrPreTrainedModel(DetrPreTrainedModel): class ConditionalDetrEncoder (line 685) | class ConditionalDetrEncoder(DetrEncoder): class ConditionalDetrDecoder (line 689) | class ConditionalDetrDecoder(ConditionalDetrPreTrainedModel): method __init__ (line 710) | def __init__(self, config: ConditionalDetrConfig): method forward (line 733) | def forward( class ConditionalDetrModel (line 835) | class ConditionalDetrModel(DetrModel): method __init__ (line 836) | def __init__(self, config: ConditionalDetrConfig): method forward (line 845) | def forward( class ConditionalDetrForObjectDetection (line 969) | class ConditionalDetrForObjectDetection(DetrForObjectDetection): method __init__ (line 970) | def __init__(self, config: ConditionalDetrConfig): method _set_aux_loss (line 975) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 980) | def forward( class ConditionalDetrForSegmentation (line 1098) | class ConditionalDetrForSegmentation(DetrForSegmentation): FILE: src/transformers/models/convbert/configuration_convbert.py class ConvBertConfig (line 24) | class ConvBertConfig(PreTrainedConfig): FILE: src/transformers/models/convbert/convert_convbert_original_tf1_checkpoint_to_pytorch.py function load_tf_weights_in_convbert (line 30) | def load_tf_weights_in_convbert(model, config, tf_checkpoint_path): function convert_orig_tf1_checkpoint_to_pytorch (line 154) | def convert_orig_tf1_checkpoint_to_pytorch(tf_checkpoint_path, convbert_... FILE: src/transformers/models/convbert/modeling_convbert.py class ConvBertEmbeddings (line 51) | class ConvBertEmbeddings(nn.Module): method __init__ (line 54) | def __init__(self, config): method forward (line 70) | def forward( class SeparableConv1D (line 109) | class SeparableConv1D(nn.Module): method __init__ (line 112) | def __init__(self, config, input_filters, output_filters, kernel_size,... method forward (line 128) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ConvBertSelfAttention (line 135) | class ConvBertSelfAttention(nn.Module): method __init__ (line 136) | def __init__(self, config): method forward (line 175) | def forward( class ConvBertSelfOutput (line 258) | class ConvBertSelfOutput(nn.Module): method __init__ (line 259) | def __init__(self, config): method forward (line 265) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ConvBertAttention (line 272) | class ConvBertAttention(nn.Module): method __init__ (line 273) | def __init__(self, config): method forward (line 278) | def forward( class GroupedLinearLayer (line 295) | class GroupedLinearLayer(nn.Module): method __init__ (line 296) | def __init__(self, input_size, output_size, num_groups): method forward (line 306) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ConvBertIntermediate (line 317) | class ConvBertIntermediate(nn.Module): method __init__ (line 318) | def __init__(self, config): method forward (line 331) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ConvBertOutput (line 337) | class ConvBertOutput(nn.Module): method __init__ (line 338) | def __init__(self, config): method forward (line 349) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ConvBertLayer (line 356) | class ConvBertLayer(GradientCheckpointingLayer): method __init__ (line 357) | def __init__(self, config): method forward (line 371) | def forward( method feed_forward_chunk (line 403) | def feed_forward_chunk(self, attention_output): class ConvBertPreTrainedModel (line 410) | class ConvBertPreTrainedModel(PreTrainedModel): method _init_weights (line 420) | def _init_weights(self, module): class ConvBertEncoder (line 433) | class ConvBertEncoder(nn.Module): method __init__ (line 434) | def __init__(self, config): method forward (line 440) | def forward( class ConvBertPredictionHeadTransform (line 462) | class ConvBertPredictionHeadTransform(nn.Module): method __init__ (line 463) | def __init__(self, config): method forward (line 472) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ConvBertSequenceSummary (line 480) | class ConvBertSequenceSummary(nn.Module): method __init__ (line 506) | def __init__(self, config: ConvBertConfig): method forward (line 535) | def forward( class ConvBertModel (line 580) | class ConvBertModel(ConvBertPreTrainedModel): method __init__ (line 581) | def __init__(self, config): method get_input_embeddings (line 593) | def get_input_embeddings(self): method set_input_embeddings (line 596) | def set_input_embeddings(self, value): method forward (line 602) | def forward( class ConvBertGeneratorPredictions (line 652) | class ConvBertGeneratorPredictions(nn.Module): method __init__ (line 655) | def __init__(self, config): method forward (line 662) | def forward(self, generator_hidden_states: torch.FloatTensor) -> torch... class ConvBertForMaskedLM (line 671) | class ConvBertForMaskedLM(ConvBertPreTrainedModel): method __init__ (line 674) | def __init__(self, config): method get_output_embeddings (line 684) | def get_output_embeddings(self): method set_output_embeddings (line 687) | def set_output_embeddings(self, word_embeddings): method forward (line 692) | def forward( class ConvBertClassificationHead (line 735) | class ConvBertClassificationHead(nn.Module): method __init__ (line 738) | def __init__(self, config): method forward (line 749) | def forward(self, hidden_states: torch.Tensor, **kwargs) -> torch.Tensor: class ConvBertForSequenceClassification (line 765) | class ConvBertForSequenceClassification(ConvBertPreTrainedModel): method __init__ (line 766) | def __init__(self, config): method forward (line 778) | def forward( class ConvBertForMultipleChoice (line 838) | class ConvBertForMultipleChoice(ConvBertPreTrainedModel): method __init__ (line 839) | def __init__(self, config): method forward (line 851) | def forward( class ConvBertForTokenClassification (line 933) | class ConvBertForTokenClassification(ConvBertPreTrainedModel): method __init__ (line 934) | def __init__(self, config): method forward (line 950) | def forward( class ConvBertForQuestionAnswering (line 992) | class ConvBertForQuestionAnswering(ConvBertPreTrainedModel): method __init__ (line 993) | def __init__(self, config): method forward (line 1005) | def forward( FILE: src/transformers/models/convbert/tokenization_convbert.py class ConvBertTokenizer (line 19) | class ConvBertTokenizer(BertTokenizer): FILE: src/transformers/models/convnext/configuration_convnext.py class ConvNextConfig (line 25) | class ConvNextConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 60) | def __post_init__(self, **kwargs): FILE: src/transformers/models/convnext/convert_convnext_to_pytorch.py function get_convnext_config (line 36) | def get_convnext_config(checkpoint_url): function rename_key (line 81) | def rename_key(name): function prepare_img (line 114) | def prepare_img(): function convert_convnext_checkpoint (line 122) | def convert_convnext_checkpoint(checkpoint_url, pytorch_dump_folder_path): FILE: src/transformers/models/convnext/image_processing_convnext.py class ConvNextImageProcessorKwargs (line 33) | class ConvNextImageProcessorKwargs(ImagesKwargs, total=False): class ConvNextImageProcessor (line 43) | class ConvNextImageProcessor(TorchvisionBackend): method __init__ (line 58) | def __init__(self, **kwargs: Unpack[ConvNextImageProcessorKwargs]): method resize (line 61) | def resize( method _preprocess (line 101) | def _preprocess( FILE: src/transformers/models/convnext/image_processing_pil_convnext.py class ConvNextImageProcessorKwargs (line 33) | class ConvNextImageProcessorKwargs(ImagesKwargs, total=False): class ConvNextImageProcessorPil (line 43) | class ConvNextImageProcessorPil(PilBackend): method __init__ (line 58) | def __init__(self, **kwargs: Unpack[ConvNextImageProcessorKwargs]): method resize (line 61) | def resize( method _preprocess (line 101) | def _preprocess( FILE: src/transformers/models/convnext/modeling_convnext.py function drop_path (line 40) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class ConvNextDropPath (line 56) | class ConvNextDropPath(nn.Module): method __init__ (line 59) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 63) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self) -> str: class ConvNextLayerNorm (line 70) | class ConvNextLayerNorm(nn.LayerNorm): method __init__ (line 76) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 82) | def forward(self, features: torch.Tensor) -> torch.Tensor: class ConvNextEmbeddings (line 96) | class ConvNextEmbeddings(nn.Module): method __init__ (line 101) | def __init__(self, config): method forward (line 109) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class ConvNextLayer (line 120) | class ConvNextLayer(nn.Module): method __init__ (line 134) | def __init__(self, config, dim, drop_path=0): method forward (line 148) | def forward(self, features: torch.Tensor) -> torch.Tensor: class ConvNextStage (line 163) | class ConvNextStage(nn.Module): method __init__ (line 174) | def __init__(self, config, in_channels, out_channels, kernel_size=2, s... method forward (line 191) | def forward(self, features: torch.Tensor) -> torch.Tensor: class ConvNextPreTrainedModel (line 200) | class ConvNextPreTrainedModel(PreTrainedModel): method _init_weights (line 208) | def _init_weights(self, module): class ConvNextEncoder (line 216) | class ConvNextEncoder(ConvNextPreTrainedModel): method __init__ (line 220) | def __init__(self, config): method forward (line 245) | def forward( class ConvNextModel (line 257) | class ConvNextModel(ConvNextPreTrainedModel): method __init__ (line 258) | def __init__(self, config): method forward (line 273) | def forward( class ConvNextForImageClassification (line 299) | class ConvNextForImageClassification(ConvNextPreTrainedModel): method __init__ (line 302) | def __init__(self, config): method forward (line 319) | def forward( class ConvNextBackbone (line 348) | class ConvNextBackbone(BackboneMixin, ConvNextPreTrainedModel): method __init__ (line 351) | def __init__(self, config): method forward (line 370) | def forward( FILE: src/transformers/models/convnextv2/configuration_convnextv2.py class ConvNextV2Config (line 25) | class ConvNextV2Config(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 59) | def __post_init__(self, **kwargs): FILE: src/transformers/models/convnextv2/convert_convnextv2_to_pytorch.py function get_convnextv2_config (line 37) | def get_convnextv2_config(checkpoint_url): function rename_key (line 82) | def rename_key(name): function prepare_img (line 117) | def prepare_img(): function convert_preprocessor (line 124) | def convert_preprocessor(checkpoint_url): function convert_convnextv2_checkpoint (line 145) | def convert_convnextv2_checkpoint(checkpoint_url, pytorch_dump_folder_pa... FILE: src/transformers/models/convnextv2/modeling_convnextv2.py function drop_path (line 40) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class ConvNextV2DropPath (line 56) | class ConvNextV2DropPath(nn.Module): method __init__ (line 59) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 63) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self) -> str: class ConvNextV2GRN (line 70) | class ConvNextV2GRN(nn.Module): method __init__ (line 73) | def __init__(self, dim: int): method forward (line 78) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class ConvNextV2LayerNorm (line 88) | class ConvNextV2LayerNorm(nn.LayerNorm): method __init__ (line 94) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 100) | def forward(self, features: torch.Tensor) -> torch.Tensor: class ConvNextV2Embeddings (line 115) | class ConvNextV2Embeddings(nn.Module): method __init__ (line 120) | def __init__(self, config): method forward (line 128) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class ConvNextV2Layer (line 139) | class ConvNextV2Layer(nn.Module): method __init__ (line 153) | def __init__(self, config, dim, drop_path=0): method forward (line 165) | def forward(self, features: torch.Tensor) -> torch.Tensor: class ConvNextV2Stage (line 183) | class ConvNextV2Stage(nn.Module): method __init__ (line 194) | def __init__(self, config, in_channels, out_channels, kernel_size=2, s... method forward (line 211) | def forward(self, features: torch.Tensor) -> torch.Tensor: class ConvNextV2PreTrainedModel (line 220) | class ConvNextV2PreTrainedModel(PreTrainedModel): method _init_weights (line 228) | def _init_weights(self, module): class ConvNextV2Encoder (line 237) | class ConvNextV2Encoder(ConvNextV2PreTrainedModel): method __init__ (line 241) | def __init__(self, config): method forward (line 266) | def forward( class ConvNextV2Model (line 279) | class ConvNextV2Model(ConvNextV2PreTrainedModel): method __init__ (line 280) | def __init__(self, config): method forward (line 295) | def forward( class ConvNextV2ForImageClassification (line 322) | class ConvNextV2ForImageClassification(ConvNextV2PreTrainedModel): method __init__ (line 325) | def __init__(self, config): method forward (line 342) | def forward( class ConvNextV2Backbone (line 372) | class ConvNextV2Backbone(BackboneMixin, ConvNextV2PreTrainedModel): method __init__ (line 375) | def __init__(self, config): method forward (line 394) | def forward( FILE: src/transformers/models/cpm/tokenization_cpm.py class CpmTokenizer (line 34) | class CpmTokenizer(PreTrainedTokenizer): method __init__ (line 39) | def __init__( method vocab_size (line 159) | def vocab_size(self): method get_vocab (line 162) | def get_vocab(self): method __getstate__ (line 167) | def __getstate__(self): method __setstate__ (line 172) | def __setstate__(self, d): method preprocess_text (line 182) | def preprocess_text(self, inputs): method _tokenize (line 197) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 217) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 221) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 225) | def convert_tokens_to_string(self, tokens): method build_inputs_with_special_tokens (line 230) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 255) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 283) | def create_token_type_ids_from_sequences( method save_vocabulary (line 313) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method _decode (line 330) | def _decode(self, *args, **kwargs): FILE: src/transformers/models/cpm/tokenization_cpm_fast.py class CpmTokenizerFast (line 28) | class CpmTokenizerFast(PreTrainedTokenizerFast): method __init__ (line 31) | def __init__( method build_inputs_with_special_tokens (line 145) | def build_inputs_with_special_tokens( method create_token_type_ids_from_sequences (line 170) | def create_token_type_ids_from_sequences( method save_vocabulary (line 200) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method _batch_encode_plus (line 219) | def _batch_encode_plus(self, batch_text_or_text_pairs, *args, **kwargs): method _decode (line 226) | def _decode(self, *args, **kwargs): FILE: src/transformers/models/cpmant/configuration_cpmant.py class CpmAntConfig (line 24) | class CpmAntConfig(PreTrainedConfig): FILE: src/transformers/models/cpmant/modeling_cpmant.py class CpmAntLayerNorm (line 36) | class CpmAntLayerNorm(nn.Module): method __init__ (line 41) | def __init__(self, config: CpmAntConfig): method forward (line 48) | def forward(self, hidden_states: torch.Tensor): class CpmAntAttention (line 61) | class CpmAntAttention(nn.Module): method __init__ (line 62) | def __init__(self, config: CpmAntConfig, layer_idx=None): method forward (line 82) | def forward( class CpmAntSelfAttentionBlock (line 162) | class CpmAntSelfAttentionBlock(nn.Module): method __init__ (line 163) | def __init__(self, config: CpmAntConfig, layer_idx=None): method forward (line 172) | def forward( class CpmAntDenseGatedACT (line 216) | class CpmAntDenseGatedACT(nn.Module): method __init__ (line 217) | def __init__(self, config: CpmAntConfig): method forward (line 223) | def forward(self, hidden_states: torch.Tensor): class CpmAntFeedForward (line 236) | class CpmAntFeedForward(nn.Module): method __init__ (line 237) | def __init__(self, config: CpmAntConfig): method forward (line 247) | def forward(self, hidden_states: torch.Tensor): class CpmAntFFNBlock (line 262) | class CpmAntFFNBlock(nn.Module): method __init__ (line 263) | def __init__(self, config: CpmAntConfig): method forward (line 272) | def forward( class CpmAntTransformerBlock (line 289) | class CpmAntTransformerBlock(nn.Module): method __init__ (line 290) | def __init__(self, config: CpmAntConfig, layer_idx=None): method forward (line 295) | def forward( class CpmAntEncoder (line 334) | class CpmAntEncoder(nn.Module): method __init__ (line 335) | def __init__(self, config: CpmAntConfig): method forward (line 342) | def forward( class CpmAntIntermediate (line 398) | class CpmAntIntermediate(nn.Module): method __init__ (line 399) | def __init__(self, config): method forward (line 407) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class CpmAntSegmentPositionEmbedding (line 413) | class CpmAntSegmentPositionEmbedding(nn.Module): method __init__ (line 414) | def __init__(self, config: CpmAntConfig): method forward (line 429) | def forward( method _segment_relative_position_bucket (line 481) | def _segment_relative_position_bucket(self, query_segment, key_segment): method _position_bucket (line 484) | def _position_bucket(self, relative_position, num_buckets=32, max_dist... class CpmAntOutput (line 506) | class CpmAntOutput(nn.Module): method __init__ (line 507) | def __init__(self, config): method forward (line 513) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class CpmAntPreTrainedModel (line 521) | class CpmAntPreTrainedModel(PreTrainedModel): method _init_weights (line 526) | def _init_weights(self, module): class CpmAntModel (line 536) | class CpmAntModel(CpmAntPreTrainedModel): method __init__ (line 537) | def __init__(self, config: CpmAntConfig): method get_input_embeddings (line 550) | def get_input_embeddings(self): method set_input_embeddings (line 553) | def set_input_embeddings(self, embeddings, **kwargs): method _prepare_attention_mask (line 556) | def _prepare_attention_mask(self, input_ids, span, context, length): method forward (line 575) | def forward( class CpmAntForCausalLM (line 686) | class CpmAntForCausalLM(CpmAntPreTrainedModel, GenerationMixin): method __init__ (line 689) | def __init__(self, config: CpmAntConfig): method forward (line 700) | def forward( method get_input_embeddings (line 772) | def get_input_embeddings(self): method set_input_embeddings (line 775) | def set_input_embeddings(self, embeddings): FILE: src/transformers/models/cpmant/tokenization_cpmant.py function load_vocab (line 34) | def load_vocab(vocab_file): class WordpieceTokenizer (line 45) | class WordpieceTokenizer: method __init__ (line 46) | def __init__(self, vocab, unk_token="", max_input_chars_per_word=... method tokenize (line 51) | def tokenize(self, token): class CpmAntTokenizer (line 77) | class CpmAntTokenizer(PreTrainedTokenizer): method __init__ (line 106) | def __init__( method bod_token_id (line 157) | def bod_token_id(self): method eod_token_id (line 161) | def eod_token_id(self): method newline_id (line 165) | def newline_id(self): method vocab_size (line 169) | def vocab_size(self) -> int: method get_vocab (line 172) | def get_vocab(self): method _tokenize (line 175) | def _tokenize(self, text): method _decode (line 182) | def _decode(self, token_ids, **kwargs): method check (line 190) | def check(self, token): method convert_tokens_to_string (line 193) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method _convert_token_to_id (line 196) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 200) | def _convert_id_to_token(self, index): method save_vocabulary (line 204) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/csm/configuration_csm.py class CsmDepthDecoderConfig (line 29) | class CsmDepthDecoderConfig(PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): class CsmConfig (line 90) | class CsmConfig(PreTrainedConfig): method __post_init__ (line 162) | def __post_init__(self, **kwargs): FILE: src/transformers/models/csm/convert_csm.py function permute_for_rope (line 61) | def permute_for_rope(input_tensor, n_heads, dim1, dim2): function convert_key (line 72) | def convert_key(key, mapping): function write_model (line 78) | def write_model( function write_tokenizer (line 233) | def write_tokenizer(output_dir): function write_processor (line 279) | def write_processor(output_dir, codec_model_path_or_repo): function main (line 294) | def main(): FILE: src/transformers/models/csm/generation_csm.py class CsmGenerateOutput (line 41) | class CsmGenerateOutput(GenerateDecoderOnlyOutput): class CsmGenerationMixin (line 72) | class CsmGenerationMixin(GenerationMixin): method _get_stopping_criteria (line 73) | def _get_stopping_criteria( method _prepare_generation_config (line 90) | def _prepare_generation_config( method _sample (line 146) | def _sample( method generate (line 334) | def generate( FILE: src/transformers/models/csm/modeling_csm.py class CsmOutputWithPast (line 57) | class CsmOutputWithPast(ModelOutput): class CsmRMSNorm (line 100) | class CsmRMSNorm(nn.Module): method __init__ (line 101) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 109) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 116) | def extra_repr(self): class CsmRotaryEmbedding (line 120) | class CsmRotaryEmbedding(nn.Module): method __init__ (line 123) | def __init__(self, config: CsmConfig, device=None): method compute_default_rope_parameters (line 140) | def compute_default_rope_parameters( method forward (line 171) | def forward(self, x, position_ids): class CsmMLP (line 185) | class CsmMLP(nn.Module): method __init__ (line 186) | def __init__(self, config): method forward (line 196) | def forward(self, x): function rotate_half (line 201) | def rotate_half(x): function apply_rotary_pos_emb (line 209) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 234) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 246) | def eager_attention_forward( class CsmAttention (line 272) | class CsmAttention(nn.Module): method __init__ (line 275) | def __init__(self, config: CsmConfig, layer_idx: int): method forward (line 298) | def forward( class CsmDecoderLayer (line 339) | class CsmDecoderLayer(GradientCheckpointingLayer): method __init__ (line 340) | def __init__(self, config: CsmConfig, layer_idx: int): method forward (line 350) | def forward( class CsmPreTrainedModel (line 388) | class CsmPreTrainedModel(PreTrainedModel): method _init_weights (line 408) | def _init_weights(self, module): class CsmDepthDecoderModel (line 419) | class CsmDepthDecoderModel(CsmPreTrainedModel): method __init__ (line 422) | def __init__(self, config): method forward (line 441) | def forward( class CsmCodebooksHead (line 522) | class CsmCodebooksHead(nn.Module): method __init__ (line 523) | def __init__(self, hidden_size, num_codebooks, vocab_size): method forward (line 528) | def forward(self, hidden_states, codebook_indices=None): class CsmDepthDecoderForCausalLM (line 549) | class CsmDepthDecoderForCausalLM(CsmPreTrainedModel, GenerationMixin): method __init__ (line 554) | def __init__(self, config): method forward (line 565) | def forward( method prepare_inputs_for_generation (line 632) | def prepare_inputs_for_generation( class CsmBackboneModelEmbeddings (line 655) | class CsmBackboneModelEmbeddings(nn.Module): method __init__ (line 656) | def __init__(self, config): method forward (line 663) | def forward(self, input_ids): class CsmBackboneModel (line 670) | class CsmBackboneModel(CsmPreTrainedModel): method __init__ (line 671) | def __init__(self, config): method forward (line 689) | def forward( class CsmForConditionalGeneration (line 759) | class CsmForConditionalGeneration(CsmPreTrainedModel, CsmGenerationMixin): method __init__ (line 764) | def __init__(self, config): method get_input_embeddings (line 774) | def get_input_embeddings(self): method set_input_embeddings (line 777) | def set_input_embeddings(self, value): method from_pretrained (line 781) | def from_pretrained(cls, *args, **kwargs): method save_pretrained (line 807) | def save_pretrained(self, *args, **kwargs): method _merge_input_ids_with_input_values (line 817) | def _merge_input_ids_with_input_values( method prepare_inputs_for_generation (line 899) | def prepare_inputs_for_generation( method forward (line 932) | def forward( FILE: src/transformers/models/csm/modular_csm.py class CsmOutputWithPast (line 55) | class CsmOutputWithPast(ModelOutput): class CsmRMSNorm (line 98) | class CsmRMSNorm(LlamaRMSNorm): class CsmRotaryEmbedding (line 102) | class CsmRotaryEmbedding(LlamaRotaryEmbedding): class CsmMLP (line 106) | class CsmMLP(LlamaMLP): class CsmAttention (line 110) | class CsmAttention(LlamaAttention): class CsmDecoderLayer (line 114) | class CsmDecoderLayer(LlamaDecoderLayer): class CsmPreTrainedModel (line 124) | class CsmPreTrainedModel(PreTrainedModel): method _init_weights (line 144) | def _init_weights(self, module): class CsmDepthDecoderModel (line 155) | class CsmDepthDecoderModel(LlamaModel, CsmPreTrainedModel): method __init__ (line 158) | def __init__(self, config): method forward (line 166) | def forward( class CsmCodebooksHead (line 247) | class CsmCodebooksHead(nn.Module): method __init__ (line 248) | def __init__(self, hidden_size, num_codebooks, vocab_size): method forward (line 253) | def forward(self, hidden_states, codebook_indices=None): class CsmDepthDecoderForCausalLM (line 274) | class CsmDepthDecoderForCausalLM(LlamaForCausalLM, GenerationMixin): method __init__ (line 279) | def __init__(self, config): method prepare_inputs_for_generation (line 285) | def prepare_inputs_for_generation( method forward (line 309) | def forward( class CsmBackboneModelEmbeddings (line 377) | class CsmBackboneModelEmbeddings(nn.Module): method __init__ (line 378) | def __init__(self, config): method forward (line 385) | def forward(self, input_ids): class CsmBackboneModel (line 392) | class CsmBackboneModel(LlamaModel): method __init__ (line 393) | def __init__(self, config): method forward (line 400) | def forward(self, **super_kwargs): class CsmForConditionalGeneration (line 421) | class CsmForConditionalGeneration(CsmPreTrainedModel, CsmGenerationMixin): method __init__ (line 426) | def __init__(self, config): method get_input_embeddings (line 436) | def get_input_embeddings(self): method set_input_embeddings (line 439) | def set_input_embeddings(self, value): method from_pretrained (line 443) | def from_pretrained(cls, *args, **kwargs): method save_pretrained (line 469) | def save_pretrained(self, *args, **kwargs): method _merge_input_ids_with_input_values (line 479) | def _merge_input_ids_with_input_values( method prepare_inputs_for_generation (line 561) | def prepare_inputs_for_generation( method forward (line 594) | def forward( FILE: src/transformers/models/csm/processing_csm.py class CsmAudioKwargs (line 36) | class CsmAudioKwargs(AudioKwargs, total=False): class CsmProcessorKwargs (line 48) | class CsmProcessorKwargs(ProcessingKwargs, total=False): class CsmProcessor (line 70) | class CsmProcessor(ProcessorMixin): method __init__ (line 71) | def __init__( method _get_encoded_length (line 94) | def _get_encoded_length(audio_length, kernel_sizes=None, strides=None,... method save_audio (line 131) | def save_audio( method __call__ (line 166) | def __call__( method model_input_names (line 312) | def model_input_names(self): FILE: src/transformers/models/ctrl/configuration_ctrl.py class CTRLConfig (line 24) | class CTRLConfig(PreTrainedConfig): FILE: src/transformers/models/ctrl/modeling_ctrl.py function angle_defn (line 37) | def angle_defn(pos, i, d_model_size): function positional_encoding (line 42) | def positional_encoding(position, d_model_size, dtype): function scaled_dot_product_attention (line 57) | def scaled_dot_product_attention(q, k, v, mask, attention_mask=None): class MultiHeadAttention (line 79) | class MultiHeadAttention(nn.Module): method __init__ (line 80) | def __init__(self, d_model_size, num_heads, layer_idx=None): method split_into_heads (line 94) | def split_into_heads(self, x, batch_size): method forward (line 98) | def forward( function point_wise_feed_forward_network (line 131) | def point_wise_feed_forward_network(d_model_size, dff): class EncoderLayer (line 135) | class EncoderLayer(nn.Module): method __init__ (line 136) | def __init__(self, d_model_size, num_heads, dff, rate=0.1, layer_idx=N... method forward (line 148) | def forward( class CTRLPreTrainedModel (line 183) | class CTRLPreTrainedModel(PreTrainedModel): method _init_weights (line 187) | def _init_weights(self, module): class CTRLModel (line 196) | class CTRLModel(CTRLPreTrainedModel): method __init__ (line 197) | def __init__(self, config): method get_input_embeddings (line 221) | def get_input_embeddings(self): method set_input_embeddings (line 224) | def set_input_embeddings(self, new_embeddings): method forward (line 228) | def forward( class CTRLLMHeadModel (line 375) | class CTRLLMHeadModel(CTRLPreTrainedModel, GenerationMixin): method __init__ (line 378) | def __init__(self, config): method forward (line 387) | def forward( method prepare_inputs_for_generation (line 475) | def prepare_inputs_for_generation( class CTRLForSequenceClassification (line 505) | class CTRLForSequenceClassification(CTRLPreTrainedModel): method __init__ (line 506) | def __init__(self, config): method forward (line 516) | def forward( FILE: src/transformers/models/ctrl/tokenization_ctrl.py function get_pairs (line 91) | def get_pairs(word): class CTRLTokenizer (line 107) | class CTRLTokenizer(PreTrainedTokenizer): method __init__ (line 127) | def __init__(self, vocab_file, merges_file, unk_token="", **kwargs): method vocab_size (line 146) | def vocab_size(self): method get_vocab (line 149) | def get_vocab(self): method bpe (line 152) | def bpe(self, token): method _tokenize (line 196) | def _tokenize(self, text): method _convert_token_to_id (line 206) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 210) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 214) | def convert_tokens_to_string(self, tokens): FILE: src/transformers/models/cvt/configuration_cvt.py class CvtConfig (line 24) | class CvtConfig(PreTrainedConfig): FILE: src/transformers/models/cvt/convert_cvt_original_pytorch_checkpoint_to_pytorch.py function embeddings (line 29) | def embeddings(idx): function attention (line 64) | def attention(idx, cnt): function cls_token (line 256) | def cls_token(idx): function final (line 265) | def final(): function convert_cvt_checkpoint (line 277) | def convert_cvt_checkpoint(cvt_model, image_size, cvt_file_name, pytorch... FILE: src/transformers/models/cvt/modeling_cvt.py class BaseModelOutputWithCLSToken (line 39) | class BaseModelOutputWithCLSToken(ModelOutput): function drop_path (line 51) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class CvtDropPath (line 67) | class CvtDropPath(nn.Module): method __init__ (line 70) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 74) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 77) | def extra_repr(self) -> str: class CvtEmbeddings (line 81) | class CvtEmbeddings(nn.Module): method __init__ (line 86) | def __init__(self, patch_size, num_channels, embed_dim, stride, paddin... method forward (line 93) | def forward(self, pixel_values): class CvtConvEmbeddings (line 99) | class CvtConvEmbeddings(nn.Module): method __init__ (line 104) | def __init__(self, patch_size, num_channels, embed_dim, stride, padding): method forward (line 111) | def forward(self, pixel_values): class CvtSelfAttentionConvProjection (line 124) | class CvtSelfAttentionConvProjection(nn.Module): method __init__ (line 125) | def __init__(self, embed_dim, kernel_size, padding, stride): method forward (line 138) | def forward(self, hidden_state): class CvtSelfAttentionLinearProjection (line 144) | class CvtSelfAttentionLinearProjection(nn.Module): method forward (line 145) | def forward(self, hidden_state): class CvtSelfAttentionProjection (line 153) | class CvtSelfAttentionProjection(nn.Module): method __init__ (line 154) | def __init__(self, embed_dim, kernel_size, padding, stride, projection... method forward (line 160) | def forward(self, hidden_state): class CvtSelfAttention (line 166) | class CvtSelfAttention(nn.Module): method __init__ (line 167) | def __init__( method rearrange_for_multi_head_attention (line 208) | def rearrange_for_multi_head_attention(self, hidden_state): method forward (line 214) | def forward(self, hidden_state, height, width): class CvtSelfOutput (line 247) | class CvtSelfOutput(nn.Module): method __init__ (line 253) | def __init__(self, embed_dim, drop_rate): method forward (line 258) | def forward(self, hidden_state, input_tensor): class CvtAttention (line 264) | class CvtAttention(nn.Module): method __init__ (line 265) | def __init__( method forward (line 296) | def forward(self, hidden_state, height, width): class CvtIntermediate (line 302) | class CvtIntermediate(nn.Module): method __init__ (line 303) | def __init__(self, embed_dim, mlp_ratio): method forward (line 308) | def forward(self, hidden_state): class CvtOutput (line 314) | class CvtOutput(nn.Module): method __init__ (line 315) | def __init__(self, embed_dim, mlp_ratio, drop_rate): method forward (line 320) | def forward(self, hidden_state, input_tensor): class CvtLayer (line 327) | class CvtLayer(nn.Module): method __init__ (line 332) | def __init__( method forward (line 371) | def forward(self, hidden_state, height, width): class CvtStage (line 393) | class CvtStage(nn.Module): method __init__ (line 394) | def __init__(self, config, stage): method forward (line 436) | def forward(self, hidden_state): class CvtEncoder (line 456) | class CvtEncoder(nn.Module): method __init__ (line 457) | def __init__(self, config): method forward (line 464) | def forward(self, pixel_values, output_hidden_states=False, return_dic... class CvtPreTrainedModel (line 485) | class CvtPreTrainedModel(PreTrainedModel): method _init_weights (line 492) | def _init_weights(self, module): class CvtModel (line 511) | class CvtModel(CvtPreTrainedModel): method __init__ (line 512) | def __init__(self, config, add_pooling_layer=True): method forward (line 523) | def forward( class CvtForImageClassification (line 561) | class CvtForImageClassification(CvtPreTrainedModel): method __init__ (line 562) | def __init__(self, config): method forward (line 577) | def forward( FILE: src/transformers/models/cwm/configuration_cwm.py class CwmConfig (line 30) | class CwmConfig(PreTrainedConfig): method __post_init__ (line 87) | def __post_init__(self, **kwargs): method validate_architecture (line 116) | def validate_architecture(self): FILE: src/transformers/models/cwm/modeling_cwm.py class CwmRotaryEmbedding (line 45) | class CwmRotaryEmbedding(nn.Module): method __init__ (line 48) | def __init__(self, config: CwmConfig, device=None): method compute_default_rope_parameters (line 65) | def compute_default_rope_parameters( method forward (line 96) | def forward(self, x, position_ids): function rotate_half (line 110) | def rotate_half(x): function apply_rotary_pos_emb (line 118) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 143) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 155) | def eager_attention_forward( class CwmAttention (line 181) | class CwmAttention(nn.Module): method __init__ (line 184) | def __init__(self, config: CwmConfig, layer_idx: int): method forward (line 200) | def forward( class CwmRMSNorm (line 243) | class CwmRMSNorm(nn.Module): method __init__ (line 244) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 252) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 259) | def extra_repr(self): class CwmMLP (line 263) | class CwmMLP(nn.Module): method __init__ (line 264) | def __init__(self, config): method forward (line 274) | def forward(self, x): class CwmDecoderLayer (line 279) | class CwmDecoderLayer(GradientCheckpointingLayer): method __init__ (line 280) | def __init__(self, config: CwmConfig, layer_idx: int): method forward (line 289) | def forward( class CwmPreTrainedModel (line 322) | class CwmPreTrainedModel(PreTrainedModel): class CwmModelOutputWithPast (line 340) | class CwmModelOutputWithPast(BaseModelOutputWithPast): class CwmModel (line 345) | class CwmModel(CwmPreTrainedModel): method __init__ (line 348) | def __init__(self, config: CwmConfig): method forward (line 367) | def forward( class CwmForCausalLM (line 427) | class CwmForCausalLM(CwmPreTrainedModel, GenerationMixin): method __init__ (line 432) | def __init__(self, config): method forward (line 443) | def forward( FILE: src/transformers/models/cwm/modular_cwm.py class CwmConfig (line 39) | class CwmConfig(LlamaConfig): method __post_init__ (line 68) | def __post_init__(self, **kwargs): class CwmRotaryEmbedding (line 93) | class CwmRotaryEmbedding(Qwen2RotaryEmbedding): class CwmAttention (line 97) | class CwmAttention(Qwen2Attention): method __init__ (line 98) | def __init__(self, config: CwmConfig, layer_idx: int): class CwmDecoderLayer (line 105) | class CwmDecoderLayer(LlamaDecoderLayer): method __init__ (line 106) | def __init__(self, config: CwmConfig, layer_idx: int): class CwmPreTrainedModel (line 111) | class CwmPreTrainedModel(LlamaPreTrainedModel): class CwmModelOutputWithPast (line 115) | class CwmModelOutputWithPast(BaseModelOutputWithPast): class CwmModel (line 119) | class CwmModel(LlamaModel): method __init__ (line 122) | def __init__(self, config: CwmConfig): method forward (line 128) | def forward( class CwmForCausalLM (line 187) | class CwmForCausalLM(LlamaForCausalLM): FILE: src/transformers/models/d_fine/configuration_d_fine.py class DFineConfig (line 32) | class DFineConfig(PreTrainedConfig): method __post_init__ (line 218) | def __post_init__(self, **kwargs): method validate_architecture (line 228) | def validate_architecture(self): FILE: src/transformers/models/d_fine/convert_d_fine_original_pytorch_checkpoint_to_hf.py function get_d_fine_config (line 35) | def get_d_fine_config(model_name: str) -> DFineConfig: function load_original_state_dict (line 155) | def load_original_state_dict(repo_id, model_name): function convert_old_keys_to_new_keys (line 322) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function read_in_q_k_v (line 333) | def read_in_q_k_v(state_dict, config, model_name): function prepare_img (line 380) | def prepare_img(): function convert_d_fine_checkpoint (line 389) | def convert_d_fine_checkpoint(model_name, pytorch_dump_folder_path, push... FILE: src/transformers/models/d_fine/modeling_d_fine.py class DFineDecoderOutput (line 52) | class DFineDecoderOutput(ModelOutput): class DFineMLP (line 81) | class DFineMLP(nn.Module): method __init__ (line 82) | def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, n... method forward (line 91) | def forward(self, stat_features: torch.Tensor) -> torch.Tensor: class DFineGate (line 97) | class DFineGate(nn.Module): method __init__ (line 98) | def __init__(self, d_model: int): method forward (line 103) | def forward(self, second_residual: torch.Tensor, hidden_states: torch.... class DFineFrozenBatchNorm2d (line 111) | class DFineFrozenBatchNorm2d(nn.Module): method __init__ (line 119) | def __init__(self, n): method _load_from_state_dict (line 126) | def _load_from_state_dict( method forward (line 137) | def forward(self, x): function multi_scale_deformable_attention_v2 (line 150) | def multi_scale_deformable_attention_v2( class DFineMultiscaleDeformableAttention (line 224) | class DFineMultiscaleDeformableAttention(nn.Module): method __init__ (line 225) | def __init__(self, config: DFineConfig): method forward (line 253) | def forward( class DFineConvNormLayer (line 316) | class DFineConvNormLayer(nn.Module): method __init__ (line 317) | def __init__( method forward (line 341) | def forward(self, hidden_state): class DFineRepVggBlock (line 348) | class DFineRepVggBlock(nn.Module): method __init__ (line 353) | def __init__(self, config: DFineConfig, in_channels: int, out_channels... method forward (line 362) | def forward(self, x): class DFineCSPRepLayer (line 367) | class DFineCSPRepLayer(nn.Module): method __init__ (line 372) | def __init__( method forward (line 389) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class DFineRepNCSPELAN4 (line 398) | class DFineRepNCSPELAN4(nn.Module): method __init__ (line 399) | def __init__(self, config: DFineConfig, act: str = "silu", numb_blocks... method forward (line 413) | def forward(self, input_features: torch.Tensor) -> torch.Tensor: class DFineSCDown (line 429) | class DFineSCDown(nn.Module): method __init__ (line 430) | def __init__(self, config: DFineConfig, kernel_size: int, stride: int): method forward (line 442) | def forward(self, input_features: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 448) | def eager_attention_forward( class DFineSelfAttention (line 476) | class DFineSelfAttention(nn.Module): method __init__ (line 483) | def __init__( method forward (line 503) | def forward( class DFineEncoderLayer (line 542) | class DFineEncoderLayer(nn.Module): method __init__ (line 543) | def __init__(self, config: DFineConfig): method forward (line 562) | def forward( class DFineSinePositionEmbedding (line 613) | class DFineSinePositionEmbedding(nn.Module): method __init__ (line 618) | def __init__(self, embed_dim: int = 256, temperature: int = 10000): method forward (line 624) | def forward( class DFineAIFILayer (line 652) | class DFineAIFILayer(nn.Module): method __init__ (line 657) | def __init__(self, config: DFineConfig): method forward (line 669) | def forward( class DFineIntegral (line 709) | class DFineIntegral(nn.Module): method __init__ (line 722) | def __init__(self, config: DFineConfig): method forward (line 726) | def forward(self, pred_corners: torch.Tensor, project: torch.Tensor) -... class DFineLQE (line 734) | class DFineLQE(nn.Module): method __init__ (line 735) | def __init__(self, config: DFineConfig): method forward (line 741) | def forward(self, scores: torch.Tensor, pred_corners: torch.Tensor) ->... class DFineDecoderLayer (line 751) | class DFineDecoderLayer(nn.Module): method __init__ (line 752) | def __init__(self, config: DFineConfig): method forward (line 776) | def forward( class DFineMLPPredictionHead (line 843) | class DFineMLPPredictionHead(nn.Module): method __init__ (line 850) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 856) | def forward(self, x): class DFinePreTrainedModel (line 863) | class DFinePreTrainedModel(PreTrainedModel): method _init_weights (line 875) | def _init_weights(self, module): class DFineHybridEncoder (line 950) | class DFineHybridEncoder(DFinePreTrainedModel): method __init__ (line 965) | def __init__(self, config: DFineConfig): method forward (line 1003) | def forward( function inverse_sigmoid (line 1049) | def inverse_sigmoid(x, eps=1e-5): function weighting_function (line 1056) | def weighting_function(max_num_bins: int, up: torch.Tensor, reg_scale: i... function distance2bbox (line 1080) | def distance2bbox(points, distance: torch.Tensor, reg_scale: float) -> t... class DFineDecoder (line 1105) | class DFineDecoder(DFinePreTrainedModel): method __init__ (line 1120) | def __init__(self, config: DFineConfig): method forward (line 1149) | def forward( class DFineModelOutput (line 1267) | class DFineModelOutput(ModelOutput): function replace_batch_norm (line 1319) | def replace_batch_norm(model): class DFineConvEncoder (line 1343) | class DFineConvEncoder(nn.Module): method __init__ (line 1351) | def __init__(self, config): method forward (line 1363) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): function get_contrastive_denoising_training_group (line 1375) | def get_contrastive_denoising_training_group( class DFineModel (line 1503) | class DFineModel(DFinePreTrainedModel): method __init__ (line 1504) | def __init__(self, config: DFineConfig): method freeze_backbone (line 1583) | def freeze_backbone(self): method unfreeze_backbone (line 1587) | def unfreeze_backbone(self): method generate_anchors (line 1592) | def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device... method forward (line 1622) | def forward( class DFineObjectDetectionOutput (line 1824) | class DFineObjectDetectionOutput(ModelOutput): class DFineForObjectDetection (line 1902) | class DFineForObjectDetection(DFinePreTrainedModel): method __init__ (line 1913) | def __init__(self, config: DFineConfig): method _set_aux_loss (line 1938) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 1943) | def forward( FILE: src/transformers/models/d_fine/modular_d_fine.py class DFineConfig (line 55) | class DFineConfig(PreTrainedConfig): method __post_init__ (line 241) | def __post_init__(self, **kwargs): method validate_architecture (line 251) | def validate_architecture(self): class DFineDecoderOutput (line 265) | class DFineDecoderOutput(RTDetrDecoderOutput): function weighting_function (line 269) | def weighting_function(max_num_bins: int, up: torch.Tensor, reg_scale: i... function distance2bbox (line 293) | def distance2bbox(points, distance: torch.Tensor, reg_scale: float) -> t... class DFineMLP (line 318) | class DFineMLP(nn.Module): method __init__ (line 319) | def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, n... method forward (line 328) | def forward(self, stat_features: torch.Tensor) -> torch.Tensor: class DFineGate (line 334) | class DFineGate(nn.Module): method __init__ (line 335) | def __init__(self, d_model: int): method forward (line 340) | def forward(self, second_residual: torch.Tensor, hidden_states: torch.... class DFineFrozenBatchNorm2d (line 348) | class DFineFrozenBatchNorm2d(RTDetrFrozenBatchNorm2d): class DFineMultiscaleDeformableAttention (line 352) | class DFineMultiscaleDeformableAttention(nn.Module): method __init__ (line 353) | def __init__(self, config: DFineConfig): method forward (line 381) | def forward( class DFineConvNormLayer (line 444) | class DFineConvNormLayer(RTDetrConvNormLayer): method __init__ (line 445) | def __init__( class DFineRepVggBlock (line 468) | class DFineRepVggBlock(RTDetrRepVggBlock): method __init__ (line 469) | def __init__(self, config: DFineConfig, in_channels: int, out_channels... class DFineCSPRepLayer (line 476) | class DFineCSPRepLayer(nn.Module): method __init__ (line 481) | def __init__( method forward (line 498) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class DFineRepNCSPELAN4 (line 507) | class DFineRepNCSPELAN4(nn.Module): method __init__ (line 508) | def __init__(self, config: DFineConfig, act: str = "silu", numb_blocks... method forward (line 522) | def forward(self, input_features: torch.Tensor) -> torch.Tensor: class DFineSCDown (line 538) | class DFineSCDown(nn.Module): method __init__ (line 539) | def __init__(self, config: DFineConfig, kernel_size: int, stride: int): method forward (line 551) | def forward(self, input_features: torch.Tensor) -> torch.Tensor: class DFineEncoderLayer (line 557) | class DFineEncoderLayer(RTDetrEncoderLayer): method __init__ (line 558) | def __init__(self, config: DFineConfig): class DFineAIFILayer (line 565) | class DFineAIFILayer(RTDetrAIFILayer): class DFineIntegral (line 569) | class DFineIntegral(nn.Module): method __init__ (line 582) | def __init__(self, config: DFineConfig): method forward (line 586) | def forward(self, pred_corners: torch.Tensor, project: torch.Tensor) -... class DFineLQE (line 594) | class DFineLQE(nn.Module): method __init__ (line 595) | def __init__(self, config: DFineConfig): method forward (line 601) | def forward(self, scores: torch.Tensor, pred_corners: torch.Tensor) ->... class DFineDecoderLayer (line 611) | class DFineDecoderLayer(RTDetrDecoderLayer): method __init__ (line 612) | def __init__(self, config: DFineConfig): method forward (line 625) | def forward( class DFineMLPPredictionHead (line 673) | class DFineMLPPredictionHead(RTDetrMLPPredictionHead): class DFinePreTrainedModel (line 677) | class DFinePreTrainedModel(RTDetrPreTrainedModel): method _init_weights (line 679) | def _init_weights(self, module): class DFineHybridEncoder (line 754) | class DFineHybridEncoder(RTDetrHybridEncoder): method __init__ (line 755) | def __init__(self, config: DFineConfig): class DFineDecoder (line 792) | class DFineDecoder(RTDetrDecoder): method __init__ (line 801) | def __init__(self, config: DFineConfig): method forward (line 818) | def forward( class DFineModel (line 911) | class DFineModel(RTDetrModel): method __init__ (line 912) | def __init__(self, config: DFineConfig): class DFineForObjectDetection (line 937) | class DFineForObjectDetection(RTDetrForObjectDetection): method __init__ (line 948) | def __init__(self, config: DFineConfig): method forward (line 973) | def forward(**super_kwargs): FILE: src/transformers/models/dab_detr/configuration_dab_detr.py class DabDetrConfig (line 26) | class DabDetrConfig(PreTrainedConfig): method __post_init__ (line 112) | def __post_init__(self, **kwargs): method validate_architecture (line 134) | def validate_architecture(self): FILE: src/transformers/models/dab_detr/convert_dab_detr_original_pytorch_checkpoint_to_pytorch.py function convert_old_keys_to_new_keys (line 89) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function write_image_processor (line 107) | def write_image_processor(model_name, pytorch_dump_folder_path, push_to_... function write_model (line 119) | def write_model(model_name, pretrained_model_weights_path, pytorch_dump_... function convert_dab_detr_checkpoint (line 197) | def convert_dab_detr_checkpoint(model_name, pretrained_model_weights_pat... FILE: src/transformers/models/dab_detr/modeling_dab_detr.py class DabDetrDecoderOutput (line 50) | class DabDetrDecoderOutput(BaseModelOutputWithCrossAttentions): class DabDetrModelOutput (line 77) | class DabDetrModelOutput(Seq2SeqModelOutput): class DabDetrObjectDetectionOutput (line 99) | class DabDetrObjectDetectionOutput(ModelOutput): class DabDetrFrozenBatchNorm2d (line 137) | class DabDetrFrozenBatchNorm2d(nn.Module): method __init__ (line 145) | def __init__(self, n): method _load_from_state_dict (line 152) | def _load_from_state_dict( method forward (line 163) | def forward(self, x): function replace_batch_norm (line 177) | def replace_batch_norm(model): class DabDetrConvEncoder (line 202) | class DabDetrConvEncoder(nn.Module): method __init__ (line 210) | def __init__(self, config: DabDetrConfig): method forward (line 222) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class DabDetrConvModel (line 235) | class DabDetrConvModel(nn.Module): method __init__ (line 240) | def __init__(self, conv_encoder, position_embedding): method forward (line 245) | def forward(self, pixel_values, pixel_mask): class DabDetrSinePositionEmbedding (line 257) | class DabDetrSinePositionEmbedding(nn.Module): method __init__ (line 263) | def __init__(self, config: DabDetrConfig): method forward (line 274) | def forward(self, pixel_values, pixel_mask): function gen_sine_position_embeddings (line 305) | def gen_sine_position_embeddings(pos_tensor, hidden_size=256): function inverse_sigmoid (line 343) | def inverse_sigmoid(x, eps=1e-5): class DetrAttention (line 351) | class DetrAttention(nn.Module): method __init__ (line 358) | def __init__( method forward (line 380) | def forward( class DabDetrAttention (line 429) | class DabDetrAttention(nn.Module): method __init__ (line 437) | def __init__(self, config: DabDetrConfig, bias: bool = True, is_cross:... method forward (line 459) | def forward( class DabDetrDecoderLayerSelfAttention (line 503) | class DabDetrDecoderLayerSelfAttention(nn.Module): method __init__ (line 504) | def __init__(self, config: DabDetrConfig): method forward (line 515) | def forward( class DabDetrDecoderLayerCrossAttention (line 547) | class DabDetrDecoderLayerCrossAttention(nn.Module): method __init__ (line 548) | def __init__(self, config: DabDetrConfig, is_first: bool = False): method forward (line 569) | def forward( class DabDetrDecoderLayerFFN (line 632) | class DabDetrDecoderLayerFFN(nn.Module): method __init__ (line 633) | def __init__(self, config: DabDetrConfig): method forward (line 644) | def forward(self, hidden_states: torch.Tensor): class DabDetrEncoderLayer (line 657) | class DabDetrEncoderLayer(GradientCheckpointingLayer): method __init__ (line 658) | def __init__(self, config: DabDetrConfig): method forward (line 669) | def forward( class DabDetrDecoderLayer (line 719) | class DabDetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 720) | def __init__(self, config: DabDetrConfig, is_first: bool = False): method forward (line 726) | def forward( class DabDetrMLP (line 787) | class DabDetrMLP(nn.Module): method __init__ (line 796) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 802) | def forward(self, input_tensor): class DabDetrPreTrainedModel (line 810) | class DabDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 818) | def _init_weights(self, module): class DabDetrEncoder (line 852) | class DabDetrEncoder(DabDetrPreTrainedModel): method __init__ (line 867) | def __init__(self, config: DabDetrConfig): method forward (line 879) | def forward( class DabDetrDecoder (line 965) | class DabDetrDecoder(DabDetrPreTrainedModel): method __init__ (line 980) | def __init__(self, config: DabDetrConfig): method forward (line 1009) | def forward( class DabDetrModel (line 1163) | class DabDetrModel(DabDetrPreTrainedModel): method __init__ (line 1164) | def __init__(self, config: DabDetrConfig): method freeze_backbone (line 1207) | def freeze_backbone(self): method unfreeze_backbone (line 1211) | def unfreeze_backbone(self): method forward (line 1216) | def forward( class DabDetrMHAttentionMap (line 1401) | class DabDetrMHAttentionMap(nn.Module): method __init__ (line 1404) | def __init__(self, query_dim, hidden_dim, num_heads, dropout=0.0, bias... method forward (line 1415) | def forward(self, q, k, mask: Tensor | None = None): class DabDetrForObjectDetection (line 1435) | class DabDetrForObjectDetection(DabDetrPreTrainedModel): method __init__ (line 1439) | def __init__(self, config: DabDetrConfig): method _set_aux_loss (line 1461) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 1465) | def forward( FILE: src/transformers/models/dac/configuration_dac.py class DacConfig (line 27) | class DacConfig(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): method frame_rate (line 73) | def frame_rate(self) -> int: FILE: src/transformers/models/dac/convert_dac_checkpoint.py function match_pattern (line 42) | def match_pattern(string, pattern): function set_recursively (line 100) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function should_ignore (line 128) | def should_ignore(name, ignore_keys): function recursively_load_weights (line 142) | def recursively_load_weights(orig_dict, hf_model, model_name): function apply_weight_norm (line 189) | def apply_weight_norm(model): function convert_checkpoint (line 222) | def convert_checkpoint( FILE: src/transformers/models/dac/feature_extraction_dac.py class DacFeatureExtractor (line 26) | class DacFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 46) | def __init__( method __call__ (line 57) | def __call__( FILE: src/transformers/models/dac/modeling_dac.py class DacOutput (line 32) | class DacOutput(ModelOutput): class DacEncoderOutput (line 55) | class DacEncoderOutput(ModelOutput): class DacDecoderOutput (line 76) | class DacDecoderOutput(ModelOutput): class Snake1d (line 85) | class Snake1d(nn.Module): method __init__ (line 90) | def __init__(self, hidden_dim): method forward (line 94) | def forward(self, hidden_states): class DacVectorQuantize (line 102) | class DacVectorQuantize(nn.Module): method __init__ (line 114) | def __init__(self, config: DacConfig): method forward (line 122) | def forward(self, hidden_state): method decode_latents (line 154) | def decode_latents(self, hidden_states): class DacResidualUnit (line 173) | class DacResidualUnit(nn.Module): method __init__ (line 178) | def __init__(self, dimension: int = 16, dilation: int = 1): method forward (line 187) | def forward(self, hidden_state): class DacEncoderBlock (line 210) | class DacEncoderBlock(nn.Module): method __init__ (line 213) | def __init__(self, config: DacConfig, stride: int = 1, stride_index: i... method forward (line 225) | def forward(self, hidden_state): class DacDecoderBlock (line 234) | class DacDecoderBlock(nn.Module): method __init__ (line 237) | def __init__(self, config: DacConfig, stride: int = 1, stride_index: i... method forward (line 255) | def forward(self, hidden_state): class DacResidualVectorQuantizer (line 265) | class DacResidualVectorQuantizer(nn.Module): method __init__ (line 270) | def __init__(self, config: DacConfig): method forward (line 281) | def forward(self, hidden_state, n_quantizers: int | None = None): method from_codes (line 345) | def from_codes(self, audio_codes: torch.Tensor): method from_latents (line 371) | def from_latents(self, latents: torch.Tensor): class DacDecoder (line 405) | class DacDecoder(nn.Module): method __init__ (line 408) | def __init__(self, config: DacConfig): method forward (line 429) | def forward(self, hidden_state): class DacEncoder (line 442) | class DacEncoder(nn.Module): method __init__ (line 445) | def __init__(self, config: DacConfig): method forward (line 463) | def forward(self, hidden_state): class DacPreTrainedModel (line 476) | class DacPreTrainedModel(PreTrainedAudioTokenizerBase): method _init_weights (line 482) | def _init_weights(self, module): method apply_weight_norm (line 493) | def apply_weight_norm(self): method remove_weight_norm (line 526) | def remove_weight_norm(self): class DacModel (line 561) | class DacModel(DacPreTrainedModel): method __init__ (line 564) | def __init__(self, config: DacConfig): method encode (line 581) | def encode( method decode (line 608) | def decode( method forward (line 641) | def forward( FILE: src/transformers/models/data2vec/configuration_data2vec_audio.py class Data2VecAudioConfig (line 26) | class Data2VecAudioConfig(PreTrainedConfig): method __post_init__ (line 173) | def __post_init__(self, **kwargs): method validate_architecture (line 178) | def validate_architecture(self): method inputs_to_logits_ratio (line 193) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/data2vec/configuration_data2vec_text.py class Data2VecTextConfig (line 24) | class Data2VecTextConfig(PreTrainedConfig): FILE: src/transformers/models/data2vec/configuration_data2vec_vision.py class Data2VecVisionConfig (line 24) | class Data2VecVisionConfig(PreTrainedConfig): FILE: src/transformers/models/data2vec/convert_data2vec_audio_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 56) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 85) | def recursively_load_weights(fairseq_model, hf_model, is_headless): function access_by_string (line 143) | def access_by_string(module, path): function set_weights (line 148) | def set_weights(full_name, module, fsq_value, hf_weight_path): function load_conv_layer (line 158) | def load_conv_layer(full_name, value, feature_extractor, unused_weights): function load_pos_conv_layer (line 176) | def load_pos_conv_layer(full_name, value, pos_conv_embeddings, unused_we... function convert_wav2vec2_checkpoint (line 193) | def convert_wav2vec2_checkpoint( FILE: src/transformers/models/data2vec/convert_data2vec_text_original_pytorch_checkpoint_to_pytorch.py function convert_data2vec_checkpoint_to_pytorch (line 54) | def convert_data2vec_checkpoint_to_pytorch( FILE: src/transformers/models/data2vec/convert_data2vec_vision_original_pytorch_checkpoint_to_pytorch.py function create_rename_keys (line 18) | def create_rename_keys(config, has_lm_head=False, is_semantic=False, hf_... function read_in_q_k_v (line 97) | def read_in_q_k_v(state_dict, config, has_lm_head=False, is_semantic=Fal... function get_args (line 139) | def get_args(): function load_beit_model (line 150) | def load_beit_model(args, is_finetuned, is_large): function main (line 249) | def main(): FILE: src/transformers/models/data2vec/modeling_data2vec_audio.py class Data2VecAudioConvLayer (line 51) | class Data2VecAudioConvLayer(GradientCheckpointingLayer): method __init__ (line 52) | def __init__(self, config, layer_id=0): method forward (line 67) | def forward(self, hidden_states): class Data2VecAudioPadLayer (line 78) | class Data2VecAudioPadLayer(nn.Module): method __init__ (line 79) | def __init__(self, num_conv_pos_embeddings): method forward (line 83) | def forward(self, hidden_states): class Data2VecAudioPositionalConvLayer (line 89) | class Data2VecAudioPositionalConvLayer(nn.Module): method __init__ (line 90) | def __init__(self, config): method forward (line 105) | def forward(self, hidden_states): class Data2VecAudioPositionalConvEmbedding (line 116) | class Data2VecAudioPositionalConvEmbedding(nn.Module): method __init__ (line 117) | def __init__(self, config): method forward (line 123) | def forward(self, hidden_states): class Data2VecAudioFeatureEncoder (line 131) | class Data2VecAudioFeatureEncoder(nn.Module): method __init__ (line 134) | def __init__(self, config): method _freeze_parameters (line 142) | def _freeze_parameters(self): method forward (line 147) | def forward(self, input_values): class Data2VecAudioFeatureProjection (line 160) | class Data2VecAudioFeatureProjection(nn.Module): method __init__ (line 161) | def __init__(self, config): method forward (line 167) | def forward(self, hidden_states): function eager_attention_forward (line 175) | def eager_attention_forward( class Data2VecAudioAttention (line 203) | class Data2VecAudioAttention(nn.Module): method __init__ (line 206) | def __init__( method forward (line 237) | def forward( class Data2VecAudioFeedForward (line 289) | class Data2VecAudioFeedForward(nn.Module): method __init__ (line 290) | def __init__(self, config): method forward (line 303) | def forward(self, hidden_states): class Data2VecAudioEncoderLayer (line 313) | class Data2VecAudioEncoderLayer(GradientCheckpointingLayer): method __init__ (line 314) | def __init__(self, config): method forward (line 329) | def forward(self, hidden_states, attention_mask=None, output_attention... class Data2VecAudioEncoder (line 349) | class Data2VecAudioEncoder(nn.Module): method __init__ (line 350) | def __init__(self, config): method forward (line 359) | def forward( class Data2VecAudioAdapterLayer (line 421) | class Data2VecAudioAdapterLayer(nn.Module): method __init__ (line 422) | def __init__(self, config): method forward (line 432) | def forward(self, hidden_states): class Data2VecAudioAdapter (line 439) | class Data2VecAudioAdapter(nn.Module): method __init__ (line 440) | def __init__(self, config): method forward (line 453) | def forward(self, hidden_states): class Data2VecAudioPreTrainedModel (line 471) | class Data2VecAudioPreTrainedModel(PreTrainedModel): method _init_weights (line 482) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 507) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 528) | def _get_feature_vector_attention_mask( function _compute_mask_indices (line 549) | def _compute_mask_indices( class Data2VecAudioModel (line 672) | class Data2VecAudioModel(Data2VecAudioPreTrainedModel): method __init__ (line 673) | def __init__(self, config: Data2VecAudioConfig): method freeze_feature_encoder (line 690) | def freeze_feature_encoder(self): method _mask_hidden_states (line 697) | def _mask_hidden_states( method forward (line 744) | def forward( class Data2VecAudioForCTC (line 811) | class Data2VecAudioForCTC(Data2VecAudioPreTrainedModel): method __init__ (line 812) | def __init__(self, config): method freeze_feature_encoder (line 839) | def freeze_feature_encoder(self): method forward (line 847) | def forward( class Data2VecAudioForSequenceClassification (line 925) | class Data2VecAudioForSequenceClassification(Data2VecAudioPreTrainedModel): method __init__ (line 926) | def __init__(self, config): method freeze_feature_encoder (line 943) | def freeze_feature_encoder(self): method freeze_base_model (line 950) | def freeze_base_model(self): method forward (line 959) | def forward( class Data2VecAudioForAudioFrameClassification (line 1030) | class Data2VecAudioForAudioFrameClassification(Data2VecAudioPreTrainedMo... method __init__ (line 1031) | def __init__(self, config): method freeze_feature_encoder (line 1047) | def freeze_feature_encoder(self): method freeze_base_model (line 1054) | def freeze_base_model(self): method forward (line 1063) | def forward( class AMSoftmaxLoss (line 1124) | class AMSoftmaxLoss(nn.Module): method __init__ (line 1125) | def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4): method forward (line 1133) | def forward(self, hidden_states, labels): class TDNNLayer (line 1147) | class TDNNLayer(nn.Module): method __init__ (line 1148) | def __init__(self, config, layer_id=0): method forward (line 1158) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecAudioForXVector (line 1184) | class Data2VecAudioForXVector(Data2VecAudioPreTrainedModel): method __init__ (line 1185) | def __init__(self, config): method freeze_feature_encoder (line 1204) | def freeze_feature_encoder(self): method freeze_base_model (line 1211) | def freeze_base_model(self): method _get_tdnn_output_lengths (line 1219) | def _get_tdnn_output_lengths(self, input_lengths: torch.LongTensor | i... method forward (line 1235) | def forward( FILE: src/transformers/models/data2vec/modeling_data2vec_text.py class Data2VecTextEmbeddings (line 55) | class Data2VecTextEmbeddings(nn.Module): method __init__ (line 58) | def __init__(self, config): method forward (line 78) | def forward( method create_position_ids_from_inputs_embeds (line 127) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 145) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 161) | def eager_attention_forward( class Data2VecTextSelfAttention (line 189) | class Data2VecTextSelfAttention(nn.Module): method __init__ (line 190) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 214) | def forward( class Data2VecTextCrossAttention (line 256) | class Data2VecTextCrossAttention(nn.Module): method __init__ (line 257) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 280) | def forward( class Data2VecTextSelfOutput (line 333) | class Data2VecTextSelfOutput(nn.Module): method __init__ (line 334) | def __init__(self, config): method forward (line 340) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Data2VecTextAttention (line 347) | class Data2VecTextAttention(nn.Module): method __init__ (line 348) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 355) | def forward( class Data2VecTextIntermediate (line 376) | class Data2VecTextIntermediate(nn.Module): method __init__ (line 377) | def __init__(self, config): method forward (line 385) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecTextOutput (line 391) | class Data2VecTextOutput(nn.Module): method __init__ (line 392) | def __init__(self, config): method forward (line 398) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Data2VecTextLayer (line 405) | class Data2VecTextLayer(GradientCheckpointingLayer): method __init__ (line 406) | def __init__(self, config, layer_idx=None): method forward (line 425) | def forward( method feed_forward_chunk (line 464) | def feed_forward_chunk(self, attention_output): class Data2VecTextPreTrainedModel (line 471) | class Data2VecTextPreTrainedModel(PreTrainedModel): method _init_weights (line 486) | def _init_weights(self, module): class Data2VecTextEncoder (line 493) | class Data2VecTextEncoder(nn.Module): method __init__ (line 494) | def __init__(self, config): method forward (line 499) | def forward( class Data2VecTextPooler (line 525) | class Data2VecTextPooler(nn.Module): method __init__ (line 526) | def __init__(self, config): method forward (line 531) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecTextModel (line 541) | class Data2VecTextModel(Data2VecTextPreTrainedModel): method __init__ (line 544) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 561) | def get_input_embeddings(self): method set_input_embeddings (line 564) | def set_input_embeddings(self, value): method forward (line 570) | def forward( method _create_attention_masks (line 635) | def _create_attention_masks( class Data2VecTextLMHead (line 668) | class Data2VecTextLMHead(nn.Module): method __init__ (line 671) | def __init__(self, config): method forward (line 679) | def forward(self, features, **kwargs): class Data2VecTextClassificationHead (line 690) | class Data2VecTextClassificationHead(nn.Module): method __init__ (line 693) | def __init__(self, config): method forward (line 702) | def forward(self, features, **kwargs): class Data2VecTextForCausalLM (line 717) | class Data2VecTextForCausalLM(Data2VecTextPreTrainedModel, GenerationMix... method __init__ (line 723) | def __init__(self, config): method get_output_embeddings (line 735) | def get_output_embeddings(self): method set_output_embeddings (line 738) | def set_output_embeddings(self, new_embeddings): method forward (line 743) | def forward( class Data2VecTextForMaskedLM (line 817) | class Data2VecTextForMaskedLM(Data2VecTextPreTrainedModel): method __init__ (line 823) | def __init__(self, config): method get_output_embeddings (line 838) | def get_output_embeddings(self): method set_output_embeddings (line 841) | def set_output_embeddings(self, new_embeddings): method forward (line 846) | def forward( class Data2VecTextForSequenceClassification (line 899) | class Data2VecTextForSequenceClassification(Data2VecTextPreTrainedModel): method __init__ (line 900) | def __init__(self, config): method forward (line 913) | def forward( class Data2VecTextForMultipleChoice (line 975) | class Data2VecTextForMultipleChoice(Data2VecTextPreTrainedModel): method __init__ (line 976) | def __init__(self, config): method forward (line 988) | def forward( class Data2VecTextForTokenClassification (line 1071) | class Data2VecTextForTokenClassification(Data2VecTextPreTrainedModel): method __init__ (line 1072) | def __init__(self, config): method forward (line 1088) | def forward( class Data2VecTextForQuestionAnswering (line 1133) | class Data2VecTextForQuestionAnswering(Data2VecTextPreTrainedModel): method __init__ (line 1134) | def __init__(self, config): method forward (line 1146) | def forward( FILE: src/transformers/models/data2vec/modeling_data2vec_vision.py class Data2VecVisionModelOutputWithPooling (line 50) | class Data2VecVisionModelOutputWithPooling(BaseModelOutputWithPooling): function drop_path (line 60) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class Data2VecVisionDropPath (line 76) | class Data2VecVisionDropPath(nn.Module): method __init__ (line 79) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 83) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 86) | def extra_repr(self) -> str: class Data2VecVisionEmbeddings (line 91) | class Data2VecVisionEmbeddings(nn.Module): method __init__ (line 97) | def __init__(self, config: Data2VecVisionConfig) -> None: method interpolate_pos_encoding (line 120) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 160) | def forward( class Data2VecVisionPatchEmbeddings (line 187) | class Data2VecVisionPatchEmbeddings(nn.Module): method __init__ (line 194) | def __init__(self, config): method forward (line 211) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class Data2VecVisionSelfAttention (line 226) | class Data2VecVisionSelfAttention(nn.Module): method __init__ (line 227) | def __init__(self, config: Data2VecVisionConfig, window_size: tuple | ... method forward (line 250) | def forward( class Data2VecVisionSdpaSelfAttention (line 311) | class Data2VecVisionSdpaSelfAttention(Data2VecVisionSelfAttention): method forward (line 312) | def forward( class Data2VecVisionSelfOutput (line 374) | class Data2VecVisionSelfOutput(nn.Module): method __init__ (line 380) | def __init__(self, config: Data2VecVisionConfig) -> None: method forward (line 385) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Data2VecVisionAttention (line 399) | class Data2VecVisionAttention(nn.Module): method __init__ (line 400) | def __init__(self, config: Data2VecVisionConfig, window_size: tuple | ... method forward (line 407) | def forward( class Data2VecVisionIntermediate (line 426) | class Data2VecVisionIntermediate(nn.Module): method __init__ (line 427) | def __init__(self, config: Data2VecVisionConfig) -> None: method forward (line 435) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecVisionOutput (line 443) | class Data2VecVisionOutput(nn.Module): method __init__ (line 444) | def __init__(self, config: Data2VecVisionConfig) -> None: method forward (line 449) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecVisionLayer (line 457) | class Data2VecVisionLayer(GradientCheckpointingLayer): method __init__ (line 460) | def __init__( method forward (line 480) | def forward( class Data2VecVisionRelativePositionBias (line 523) | class Data2VecVisionRelativePositionBias(nn.Module): method __init__ (line 524) | def __init__(self, config: Data2VecVisionConfig, window_size: tuple) -... method generate_relative_position_index (line 534) | def generate_relative_position_index(self, window_size: tuple[int, int... method forward (line 558) | def forward(self, window_size, interpolate_pos_encoding: bool = False,... class Data2VecVisionEncoder (line 607) | class Data2VecVisionEncoder(nn.Module): method __init__ (line 608) | def __init__(self, config: Data2VecVisionConfig, window_size: tuple | ... method forward (line 629) | def forward( class Data2VecVisionPreTrainedModel (line 681) | class Data2VecVisionPreTrainedModel(PreTrainedModel): method _init_weights (line 692) | def _init_weights(self, module): class Data2VecVisionModel (line 711) | class Data2VecVisionModel(Data2VecVisionPreTrainedModel): method __init__ (line 712) | def __init__(self, config: Data2VecVisionConfig, add_pooling_layer: bo... method get_input_embeddings (line 731) | def get_input_embeddings(self): method forward (line 735) | def forward( class Data2VecVisionPooler (line 783) | class Data2VecVisionPooler(nn.Module): method __init__ (line 784) | def __init__(self, config: Data2VecVisionConfig) -> None: method forward (line 790) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecVisionForImageClassification (line 809) | class Data2VecVisionForImageClassification(Data2VecVisionPreTrainedModel): method __init__ (line 810) | def __init__(self, config: Data2VecVisionConfig) -> None: method forward (line 823) | def forward( class Data2VecVisionConvModule (line 869) | class Data2VecVisionConvModule(nn.Module): method __init__ (line 877) | def __init__( method forward (line 898) | def forward(self, input: torch.Tensor) -> torch.Tensor: class Data2VecVisionPyramidPoolingBlock (line 907) | class Data2VecVisionPyramidPoolingBlock(nn.Module): method __init__ (line 908) | def __init__(self, pool_scale: int, in_channels: int, channels: int) -... method forward (line 917) | def forward(self, input: torch.Tensor) -> torch.Tensor: class Data2VecVisionPyramidPoolingModule (line 925) | class Data2VecVisionPyramidPoolingModule(nn.Module): method __init__ (line 939) | def __init__(self, pool_scales: tuple[int, ...], in_channels: int, cha... method forward (line 953) | def forward(self, x: torch.Tensor) -> list[torch.Tensor]: class Data2VecVisionUperHead (line 965) | class Data2VecVisionUperHead(nn.Module): method __init__ (line 973) | def __init__(self, config: Data2VecVisionConfig) -> None: method psp_forward (line 1011) | def psp_forward(self, inputs): method forward (line 1020) | def forward(self, encoder_hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecVisionFCNHead (line 1051) | class Data2VecVisionFCNHead(nn.Module): method __init__ (line 1066) | def __init__( method forward (line 1104) | def forward(self, encoder_hidden_states: torch.Tensor) -> torch.Tensor: class Data2VecVisionForSemanticSegmentation (line 1116) | class Data2VecVisionForSemanticSegmentation(Data2VecVisionPreTrainedModel): method __init__ (line 1117) | def __init__(self, config: Data2VecVisionConfig) -> None: method compute_loss (line 1149) | def compute_loss(self, logits, auxiliary_logits, labels): method forward (line 1169) | def forward( FILE: src/transformers/models/data2vec/modular_data2vec_audio.py class Data2VecAudioConvLayer (line 42) | class Data2VecAudioConvLayer(GradientCheckpointingLayer): method __init__ (line 43) | def __init__(self, config, layer_id=0): method forward (line 58) | def forward(self, hidden_states): class Data2VecAudioPadLayer (line 69) | class Data2VecAudioPadLayer(Wav2Vec2SamePadLayer): class Data2VecAudioPositionalConvLayer (line 73) | class Data2VecAudioPositionalConvLayer(nn.Module): method __init__ (line 74) | def __init__(self, config): method forward (line 89) | def forward(self, hidden_states): class Data2VecAudioPositionalConvEmbedding (line 100) | class Data2VecAudioPositionalConvEmbedding(nn.Module): method __init__ (line 101) | def __init__(self, config): method forward (line 107) | def forward(self, hidden_states): class Data2VecAudioFeatureEncoder (line 115) | class Data2VecAudioFeatureEncoder(Wav2Vec2FeatureEncoder): method __init__ (line 116) | def __init__(self, config): class Data2VecAudioFeatureProjection (line 125) | class Data2VecAudioFeatureProjection(Wav2Vec2FeatureProjection): class Data2VecAudioEncoder (line 129) | class Data2VecAudioEncoder(Wav2Vec2Encoder): class Data2VecAudioAdapter (line 133) | class Data2VecAudioAdapter(Wav2Vec2Adapter): class Data2VecAudioPreTrainedModel (line 137) | class Data2VecAudioPreTrainedModel(PreTrainedModel, Wav2Vec2PreTrainedMo... method _init_weights (line 148) | def _init_weights(self, module): method _get_adapters (line 173) | def _get_adapters(self): method init_adapter_layers (line 176) | def init_adapter_layers(self): method load_adapter (line 179) | def load_adapter(self): class Data2VecAudioModel (line 186) | class Data2VecAudioModel(Data2VecAudioPreTrainedModel, Wav2Vec2Model): method __init__ (line 187) | def __init__(self, config: Data2VecAudioConfig): method freeze_feature_encoder (line 204) | def freeze_feature_encoder(self): method forward (line 211) | def forward(self, **super_kwargs): class Data2VecAudioForCTC (line 215) | class Data2VecAudioForCTC(Data2VecAudioPreTrainedModel, Wav2Vec2ForCTC): method __init__ (line 216) | def __init__(self, config): method freeze_base_model (line 243) | def freeze_base_model(self): method tie_weights (line 246) | def tie_weights(self): method forward (line 249) | def forward(self, **super_kwargs): class Data2VecAudioForSequenceClassification (line 253) | class Data2VecAudioForSequenceClassification(Wav2Vec2ForSequenceClassifi... class Data2VecAudioForAudioFrameClassification (line 257) | class Data2VecAudioForAudioFrameClassification(Wav2Vec2ForAudioFrameClas... class Data2VecAudioForXVector (line 261) | class Data2VecAudioForXVector(Wav2Vec2ForXVector): FILE: src/transformers/models/data2vec/modular_data2vec_text.py class Data2VecTextEmbeddings (line 50) | class Data2VecTextEmbeddings(RobertaEmbeddings): class Data2VecTextSelfAttention (line 54) | class Data2VecTextSelfAttention(RobertaSelfAttention): class Data2VecTextCrossAttention (line 58) | class Data2VecTextCrossAttention(RobertaCrossAttention): class Data2VecTextLayer (line 62) | class Data2VecTextLayer(RobertaLayer): class Data2VecTextPreTrainedModel (line 67) | class Data2VecTextPreTrainedModel(PreTrainedModel): method _init_weights (line 82) | def _init_weights(self, module): class Data2VecTextModel (line 90) | class Data2VecTextModel(RobertaModel): class Data2VecTextLMHead (line 94) | class Data2VecTextLMHead(RobertaLMHead): class Data2VecTextClassificationHead (line 98) | class Data2VecTextClassificationHead(RobertaClassificationHead): class Data2VecTextForCausalLM (line 107) | class Data2VecTextForCausalLM(Data2VecTextPreTrainedModel, GenerationMix... method __init__ (line 113) | def __init__(self, config): method get_output_embeddings (line 125) | def get_output_embeddings(self): method set_output_embeddings (line 128) | def set_output_embeddings(self, new_embeddings): method forward (line 133) | def forward( class Data2VecTextForMaskedLM (line 207) | class Data2VecTextForMaskedLM(Data2VecTextPreTrainedModel): method __init__ (line 213) | def __init__(self, config): method get_output_embeddings (line 228) | def get_output_embeddings(self): method set_output_embeddings (line 231) | def set_output_embeddings(self, new_embeddings): method forward (line 236) | def forward( class Data2VecTextForSequenceClassification (line 289) | class Data2VecTextForSequenceClassification(Data2VecTextPreTrainedModel): method __init__ (line 290) | def __init__(self, config): method forward (line 303) | def forward( class Data2VecTextForMultipleChoice (line 365) | class Data2VecTextForMultipleChoice(Data2VecTextPreTrainedModel): method __init__ (line 366) | def __init__(self, config): method forward (line 378) | def forward( class Data2VecTextForTokenClassification (line 461) | class Data2VecTextForTokenClassification(Data2VecTextPreTrainedModel): method __init__ (line 462) | def __init__(self, config): method forward (line 478) | def forward( class Data2VecTextForQuestionAnswering (line 523) | class Data2VecTextForQuestionAnswering(Data2VecTextPreTrainedModel): method __init__ (line 524) | def __init__(self, config): method forward (line 536) | def forward( FILE: src/transformers/models/dbrx/configuration_dbrx.py class DbrxAttentionConfig (line 28) | class DbrxAttentionConfig(PreTrainedConfig): class DbrxFFNConfig (line 50) | class DbrxFFNConfig(PreTrainedConfig): method __post_init__ (line 81) | def __post_init__(self, **kwargs): class DbrxConfig (line 104) | class DbrxConfig(PreTrainedConfig): method __post_init__ (line 155) | def __post_init__(self, **kwargs): method validate_architecture (line 169) | def validate_architecture(self): FILE: src/transformers/models/dbrx/modeling_dbrx.py class DbrxRotaryEmbedding (line 44) | class DbrxRotaryEmbedding(nn.Module): method __init__ (line 47) | def __init__(self, config: DbrxConfig, device=None): method compute_default_rope_parameters (line 64) | def compute_default_rope_parameters( method forward (line 95) | def forward(self, x, position_ids): function rotate_half (line 109) | def rotate_half(x): function apply_rotary_pos_emb (line 117) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 142) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 154) | def eager_attention_forward( class DbrxAttention (line 179) | class DbrxAttention(nn.Module): method __init__ (line 182) | def __init__( method forward (line 210) | def forward( class DbrxExpertGLU (line 264) | class DbrxExpertGLU(nn.Module): method __init__ (line 265) | def __init__(self, config): method forward (line 278) | def forward( class DbrxExperts (line 289) | class DbrxExperts(nn.Module): method __init__ (line 290) | def __init__(self, config): method forward (line 297) | def forward( class DbrxRouter (line 328) | class DbrxRouter(nn.Module): method __init__ (line 329) | def __init__(self, config): method forward (line 335) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class DbrxFFN (line 345) | class DbrxFFN(nn.Module): method __init__ (line 348) | def __init__(self, config, **kwargs): method route_tokens_to_experts (line 356) | def route_tokens_to_experts(self, router_logits): method forward (line 365) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class DbrxNormAttentionNorm (line 372) | class DbrxNormAttentionNorm(nn.Module): method __init__ (line 373) | def __init__(self, config: DbrxConfig, layer_idx: int | None = None): method forward (line 384) | def forward( class DbrxBlock (line 412) | class DbrxBlock(GradientCheckpointingLayer): method __init__ (line 413) | def __init__(self, config: DbrxConfig, layer_idx: int): method forward (line 424) | def forward( class DbrxPreTrainedModel (line 446) | class DbrxPreTrainedModel(PreTrainedModel): method _init_weights (line 463) | def _init_weights(self, module: nn.Module): class DbrxModel (line 473) | class DbrxModel(DbrxPreTrainedModel): method __init__ (line 482) | def __init__(self, config: DbrxConfig): method get_input_embeddings (line 496) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 499) | def set_input_embeddings(self, value: nn.Embedding): method forward (line 505) | def forward( function load_balancing_loss_func (line 561) | def load_balancing_loss_func( class DbrxForCausalLM (line 643) | class DbrxForCausalLM(DbrxPreTrainedModel, GenerationMixin): method __init__ (line 648) | def __init__(self, config: DbrxConfig): method get_input_embeddings (line 658) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 661) | def set_input_embeddings(self, value: nn.Embedding): method get_output_embeddings (line 664) | def get_output_embeddings(self) -> nn.Linear: method set_output_embeddings (line 667) | def set_output_embeddings(self, new_embeddings: nn.Linear): method set_decoder (line 670) | def set_decoder(self, decoder: DbrxModel): method get_decoder (line 673) | def get_decoder(self) -> DbrxModel: method forward (line 678) | def forward( FILE: src/transformers/models/dbrx/modular_dbrx.py class DbrxRotaryEmbedding (line 45) | class DbrxRotaryEmbedding(LlamaRotaryEmbedding): class DbrxAttention (line 49) | class DbrxAttention(nn.Module): method __init__ (line 52) | def __init__( method forward (line 80) | def forward( class DbrxExpertGLU (line 134) | class DbrxExpertGLU(nn.Module): method __init__ (line 135) | def __init__(self, config): method forward (line 148) | def forward( class DbrxExperts (line 159) | class DbrxExperts(nn.Module): method __init__ (line 160) | def __init__(self, config): method forward (line 167) | def forward( class DbrxRouter (line 198) | class DbrxRouter(nn.Module): method __init__ (line 199) | def __init__(self, config): method forward (line 205) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class DbrxFFN (line 215) | class DbrxFFN(nn.Module): method __init__ (line 218) | def __init__(self, config, **kwargs): method route_tokens_to_experts (line 226) | def route_tokens_to_experts(self, router_logits): method forward (line 235) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class DbrxNormAttentionNorm (line 242) | class DbrxNormAttentionNorm(nn.Module): method __init__ (line 243) | def __init__(self, config: DbrxConfig, layer_idx: int | None = None): method forward (line 254) | def forward( class DbrxBlock (line 282) | class DbrxBlock(GradientCheckpointingLayer): method __init__ (line 283) | def __init__(self, config: DbrxConfig, layer_idx: int): method forward (line 294) | def forward( class DbrxPreTrainedModel (line 316) | class DbrxPreTrainedModel(PreTrainedModel): method _init_weights (line 333) | def _init_weights(self, module: nn.Module): class DbrxModel (line 343) | class DbrxModel(DbrxPreTrainedModel): method __init__ (line 352) | def __init__(self, config: DbrxConfig): method get_input_embeddings (line 366) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 369) | def set_input_embeddings(self, value: nn.Embedding): method forward (line 375) | def forward( class DbrxForCausalLM (line 431) | class DbrxForCausalLM(DbrxPreTrainedModel, GenerationMixin): method __init__ (line 436) | def __init__(self, config: DbrxConfig): method get_input_embeddings (line 446) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 449) | def set_input_embeddings(self, value: nn.Embedding): method get_output_embeddings (line 452) | def get_output_embeddings(self) -> nn.Linear: method set_output_embeddings (line 455) | def set_output_embeddings(self, new_embeddings: nn.Linear): method set_decoder (line 458) | def set_decoder(self, decoder: DbrxModel): method get_decoder (line 461) | def get_decoder(self) -> DbrxModel: method forward (line 466) | def forward( FILE: src/transformers/models/deberta/configuration_deberta.py class DebertaConfig (line 24) | class DebertaConfig(PreTrainedConfig): method __post_init__ (line 85) | def __post_init__(self, **kwargs): FILE: src/transformers/models/deberta/modeling_deberta.py class DebertaLayerNorm (line 38) | class DebertaLayerNorm(nn.Module): method __init__ (line 41) | def __init__(self, size, eps=1e-12): method forward (line 47) | def forward(self, hidden_states): class DebertaSelfOutput (line 58) | class DebertaSelfOutput(nn.Module): method __init__ (line 59) | def __init__(self, config): method forward (line 65) | def forward(self, hidden_states, input_tensor): function build_relative_position (line 73) | def build_relative_position(query_layer, key_layer): function c2p_dynamic_expand (line 102) | def c2p_dynamic_expand(c2p_pos, query_layer, relative_pos): function p2c_dynamic_expand (line 107) | def p2c_dynamic_expand(c2p_pos, query_layer, key_layer): function pos_dynamic_expand (line 112) | def pos_dynamic_expand(pos_index, p2c_att, key_layer): function scaled_size_sqrt (line 120) | def scaled_size_sqrt(query_layer: torch.Tensor, scale_factor: int): function build_rpos (line 125) | def build_rpos(query_layer: torch.Tensor, key_layer: torch.Tensor, relat... function compute_attention_span (line 133) | def compute_attention_span(query_layer: torch.Tensor, key_layer: torch.T... function uneven_size_corrected (line 138) | def uneven_size_corrected(p2c_att, query_layer: torch.Tensor, key_layer:... class DisentangledSelfAttention (line 149) | class DisentangledSelfAttention(nn.Module): method __init__ (line 160) | def __init__(self, config): method transpose_for_scores (line 198) | def transpose_for_scores(self, x): method forward (line 203) | def forward( method disentangled_att_bias (line 290) | def disentangled_att_bias( class DebertaEmbeddings (line 347) | class DebertaEmbeddings(nn.Module): method __init__ (line 350) | def __init__(self, config): method forward (line 381) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class DebertaAttention (line 428) | class DebertaAttention(nn.Module): method __init__ (line 429) | def __init__(self, config): method forward (line 435) | def forward( class DebertaIntermediate (line 463) | class DebertaIntermediate(nn.Module): method __init__ (line 464) | def __init__(self, config): method forward (line 472) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DebertaOutput (line 478) | class DebertaOutput(nn.Module): method __init__ (line 479) | def __init__(self, config): method forward (line 486) | def forward(self, hidden_states, input_tensor): class DebertaLayer (line 493) | class DebertaLayer(GradientCheckpointingLayer): method __init__ (line 494) | def __init__(self, config): method forward (line 500) | def forward( class DebertaEncoder (line 526) | class DebertaEncoder(nn.Module): method __init__ (line 529) | def __init__(self, config): method get_rel_embedding (line 540) | def get_rel_embedding(self): method get_attention_mask (line 544) | def get_attention_mask(self, attention_mask): method get_rel_pos (line 553) | def get_rel_pos(self, hidden_states, query_states=None, relative_pos=N... method forward (line 561) | def forward( class DebertaPreTrainedModel (line 609) | class DebertaPreTrainedModel(PreTrainedModel): method _init_weights (line 616) | def _init_weights(self, module): class DebertaModel (line 629) | class DebertaModel(DebertaPreTrainedModel): method __init__ (line 630) | def __init__(self, config): method get_input_embeddings (line 640) | def get_input_embeddings(self): method set_input_embeddings (line 643) | def set_input_embeddings(self, new_embeddings): method forward (line 647) | def forward( class LegacyDebertaPredictionHeadTransform (line 729) | class LegacyDebertaPredictionHeadTransform(nn.Module): method __init__ (line 730) | def __init__(self, config): method forward (line 741) | def forward(self, hidden_states): class LegacyDebertaLMPredictionHead (line 748) | class LegacyDebertaLMPredictionHead(nn.Module): method __init__ (line 749) | def __init__(self, config): method forward (line 760) | def forward(self, hidden_states): class LegacyDebertaOnlyMLMHead (line 767) | class LegacyDebertaOnlyMLMHead(nn.Module): method __init__ (line 768) | def __init__(self, config): method forward (line 772) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class DebertaLMPredictionHead (line 777) | class DebertaLMPredictionHead(nn.Module): method __init__ (line 780) | def __init__(self, config): method forward (line 794) | def forward(self, hidden_states, word_embeddings): class DebertaOnlyMLMHead (line 804) | class DebertaOnlyMLMHead(nn.Module): method __init__ (line 805) | def __init__(self, config): method forward (line 810) | def forward(self, sequence_output, word_embeddings): class DebertaForMaskedLM (line 816) | class DebertaForMaskedLM(DebertaPreTrainedModel): method __init__ (line 822) | def __init__(self, config): method get_output_embeddings (line 837) | def get_output_embeddings(self): method set_output_embeddings (line 843) | def set_output_embeddings(self, new_embeddings): method forward (line 852) | def forward( class ContextPooler (line 908) | class ContextPooler(nn.Module): method __init__ (line 909) | def __init__(self, config): method forward (line 915) | def forward(self, hidden_states): method output_dim (line 926) | def output_dim(self): class DebertaForSequenceClassification (line 936) | class DebertaForSequenceClassification(DebertaPreTrainedModel): method __init__ (line 937) | def __init__(self, config): method get_input_embeddings (line 955) | def get_input_embeddings(self): method set_input_embeddings (line 958) | def set_input_embeddings(self, new_embeddings): method forward (line 962) | def forward( class DebertaForTokenClassification (line 1044) | class DebertaForTokenClassification(DebertaPreTrainedModel): method __init__ (line 1045) | def __init__(self, config): method forward (line 1057) | def forward( class DebertaForQuestionAnswering (line 1107) | class DebertaForQuestionAnswering(DebertaPreTrainedModel): method __init__ (line 1108) | def __init__(self, config): method forward (line 1119) | def forward( FILE: src/transformers/models/deberta/tokenization_deberta.py class DebertaTokenizer (line 28) | class DebertaTokenizer(TokenizersBackend): method __init__ (line 97) | def __init__( method mask_token (line 167) | def mask_token(self) -> str: method mask_token (line 182) | def mask_token(self, value): FILE: src/transformers/models/deberta_v2/configuration_deberta_v2.py class DebertaV2Config (line 24) | class DebertaV2Config(PreTrainedConfig): method __post_init__ (line 85) | def __post_init__(self, **kwargs): FILE: src/transformers/models/deberta_v2/modeling_deberta_v2.py class DebertaV2SelfOutput (line 42) | class DebertaV2SelfOutput(nn.Module): method __init__ (line 43) | def __init__(self, config): method forward (line 49) | def forward(self, hidden_states, input_tensor): function make_log_bucket_position (line 57) | def make_log_bucket_position(relative_pos, bucket_size: int, max_positio... function build_relative_position (line 72) | def build_relative_position(query_layer, key_layer, bucket_size: int = -... function c2p_dynamic_expand (line 105) | def c2p_dynamic_expand(c2p_pos, query_layer, relative_pos): function p2c_dynamic_expand (line 110) | def p2c_dynamic_expand(c2p_pos, query_layer, key_layer): function pos_dynamic_expand (line 115) | def pos_dynamic_expand(pos_index, p2c_att, key_layer): function scaled_size_sqrt (line 120) | def scaled_size_sqrt(query_layer: torch.Tensor, scale_factor: int): function build_rpos (line 125) | def build_rpos(query_layer, key_layer, relative_pos, position_buckets: i... class DisentangledSelfAttention (line 137) | class DisentangledSelfAttention(nn.Module): method __init__ (line 148) | def __init__(self, config): method transpose_for_scores (line 186) | def transpose_for_scores(self, x, attention_heads) -> torch.Tensor: method forward (line 191) | def forward( method disentangled_attention_bias (line 276) | def disentangled_attention_bias(self, query_layer, key_layer, relative... class DebertaV2Attention (line 349) | class DebertaV2Attention(nn.Module): method __init__ (line 350) | def __init__(self, config): method forward (line 356) | def forward( class DebertaV2Intermediate (line 384) | class DebertaV2Intermediate(nn.Module): method __init__ (line 385) | def __init__(self, config): method forward (line 393) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DebertaV2Output (line 400) | class DebertaV2Output(nn.Module): method __init__ (line 401) | def __init__(self, config): method forward (line 408) | def forward(self, hidden_states, input_tensor): class DebertaV2Layer (line 416) | class DebertaV2Layer(GradientCheckpointingLayer): method __init__ (line 417) | def __init__(self, config): method forward (line 423) | def forward( class ConvLayer (line 449) | class ConvLayer(nn.Module): method __init__ (line 450) | def __init__(self, config): method forward (line 462) | def forward(self, hidden_states, residual_states, input_mask): class DebertaV2Embeddings (line 486) | class DebertaV2Embeddings(nn.Module): method __init__ (line 489) | def __init__(self, config): method forward (line 520) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class DebertaV2Encoder (line 567) | class DebertaV2Encoder(nn.Module): method __init__ (line 570) | def __init__(self, config): method get_rel_embedding (line 597) | def get_rel_embedding(self): method get_attention_mask (line 603) | def get_attention_mask(self, attention_mask): method get_rel_pos (line 612) | def get_rel_pos(self, hidden_states, query_states=None, relative_pos=N... method forward (line 630) | def forward( class DebertaV2PreTrainedModel (line 686) | class DebertaV2PreTrainedModel(PreTrainedModel): method _init_weights (line 693) | def _init_weights(self, module): class DebertaV2Model (line 704) | class DebertaV2Model(DebertaV2PreTrainedModel): method __init__ (line 705) | def __init__(self, config): method get_input_embeddings (line 715) | def get_input_embeddings(self): method set_input_embeddings (line 718) | def set_input_embeddings(self, new_embeddings): method forward (line 722) | def forward( class LegacyDebertaV2PredictionHeadTransform (line 805) | class LegacyDebertaV2PredictionHeadTransform(nn.Module): method __init__ (line 806) | def __init__(self, config): method forward (line 817) | def forward(self, hidden_states): class LegacyDebertaV2LMPredictionHead (line 824) | class LegacyDebertaV2LMPredictionHead(nn.Module): method __init__ (line 825) | def __init__(self, config): method forward (line 836) | def forward(self, hidden_states): class LegacyDebertaV2OnlyMLMHead (line 842) | class LegacyDebertaV2OnlyMLMHead(nn.Module): method __init__ (line 843) | def __init__(self, config): method forward (line 847) | def forward(self, sequence_output): class DebertaV2LMPredictionHead (line 852) | class DebertaV2LMPredictionHead(nn.Module): method __init__ (line 855) | def __init__(self, config): method forward (line 869) | def forward(self, hidden_states, word_embeddings): class DebertaV2OnlyMLMHead (line 877) | class DebertaV2OnlyMLMHead(nn.Module): method __init__ (line 878) | def __init__(self, config): method forward (line 883) | def forward(self, sequence_output, word_embeddings): class DebertaV2ForMaskedLM (line 889) | class DebertaV2ForMaskedLM(DebertaV2PreTrainedModel): method __init__ (line 896) | def __init__(self, config): method get_output_embeddings (line 910) | def get_output_embeddings(self): method set_output_embeddings (line 916) | def set_output_embeddings(self, new_embeddings): method forward (line 926) | def forward( class ContextPooler (line 983) | class ContextPooler(nn.Module): method __init__ (line 984) | def __init__(self, config): method forward (line 990) | def forward(self, hidden_states): method output_dim (line 1001) | def output_dim(self): class DebertaV2ForSequenceClassification (line 1011) | class DebertaV2ForSequenceClassification(DebertaV2PreTrainedModel): method __init__ (line 1012) | def __init__(self, config): method get_input_embeddings (line 1030) | def get_input_embeddings(self): method set_input_embeddings (line 1033) | def set_input_embeddings(self, new_embeddings): method forward (line 1038) | def forward( class DebertaV2ForTokenClassification (line 1121) | class DebertaV2ForTokenClassification(DebertaV2PreTrainedModel): method __init__ (line 1122) | def __init__(self, config): method forward (line 1134) | def forward( class DebertaV2ForQuestionAnswering (line 1184) | class DebertaV2ForQuestionAnswering(DebertaV2PreTrainedModel): method __init__ (line 1185) | def __init__(self, config): method forward (line 1197) | def forward( class DebertaV2ForMultipleChoice (line 1262) | class DebertaV2ForMultipleChoice(DebertaV2PreTrainedModel): method __init__ (line 1263) | def __init__(self, config): method get_input_embeddings (line 1280) | def get_input_embeddings(self): method set_input_embeddings (line 1283) | def set_input_embeddings(self, new_embeddings): method forward (line 1287) | def forward( FILE: src/transformers/models/deberta_v2/tokenization_deberta_v2.py class DebertaV2Tokenizer (line 28) | class DebertaV2Tokenizer(TokenizersBackend): method __init__ (line 76) | def __init__( FILE: src/transformers/models/decision_transformer/configuration_decision_transformer.py class DecisionTransformerConfig (line 24) | class DecisionTransformerConfig(PreTrainedConfig): FILE: src/transformers/models/decision_transformer/modeling_decision_transformer.py function eager_attention_forward (line 47) | def eager_attention_forward(module, query, key, value, attention_mask, s... class DecisionTransformerGPT2Attention (line 69) | class DecisionTransformerGPT2Attention(nn.Module): method __init__ (line 70) | def __init__(self, config, is_cross_attention=False, layer_idx=None): method _upcast_and_reordered_attn (line 107) | def _upcast_and_reordered_attn(self, query, key, value, attention_mask... method forward (line 138) | def forward( class DecisionTransformerGPT2MLP (line 224) | class DecisionTransformerGPT2MLP(nn.Module): method __init__ (line 225) | def __init__(self, intermediate_size, config): method forward (line 233) | def forward(self, hidden_states: tuple[torch.FloatTensor] | None) -> t... class DecisionTransformerGPT2Block (line 242) | class DecisionTransformerGPT2Block(GradientCheckpointingLayer): method __init__ (line 244) | def __init__(self, config, layer_idx=None): method forward (line 261) | def forward( class DecisionTransformerGPT2PreTrainedModel (line 312) | class DecisionTransformerGPT2PreTrainedModel(PreTrainedModel): method _init_weights (line 327) | def _init_weights(self, module): class DecisionTransformerGPT2Model (line 344) | class DecisionTransformerGPT2Model(DecisionTransformerGPT2PreTrainedModel): method __init__ (line 345) | def __init__(self, config): method get_input_embeddings (line 364) | def get_input_embeddings(self): method set_input_embeddings (line 367) | def set_input_embeddings(self, new_embeddings): method forward (line 372) | def forward( class DecisionTransformerOutput (line 467) | class DecisionTransformerOutput(ModelOutput): class DecisionTransformerPreTrainedModel (line 485) | class DecisionTransformerPreTrainedModel(PreTrainedModel): class DecisionTransformerModel (line 502) | class DecisionTransformerModel(DecisionTransformerPreTrainedModel): method __init__ (line 510) | def __init__(self, config): method forward (line 536) | def forward( FILE: src/transformers/models/deepseek_v2/configuration_deepseek_v2.py class DeepseekV2Config (line 30) | class DeepseekV2Config(PreTrainedConfig): method __post_init__ (line 113) | def __post_init__(self, **kwargs): method validate_architecture (line 122) | def validate_architecture(self): FILE: src/transformers/models/deepseek_v2/modeling_deepseek_v2.py class DeepseekV2Experts (line 46) | class DeepseekV2Experts(nn.Module): method __init__ (line 49) | def __init__(self, config): method forward (line 58) | def forward( class DeepseekV2Moe (line 85) | class DeepseekV2Moe(nn.Module): method __init__ (line 86) | def __init__(self, config: DeepseekV2Config): method route_tokens_to_experts (line 100) | def route_tokens_to_experts(self, router_logits): method forward (line 122) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DeepseekV2MLP (line 133) | class DeepseekV2MLP(nn.Module): method __init__ (line 134) | def __init__(self, config: DeepseekV2Config, hidden_size=None, interme... method forward (line 144) | def forward(self, x): class DeepseekV2RMSNorm (line 150) | class DeepseekV2RMSNorm(nn.Module): method __init__ (line 151) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 159) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 166) | def extra_repr(self): class DeepseekV2RotaryEmbedding (line 170) | class DeepseekV2RotaryEmbedding(nn.Module): method __init__ (line 173) | def __init__(self, config: DeepseekV2Config, device=None): method compute_default_rope_parameters (line 190) | def compute_default_rope_parameters( method forward (line 221) | def forward(self, x, position_ids): function repeat_kv (line 234) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 246) | def eager_attention_forward( function apply_rotary_emb (line 271) | def apply_rotary_emb( class DeepseekV2Attention (line 287) | class DeepseekV2Attention(nn.Module): method __init__ (line 290) | def __init__(self, config: DeepseekV2Config, layer_idx: int | None = N... method forward (line 337) | def forward( class DeepseekV2DecoderLayer (line 398) | class DeepseekV2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 399) | def __init__(self, config: DeepseekV2Config, layer_idx: int): method forward (line 409) | def forward( class DeepseekV2PreTrainedModel (line 442) | class DeepseekV2PreTrainedModel(PreTrainedModel): method _init_weights (line 460) | def _init_weights(self, module): class DeepseekV2Model (line 468) | class DeepseekV2Model(DeepseekV2PreTrainedModel): method __init__ (line 469) | def __init__(self, config: DeepseekV2Config): method forward (line 488) | def forward( class DeepseekV2ForCausalLM (line 542) | class DeepseekV2ForCausalLM(DeepseekV2PreTrainedModel, GenerationMixin): method __init__ (line 547) | def __init__(self, config): method forward (line 558) | def forward( class DeepseekV2ForSequenceClassification (line 615) | class DeepseekV2ForSequenceClassification(GenericForSequenceClassificati... FILE: src/transformers/models/deepseek_v2/modular_deepseek_v2.py class DeepseekV2Config (line 48) | class DeepseekV2Config(LlamaConfig): method __post_init__ (line 124) | def __post_init__(self, **kwargs): function apply_rotary_emb (line 129) | def apply_rotary_emb( class DeepseekV2Experts (line 145) | class DeepseekV2Experts(Qwen2MoeExperts): method __init__ (line 146) | def __init__(self, config): class DeepseekV2Moe (line 151) | class DeepseekV2Moe(nn.Module): method __init__ (line 152) | def __init__(self, config: DeepseekV2Config): method route_tokens_to_experts (line 166) | def route_tokens_to_experts(self, router_logits): method forward (line 188) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DeepseekV2MLP (line 199) | class DeepseekV2MLP(LlamaMLP): method __init__ (line 200) | def __init__(self, config: DeepseekV2Config, hidden_size=None, interme... class DeepseekV2RMSNorm (line 206) | class DeepseekV2RMSNorm(LlamaRMSNorm): class DeepseekV2RotaryEmbedding (line 210) | class DeepseekV2RotaryEmbedding(LlamaRotaryEmbedding): method forward (line 213) | def forward(self, x, position_ids): class DeepseekV2Attention (line 226) | class DeepseekV2Attention(nn.Module): method __init__ (line 229) | def __init__(self, config: DeepseekV2Config, layer_idx: int | None = N... method forward (line 276) | def forward( class DeepseekV2DecoderLayer (line 337) | class DeepseekV2DecoderLayer(LlamaDecoderLayer): method __init__ (line 338) | def __init__(self, config: DeepseekV2Config, layer_idx: int): class DeepseekV2PreTrainedModel (line 348) | class DeepseekV2PreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 350) | def _init_weights(self, module): class DeepseekV2Model (line 357) | class DeepseekV2Model(LlamaModel): class DeepseekV2ForCausalLM (line 361) | class DeepseekV2ForCausalLM(LlamaForCausalLM): class DeepseekV2ForSequenceClassification (line 365) | class DeepseekV2ForSequenceClassification(LlamaForSequenceClassification): FILE: src/transformers/models/deepseek_v3/configuration_deepseek_v3.py class DeepseekV3Config (line 27) | class DeepseekV3Config(PreTrainedConfig): method __post_init__ (line 106) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 114) | def convert_rope_params_to_dict(self, **kwargs): FILE: src/transformers/models/deepseek_v3/modeling_deepseek_v3.py class DeepseekV3RMSNorm (line 38) | class DeepseekV3RMSNorm(nn.Module): method __init__ (line 39) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 47) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 54) | def extra_repr(self): class DeepseekV3RotaryEmbedding (line 58) | class DeepseekV3RotaryEmbedding(nn.Module): method __init__ (line 61) | def __init__(self, config: DeepseekV3Config, device=None): method compute_default_rope_parameters (line 78) | def compute_default_rope_parameters( method forward (line 109) | def forward(self, x, position_ids): class DeepseekV3MLP (line 123) | class DeepseekV3MLP(nn.Module): method __init__ (line 124) | def __init__(self, config, intermediate_size=None): method forward (line 134) | def forward(self, x): class DeepseekV3TopkRouter (line 139) | class DeepseekV3TopkRouter(nn.Module): method __init__ (line 140) | def __init__(self, config): method forward (line 148) | def forward(self, hidden_states): class DeepseekV3NaiveMoe (line 155) | class DeepseekV3NaiveMoe(nn.Module): method __init__ (line 158) | def __init__(self, config): method forward (line 167) | def forward( class DeepseekV3MoE (line 194) | class DeepseekV3MoE(nn.Module): method __init__ (line 199) | def __init__(self, config): method route_tokens_to_experts (line 214) | def route_tokens_to_experts(self, router_logits): method forward (line 239) | def forward(self, hidden_states): function rotate_half (line 250) | def rotate_half(x): function apply_rotary_pos_emb (line 258) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 283) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 295) | def eager_attention_forward( function apply_rotary_pos_emb_interleave (line 320) | def apply_rotary_pos_emb_interleave(q, k, cos, sin, position_ids=None, u... function yarn_get_mscale (line 358) | def yarn_get_mscale(scale=1, mscale=1): class DeepseekV3Attention (line 364) | class DeepseekV3Attention(nn.Module): method __init__ (line 367) | def __init__(self, config: DeepseekV3Config, layer_idx: int): method forward (line 416) | def forward( class DeepseekV3DecoderLayer (line 482) | class DeepseekV3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 483) | def __init__(self, config: DeepseekV3Config, layer_idx: int): method forward (line 497) | def forward( class DeepseekV3PreTrainedModel (line 530) | class DeepseekV3PreTrainedModel(PreTrainedModel): method _init_weights (line 550) | def _init_weights(self, module): class DeepseekV3Model (line 561) | class DeepseekV3Model(DeepseekV3PreTrainedModel): method __init__ (line 562) | def __init__(self, config: DeepseekV3Config): method forward (line 581) | def forward( class DeepseekV3ForCausalLM (line 635) | class DeepseekV3ForCausalLM(DeepseekV3PreTrainedModel, GenerationMixin): method __init__ (line 640) | def __init__(self, config): method forward (line 651) | def forward( class DeepseekV3ForSequenceClassification (line 708) | class DeepseekV3ForSequenceClassification(GenericForSequenceClassificati... class DeepseekV3ForTokenClassification (line 712) | class DeepseekV3ForTokenClassification(GenericForTokenClassification, De... FILE: src/transformers/models/deepseek_v3/modular_deepseek_v3.py class DeepseekV3RMSNorm (line 35) | class DeepseekV3RMSNorm(LlamaRMSNorm): class DeepseekV3RotaryEmbedding (line 39) | class DeepseekV3RotaryEmbedding(LlamaRotaryEmbedding): class DeepseekV3MLP (line 43) | class DeepseekV3MLP(Qwen2MoeMLP): function apply_rotary_pos_emb_interleave (line 47) | def apply_rotary_pos_emb_interleave(q, k, cos, sin, position_ids=None, u... function yarn_get_mscale (line 85) | def yarn_get_mscale(scale=1, mscale=1): class DeepseekV3TopkRouter (line 91) | class DeepseekV3TopkRouter(nn.Module): method __init__ (line 92) | def __init__(self, config): method forward (line 100) | def forward(self, hidden_states): class DeepseekV3NaiveMoe (line 106) | class DeepseekV3NaiveMoe(MixtralExperts): method __init__ (line 107) | def __init__(self, config): class DeepseekV3MoE (line 113) | class DeepseekV3MoE(nn.Module): method __init__ (line 118) | def __init__(self, config): method route_tokens_to_experts (line 133) | def route_tokens_to_experts(self, router_logits): method forward (line 158) | def forward(self, hidden_states): class DeepseekV3Attention (line 169) | class DeepseekV3Attention(nn.Module): method __init__ (line 172) | def __init__(self, config: DeepseekV3Config, layer_idx: int): method forward (line 221) | def forward( class DeepseekV3DecoderLayer (line 287) | class DeepseekV3DecoderLayer(LlamaDecoderLayer): method __init__ (line 288) | def __init__(self, config: DeepseekV3Config, layer_idx: int): class DeepseekV3PreTrainedModel (line 303) | class DeepseekV3PreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 308) | def _init_weights(self, module): class DeepseekV3Model (line 318) | class DeepseekV3Model(LlamaModel): class DeepseekV3ForCausalLM (line 322) | class DeepseekV3ForCausalLM(LlamaForCausalLM): class DeepseekV3ForSequenceClassification (line 326) | class DeepseekV3ForSequenceClassification(GenericForSequenceClassificati... class DeepseekV3ForTokenClassification (line 330) | class DeepseekV3ForTokenClassification(GenericForTokenClassification, De... FILE: src/transformers/models/deepseek_vl/configuration_deepseek_vl.py class DeepseekVLConfig (line 34) | class DeepseekVLConfig(PreTrainedConfig): method __post_init__ (line 59) | def __post_init__(self, **kwargs): FILE: src/transformers/models/deepseek_vl/convert_deepseek_vl_weights_to_hf.py function convert_old_keys_to_new_keys (line 112) | def convert_old_keys_to_new_keys(state_dict_keys: dict): function get_qkv_state_dict (line 127) | def get_qkv_state_dict(key, parameter): function update_state_dict (line 148) | def update_state_dict(old_state_dict): function load_model_state_dict (line 173) | def load_model_state_dict(input_path: str) -> dict: function convert_model (line 206) | def convert_model( function main (line 321) | def main(): FILE: src/transformers/models/deepseek_vl/image_processing_deepseek_vl.py class DeepseekVLImageProcessorKwargs (line 33) | class DeepseekVLImageProcessorKwargs(ImagesKwargs, total=False): class DeepseekVLImageProcessor (line 44) | class DeepseekVLImageProcessor(TorchvisionBackend): method __init__ (line 56) | def __init__(self, **kwargs: Unpack[DeepseekVLImageProcessorKwargs]): method resize (line 64) | def resize( method pad_to_square (line 91) | def pad_to_square( method _preprocess (line 141) | def _preprocess( method postprocess (line 184) | def postprocess(self) -> "torch.Tensor": FILE: src/transformers/models/deepseek_vl/image_processing_pil_deepseek_vl.py class DeepseekVLImageProcessorKwargs (line 39) | class DeepseekVLImageProcessorKwargs(ImagesKwargs, total=False): class DeepseekVLImageProcessorPil (line 50) | class DeepseekVLImageProcessorPil(PilBackend): method __init__ (line 62) | def __init__(self, **kwargs: Unpack[DeepseekVLImageProcessorKwargs]): method preprocess (line 72) | def preprocess(self, images: ImageInput, **kwargs: Unpack[DeepseekVLIm... method resize (line 75) | def resize( method pad_to_square (line 105) | def pad_to_square( method _preprocess (line 139) | def _preprocess( method postprocess (line 169) | def postprocess(self): FILE: src/transformers/models/deepseek_vl/modeling_deepseek_vl.py class DeepseekVLBaseModelOutputWithPast (line 43) | class DeepseekVLBaseModelOutputWithPast(ModelOutput): class DeepseekVLCausalLMOutputWithPast (line 76) | class DeepseekVLCausalLMOutputWithPast(ModelOutput): class DeepseekVLAligner (line 102) | class DeepseekVLAligner(nn.Module): method __init__ (line 103) | def __init__(self, config): method forward (line 114) | def forward(self, vision_encodings: torch.Tensor) -> torch.Tensor: class DeepseekVLPreTrainedModel (line 122) | class DeepseekVLPreTrainedModel(PreTrainedModel): class DeepseekVLModel (line 136) | class DeepseekVLModel(DeepseekVLPreTrainedModel): method __init__ (line 137) | def __init__(self, config): method get_input_embeddings (line 150) | def get_input_embeddings(self): method set_input_embeddings (line 153) | def set_input_embeddings(self, value): method get_image_features (line 158) | def get_image_features( method get_placeholder_mask (line 166) | def get_placeholder_mask( method forward (line 192) | def forward( class DeepseekVLForConditionalGeneration (line 239) | class DeepseekVLForConditionalGeneration(DeepseekVLPreTrainedModel, Gene... method __init__ (line 244) | def __init__(self, config: DeepseekVLConfig): method get_input_embeddings (line 253) | def get_input_embeddings(self): method set_input_embeddings (line 256) | def set_input_embeddings(self, value): method forward (line 261) | def forward( method prepare_inputs_for_generation (line 310) | def prepare_inputs_for_generation( FILE: src/transformers/models/deepseek_vl/modular_deepseek_vl.py class DeepseekVLConfig (line 44) | class DeepseekVLConfig(PreTrainedConfig): method __post_init__ (line 69) | def __post_init__(self, **kwargs): class DeepseekVLBaseModelOutputWithPast (line 87) | class DeepseekVLBaseModelOutputWithPast(IdeficsBaseModelOutputWithPast): class DeepseekVLCausalLMOutputWithPast (line 91) | class DeepseekVLCausalLMOutputWithPast(IdeficsCausalLMOutputWithPast): class DeepseekVLAligner (line 95) | class DeepseekVLAligner(nn.Module): method __init__ (line 96) | def __init__(self, config): method forward (line 107) | def forward(self, vision_encodings: torch.Tensor) -> torch.Tensor: class DeepseekVLPreTrainedModel (line 114) | class DeepseekVLPreTrainedModel(JanusPreTrainedModel): method _init_weights (line 117) | def _init_weights(self, module): class DeepseekVLModel (line 122) | class DeepseekVLModel(JanusModel): method __init__ (line 123) | def __init__(self, config): class DeepseekVLForConditionalGeneration (line 142) | class DeepseekVLForConditionalGeneration(JanusForConditionalGeneration): method prepare_embeddings_for_image_generation (line 145) | def prepare_embeddings_for_image_generation(self): method decode_image_tokens (line 148) | def decode_image_tokens(self): method generate (line 151) | def generate(self): class DeepseekVLImageProcessorKwargs (line 155) | class DeepseekVLImageProcessorKwargs(ImagesKwargs, total=False): class DeepseekVLImageProcessorPil (line 165) | class DeepseekVLImageProcessorPil(JanusImageProcessorPil): method postprocess (line 166) | def postprocess(self): method unnormalize (line 169) | def unnormalize(self): class DeepseekVLImageProcessor (line 173) | class DeepseekVLImageProcessor(JanusImageProcessor): method postprocess (line 174) | def postprocess(self): class DeepseekVLProcessorKwargs (line 178) | class DeepseekVLProcessorKwargs(ProcessingKwargs, total=False): class DeepseekVLProcessor (line 186) | class DeepseekVLProcessor(ProcessorMixin): method __init__ (line 187) | def __init__( method __call__ (line 204) | def __call__( method batch_decode (line 246) | def batch_decode(self, *args, **kwargs): method decode (line 253) | def decode(self, *args, **kwargs): method model_input_names (line 261) | def model_input_names(self): FILE: src/transformers/models/deepseek_vl/processing_deepseek_vl.py class DeepseekVLProcessorKwargs (line 29) | class DeepseekVLProcessorKwargs(ProcessingKwargs, total=False): class DeepseekVLProcessor (line 37) | class DeepseekVLProcessor(ProcessorMixin): method __init__ (line 38) | def __init__( method __call__ (line 55) | def __call__( method batch_decode (line 97) | def batch_decode(self, *args, **kwargs): method decode (line 104) | def decode(self, *args, **kwargs): method model_input_names (line 112) | def model_input_names(self): FILE: src/transformers/models/deepseek_vl_hybrid/configuration_deepseek_vl_hybrid.py class DeepseekVLHybridConfig (line 33) | class DeepseekVLHybridConfig(PreTrainedConfig): method __post_init__ (line 63) | def __post_init__(self, **kwargs): FILE: src/transformers/models/deepseek_vl_hybrid/convert_deepseek_vl_hybrid_weights_to_hf.py function convert_old_keys_to_new_keys (line 139) | def convert_old_keys_to_new_keys(state_dict_keys: dict): function get_qkv_state_dict (line 154) | def get_qkv_state_dict(key, parameter): function update_state_dict (line 175) | def update_state_dict(old_state_dict): function load_model_state_dict (line 200) | def load_model_state_dict(input_path: str) -> dict: function convert_model (line 233) | def convert_model( function main (line 359) | def main(): FILE: src/transformers/models/deepseek_vl_hybrid/image_processing_deepseek_vl_hybrid.py class DeepseekVLHybridImageProcessorKwargs (line 35) | class DeepseekVLHybridImageProcessorKwargs(ImagesKwargs, total=False): class DeepseekVLHybridImageProcessor (line 62) | class DeepseekVLHybridImageProcessor(TorchvisionBackend): method __init__ (line 79) | def __init__(self, **kwargs: Unpack[DeepseekVLHybridImageProcessorKwar... method resize (line 92) | def resize( method pad_to_square (line 119) | def pad_to_square( method _preprocess (line 169) | def _preprocess( method postprocess (line 254) | def postprocess(self) -> "torch.Tensor": method _standardize_kwargs (line 257) | def _standardize_kwargs( FILE: src/transformers/models/deepseek_vl_hybrid/image_processing_pil_deepseek_vl_hybrid.py class DeepseekVLHybridImageProcessorKwargs (line 41) | class DeepseekVLHybridImageProcessorKwargs(ImagesKwargs, total=False): class DeepseekVLHybridImageProcessorPil (line 68) | class DeepseekVLHybridImageProcessorPil(PilBackend): method __init__ (line 85) | def __init__(self, **kwargs: Unpack[DeepseekVLHybridImageProcessorKwar... method preprocess (line 99) | def preprocess(self, images: ImageInput, **kwargs: Unpack[DeepseekVLHy... method resize (line 102) | def resize( method pad_to_square (line 132) | def pad_to_square( method _preprocess (line 166) | def _preprocess( method postprocess (line 217) | def postprocess(self): method _standardize_kwargs (line 221) | def _standardize_kwargs( FILE: src/transformers/models/deepseek_vl_hybrid/modeling_deepseek_vl_hybrid.py class BaseModelOutputWithHighResVisionEncodings (line 39) | class BaseModelOutputWithHighResVisionEncodings(BaseModelOutputWithPooli... class DeepseekVLHybridBaseModelOutputWithPast (line 67) | class DeepseekVLHybridBaseModelOutputWithPast(ModelOutput): class DeepseekVLHybridCausalLMOutputWithPast (line 100) | class DeepseekVLHybridCausalLMOutputWithPast(ModelOutput): class DeepseekVLHybridLayerNorm (line 126) | class DeepseekVLHybridLayerNorm(nn.LayerNorm): method __init__ (line 132) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 138) | def forward(self, features: torch.Tensor) -> torch.Tensor: class DeepseekVLSamVisionNeck (line 152) | class DeepseekVLSamVisionNeck(nn.Module): method __init__ (line 153) | def __init__(self, config): method forward (line 162) | def forward(self, hidden_states): class DeepseekVLSamVisionProj (line 172) | class DeepseekVLSamVisionProj(nn.Module): method __init__ (line 173) | def __init__(self, config, output_size: int = 24): method forward (line 185) | def forward(self, features: torch.Tensor) -> torch.Tensor: class DeepseekVLHybridAligner (line 198) | class DeepseekVLHybridAligner(nn.Module): method __init__ (line 199) | def __init__(self, config: DeepseekVLHybridConfig): method forward (line 212) | def forward( class DeepseekVLHybridPreTrainedModel (line 228) | class DeepseekVLHybridPreTrainedModel(PreTrainedModel): method _init_weights (line 241) | def _init_weights(self, module): class DeepseekVLHybridModel (line 266) | class DeepseekVLHybridModel(DeepseekVLHybridPreTrainedModel): method __init__ (line 267) | def __init__(self, config): method get_input_embeddings (line 289) | def get_input_embeddings(self): method set_input_embeddings (line 292) | def set_input_embeddings(self, value): method get_image_features (line 297) | def get_image_features( method get_placeholder_mask (line 317) | def get_placeholder_mask( method forward (line 343) | def forward( method get_low_res_image_features (line 400) | def get_low_res_image_features(self, pixel_values: torch.FloatTensor, ... method get_high_res_image_features (line 403) | def get_high_res_image_features( class DeepseekVLHybridForConditionalGeneration (line 433) | class DeepseekVLHybridForConditionalGeneration(DeepseekVLHybridPreTraine... method __init__ (line 438) | def __init__(self, config: DeepseekVLHybridConfig): method get_input_embeddings (line 447) | def get_input_embeddings(self): method set_input_embeddings (line 450) | def set_input_embeddings(self, value): method forward (line 455) | def forward( method prepare_inputs_for_generation (line 506) | def prepare_inputs_for_generation( FILE: src/transformers/models/deepseek_vl_hybrid/modular_deepseek_vl_hybrid.py class DeepseekVLHybridConfig (line 76) | class DeepseekVLHybridConfig(DeepseekVLConfig): method __post_init__ (line 101) | def __post_init__(self, **kwargs): class BaseModelOutputWithHighResVisionEncodings (line 119) | class BaseModelOutputWithHighResVisionEncodings(BaseModelOutputWithPooli... class DeepseekVLHybridBaseModelOutputWithPast (line 141) | class DeepseekVLHybridBaseModelOutputWithPast(IdeficsBaseModelOutputWith... class DeepseekVLHybridCausalLMOutputWithPast (line 145) | class DeepseekVLHybridCausalLMOutputWithPast(IdeficsCausalLMOutputWithPa... class DeepseekVLHybridLayerNorm (line 149) | class DeepseekVLHybridLayerNorm(SamLayerNorm): class DeepseekVLSamVisionNeck (line 153) | class DeepseekVLSamVisionNeck(SamVisionNeck): method __init__ (line 154) | def __init__(self, config): class DeepseekVLSamVisionProj (line 158) | class DeepseekVLSamVisionProj(nn.Module): method __init__ (line 159) | def __init__(self, config, output_size: int = 24): method forward (line 171) | def forward(self, features: torch.Tensor) -> torch.Tensor: class DeepseekVLHybridAligner (line 184) | class DeepseekVLHybridAligner(nn.Module): method __init__ (line 185) | def __init__(self, config: DeepseekVLHybridConfig): method forward (line 198) | def forward( class DeepseekVLHybridPreTrainedModel (line 213) | class DeepseekVLHybridPreTrainedModel(DeepseekVLPreTrainedModel): method _init_weights (line 215) | def _init_weights(self, module): class DeepseekVLHybridModel (line 232) | class DeepseekVLHybridModel(DeepseekVLModel): method __init__ (line 233) | def __init__(self, config): method get_low_res_image_features (line 246) | def get_low_res_image_features(self, pixel_values: torch.FloatTensor, ... method get_high_res_image_features (line 249) | def get_high_res_image_features( method get_image_features (line 280) | def get_image_features( method forward (line 302) | def forward( class DeepseekVLHybridForConditionalGeneration (line 360) | class DeepseekVLHybridForConditionalGeneration(DeepseekVLForConditionalG... method forward (line 363) | def forward( method prepare_inputs_for_generation (line 414) | def prepare_inputs_for_generation( class DeepseekVLHybridImageProcessorKwargs (line 447) | class DeepseekVLHybridImageProcessorKwargs(ImagesKwargs, total=False): class DeepseekVLHybridImageProcessorPil (line 473) | class DeepseekVLHybridImageProcessorPil(DeepseekVLImageProcessorPil): method __init__ (line 480) | def __init__(self, **kwargs: Unpack[DeepseekVLHybridImageProcessorKwar... method _standardize_kwargs (line 493) | def _standardize_kwargs( method _preprocess (line 532) | def _preprocess( class DeepseekVLHybridImageProcessor (line 584) | class DeepseekVLHybridImageProcessor(DeepseekVLImageProcessor): method __init__ (line 591) | def __init__(self, **kwargs: Unpack[DeepseekVLHybridImageProcessorKwar... method _standardize_kwargs (line 604) | def _standardize_kwargs( method _preprocess (line 643) | def _preprocess( class DeepseekVLHybridProcessorKwargs (line 729) | class DeepseekVLHybridProcessorKwargs(DeepseekVLProcessorKwargs): class DeepseekVLHybridProcessor (line 733) | class DeepseekVLHybridProcessor(DeepseekVLProcessor): method __call__ (line 734) | def __call__( FILE: src/transformers/models/deepseek_vl_hybrid/processing_deepseek_vl_hybrid.py class DeepseekVLHybridProcessorKwargs (line 28) | class DeepseekVLHybridProcessorKwargs(ProcessingKwargs, total=False): class DeepseekVLHybridProcessor (line 36) | class DeepseekVLHybridProcessor(ProcessorMixin): method __init__ (line 37) | def __init__( method __call__ (line 54) | def __call__( method batch_decode (line 98) | def batch_decode(self, *args, **kwargs): method decode (line 105) | def decode(self, *args, **kwargs): method model_input_names (line 113) | def model_input_names(self): FILE: src/transformers/models/deformable_detr/configuration_deformable_detr.py class DeformableDetrConfig (line 26) | class DeformableDetrConfig(PreTrainedConfig): method __post_init__ (line 120) | def __post_init__(self, **kwargs): method validate_architecture (line 142) | def validate_architecture(self): FILE: src/transformers/models/deformable_detr/convert_deformable_detr_to_pytorch.py function rename_key (line 34) | def rename_key(orig_key): function read_in_q_k_v (line 63) | def read_in_q_k_v(state_dict): function prepare_img (line 79) | def prepare_img(): function convert_deformable_detr_checkpoint (line 88) | def convert_deformable_detr_checkpoint( FILE: src/transformers/models/deformable_detr/image_processing_deformable_detr.py class DeformableDetrImageProcessorKwargs (line 54) | class DeformableDetrImageProcessorKwargs(ImagesKwargs, total=False): function convert_coco_poly_to_mask (line 72) | def convert_coco_poly_to_mask(segmentations, height: int, width: int, de... function prepare_coco_detection_annotation (line 107) | def prepare_coco_detection_annotation( function masks_to_boxes (line 171) | def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor: function rgb_to_id (line 208) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 219) | def prepare_coco_panoptic_annotation( class DeformableDetrImageProcessor (line 269) | class DeformableDetrImageProcessor(TorchvisionBackend): method __init__ (line 283) | def __init__(self, **kwargs: Unpack[DeformableDetrImageProcessorKwargs... method prepare_annotation (line 300) | def prepare_annotation( method resize (line 332) | def resize( method resize_annotation (line 377) | def resize_annotation( method normalize_annotation (line 434) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 449) | def _update_annotation_for_padded_image( method pad (line 484) | def pad( method preprocess (line 515) | def preprocess( method _preprocess (line 533) | def _preprocess( method post_process_object_detection (line 649) | def post_process_object_detection( FILE: src/transformers/models/deformable_detr/image_processing_pil_deformable_detr.py class DeformableDetrImageProcessorKwargs (line 61) | class DeformableDetrImageProcessorKwargs(ImagesKwargs, total=False): function convert_coco_poly_to_mask (line 79) | def convert_coco_poly_to_mask(segmentations, height: int, width: int) ->... function prepare_coco_detection_annotation (line 114) | def prepare_coco_detection_annotation( function masks_to_boxes (line 174) | def masks_to_boxes(masks: np.ndarray) -> np.ndarray: function rgb_to_id (line 211) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 222) | def prepare_coco_panoptic_annotation( class DeformableDetrImageProcessorPil (line 264) | class DeformableDetrImageProcessorPil(PilBackend): method __init__ (line 278) | def __init__(self, **kwargs: Unpack[DeformableDetrImageProcessorKwargs... method prepare_annotation (line 298) | def prepare_annotation( method resize (line 330) | def resize( method resize_annotation (line 384) | def resize_annotation( method normalize_annotation (line 437) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 450) | def _update_annotation_for_padded_image( method pad (line 494) | def pad( method preprocess (line 533) | def preprocess( method _preprocess (line 551) | def _preprocess( method post_process_object_detection (line 678) | def post_process_object_detection( FILE: src/transformers/models/deformable_detr/modeling_deformable_detr.py class DeformableDetrDecoderOutput (line 53) | class DeformableDetrDecoderOutput(BaseModelOutputWithCrossAttentions): class DeformableDetrModelOutput (line 77) | class DeformableDetrModelOutput(ModelOutput): class DeformableDetrObjectDetectionOutput (line 115) | class DeformableDetrObjectDetectionOutput(ModelOutput): class MultiScaleDeformableAttention (line 171) | class MultiScaleDeformableAttention(nn.Module): method forward (line 172) | def forward( class DeformableDetrFrozenBatchNorm2d (line 225) | class DeformableDetrFrozenBatchNorm2d(nn.Module): method __init__ (line 233) | def __init__(self, n): method _load_from_state_dict (line 240) | def _load_from_state_dict( method forward (line 251) | def forward(self, x): function replace_batch_norm (line 264) | def replace_batch_norm(model): class DeformableDetrConvEncoder (line 288) | class DeformableDetrConvEncoder(nn.Module): method __init__ (line 296) | def __init__(self, config): method forward (line 326) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class DeformableDetrSinePositionEmbedding (line 340) | class DeformableDetrSinePositionEmbedding(nn.Module): method __init__ (line 346) | def __init__( method forward (line 362) | def forward( class DeformableDetrLearnedPositionEmbedding (line 392) | class DeformableDetrLearnedPositionEmbedding(nn.Module): method __init__ (line 397) | def __init__(self, embedding_dim=256): method forward (line 403) | def forward( function eager_attention_forward (line 425) | def eager_attention_forward( class DeformableDetrSelfAttention (line 453) | class DeformableDetrSelfAttention(nn.Module): method __init__ (line 460) | def __init__( method forward (line 480) | def forward( class DeformableDetrMultiscaleDeformableAttention (line 519) | class DeformableDetrMultiscaleDeformableAttention(nn.Module): method __init__ (line 524) | def __init__(self, config: DeformableDetrConfig, num_heads: int, n_poi... method forward (line 556) | def forward( class DeformableDetrMLP (line 626) | class DeformableDetrMLP(nn.Module): method __init__ (line 627) | def __init__(self, config: DeformableDetrConfig, hidden_size: int, int... method forward (line 635) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DeformableDetrEncoderLayer (line 643) | class DeformableDetrEncoderLayer(GradientCheckpointingLayer): method __init__ (line 644) | def __init__(self, config: DeformableDetrConfig): method forward (line 657) | def forward( class DeformableDetrDecoderLayer (line 713) | class DeformableDetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 714) | def __init__(self, config: DeformableDetrConfig): method forward (line 736) | def forward( class DeformableDetrPreTrainedModel (line 809) | class DeformableDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 829) | def _init_weights(self, module): class DeformableDetrEncoder (line 873) | class DeformableDetrEncoder(DeformableDetrPreTrainedModel): method __init__ (line 889) | def __init__(self, config: DeformableDetrConfig): method forward (line 900) | def forward( method get_reference_points (line 950) | def get_reference_points(spatial_shapes_list, valid_ratios, device): function inverse_sigmoid (line 981) | def inverse_sigmoid(x, eps=1e-5): class DeformableDetrDecoder (line 988) | class DeformableDetrDecoder(DeformableDetrPreTrainedModel): method __init__ (line 1011) | def __init__(self, config: DeformableDetrConfig): method forward (line 1026) | def forward( class DeformableDetrModel (line 1130) | class DeformableDetrModel(DeformableDetrPreTrainedModel): method __init__ (line 1131) | def __init__(self, config: DeformableDetrConfig): method freeze_backbone (line 1204) | def freeze_backbone(self): method unfreeze_backbone (line 1208) | def unfreeze_backbone(self): method get_valid_ratio (line 1212) | def get_valid_ratio(self, mask, dtype=torch.float32): method get_proposal_pos_embed (line 1223) | def get_proposal_pos_embed(self, proposals): method gen_encoder_output_proposals (line 1243) | def gen_encoder_output_proposals(self, enc_output, padding_mask, spati... method forward (line 1306) | def forward( class DeformableDetrMLPPredictionHead (line 1499) | class DeformableDetrMLPPredictionHead(nn.Module): method __init__ (line 1506) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 1512) | def forward(self, x): class DeformableDetrForObjectDetection (line 1524) | class DeformableDetrForObjectDetection(DeformableDetrPreTrainedModel): method __init__ (line 1533) | def __init__(self, config: DeformableDetrConfig): method forward (line 1564) | def forward( FILE: src/transformers/models/deformable_detr/modular_deformable_detr.py class DeformableDetrImageProcessorKwargs (line 64) | class DeformableDetrImageProcessorKwargs(ImagesKwargs, total=False): class DeformableDetrImageProcessor (line 78) | class DeformableDetrImageProcessor(DetrImageProcessor): method post_process_object_detection (line 79) | def post_process_object_detection( method post_process_instance_segmentation (line 138) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 141) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 144) | def post_process_panoptic_segmentation(self): class DeformableDetrImageProcessorPil (line 148) | class DeformableDetrImageProcessorPil(DetrImageProcessorPil): method post_process_object_detection (line 150) | def post_process_object_detection( method post_process_instance_segmentation (line 210) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 213) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 216) | def post_process_panoptic_segmentation(self): class DeformableDetrDecoderOutput (line 220) | class DeformableDetrDecoderOutput(DetrDecoderOutput): class DeformableDetrModelOutput (line 242) | class DeformableDetrModelOutput(ModelOutput): class DeformableDetrObjectDetectionOutput (line 274) | class DeformableDetrObjectDetectionOutput(DetrObjectDetectionOutput): function inverse_sigmoid (line 316) | def inverse_sigmoid(x, eps=1e-5): class MultiScaleDeformableAttention (line 324) | class MultiScaleDeformableAttention(nn.Module): method forward (line 325) | def forward( class DeformableDetrConvEncoder (line 378) | class DeformableDetrConvEncoder(DetrConvEncoder): method __init__ (line 379) | def __init__(self, config): class DeformableDetrSinePositionEmbedding (line 410) | class DeformableDetrSinePositionEmbedding(DetrSinePositionEmbedding): method forward (line 411) | def forward( class DeformableDetrLearnedPositionEmbedding (line 441) | class DeformableDetrLearnedPositionEmbedding(DetrLearnedPositionEmbedding): class DeformableDetrSelfAttention (line 445) | class DeformableDetrSelfAttention(DetrSelfAttention): class DeformableDetrMultiscaleDeformableAttention (line 449) | class DeformableDetrMultiscaleDeformableAttention(nn.Module): method __init__ (line 454) | def __init__(self, config: DeformableDetrConfig, num_heads: int, n_poi... method forward (line 486) | def forward( class DeformableDetrMLP (line 556) | class DeformableDetrMLP(DetrMLP): class DeformableDetrEncoderLayer (line 560) | class DeformableDetrEncoderLayer(DetrEncoderLayer): method __init__ (line 561) | def __init__(self, config: DeformableDetrConfig): method forward (line 569) | def forward( class DeformableDetrDecoderLayer (line 614) | class DeformableDetrDecoderLayer(DetrDecoderLayer): method __init__ (line 615) | def __init__(self, config: DeformableDetrConfig): method forward (line 623) | def forward( class DeformableDetrPreTrainedModel (line 696) | class DeformableDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 716) | def _init_weights(self, module): class DeformableDetrEncoder (line 760) | class DeformableDetrEncoder(DetrEncoder): method forward (line 778) | def forward( method get_reference_points (line 828) | def get_reference_points(spatial_shapes_list, valid_ratios, device): class DeformableDetrDecoder (line 859) | class DeformableDetrDecoder(DeformableDetrPreTrainedModel): method __init__ (line 882) | def __init__(self, config: DeformableDetrConfig): method forward (line 897) | def forward( class DeformableDetrModel (line 1001) | class DeformableDetrModel(DeformableDetrPreTrainedModel): method __init__ (line 1002) | def __init__(self, config: DeformableDetrConfig): method freeze_backbone (line 1075) | def freeze_backbone(self): method unfreeze_backbone (line 1079) | def unfreeze_backbone(self): method get_valid_ratio (line 1083) | def get_valid_ratio(self, mask, dtype=torch.float32): method get_proposal_pos_embed (line 1094) | def get_proposal_pos_embed(self, proposals): method gen_encoder_output_proposals (line 1114) | def gen_encoder_output_proposals(self, enc_output, padding_mask, spati... method forward (line 1177) | def forward( class DeformableDetrMLPPredictionHead (line 1370) | class DeformableDetrMLPPredictionHead(DetrMLPPredictionHead): class DeformableDetrForObjectDetection (line 1380) | class DeformableDetrForObjectDetection(DeformableDetrPreTrainedModel): method __init__ (line 1389) | def __init__(self, config: DeformableDetrConfig): method forward (line 1420) | def forward( FILE: src/transformers/models/deit/configuration_deit.py class DeiTConfig (line 24) | class DeiTConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/deit/convert_deit_timm_to_pytorch.py function create_rename_keys (line 36) | def create_rename_keys(config, base_model=False): function read_in_q_k_v (line 92) | def read_in_q_k_v(state_dict, config, base_model=False): function rename_key (line 118) | def rename_key(dct, old, new): function prepare_img (line 124) | def prepare_img(): function convert_deit_checkpoint (line 132) | def convert_deit_checkpoint(deit_name, pytorch_dump_folder_path): FILE: src/transformers/models/deit/image_processing_deit.py class DeiTImageProcessor (line 22) | class DeiTImageProcessor(TorchvisionBackend): FILE: src/transformers/models/deit/image_processing_pil_deit.py class DeiTImageProcessorPil (line 22) | class DeiTImageProcessorPil(PilBackend): FILE: src/transformers/models/deit/modeling_deit.py class DeiTEmbeddings (line 43) | class DeiTEmbeddings(nn.Module): method __init__ (line 48) | def __init__(self, config: DeiTConfig, use_mask_token: bool = False) -... method interpolate_pos_encoding (line 60) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 100) | def forward( class DeiTPatchEmbeddings (line 132) | class DeiTPatchEmbeddings(nn.Module): method __init__ (line 139) | def __init__(self, config): method forward (line 154) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 165) | def eager_attention_forward( class DeiTSelfAttention (line 194) | class DeiTSelfAttention(nn.Module): method __init__ (line 195) | def __init__(self, config: DeiTConfig): method forward (line 215) | def forward( class DeiTSelfOutput (line 250) | class DeiTSelfOutput(nn.Module): method __init__ (line 256) | def __init__(self, config: DeiTConfig): method forward (line 261) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class DeiTAttention (line 268) | class DeiTAttention(nn.Module): method __init__ (line 269) | def __init__(self, config: DeiTConfig): method forward (line 274) | def forward( class DeiTIntermediate (line 285) | class DeiTIntermediate(nn.Module): method __init__ (line 286) | def __init__(self, config: DeiTConfig): method forward (line 294) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DeiTOutput (line 301) | class DeiTOutput(nn.Module): method __init__ (line 302) | def __init__(self, config: DeiTConfig): method forward (line 307) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class DeiTLayer (line 315) | class DeiTLayer(GradientCheckpointingLayer): method __init__ (line 318) | def __init__(self, config: DeiTConfig): method forward (line 328) | def forward( class DeiTEncoder (line 350) | class DeiTEncoder(nn.Module): method __init__ (line 351) | def __init__(self, config: DeiTConfig): method forward (line 357) | def forward( class DeiTPreTrainedModel (line 369) | class DeiTPreTrainedModel(PreTrainedModel): method _init_weights (line 386) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class DeiTModel (line 404) | class DeiTModel(DeiTPreTrainedModel): method __init__ (line 405) | def __init__(self, config: DeiTConfig, add_pooling_layer: bool = True,... method get_input_embeddings (line 424) | def get_input_embeddings(self) -> DeiTPatchEmbeddings: method forward (line 430) | def forward( class DeiTPooler (line 466) | class DeiTPooler(nn.Module): method __init__ (line 467) | def __init__(self, config: DeiTConfig): method forward (line 472) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DeiTForMaskedImageModeling (line 493) | class DeiTForMaskedImageModeling(DeiTPreTrainedModel): method __init__ (line 494) | def __init__(self, config: DeiTConfig) -> None: method forward (line 513) | def forward( class DeiTForImageClassification (line 595) | class DeiTForImageClassification(DeiTPreTrainedModel): method __init__ (line 596) | def __init__(self, config: DeiTConfig) -> None: method forward (line 610) | def forward( class DeiTForImageClassificationWithTeacherOutput (line 680) | class DeiTForImageClassificationWithTeacherOutput(ModelOutput): class DeiTForImageClassificationWithTeacher (line 710) | class DeiTForImageClassificationWithTeacher(DeiTPreTrainedModel): method __init__ (line 711) | def __init__(self, config: DeiTConfig) -> None: method forward (line 730) | def forward( FILE: src/transformers/models/depth_anything/configuration_depth_anything.py class DepthAnythingConfig (line 26) | class DepthAnythingConfig(PreTrainedConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): method validate_architecture (line 93) | def validate_architecture(self): FILE: src/transformers/models/depth_anything/convert_depth_anything_to_hf.py function get_dpt_config (line 34) | def get_dpt_config(model_name): function create_rename_keys (line 79) | def create_rename_keys(config): function read_in_q_k_v (line 152) | def read_in_q_k_v(state_dict, config): function rename_key (line 171) | def rename_key(dct, old, new): function prepare_img (line 177) | def prepare_img(): function convert_dpt_checkpoint (line 202) | def convert_dpt_checkpoint(model_name, pytorch_dump_folder_path, push_to... FILE: src/transformers/models/depth_anything/convert_distill_any_depth_to_hf.py function get_dpt_config (line 57) | def get_dpt_config(model_name): function convert_key_pattern (line 98) | def convert_key_pattern(key, mapping): function convert_keys (line 108) | def convert_keys(state_dict, config): function prepare_img (line 134) | def prepare_img(): function convert_dpt_checkpoint (line 149) | def convert_dpt_checkpoint(model_name, pytorch_dump_folder_path, push_to... FILE: src/transformers/models/depth_anything/modeling_depth_anything.py class DepthAnythingReassembleLayer (line 31) | class DepthAnythingReassembleLayer(nn.Module): method __init__ (line 32) | def __init__(self, config, channels, factor): method forward (line 46) | def forward(self, hidden_state): class DepthAnythingReassembleStage (line 53) | class DepthAnythingReassembleStage(nn.Module): method __init__ (line 68) | def __init__(self, config): method forward (line 76) | def forward(self, hidden_states: list[torch.Tensor], patch_height=None... class DepthAnythingPreActResidualLayer (line 96) | class DepthAnythingPreActResidualLayer(nn.Module): method __init__ (line 105) | def __init__(self, config): method forward (line 128) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class DepthAnythingFeatureFusionLayer (line 138) | class DepthAnythingFeatureFusionLayer(nn.Module): method __init__ (line 146) | def __init__(self, config): method forward (line 154) | def forward(self, hidden_state, residual=None, size=None): class DepthAnythingFeatureFusionStage (line 177) | class DepthAnythingFeatureFusionStage(nn.Module): method __init__ (line 179) | def __init__(self, config: DepthAnythingConfig): method forward (line 185) | def forward(self, hidden_states, size=None): class DepthAnythingPreTrainedModel (line 209) | class DepthAnythingPreTrainedModel(PreTrainedModel): class DepthAnythingNeck (line 217) | class DepthAnythingNeck(nn.Module): method __init__ (line 229) | def __init__(self, config): method forward (line 242) | def forward(self, hidden_states: list[torch.Tensor], patch_height=None... class DepthAnythingDepthEstimationHead (line 265) | class DepthAnythingDepthEstimationHead(nn.Module): method __init__ (line 273) | def __init__(self, config): method forward (line 292) | def forward(self, hidden_states: list[torch.Tensor], patch_height, pat... class DepthAnythingForDepthEstimation (line 316) | class DepthAnythingForDepthEstimation(DepthAnythingPreTrainedModel): method __init__ (line 319) | def __init__(self, config): method forward (line 330) | def forward( FILE: src/transformers/models/depth_pro/configuration_depth_pro.py class DepthProConfig (line 30) | class DepthProConfig(PreTrainedConfig): method __post_init__ (line 99) | def __post_init__(self, **kwargs): method validate_architecture (line 144) | def validate_architecture(self): FILE: src/transformers/models/depth_pro/convert_depth_pro_weights_to_hf.py function convert_old_keys_to_new_keys (line 96) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function get_qkv_state_dict (line 110) | def get_qkv_state_dict(key, parameter): function write_model (line 131) | def write_model( function write_image_processor (line 203) | def write_image_processor(output_dir: str): function main (line 209) | def main(): FILE: src/transformers/models/depth_pro/image_processing_depth_pro.py class DepthProImageProcessor (line 46) | class DepthProImageProcessor(TorchvisionBackend): method _preprocess (line 55) | def _preprocess( method post_process_depth_estimation (line 85) | def post_process_depth_estimation( FILE: src/transformers/models/depth_pro/modeling_depth_pro.py class DepthProOutput (line 39) | class DepthProOutput(ModelOutput): class DepthProDepthEstimatorOutput (line 59) | class DepthProDepthEstimatorOutput(ModelOutput): function split_to_patches (line 74) | def split_to_patches(pixel_values: torch.Tensor, patch_size: int, overla... function reshape_features (line 91) | def reshape_features(hidden_states: torch.Tensor) -> torch.Tensor: function merge_patches (line 103) | def merge_patches(patches: torch.Tensor, batch_size: int, padding: int) ... function reconstruct_feature_maps (line 181) | def reconstruct_feature_maps( class DepthProPatchEncoder (line 220) | class DepthProPatchEncoder(nn.Module): method __init__ (line 221) | def __init__(self, config: DepthProConfig): method forward (line 238) | def forward( class DepthProImageEncoder (line 336) | class DepthProImageEncoder(nn.Module): method __init__ (line 337) | def __init__(self, config: DepthProConfig): method forward (line 344) | def forward( class DepthProEncoder (line 391) | class DepthProEncoder(nn.Module): method __init__ (line 392) | def __init__(self, config: DepthProConfig): method forward (line 408) | def forward( class DepthProFeatureUpsampleBlock (line 441) | class DepthProFeatureUpsampleBlock(nn.Module): method __init__ (line 442) | def __init__( method forward (line 481) | def forward(self, features: torch.Tensor) -> torch.Tensor: class DepthProFeatureUpsample (line 487) | class DepthProFeatureUpsample(nn.Module): method __init__ (line 488) | def __init__(self, config: DepthProConfig): method forward (line 530) | def forward(self, features: list[torch.Tensor]) -> list[torch.Tensor]: class DepthProFeatureProjection (line 542) | class DepthProFeatureProjection(nn.Module): method __init__ (line 543) | def __init__(self, config: DepthProConfig): method forward (line 565) | def forward(self, features: list[torch.Tensor]) -> list[torch.Tensor]: class DepthProNeck (line 573) | class DepthProNeck(nn.Module): method __init__ (line 574) | def __init__(self, config: DepthProConfig): method forward (line 589) | def forward(self, features: list[torch.Tensor]) -> list[torch.Tensor]: class DepthProPreTrainedModel (line 603) | class DepthProPreTrainedModel(PreTrainedModel): method _init_weights (line 614) | def _init_weights(self, module): class DepthProModel (line 630) | class DepthProModel(DepthProPreTrainedModel): method __init__ (line 631) | def __init__(self, config): method get_input_embeddings (line 639) | def get_input_embeddings(self): method forward (line 643) | def forward( class DepthProPreActResidualLayer (line 705) | class DepthProPreActResidualLayer(nn.Module): method __init__ (line 714) | def __init__(self, config: DepthProConfig): method forward (line 748) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class DepthProFeatureFusionLayer (line 768) | class DepthProFeatureFusionLayer(nn.Module): method __init__ (line 769) | def __init__(self, config: DepthProConfig, use_deconv: bool = True): method forward (line 789) | def forward(self, hidden_state: torch.Tensor, residual: torch.Tensor |... class DepthProFeatureFusionStage (line 804) | class DepthProFeatureFusionStage(nn.Module): method __init__ (line 805) | def __init__(self, config): method forward (line 817) | def forward(self, hidden_states: list[torch.Tensor]) -> list[torch.Ten... class DepthProFovEncoder (line 841) | class DepthProFovEncoder(nn.Module): method __init__ (line 842) | def __init__(self, config: DepthProConfig): method forward (line 850) | def forward( class DepthProFovHead (line 886) | class DepthProFovHead(nn.Module): method __init__ (line 887) | def __init__(self, config: DepthProConfig): method forward (line 915) | def forward(self, features: torch.Tensor) -> torch.Tensor: class DepthProFovModel (line 927) | class DepthProFovModel(nn.Module): method __init__ (line 928) | def __init__(self, config: DepthProConfig): method forward (line 940) | def forward( class DepthProDepthEstimationHead (line 957) | class DepthProDepthEstimationHead(nn.Module): method __init__ (line 965) | def __init__(self, config): method forward (line 988) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DepthProForDepthEstimation (line 1001) | class DepthProForDepthEstimation(DepthProPreTrainedModel): method __init__ (line 1002) | def __init__(self, config, use_fov_model=None): method forward (line 1027) | def forward( FILE: src/transformers/models/detr/configuration_detr.py class DetrConfig (line 26) | class DetrConfig(PreTrainedConfig): method __post_init__ (line 92) | def __post_init__(self, **kwargs): FILE: src/transformers/models/detr/convert_detr_original_pytorch_checkpoint_to_pytorch.py function rename_key (line 110) | def rename_key(state_dict, old, new): function rename_backbone_keys (line 115) | def rename_backbone_keys(state_dict): function read_in_q_k_v (line 127) | def read_in_q_k_v(state_dict, is_panoptic=False): function prepare_img (line 171) | def prepare_img(): function convert_detr_checkpoint (line 179) | def convert_detr_checkpoint(model_name, pytorch_dump_folder_path): FILE: src/transformers/models/detr/convert_detr_to_pytorch.py function get_detr_config (line 34) | def get_detr_config(model_name): function create_rename_keys (line 61) | def create_rename_keys(config): function rename_key (line 231) | def rename_key(state_dict, old, new): function read_in_q_k_v (line 236) | def read_in_q_k_v(state_dict, is_panoptic=False): function prepare_img (line 280) | def prepare_img(): function convert_detr_checkpoint (line 289) | def convert_detr_checkpoint(model_name, pytorch_dump_folder_path=None, p... FILE: src/transformers/models/detr/image_processing_detr.py class DetrImageProcessorKwargs (line 60) | class DetrImageProcessorKwargs(ImagesKwargs, total=False): function binary_mask_to_rle (line 74) | def binary_mask_to_rle(mask): function convert_segmentation_to_rle (line 98) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 119) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... function check_segment_validity (line 147) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 165) | def compute_segments( function convert_coco_poly_to_mask (line 226) | def convert_coco_poly_to_mask(segmentations, height: int, width: int, de... function prepare_coco_detection_annotation (line 261) | def prepare_coco_detection_annotation( function masks_to_boxes (line 325) | def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor: function rgb_to_id (line 362) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 373) | def prepare_coco_panoptic_annotation( class DetrImageProcessor (line 423) | class DetrImageProcessor(TorchvisionBackend): method __init__ (line 437) | def __init__(self, **kwargs: Unpack[DetrImageProcessorKwargs]) -> None: method prepare_annotation (line 454) | def prepare_annotation( method resize (line 486) | def resize( method resize_annotation (line 531) | def resize_annotation( method normalize_annotation (line 588) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 603) | def _update_annotation_for_padded_image( method pad (line 638) | def pad( method preprocess (line 669) | def preprocess( method _preprocess (line 687) | def _preprocess( method post_process_object_detection (line 804) | def post_process_object_detection( method post_process_semantic_segmentation (line 857) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... method post_process_instance_segmentation (line 904) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 987) | def post_process_panoptic_segmentation( FILE: src/transformers/models/detr/image_processing_pil_detr.py function convert_coco_poly_to_mask (line 66) | def convert_coco_poly_to_mask(segmentations, height: int, width: int) ->... function prepare_coco_detection_annotation (line 101) | def prepare_coco_detection_annotation( function masks_to_boxes (line 161) | def masks_to_boxes(masks: np.ndarray) -> np.ndarray: function rgb_to_id (line 198) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 209) | def prepare_coco_panoptic_annotation( class DetrImageProcessorKwargs (line 251) | class DetrImageProcessorKwargs(ImagesKwargs, total=False): function binary_mask_to_rle (line 266) | def binary_mask_to_rle(mask): function check_segment_validity (line 291) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 310) | def compute_segments( function convert_segmentation_to_rle (line 374) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 398) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... class DetrImageProcessorPil (line 427) | class DetrImageProcessorPil(PilBackend): method __init__ (line 441) | def __init__(self, **kwargs: Unpack[DetrImageProcessorKwargs]) -> None: method prepare_annotation (line 461) | def prepare_annotation( method resize (line 493) | def resize( method resize_annotation (line 547) | def resize_annotation( method normalize_annotation (line 600) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 613) | def _update_annotation_for_padded_image( method pad (line 657) | def pad( method preprocess (line 696) | def preprocess( method _preprocess (line 714) | def _preprocess( method post_process_object_detection (line 841) | def post_process_object_detection( method post_process_semantic_segmentation (line 900) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... method post_process_instance_segmentation (line 953) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 1042) | def post_process_panoptic_segmentation( FILE: src/transformers/models/detr/modeling_detr.py class DetrDecoderOutput (line 58) | class DetrDecoderOutput(BaseModelOutputWithCrossAttentions): class DetrModelOutput (line 80) | class DetrModelOutput(Seq2SeqModelOutput): class DetrObjectDetectionOutput (line 98) | class DetrObjectDetectionOutput(ModelOutput): class DetrSegmentationOutput (line 141) | class DetrSegmentationOutput(ModelOutput): class DetrFrozenBatchNorm2d (line 185) | class DetrFrozenBatchNorm2d(nn.Module): method __init__ (line 193) | def __init__(self, n): method _load_from_state_dict (line 200) | def _load_from_state_dict( method forward (line 211) | def forward(self, x): function replace_batch_norm (line 224) | def replace_batch_norm(model): class DetrConvEncoder (line 248) | class DetrConvEncoder(nn.Module): method __init__ (line 256) | def __init__(self, config): method forward (line 286) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class DetrSinePositionEmbedding (line 300) | class DetrSinePositionEmbedding(nn.Module): method __init__ (line 306) | def __init__( method forward (line 322) | def forward( class DetrLearnedPositionEmbedding (line 352) | class DetrLearnedPositionEmbedding(nn.Module): method __init__ (line 357) | def __init__(self, embedding_dim=256): method forward (line 363) | def forward( function eager_attention_forward (line 386) | def eager_attention_forward( class DetrSelfAttention (line 414) | class DetrSelfAttention(nn.Module): method __init__ (line 421) | def __init__( method forward (line 441) | def forward( class DetrCrossAttention (line 480) | class DetrCrossAttention(nn.Module): method __init__ (line 488) | def __init__( method forward (line 508) | def forward( class DetrMLP (line 560) | class DetrMLP(nn.Module): method __init__ (line 561) | def __init__(self, config: DetrConfig, hidden_size: int, intermediate_... method forward (line 569) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DetrEncoderLayer (line 577) | class DetrEncoderLayer(GradientCheckpointingLayer): method __init__ (line 578) | def __init__(self, config: DetrConfig): method forward (line 592) | def forward( class DetrDecoderLayer (line 634) | class DetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 635) | def __init__(self, config: DetrConfig): method forward (line 658) | def forward( class DetrConvBlock (line 726) | class DetrConvBlock(nn.Module): method __init__ (line 729) | def __init__(self, in_channels: int, out_channels: int, activation: st... method forward (line 735) | def forward(self, x: torch.Tensor) -> torch.Tensor: class DetrFPNFusionStage (line 739) | class DetrFPNFusionStage(nn.Module): method __init__ (line 742) | def __init__(self, fpn_channels: int, current_channels: int, output_ch... method forward (line 747) | def forward(self, features: torch.Tensor, fpn_features: torch.Tensor) ... class DetrMaskHeadSmallConv (line 761) | class DetrMaskHeadSmallConv(nn.Module): method __init__ (line 769) | def __init__( method forward (line 794) | def forward( class DetrMHAttentionMap (line 828) | class DetrMHAttentionMap(nn.Module): method __init__ (line 831) | def __init__( method forward (line 846) | def forward( class DetrPreTrainedModel (line 880) | class DetrPreTrainedModel(PreTrainedModel): method _init_weights (line 896) | def _init_weights(self, module): class DetrEncoder (line 929) | class DetrEncoder(DetrPreTrainedModel): method __init__ (line 940) | def __init__(self, config: DetrConfig): method forward (line 951) | def forward( class DetrDecoder (line 990) | class DetrDecoder(DetrPreTrainedModel): method __init__ (line 1005) | def __init__(self, config: DetrConfig): method forward (line 1018) | def forward( class DetrModel (line 1111) | class DetrModel(DetrPreTrainedModel): method __init__ (line 1112) | def __init__(self, config: DetrConfig): method freeze_backbone (line 1132) | def freeze_backbone(self): method unfreeze_backbone (line 1136) | def unfreeze_backbone(self): method forward (line 1142) | def forward( class DetrMLPPredictionHead (line 1275) | class DetrMLPPredictionHead(nn.Module): method __init__ (line 1282) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 1288) | def forward(self, x): class DetrForObjectDetection (line 1300) | class DetrForObjectDetection(DetrPreTrainedModel): method __init__ (line 1301) | def __init__(self, config: DetrConfig): method forward (line 1320) | def forward( class DetrForSegmentation (line 1437) | class DetrForSegmentation(DetrPreTrainedModel): method __init__ (line 1438) | def __init__(self, config: DetrConfig): method forward (line 1461) | def forward( FILE: src/transformers/models/dia/configuration_dia.py class DiaEncoderConfig (line 28) | class DiaEncoderConfig(PreTrainedConfig): class DiaDecoderConfig (line 47) | class DiaDecoderConfig(PreTrainedConfig): class DiaConfig (line 87) | class DiaConfig(PreTrainedConfig): method __post_init__ (line 123) | def __post_init__(self, **kwargs): method validate_architecture (line 159) | def validate_architecture(self): method get_text_config (line 164) | def get_text_config(self, *args, **kwargs): FILE: src/transformers/models/dia/convert_dia_to_hf.py function get_generation_config (line 64) | def get_generation_config(config): function convert_dia_model_to_hf (line 77) | def convert_dia_model_to_hf(checkpoint_path, verbose=False): FILE: src/transformers/models/dia/feature_extraction_dia.py class DiaFeatureExtractor (line 26) | class DiaFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 46) | def __init__( method __call__ (line 57) | def __call__( FILE: src/transformers/models/dia/generation_dia.py class DiaGenerationMixin (line 40) | class DiaGenerationMixin(GenerationMixin): method _get_logits_processor (line 44) | def _get_logits_processor( method _prepare_generation_config (line 111) | def _prepare_generation_config( method _prepare_model_inputs (line 130) | def _prepare_model_inputs( method _prepare_decoder_input_ids_for_generation (line 152) | def _prepare_decoder_input_ids_for_generation( method prepare_inputs_for_generation (line 203) | def prepare_inputs_for_generation( method apply_delay_mask (line 242) | def apply_delay_mask(input_ids: torch.Tensor, pad_id: int, delay_mask:... method _main_generate_loop (line 255) | def _main_generate_loop( method generate (line 407) | def generate( FILE: src/transformers/models/dia/modeling_dia.py class DiaPreTrainedModel (line 54) | class DiaPreTrainedModel(PreTrainedModel): method _init_weights (line 65) | def _init_weights(self, module): class DiaMultiChannelEmbedding (line 72) | class DiaMultiChannelEmbedding(nn.Module): method __init__ (line 86) | def __init__(self, config: DiaDecoderConfig): method forward (line 94) | def forward(self, audio_codes: torch.Tensor) -> torch.Tensor: class DiaMLP (line 100) | class DiaMLP(nn.Module): method __init__ (line 101) | def __init__(self, config): method forward (line 109) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class DiaRMSNorm (line 119) | class DiaRMSNorm(nn.Module): method __init__ (line 120) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 128) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 135) | def extra_repr(self): class DiaRotaryEmbedding (line 139) | class DiaRotaryEmbedding(nn.Module): method __init__ (line 142) | def __init__(self, config: DiaConfig, device=None): method compute_default_rope_parameters (line 159) | def compute_default_rope_parameters( method forward (line 190) | def forward(self, x, position_ids): function rotate_half (line 204) | def rotate_half(x): function apply_rotary_pos_emb (line 212) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 237) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 249) | def eager_attention_forward( class DiaSelfAttention (line 275) | class DiaSelfAttention(nn.Module): method __init__ (line 278) | def __init__(self, config: DiaEncoderConfig | DiaDecoderConfig, layer_... method forward (line 296) | def forward( class DiaCrossAttention (line 337) | class DiaCrossAttention(nn.Module): method __init__ (line 340) | def __init__(self, config: DiaDecoderConfig, layer_idx: int): method forward (line 359) | def forward( class DiaEncoderLayer (line 411) | class DiaEncoderLayer(GradientCheckpointingLayer): method __init__ (line 412) | def __init__(self, config: DiaEncoderConfig, layer_idx: int): method forward (line 419) | def forward( class DiaEncoder (line 444) | class DiaEncoder(DiaPreTrainedModel): method __init__ (line 450) | def __init__(self, config: DiaEncoderConfig): method forward (line 466) | def forward( class DiaDecoderLayer (line 500) | class DiaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 501) | def __init__(self, config: DiaDecoderConfig, layer_idx: int): method forward (line 511) | def forward( class DiaDecoder (line 557) | class DiaDecoder(DiaPreTrainedModel): method __init__ (line 565) | def __init__(self, config: DiaDecoderConfig): method forward (line 581) | def forward( class DiaModel (line 654) | class DiaModel(DiaPreTrainedModel): method __init__ (line 655) | def __init__(self, config: DiaConfig): method forward (line 664) | def forward( class DiaForConditionalGeneration (line 765) | class DiaForConditionalGeneration(DiaPreTrainedModel, DiaGenerationMixin): method __init__ (line 769) | def __init__(self, config: DiaConfig): method forward (line 786) | def forward( FILE: src/transformers/models/dia/modular_dia.py class DiaPreTrainedModel (line 52) | class DiaPreTrainedModel(PreTrainedModel): method _init_weights (line 63) | def _init_weights(self, module): class DiaMultiChannelEmbedding (line 70) | class DiaMultiChannelEmbedding(nn.Module): method __init__ (line 84) | def __init__(self, config: DiaDecoderConfig): method forward (line 92) | def forward(self, audio_codes: torch.Tensor) -> torch.Tensor: class DiaMLP (line 98) | class DiaMLP(Phi3MLP): class DiaRMSNorm (line 102) | class DiaRMSNorm(LlamaRMSNorm): class DiaRotaryEmbedding (line 106) | class DiaRotaryEmbedding(LlamaRotaryEmbedding): class DiaSelfAttention (line 110) | class DiaSelfAttention(LlamaAttention): method __init__ (line 113) | def __init__(self, config: DiaEncoderConfig | DiaDecoderConfig, layer_... class DiaCrossAttention (line 132) | class DiaCrossAttention(nn.Module): method __init__ (line 135) | def __init__(self, config: DiaDecoderConfig, layer_idx: int): method forward (line 154) | def forward( class DiaEncoderLayer (line 206) | class DiaEncoderLayer(GradientCheckpointingLayer): method __init__ (line 207) | def __init__(self, config: DiaEncoderConfig, layer_idx: int): method forward (line 214) | def forward( class DiaEncoder (line 239) | class DiaEncoder(DiaPreTrainedModel): method __init__ (line 245) | def __init__(self, config: DiaEncoderConfig): method forward (line 261) | def forward( class DiaDecoderLayer (line 295) | class DiaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 296) | def __init__(self, config: DiaDecoderConfig, layer_idx: int): method forward (line 306) | def forward( class DiaDecoder (line 352) | class DiaDecoder(DiaPreTrainedModel): method __init__ (line 360) | def __init__(self, config: DiaDecoderConfig): method forward (line 376) | def forward( class DiaModel (line 449) | class DiaModel(DiaPreTrainedModel): method __init__ (line 450) | def __init__(self, config: DiaConfig): method forward (line 459) | def forward( class DiaForConditionalGeneration (line 560) | class DiaForConditionalGeneration(DiaPreTrainedModel, DiaGenerationMixin): method __init__ (line 564) | def __init__(self, config: DiaConfig): method forward (line 581) | def forward( FILE: src/transformers/models/dia/processing_dia.py class DiaAudioKwargs (line 32) | class DiaAudioKwargs(AudioKwargs, total=False): class DiaProcessorKwargs (line 60) | class DiaProcessorKwargs(ProcessingKwargs, total=False): class DiaProcessor (line 83) | class DiaProcessor(ProcessorMixin): method __init__ (line 86) | def __init__(self, feature_extractor, tokenizer, audio_tokenizer): method __call__ (line 94) | def __call__( method batch_decode (line 266) | def batch_decode( method decode (line 337) | def decode( method get_audio_prompt_len (line 354) | def get_audio_prompt_len( method save_audio (line 375) | def save_audio( method build_indices (line 410) | def build_indices( method apply_audio_delay (line 445) | def apply_audio_delay( FILE: src/transformers/models/dia/tokenization_dia.py class DiaTokenizer (line 23) | class DiaTokenizer(PreTrainedTokenizer): method __init__ (line 44) | def __init__( method vocab_size (line 71) | def vocab_size(self): method get_vocab (line 74) | def get_vocab(self): method _tokenize (line 79) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 84) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 94) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 99) | def convert_tokens_to_string(self, tokens: list[str]) -> str: FILE: src/transformers/models/dialogpt/convert_dialogpt_original_pytorch_checkpoint_to_pytorch.py function convert_dialogpt_checkpoint (line 29) | def convert_dialogpt_checkpoint(checkpoint_path: str, pytorch_dump_folde... FILE: src/transformers/models/diffllama/configuration_diffllama.py class DiffLlamaConfig (line 28) | class DiffLlamaConfig(PreTrainedConfig): method __post_init__ (line 71) | def __post_init__(self, **kwargs): FILE: src/transformers/models/diffllama/modeling_diffllama.py class DiffLlamaMLP (line 56) | class DiffLlamaMLP(nn.Module): method __init__ (line 57) | def __init__(self, config): method forward (line 67) | def forward(self, x): class DiffLlamaRotaryEmbedding (line 72) | class DiffLlamaRotaryEmbedding(nn.Module): method __init__ (line 75) | def __init__(self, config: DiffLlamaConfig, device=None): method compute_default_rope_parameters (line 92) | def compute_default_rope_parameters( method forward (line 123) | def forward(self, x, position_ids): function rotate_half (line 137) | def rotate_half(x): function apply_rotary_pos_emb (line 145) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 170) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function lambda_init_fn (line 182) | def lambda_init_fn(layer_idx): class DiffLlamaAttention (line 186) | class DiffLlamaAttention(nn.Module): method __init__ (line 189) | def __init__(self, config: DiffLlamaConfig, layer_idx: int | None = No... method forward (line 222) | def forward( class DiffLlamaFlashAttention2 (line 281) | class DiffLlamaFlashAttention2(DiffLlamaAttention): method __init__ (line 288) | def __init__(self, *args, **kwargs): method forward (line 296) | def forward( class DiffLlamaSdpaAttention (line 413) | class DiffLlamaSdpaAttention(DiffLlamaAttention): method forward (line 421) | def forward( class DiffLlamaRMSNorm (line 488) | class DiffLlamaRMSNorm(nn.Module): method __init__ (line 489) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 497) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 504) | def extra_repr(self): class DiffLlamaDecoderLayer (line 515) | class DiffLlamaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 516) | def __init__(self, config: DiffLlamaConfig, layer_idx: int): method forward (line 526) | def forward( class DiffLlamaPreTrainedModel (line 559) | class DiffLlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 577) | def _init_weights(self, module): class DiffLlamaModel (line 587) | class DiffLlamaModel(DiffLlamaPreTrainedModel): method __init__ (line 588) | def __init__(self, config: DiffLlamaConfig): method forward (line 607) | def forward( class DiffLlamaForCausalLM (line 661) | class DiffLlamaForCausalLM(DiffLlamaPreTrainedModel, GenerationMixin): method __init__ (line 666) | def __init__(self, config): method forward (line 677) | def forward( class DiffLlamaForSequenceClassification (line 734) | class DiffLlamaForSequenceClassification(GenericForSequenceClassificatio... class DiffLlamaForQuestionAnswering (line 738) | class DiffLlamaForQuestionAnswering(GenericForQuestionAnswering, DiffLla... class DiffLlamaForTokenClassification (line 742) | class DiffLlamaForTokenClassification(GenericForTokenClassification, Dif... FILE: src/transformers/models/diffllama/modular_diffllama.py class DiffLlamaMLP (line 49) | class DiffLlamaMLP(MistralMLP): function lambda_init_fn (line 53) | def lambda_init_fn(layer_idx): class DiffLlamaRotaryEmbedding (line 57) | class DiffLlamaRotaryEmbedding(LlamaRotaryEmbedding): class DiffLlamaAttention (line 61) | class DiffLlamaAttention(nn.Module): method __init__ (line 64) | def __init__(self, config: DiffLlamaConfig, layer_idx: int | None = No... method forward (line 97) | def forward( class DiffLlamaFlashAttention2 (line 156) | class DiffLlamaFlashAttention2(DiffLlamaAttention): method __init__ (line 163) | def __init__(self, *args, **kwargs): method forward (line 171) | def forward( class DiffLlamaSdpaAttention (line 288) | class DiffLlamaSdpaAttention(DiffLlamaAttention): method forward (line 296) | def forward( class DiffLlamaDecoderLayer (line 369) | class DiffLlamaDecoderLayer(LlamaDecoderLayer): method __init__ (line 370) | def __init__(self, config: DiffLlamaConfig, layer_idx: int): class DiffLlamaPreTrainedModel (line 376) | class DiffLlamaPreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 381) | def _init_weights(self, module): class DiffLlamaModel (line 390) | class DiffLlamaModel(LlamaModel): class DiffLlamaForCausalLM (line 394) | class DiffLlamaForCausalLM(GemmaForCausalLM): class DiffLlamaForSequenceClassification (line 398) | class DiffLlamaForSequenceClassification(LlamaForSequenceClassification): class DiffLlamaForQuestionAnswering (line 402) | class DiffLlamaForQuestionAnswering(LlamaForQuestionAnswering): class DiffLlamaForTokenClassification (line 406) | class DiffLlamaForTokenClassification(LlamaForTokenClassification): FILE: src/transformers/models/dinat/configuration_dinat.py class DinatConfig (line 25) | class DinatConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 71) | def __post_init__(self, **kwargs): FILE: src/transformers/models/dinat/modeling_dinat.py function natten2dqkrpb (line 42) | def natten2dqkrpb(*args, **kwargs): function natten2dav (line 45) | def natten2dav(*args, **kwargs): class DinatEncoderOutput (line 61) | class DinatEncoderOutput(ModelOutput): class DinatModelOutput (line 83) | class DinatModelOutput(ModelOutput): class DinatImageClassifierOutput (line 108) | class DinatImageClassifierOutput(ModelOutput): class DinatEmbeddings (line 129) | class DinatEmbeddings(nn.Module): method __init__ (line 134) | def __init__(self, config): method forward (line 142) | def forward(self, pixel_values: torch.FloatTensor | None) -> tuple[tor... class DinatPatchEmbeddings (line 151) | class DinatPatchEmbeddings(nn.Module): method __init__ (line 158) | def __init__(self, config): method forward (line 175) | def forward(self, pixel_values: torch.FloatTensor | None) -> torch.Ten... class DinatDownsampler (line 187) | class DinatDownsampler(nn.Module): method __init__ (line 198) | def __init__(self, dim: int, norm_layer: nn.Module = nn.LayerNorm) -> ... method forward (line 204) | def forward(self, input_feature: torch.Tensor) -> torch.Tensor: function drop_path (line 211) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class DinatDropPath (line 227) | class DinatDropPath(nn.Module): method __init__ (line 230) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 234) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 237) | def extra_repr(self) -> str: class NeighborhoodAttention (line 241) | class NeighborhoodAttention(nn.Module): method __init__ (line 242) | def __init__(self, config, dim, num_heads, kernel_size, dilation): method forward (line 264) | def forward( class NeighborhoodAttentionOutput (line 311) | class NeighborhoodAttentionOutput(nn.Module): method __init__ (line 312) | def __init__(self, config, dim): method forward (line 317) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class NeighborhoodAttentionModule (line 324) | class NeighborhoodAttentionModule(nn.Module): method __init__ (line 325) | def __init__(self, config, dim, num_heads, kernel_size, dilation): method forward (line 330) | def forward( class DinatIntermediate (line 341) | class DinatIntermediate(nn.Module): method __init__ (line 342) | def __init__(self, config, dim): method forward (line 350) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DinatOutput (line 356) | class DinatOutput(nn.Module): method __init__ (line 357) | def __init__(self, config, dim): method forward (line 362) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DinatLayer (line 368) | class DinatLayer(nn.Module): method __init__ (line 369) | def __init__(self, config, dim, num_heads, dilation, drop_path_rate=0.0): method maybe_pad (line 389) | def maybe_pad(self, hidden_states, height, width): method forward (line 400) | def forward( class DinatStage (line 439) | class DinatStage(nn.Module): method __init__ (line 440) | def __init__(self, config, dim, depth, num_heads, dilations, drop_path... method forward (line 465) | def forward( class DinatEncoder (line 486) | class DinatEncoder(nn.Module): method __init__ (line 487) | def __init__(self, config): method forward (line 507) | def forward( class DinatPreTrainedModel (line 557) | class DinatPreTrainedModel(PreTrainedModel): class DinatModel (line 565) | class DinatModel(DinatPreTrainedModel): method __init__ (line 566) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 588) | def get_input_embeddings(self): method forward (line 592) | def forward( class DinatForImageClassification (line 646) | class DinatForImageClassification(DinatPreTrainedModel): method __init__ (line 647) | def __init__(self, config): method forward (line 664) | def forward( class DinatBackbone (line 714) | class DinatBackbone(BackboneMixin, DinatPreTrainedModel): method __init__ (line 715) | def __init__(self, config): method get_input_embeddings (line 733) | def get_input_embeddings(self): method forward (line 739) | def forward( FILE: src/transformers/models/dinov2/configuration_dinov2.py class Dinov2Config (line 25) | class Dinov2Config(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 79) | def __post_init__(self, **kwargs): FILE: src/transformers/models/dinov2/convert_dinov2_to_hf.py function get_dinov2_config (line 40) | def get_dinov2_config(model_name, image_classifier=False): function create_rename_keys (line 71) | def create_rename_keys(config): function rename_key (line 114) | def rename_key(dct, old, new): function read_in_q_k_v (line 120) | def read_in_q_k_v(state_dict, config): function prepare_img (line 139) | def prepare_img(): function convert_dinov2_checkpoint (line 147) | def convert_dinov2_checkpoint(model_name, pytorch_dump_folder_path, push... FILE: src/transformers/models/dinov2/modeling_dinov2.py class Dinov2Embeddings (line 38) | class Dinov2Embeddings(nn.Module): method __init__ (line 43) | def __init__(self, config: Dinov2Config) -> None: method interpolate_pos_encoding (line 57) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 97) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... class Dinov2PatchEmbeddings (line 119) | class Dinov2PatchEmbeddings(nn.Module): method __init__ (line 126) | def __init__(self, config): method forward (line 141) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 153) | def eager_attention_forward( class Dinov2SelfAttention (line 182) | class Dinov2SelfAttention(nn.Module): method __init__ (line 183) | def __init__(self, config: Dinov2Config): method forward (line 203) | def forward( class Dinov2SelfOutput (line 238) | class Dinov2SelfOutput(nn.Module): method __init__ (line 244) | def __init__(self, config: Dinov2Config): method forward (line 249) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Dinov2Attention (line 256) | class Dinov2Attention(nn.Module): method __init__ (line 257) | def __init__(self, config: Dinov2Config): method forward (line 262) | def forward( class Dinov2LayerScale (line 272) | class Dinov2LayerScale(nn.Module): method __init__ (line 273) | def __init__(self, config) -> None: method forward (line 277) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: function drop_path (line 282) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class Dinov2DropPath (line 298) | class Dinov2DropPath(nn.Module): method __init__ (line 301) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 305) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 308) | def extra_repr(self) -> str: class Dinov2MLP (line 312) | class Dinov2MLP(nn.Module): method __init__ (line 313) | def __init__(self, config) -> None: method forward (line 324) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Dinov2SwiGLUFFN (line 331) | class Dinov2SwiGLUFFN(nn.Module): method __init__ (line 332) | def __init__(self, config) -> None: method forward (line 341) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Dinov2Layer (line 348) | class Dinov2Layer(GradientCheckpointingLayer): method __init__ (line 351) | def __init__(self, config: Dinov2Config) -> None: method forward (line 367) | def forward( class Dinov2PreTrainedModel (line 390) | class Dinov2PreTrainedModel(PreTrainedModel): method _init_weights (line 407) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class Dinov2Encoder (line 425) | class Dinov2Encoder(Dinov2PreTrainedModel): method __init__ (line 426) | def __init__(self, config: Dinov2Config): method forward (line 433) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class Dinov2Model (line 441) | class Dinov2Model(Dinov2PreTrainedModel): method __init__ (line 442) | def __init__(self, config: Dinov2Config): method get_input_embeddings (line 454) | def get_input_embeddings(self) -> Dinov2PatchEmbeddings: method forward (line 459) | def forward( class Dinov2ForImageClassification (line 494) | class Dinov2ForImageClassification(Dinov2PreTrainedModel): method __init__ (line 495) | def __init__(self, config: Dinov2Config) -> None: method forward (line 511) | def forward( class Dinov2Backbone (line 549) | class Dinov2Backbone(BackboneMixin, Dinov2PreTrainedModel): method __init__ (line 550) | def __init__(self, config): method get_input_embeddings (line 562) | def get_input_embeddings(self) -> Dinov2PatchEmbeddings: method forward (line 568) | def forward( FILE: src/transformers/models/dinov2_with_registers/configuration_dinov2_with_registers.py class Dinov2WithRegistersConfig (line 32) | class Dinov2WithRegistersConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/dinov2_with_registers/convert_dinov2_with_registers_to_hf.py function get_dinov2_with_registers_config (line 45) | def get_dinov2_with_registers_config(model_name, image_classifier=False): function create_rename_keys (line 76) | def create_rename_keys(config): function rename_key (line 120) | def rename_key(dct, old, new): function read_in_q_k_v (line 126) | def read_in_q_k_v(state_dict, config): function prepare_img (line 145) | def prepare_img(): function convert_dinov2_with_registers_checkpoint (line 153) | def convert_dinov2_with_registers_checkpoint(model_name, pytorch_dump_fo... FILE: src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py class Dinov2WithRegistersPatchEmbeddings (line 42) | class Dinov2WithRegistersPatchEmbeddings(nn.Module): method __init__ (line 49) | def __init__(self, config): method forward (line 64) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class Dinov2WithRegistersEmbeddings (line 75) | class Dinov2WithRegistersEmbeddings(nn.Module): method __init__ (line 80) | def __init__(self, config: Dinov2WithRegistersConfig) -> None: method interpolate_pos_encoding (line 93) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 147) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... function eager_attention_forward (line 174) | def eager_attention_forward( class Dinov2WithRegistersSelfAttention (line 202) | class Dinov2WithRegistersSelfAttention(nn.Module): method __init__ (line 203) | def __init__(self, config: Dinov2WithRegistersConfig): method forward (line 223) | def forward( class Dinov2WithRegistersSelfOutput (line 257) | class Dinov2WithRegistersSelfOutput(nn.Module): method __init__ (line 263) | def __init__(self, config: Dinov2WithRegistersConfig): method forward (line 268) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Dinov2WithRegistersAttention (line 274) | class Dinov2WithRegistersAttention(nn.Module): method __init__ (line 275) | def __init__(self, config: Dinov2WithRegistersConfig): method forward (line 280) | def forward( class Dinov2WithRegistersLayerScale (line 290) | class Dinov2WithRegistersLayerScale(nn.Module): method __init__ (line 291) | def __init__(self, config) -> None: method forward (line 295) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: function drop_path (line 299) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class Dinov2WithRegistersDropPath (line 314) | class Dinov2WithRegistersDropPath(nn.Module): method __init__ (line 317) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 321) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 324) | def extra_repr(self) -> str: class Dinov2WithRegistersMLP (line 328) | class Dinov2WithRegistersMLP(nn.Module): method __init__ (line 329) | def __init__(self, config) -> None: method forward (line 340) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Dinov2WithRegistersSwiGLUFFN (line 347) | class Dinov2WithRegistersSwiGLUFFN(nn.Module): method __init__ (line 348) | def __init__(self, config) -> None: method forward (line 357) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Dinov2WithRegistersLayer (line 364) | class Dinov2WithRegistersLayer(GradientCheckpointingLayer): method __init__ (line 367) | def __init__(self, config: Dinov2WithRegistersConfig) -> None: method forward (line 385) | def forward( class Dinov2WithRegistersPreTrainedModel (line 408) | class Dinov2WithRegistersPreTrainedModel(PreTrainedModel): method _init_weights (line 425) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class Dinov2WithRegistersEncoder (line 443) | class Dinov2WithRegistersEncoder(Dinov2WithRegistersPreTrainedModel): method __init__ (line 444) | def __init__(self, config: Dinov2WithRegistersConfig): method forward (line 451) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class Dinov2WithRegistersModel (line 459) | class Dinov2WithRegistersModel(Dinov2WithRegistersPreTrainedModel): method __init__ (line 460) | def __init__(self, config: Dinov2WithRegistersConfig): method get_input_embeddings (line 472) | def get_input_embeddings(self) -> Dinov2WithRegistersPatchEmbeddings: method forward (line 477) | def forward( class Dinov2WithRegistersForImageClassification (line 512) | class Dinov2WithRegistersForImageClassification(Dinov2WithRegistersPreTr... method __init__ (line 513) | def __init__(self, config: Dinov2WithRegistersConfig) -> None: method forward (line 529) | def forward( class Dinov2WithRegistersBackbone (line 569) | class Dinov2WithRegistersBackbone(BackboneMixin, Dinov2WithRegistersPreT... method __init__ (line 570) | def __init__(self, config): method get_input_embeddings (line 583) | def get_input_embeddings(self) -> Dinov2WithRegistersPatchEmbeddings: method forward (line 589) | def forward( FILE: src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py class Dinov2WithRegistersConfig (line 42) | class Dinov2WithRegistersConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 96) | def __post_init__(self, **kwargs): class Dinov2WithRegistersPatchEmbeddings (line 104) | class Dinov2WithRegistersPatchEmbeddings(Dinov2PatchEmbeddings): class Dinov2WithRegistersEmbeddings (line 108) | class Dinov2WithRegistersEmbeddings(nn.Module): method __init__ (line 113) | def __init__(self, config: Dinov2WithRegistersConfig) -> None: method interpolate_pos_encoding (line 126) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 180) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... class Dinov2WithRegistersPreTrainedModel (line 207) | class Dinov2WithRegistersPreTrainedModel(Dinov2PreTrainedModel): method _init_weights (line 209) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class Dinov2WithRegistersEncoder (line 227) | class Dinov2WithRegistersEncoder(Dinov2Encoder): class Dinov2WithRegistersModel (line 231) | class Dinov2WithRegistersModel(Dinov2Model): class Dinov2WithRegistersForImageClassification (line 235) | class Dinov2WithRegistersForImageClassification(Dinov2ForImageClassifica... method forward (line 236) | def forward( class Dinov2WithRegistersBackbone (line 271) | class Dinov2WithRegistersBackbone(Dinov2Backbone): method __init__ (line 272) | def __init__(self, config): method get_input_embeddings (line 285) | def get_input_embeddings(self) -> Dinov2WithRegistersPatchEmbeddings: method forward (line 288) | def forward( FILE: src/transformers/models/dinov3_convnext/configuration_dinov3_convnext.py class DINOv3ConvNextConfig (line 25) | class DINOv3ConvNextConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 55) | def __post_init__(self, **kwargs): method num_stages (line 65) | def num_stages(self) -> int: FILE: src/transformers/models/dinov3_convnext/convert_dinov3_convnext_to_hf.py function get_dinov3_config (line 58) | def get_dinov3_config(model_name: str) -> DINOv3ConvNextConfig: function prepare_img (line 84) | def prepare_img(): function get_transform (line 91) | def get_transform(resize_size: int = 224): function get_image_processor (line 101) | def get_image_processor(resize_size: int = 224): function convert_old_keys_to_new_keys (line 109) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function convert_and_test_dinov3_checkpoint (line 128) | def convert_and_test_dinov3_checkpoint(args): FILE: src/transformers/models/dinov3_convnext/modeling_dinov3_convnext.py function drop_path (line 36) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class DINOv3ConvNextDropPath (line 52) | class DINOv3ConvNextDropPath(nn.Module): method __init__ (line 55) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 59) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 62) | def extra_repr(self) -> str: class DINOv3ConvNextLayerNorm (line 66) | class DINOv3ConvNextLayerNorm(nn.LayerNorm): method __init__ (line 72) | def __init__(self, *args, data_format="channels_last", **kwargs): method forward (line 78) | def forward(self, features: torch.Tensor) -> torch.Tensor: class DINOv3ConvNextLayer (line 92) | class DINOv3ConvNextLayer(nn.Module): method __init__ (line 110) | def __init__(self, config: DINOv3ConvNextConfig, channels: int, drop_p... method forward (line 120) | def forward(self, features: torch.Tensor) -> torch.Tensor: class DINOv3ConvNextStage (line 138) | class DINOv3ConvNextStage(nn.Module): method __init__ (line 139) | def __init__(self, config: DINOv3ConvNextConfig, stage_idx: int): method forward (line 172) | def forward(self, features: torch.Tensor, **kwargs: Unpack[Transformer... class DINOv3ConvNextPreTrainedModel (line 185) | class DINOv3ConvNextPreTrainedModel(PreTrainedModel): method _init_weights (line 194) | def _init_weights(self, module): class DINOv3ConvNextEncoder (line 202) | class DINOv3ConvNextEncoder(DINOv3ConvNextPreTrainedModel): method __init__ (line 203) | def __init__(self, config: DINOv3ConvNextConfig): method forward (line 211) | def forward( class DINOv3ConvNextModel (line 223) | class DINOv3ConvNextModel(DINOv3ConvNextPreTrainedModel): method __init__ (line 224) | def __init__(self, config: DINOv3ConvNextConfig): method forward (line 233) | def forward(self, pixel_values: torch.FloatTensor, **kwargs) -> BaseMo... class DINOv3ConvNextBackbone (line 258) | class DINOv3ConvNextBackbone(BackboneMixin, DINOv3ConvNextPreTrainedModel): method __init__ (line 261) | def __init__(self, config: DINOv3ConvNextConfig): method get_input_embeddings (line 270) | def get_input_embeddings(self): method forward (line 276) | def forward(self, pixel_values: torch.FloatTensor, **kwargs) -> Backbo... FILE: src/transformers/models/dinov3_vit/configuration_dinov3_vit.py class DINOv3ViTConfig (line 25) | class DINOv3ViTConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 103) | def __post_init__(self, **kwargs): FILE: src/transformers/models/dinov3_vit/convert_dinov3_vit_to_hf.py function convert_old_keys_to_new_keys (line 77) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function split_qkv (line 95) | def split_qkv(state_dict: dict): function get_dinov3_config (line 106) | def get_dinov3_config(model_name: str) -> DINOv3ViTConfig: function prepare_img (line 182) | def prepare_img(): function get_transform (line 189) | def get_transform(resize_size: int = 224): function get_image_processor (line 199) | def get_image_processor(resize_size: int = 224): function convert_and_test_dinov3_checkpoint (line 208) | def convert_and_test_dinov3_checkpoint(args): FILE: src/transformers/models/dinov3_vit/image_processing_dinov3_vit.py class DINOv3ViTImageProcessor (line 34) | class DINOv3ViTImageProcessor(TorchvisionBackend): method _preprocess (line 45) | def _preprocess( FILE: src/transformers/models/dinov3_vit/modeling_dinov3_vit.py class DINOv3ViTBackboneOutput (line 50) | class DINOv3ViTBackboneOutput(BackboneOutput): class DINOv3ViTEmbeddings (line 60) | class DINOv3ViTEmbeddings(nn.Module): method __init__ (line 65) | def __init__(self, config: DINOv3ViTConfig): method forward (line 75) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... function get_patches_center_coordinates (line 96) | def get_patches_center_coordinates( function augment_patches_center_coordinates (line 124) | def augment_patches_center_coordinates( class DINOv3ViTRopePositionEmbedding (line 153) | class DINOv3ViTRopePositionEmbedding(nn.Module): method __init__ (line 156) | def __init__(self, config: DINOv3ViTConfig): method forward (line 168) | def forward(self, pixel_values: torch.Tensor) -> tuple[torch.Tensor, t... function rotate_half (line 203) | def rotate_half(x): function eager_attention_forward (line 210) | def eager_attention_forward( function apply_rotary_pos_emb (line 238) | def apply_rotary_pos_emb( class DINOv3ViTAttention (line 271) | class DINOv3ViTAttention(nn.Module): method __init__ (line 276) | def __init__(self, config: DINOv3ViTConfig): method forward (line 294) | def forward( class DINOv3ViTLayerScale (line 337) | class DINOv3ViTLayerScale(nn.Module): method __init__ (line 338) | def __init__(self, config) -> None: method forward (line 342) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: function drop_path (line 346) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class DINOv3ViTDropPath (line 361) | class DINOv3ViTDropPath(nn.Module): method __init__ (line 364) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 368) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 371) | def extra_repr(self) -> str: class DINOv3ViTMLP (line 375) | class DINOv3ViTMLP(nn.Module): method __init__ (line 376) | def __init__(self, config): method forward (line 385) | def forward(self, x): class DINOv3ViTGatedMLP (line 389) | class DINOv3ViTGatedMLP(nn.Module): method __init__ (line 390) | def __init__(self, config): method forward (line 400) | def forward(self, x): class DINOv3ViTLayer (line 405) | class DINOv3ViTLayer(GradientCheckpointingLayer): method __init__ (line 408) | def __init__(self, config: DINOv3ViTConfig): method forward (line 424) | def forward( class DINOv3ViTPreTrainedModel (line 454) | class DINOv3ViTPreTrainedModel(PreTrainedModel): method _init_weights (line 471) | def _init_weights(self, module) -> None: class DINOv3ViTEncoder (line 492) | class DINOv3ViTEncoder(DINOv3ViTPreTrainedModel): method __init__ (line 493) | def __init__(self, config: DINOv3ViTConfig): method forward (line 501) | def forward( class DINOv3ViTModel (line 514) | class DINOv3ViTModel(DINOv3ViTPreTrainedModel): method __init__ (line 515) | def __init__(self, config: DINOv3ViTConfig): method get_input_embeddings (line 525) | def get_input_embeddings(self): method forward (line 530) | def forward( class DINOv3ViTBackbone (line 559) | class DINOv3ViTBackbone(BackboneMixin, DINOv3ViTPreTrainedModel): method __init__ (line 560) | def __init__(self, config): method get_input_embeddings (line 572) | def get_input_embeddings(self): method forward (line 578) | def forward( FILE: src/transformers/models/dinov3_vit/modular_dinov3_vit.py class DINOv3ViTBackboneOutput (line 57) | class DINOv3ViTBackboneOutput(BackboneOutput): class DINOv3ViTEmbeddings (line 67) | class DINOv3ViTEmbeddings(nn.Module): method __init__ (line 72) | def __init__(self, config: DINOv3ViTConfig): method forward (line 82) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... function get_patches_center_coordinates (line 103) | def get_patches_center_coordinates( function augment_patches_center_coordinates (line 131) | def augment_patches_center_coordinates( class DINOv3ViTRopePositionEmbedding (line 160) | class DINOv3ViTRopePositionEmbedding(nn.Module): method __init__ (line 163) | def __init__(self, config: DINOv3ViTConfig): method forward (line 175) | def forward(self, pixel_values: torch.Tensor) -> tuple[torch.Tensor, t... function apply_rotary_pos_emb (line 210) | def apply_rotary_pos_emb( class DINOv3ViTAttention (line 243) | class DINOv3ViTAttention(PixtralAttention): method __init__ (line 244) | def __init__(self, config: DINOv3ViTConfig): method forward (line 252) | def forward( class DINOv3ViTLayerScale (line 295) | class DINOv3ViTLayerScale(Dinov2LayerScale): class DINOv3ViTDropPath (line 299) | class DINOv3ViTDropPath(Dinov2DropPath): class DINOv3ViTMLP (line 303) | class DINOv3ViTMLP(ArceeMLP): class DINOv3ViTGatedMLP (line 307) | class DINOv3ViTGatedMLP(LlamaMLP): class DINOv3ViTLayer (line 311) | class DINOv3ViTLayer(GradientCheckpointingLayer): method __init__ (line 314) | def __init__(self, config: DINOv3ViTConfig): method forward (line 330) | def forward( class DINOv3ViTPreTrainedModel (line 360) | class DINOv3ViTPreTrainedModel(Dinov2PreTrainedModel): method _init_weights (line 368) | def _init_weights(self, module) -> None: class DINOv3ViTEncoder (line 389) | class DINOv3ViTEncoder(DINOv3ViTPreTrainedModel): method __init__ (line 390) | def __init__(self, config: DINOv3ViTConfig): method forward (line 398) | def forward( class DINOv3ViTModel (line 411) | class DINOv3ViTModel(DINOv3ViTPreTrainedModel): method __init__ (line 412) | def __init__(self, config: DINOv3ViTConfig): method get_input_embeddings (line 422) | def get_input_embeddings(self): method forward (line 427) | def forward( class DINOv3ViTBackbone (line 456) | class DINOv3ViTBackbone(BackboneMixin, DINOv3ViTPreTrainedModel): method __init__ (line 457) | def __init__(self, config): method get_input_embeddings (line 469) | def get_input_embeddings(self): method forward (line 475) | def forward( FILE: src/transformers/models/distilbert/configuration_distilbert.py class DistilBertConfig (line 24) | class DistilBertConfig(PreTrainedConfig): FILE: src/transformers/models/distilbert/modeling_distilbert.py function create_sinusoidal_embeddings (line 63) | def create_sinusoidal_embeddings(n_pos: int, dim: int, out: torch.Tensor): function _create_sinusoidal_embeddings (line 74) | def _create_sinusoidal_embeddings(n_pos: int, dim: int, out: torch.Tensor): class Embeddings (line 83) | class Embeddings(nn.Module): method __init__ (line 84) | def __init__(self, config: PreTrainedConfig): method forward (line 96) | def forward( function eager_attention_forward (line 126) | def eager_attention_forward( class DistilBertSelfAttention (line 154) | class DistilBertSelfAttention(nn.Module): method __init__ (line 155) | def __init__(self, config: PreTrainedConfig): method forward (line 177) | def forward( class FFN (line 210) | class FFN(nn.Module): method __init__ (line 211) | def __init__(self, config: PreTrainedConfig): method forward (line 220) | def forward(self, input: torch.Tensor) -> torch.Tensor: method ff_chunk (line 223) | def ff_chunk(self, input: torch.Tensor) -> torch.Tensor: class TransformerBlock (line 231) | class TransformerBlock(GradientCheckpointingLayer): method __init__ (line 232) | def __init__(self, config: PreTrainedConfig): method forward (line 245) | def forward( class Transformer (line 266) | class Transformer(nn.Module): method __init__ (line 267) | def __init__(self, config: PreTrainedConfig): method forward (line 273) | def forward( class DistilBertPreTrainedModel (line 291) | class DistilBertPreTrainedModel(PreTrainedModel): method _init_weights (line 305) | def _init_weights(self, module: nn.Module): class DistilBertModel (line 322) | class DistilBertModel(DistilBertPreTrainedModel): method __init__ (line 323) | def __init__(self, config: PreTrainedConfig): method get_position_embeddings (line 332) | def get_position_embeddings(self) -> nn.Embedding: method resize_position_embeddings (line 338) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_input_embeddings (line 380) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 383) | def set_input_embeddings(self, new_embeddings: nn.Embedding): method forward (line 389) | def forward( class DistilBertForMaskedLM (line 433) | class DistilBertForMaskedLM(DistilBertPreTrainedModel): method __init__ (line 436) | def __init__(self, config: PreTrainedConfig): method get_position_embeddings (line 451) | def get_position_embeddings(self) -> nn.Embedding: method resize_position_embeddings (line 457) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_output_embeddings (line 471) | def get_output_embeddings(self) -> nn.Module: method set_output_embeddings (line 474) | def set_output_embeddings(self, new_embeddings: nn.Module): method forward (line 479) | def forward( class DistilBertForSequenceClassification (line 537) | class DistilBertForSequenceClassification(DistilBertPreTrainedModel): method __init__ (line 538) | def __init__(self, config: PreTrainedConfig): method get_position_embeddings (line 551) | def get_position_embeddings(self) -> nn.Embedding: method resize_position_embeddings (line 557) | def resize_position_embeddings(self, new_num_position_embeddings: int): method forward (line 573) | def forward( class DistilBertForQuestionAnswering (line 635) | class DistilBertForQuestionAnswering(DistilBertPreTrainedModel): method __init__ (line 636) | def __init__(self, config: PreTrainedConfig): method get_position_embeddings (line 649) | def get_position_embeddings(self) -> nn.Embedding: method resize_position_embeddings (line 655) | def resize_position_embeddings(self, new_num_position_embeddings: int): method forward (line 671) | def forward( class DistilBertForTokenClassification (line 737) | class DistilBertForTokenClassification(DistilBertPreTrainedModel): method __init__ (line 738) | def __init__(self, config: PreTrainedConfig): method get_position_embeddings (line 749) | def get_position_embeddings(self) -> nn.Embedding: method resize_position_embeddings (line 755) | def resize_position_embeddings(self, new_num_position_embeddings: int): method forward (line 771) | def forward( class DistilBertForMultipleChoice (line 812) | class DistilBertForMultipleChoice(DistilBertPreTrainedModel): method __init__ (line 813) | def __init__(self, config: PreTrainedConfig): method get_position_embeddings (line 824) | def get_position_embeddings(self) -> nn.Embedding: method resize_position_embeddings (line 830) | def resize_position_embeddings(self, new_num_position_embeddings: int): method forward (line 846) | def forward( FILE: src/transformers/models/distilbert/tokenization_distilbert.py class DistilBertTokenizer (line 22) | class DistilBertTokenizer(BertTokenizer): method __init__ (line 25) | def __init__(self, *args, do_lower_case: bool = True, **kwargs): FILE: src/transformers/models/dit/convert_dit_unilm_to_pytorch.py function create_rename_keys (line 36) | def create_rename_keys(config, has_lm_head=False, is_semantic=False): function read_in_q_k_v (line 91) | def read_in_q_k_v(state_dict, config, has_lm_head=False, is_semantic=Fal... function rename_key (line 120) | def rename_key(dct, old, new): function prepare_img (line 126) | def prepare_img(): function convert_dit_checkpoint (line 134) | def convert_dit_checkpoint(checkpoint_url, pytorch_dump_folder_path, pus... FILE: src/transformers/models/doge/configuration_doge.py class DogeConfig (line 31) | class DogeConfig(PreTrainedConfig): method __post_init__ (line 102) | def __post_init__(self, **kwargs): FILE: src/transformers/models/doge/convert_doge_weights_to_hf.py function load_weights (line 49) | def load_weights(input_dir: str): function map_old_key_to_new (line 69) | def map_old_key_to_new(old_key): function convert_state_dict (line 83) | def convert_state_dict(original_state_dict: dict, config: DogeConfig): function convert_doge_model (line 94) | def convert_doge_model(input_dir, output_dir): FILE: src/transformers/models/doge/modeling_doge.py class DogeRMSNorm (line 54) | class DogeRMSNorm(nn.Module): method __init__ (line 55) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 63) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 70) | def extra_repr(self): class DogeRotaryEmbedding (line 74) | class DogeRotaryEmbedding(nn.Module): method __init__ (line 77) | def __init__(self, config: DogeConfig, device=None): method compute_default_rope_parameters (line 94) | def compute_default_rope_parameters( method forward (line 125) | def forward(self, x, position_ids): function rotate_half (line 139) | def rotate_half(x): function apply_rotary_pos_emb (line 147) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 172) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 184) | def eager_attention_forward( function flex_attention_forward (line 209) | def flex_attention_forward( class DogeAttention (line 259) | class DogeAttention(nn.Module): method __init__ (line 260) | def __init__(self, config: DogeConfig, layer_idx: int | None = None): method forward (line 290) | def forward( method prepare_dynamic_mask (line 343) | def prepare_dynamic_mask( class DogeMLP (line 381) | class DogeMLP(nn.Module): method __init__ (line 382) | def __init__(self, config): method forward (line 392) | def forward(self, x): class DogeCDMoE (line 397) | class DogeCDMoE(nn.Module): method __init__ (line 398) | def __init__(self, config: DogeConfig): method forward (line 421) | def forward( class DogeDecoderLayer (line 454) | class DogeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 455) | def __init__(self, config: DogeConfig, layer_idx: int | None = None): method forward (line 467) | def forward( class DogePreTrainedModel (line 503) | class DogePreTrainedModel(PreTrainedModel): method _init_weights (line 521) | def _init_weights(self, module): class DogeModel (line 535) | class DogeModel(DogePreTrainedModel): method __init__ (line 536) | def __init__(self, config: DogeConfig): method forward (line 555) | def forward( function load_balancing_loss_func (line 610) | def load_balancing_loss_func( class DogeForCausalLM (line 717) | class DogeForCausalLM(DogePreTrainedModel, GenerationMixin): method __init__ (line 722) | def __init__(self, config): method forward (line 736) | def forward( class DogeForSequenceClassification (line 818) | class DogeForSequenceClassification(GenericForSequenceClassification, Do... FILE: src/transformers/models/doge/modular_doge.py class DogeConfig (line 60) | class DogeConfig(PreTrainedConfig): method __post_init__ (line 131) | def __post_init__(self, **kwargs): class DogeRMSNorm (line 139) | class DogeRMSNorm(LlamaRMSNorm): class DogeRotaryEmbedding (line 143) | class DogeRotaryEmbedding(LlamaRotaryEmbedding): function flex_attention_forward (line 147) | def flex_attention_forward( class DogeAttention (line 197) | class DogeAttention(nn.Module): method __init__ (line 198) | def __init__(self, config: DogeConfig, layer_idx: int | None = None): method forward (line 228) | def forward( method prepare_dynamic_mask (line 281) | def prepare_dynamic_mask( class DogeMLP (line 319) | class DogeMLP(LlamaMLP): class DogeCDMoE (line 323) | class DogeCDMoE(nn.Module): method __init__ (line 324) | def __init__(self, config: DogeConfig): method forward (line 347) | def forward( class DogeDecoderLayer (line 380) | class DogeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 381) | def __init__(self, config: DogeConfig, layer_idx: int | None = None): method forward (line 393) | def forward( class DogePreTrainedModel (line 428) | class DogePreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 438) | def _init_weights(self, module): class DogeModel (line 451) | class DogeModel(MixtralModel): function load_balancing_loss_func (line 455) | def load_balancing_loss_func( class DogeForCausalLM (line 561) | class DogeForCausalLM(MixtralForCausalLM): method __init__ (line 562) | def __init__(self, config): method forward (line 567) | def forward( class DogeForSequenceClassification (line 649) | class DogeForSequenceClassification(LlamaForSequenceClassification): FILE: src/transformers/models/donut/configuration_donut_swin.py class DonutSwinConfig (line 24) | class DonutSwinConfig(PreTrainedConfig): method __post_init__ (line 68) | def __post_init__(self, **kwargs): FILE: src/transformers/models/donut/convert_donut_to_pytorch.py function get_configs (line 34) | def get_configs(model): function rename_key (line 61) | def rename_key(name): function convert_state_dict (line 94) | def convert_state_dict(orig_state_dict, model): function convert_donut_checkpoint (line 134) | def convert_donut_checkpoint(model_name, pytorch_dump_folder_path=None, ... FILE: src/transformers/models/donut/image_processing_donut.py class DonutImageProcessorKwargs (line 33) | class DonutImageProcessorKwargs(ImagesKwargs, total=False): class DonutImageProcessor (line 46) | class DonutImageProcessor(TorchvisionBackend): method __init__ (line 62) | def __init__(self, **kwargs: Unpack[DonutImageProcessorKwargs]): method preprocess (line 71) | def preprocess( method align_long_axis (line 83) | def align_long_axis( method pad_image (line 100) | def pad_image( method thumbnail (line 126) | def thumbnail( method _preprocess (line 155) | def _preprocess( FILE: src/transformers/models/donut/image_processing_pil_donut.py class DonutImageProcessorKwargs (line 33) | class DonutImageProcessorKwargs(ImagesKwargs, total=False): class DonutImageProcessorPil (line 46) | class DonutImageProcessorPil(PilBackend): method __init__ (line 62) | def __init__(self, **kwargs: Unpack[DonutImageProcessorKwargs]): method preprocess (line 71) | def preprocess( method align_long_axis (line 83) | def align_long_axis( method pad_image (line 101) | def pad_image( method thumbnail (line 139) | def thumbnail( method _preprocess (line 169) | def _preprocess( FILE: src/transformers/models/donut/modeling_donut_swin.py class DonutSwinEncoderOutput (line 44) | class DonutSwinEncoderOutput(ModelOutput): class DonutSwinModelOutput (line 67) | class DonutSwinModelOutput(ModelOutput): class DonutSwinImageClassifierOutput (line 93) | class DonutSwinImageClassifierOutput(ModelOutput): function window_partition (line 115) | def window_partition(input_feature, window_size): function window_reverse (line 128) | def window_reverse(windows, window_size, height, width): class DonutSwinEmbeddings (line 139) | class DonutSwinEmbeddings(nn.Module): method __init__ (line 144) | def __init__(self, config, use_mask_token=False): method interpolate_pos_encoding (line 163) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 203) | def forward( class DonutSwinPatchEmbeddings (line 232) | class DonutSwinPatchEmbeddings(nn.Module): method __init__ (line 239) | def __init__(self, config): method maybe_pad (line 254) | def maybe_pad(self, pixel_values, height, width): method forward (line 263) | def forward(self, pixel_values: torch.FloatTensor | None) -> tuple[tor... class DonutSwinPatchMerging (line 276) | class DonutSwinPatchMerging(nn.Module): method __init__ (line 289) | def __init__(self, input_resolution: tuple[int], dim: int, norm_layer:... method maybe_pad (line 296) | def maybe_pad(self, input_feature, height, width): method forward (line 304) | def forward(self, input_feature: torch.Tensor, input_dimensions: tuple... function drop_path (line 331) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class DonutSwinDropPath (line 347) | class DonutSwinDropPath(nn.Module): method __init__ (line 350) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 354) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 357) | def extra_repr(self) -> str: class DonutSwinSelfAttention (line 362) | class DonutSwinSelfAttention(nn.Module): method __init__ (line 363) | def __init__(self, config, dim, num_heads, window_size): method forward (line 389) | def forward( method create_relative_position_index (line 440) | def create_relative_position_index(self): class DonutSwinSelfOutput (line 456) | class DonutSwinSelfOutput(nn.Module): method __init__ (line 457) | def __init__(self, config, dim): method forward (line 462) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class DonutSwinAttention (line 470) | class DonutSwinAttention(nn.Module): method __init__ (line 471) | def __init__(self, config, dim, num_heads, window_size): method forward (line 476) | def forward( class DonutSwinIntermediate (line 489) | class DonutSwinIntermediate(nn.Module): method __init__ (line 490) | def __init__(self, config, dim): method forward (line 498) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DonutSwinOutput (line 505) | class DonutSwinOutput(nn.Module): method __init__ (line 506) | def __init__(self, config, dim): method forward (line 511) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DonutSwinLayer (line 518) | class DonutSwinLayer(nn.Module): method __init__ (line 519) | def __init__(self, config, dim, input_resolution, num_heads, drop_path... method set_shift_and_window_size (line 532) | def set_shift_and_window_size(self, input_resolution): method get_attn_mask (line 540) | def get_attn_mask(self, height, width, dtype, device): method maybe_pad (line 568) | def maybe_pad(self, hidden_states, height, width): method forward (line 575) | def forward( class DonutSwinStage (line 641) | class DonutSwinStage(GradientCheckpointingLayer): method __init__ (line 642) | def __init__(self, config, dim, input_resolution, depth, num_heads, dr... method forward (line 668) | def forward( class DonutSwinEncoder (line 697) | class DonutSwinEncoder(nn.Module): method __init__ (line 698) | def __init__(self, config, grid_size): method forward (line 720) | def forward( class DonutSwinPreTrainedModel (line 785) | class DonutSwinPreTrainedModel(PreTrainedModel): method _init_weights (line 794) | def _init_weights(self, module): class DonutSwinModel (line 808) | class DonutSwinModel(DonutSwinPreTrainedModel): method __init__ (line 809) | def __init__(self, config, add_pooling_layer=True, use_mask_token=False): method get_input_embeddings (line 829) | def get_input_embeddings(self): method forward (line 833) | def forward( class DonutSwinForImageClassification (line 904) | class DonutSwinForImageClassification(DonutSwinPreTrainedModel): method __init__ (line 905) | def __init__(self, config): method forward (line 920) | def forward( FILE: src/transformers/models/donut/processing_donut.py class DonutProcessorKwargs (line 26) | class DonutProcessorKwargs(ProcessingKwargs, total=False): class DonutProcessor (line 34) | class DonutProcessor(ProcessorMixin): method __init__ (line 35) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 39) | def __call__( method model_input_names (line 71) | def model_input_names(self): method token2json (line 76) | def token2json(self, tokens, is_inner_value=False, added_vocab=None): FILE: src/transformers/models/dots1/configuration_dots1.py class Dots1Config (line 29) | class Dots1Config(PreTrainedConfig): method __post_init__ (line 108) | def __post_init__(self, **kwargs): FILE: src/transformers/models/dots1/modeling_dots1.py class Dots1RMSNorm (line 51) | class Dots1RMSNorm(nn.Module): method __init__ (line 52) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 60) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 67) | def extra_repr(self): class Dots1RotaryEmbedding (line 71) | class Dots1RotaryEmbedding(nn.Module): method __init__ (line 74) | def __init__(self, config: Dots1Config, device=None): method compute_default_rope_parameters (line 91) | def compute_default_rope_parameters( method forward (line 122) | def forward(self, x, position_ids): function rotate_half (line 136) | def rotate_half(x): function apply_rotary_pos_emb (line 144) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 169) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 181) | def eager_attention_forward( class Dots1Attention (line 207) | class Dots1Attention(nn.Module): method __init__ (line 210) | def __init__(self, config: Dots1Config, layer_idx: int): method forward (line 237) | def forward( class Dots1MLP (line 279) | class Dots1MLP(nn.Module): method __init__ (line 280) | def __init__(self, config, intermediate_size=None): method forward (line 290) | def forward(self, x): class Dots1TopkRouter (line 295) | class Dots1TopkRouter(nn.Module): method __init__ (line 296) | def __init__(self, config): method forward (line 304) | def forward(self, hidden_states): class Dots1NaiveMoe (line 311) | class Dots1NaiveMoe(nn.Module): method __init__ (line 314) | def __init__(self, config): method forward (line 323) | def forward( class Dots1MoE (line 350) | class Dots1MoE(nn.Module): method __init__ (line 355) | def __init__(self, config): method route_tokens_to_experts (line 370) | def route_tokens_to_experts(self, router_logits): method forward (line 395) | def forward(self, hidden_states): class Dots1DecoderLayer (line 406) | class Dots1DecoderLayer(GradientCheckpointingLayer): method __init__ (line 407) | def __init__(self, config: Dots1Config, layer_idx: int): method forward (line 421) | def forward( class Dots1PreTrainedModel (line 454) | class Dots1PreTrainedModel(PreTrainedModel): method _init_weights (line 474) | def _init_weights(self, module): class Dots1Model (line 485) | class Dots1Model(Dots1PreTrainedModel): method __init__ (line 486) | def __init__(self, config: Dots1Config): method forward (line 506) | def forward( class Dots1ForCausalLM (line 570) | class Dots1ForCausalLM(Dots1PreTrainedModel, GenerationMixin): method __init__ (line 575) | def __init__(self, config): method forward (line 586) | def forward( FILE: src/transformers/models/dots1/modular_dots1.py class Dots1Config (line 44) | class Dots1Config(PreTrainedConfig): method __post_init__ (line 123) | def __post_init__(self, **kwargs): class Dots1RMSNorm (line 138) | class Dots1RMSNorm(Qwen3RMSNorm): class Dots1RotaryEmbedding (line 142) | class Dots1RotaryEmbedding(Qwen3RotaryEmbedding): class Dots1Attention (line 146) | class Dots1Attention(Qwen3Attention): class Dots1MLP (line 150) | class Dots1MLP(DeepseekV3MLP): class Dots1TopkRouter (line 154) | class Dots1TopkRouter(DeepseekV3TopkRouter): class Dots1MoE (line 158) | class Dots1MoE(DeepseekV3MoE): method route_tokens_to_experts (line 159) | def route_tokens_to_experts(self, router_logits): class Dots1DecoderLayer (line 185) | class Dots1DecoderLayer(DeepseekV3DecoderLayer): class Dots1PreTrainedModel (line 189) | class Dots1PreTrainedModel(DeepseekV3PreTrainedModel): class Dots1Model (line 193) | class Dots1Model(Qwen3Model): class Dots1ForCausalLM (line 197) | class Dots1ForCausalLM(Qwen3ForCausalLM): method forward (line 198) | def forward( FILE: src/transformers/models/dpr/configuration_dpr.py class DPRConfig (line 24) | class DPRConfig(PreTrainedConfig): FILE: src/transformers/models/dpr/convert_dpr_original_checkpoint_to_pytorch.py function load_states_from_checkpoint (line 30) | def load_states_from_checkpoint(model_file: str) -> CheckpointState: class DPRState (line 38) | class DPRState: method __init__ (line 39) | def __init__(self, src_file: Path): method load_dpr_model (line 42) | def load_dpr_model(self): method from_type (line 46) | def from_type(comp_type: str, *args, **kwargs) -> "DPRState": class DPRContextEncoderState (line 57) | class DPRContextEncoderState(DPRState): method load_dpr_model (line 58) | def load_dpr_model(self): class DPRQuestionEncoderState (line 75) | class DPRQuestionEncoderState(DPRState): method load_dpr_model (line 76) | def load_dpr_model(self): class DPRReaderState (line 93) | class DPRReaderState(DPRState): method load_dpr_model (line 94) | def load_dpr_model(self): function convert (line 110) | def convert(comp_type: str, src_file: Path, dest_dir: Path): FILE: src/transformers/models/dpr/modeling_dpr.py class DPRContextEncoderOutput (line 46) | class DPRContextEncoderOutput(ModelOutput): class DPRQuestionEncoderOutput (line 65) | class DPRQuestionEncoderOutput(ModelOutput): class DPRReaderOutput (line 84) | class DPRReaderOutput(ModelOutput): class DPRPreTrainedModel (line 103) | class DPRPreTrainedModel(PreTrainedModel): class DPREncoder (line 107) | class DPREncoder(DPRPreTrainedModel): method __init__ (line 110) | def __init__(self, config: DPRConfig): method forward (line 121) | def forward( method embeddings_size (line 158) | def embeddings_size(self) -> int: class DPRSpanPredictor (line 164) | class DPRSpanPredictor(DPRPreTrainedModel): method __init__ (line 167) | def __init__(self, config: DPRConfig): method forward (line 175) | def forward( class DPRPretrainedContextEncoder (line 227) | class DPRPretrainedContextEncoder(DPRPreTrainedModel): class DPRPretrainedQuestionEncoder (line 237) | class DPRPretrainedQuestionEncoder(DPRPreTrainedModel): class DPRPretrainedReader (line 247) | class DPRPretrainedReader(DPRPreTrainedModel): class DPRContextEncoder (line 267) | class DPRContextEncoder(DPRPretrainedContextEncoder): method __init__ (line 268) | def __init__(self, config: DPRConfig): method forward (line 276) | def forward( class DPRQuestionEncoder (line 373) | class DPRQuestionEncoder(DPRPretrainedQuestionEncoder): method __init__ (line 374) | def __init__(self, config: DPRConfig): method forward (line 382) | def forward( class DPRReader (line 480) | class DPRReader(DPRPretrainedReader): method __init__ (line 481) | def __init__(self, config: DPRConfig): method forward (line 489) | def forward( FILE: src/transformers/models/dpr/tokenization_dpr.py class DPRContextEncoderTokenizer (line 28) | class DPRContextEncoderTokenizer(BertTokenizer): method __init__ (line 40) | def __init__(self, *args, do_lower_case=False, **kwargs): class DPRQuestionEncoderTokenizer (line 45) | class DPRQuestionEncoderTokenizer(BertTokenizer): method __init__ (line 57) | def __init__(self, *args, do_lower_case=False, **kwargs): class CustomDPRReaderTokenizerMixin (line 138) | class CustomDPRReaderTokenizerMixin: method __call__ (line 139) | def __call__( method decode_best_spans (line 198) | def decode_best_spans( method _get_best_spans (line 274) | def _get_best_spans( class DPRReaderTokenizer (line 311) | class DPRReaderTokenizer(CustomDPRReaderTokenizerMixin, BertTokenizer): method __init__ (line 325) | def __init__(self, *args, do_lower_case=False, **kwargs): FILE: src/transformers/models/dpr/tokenization_dpr_fast.py class DPRContextEncoderTokenizerFast (line 29) | class DPRContextEncoderTokenizerFast(BertTokenizer): class DPRQuestionEncoderTokenizerFast (line 43) | class DPRQuestionEncoderTokenizerFast(BertTokenizer): class CustomDPRReaderTokenizerMixin (line 131) | class CustomDPRReaderTokenizerMixin: method __call__ (line 132) | def __call__( method decode_best_spans (line 190) | def decode_best_spans( method _get_best_spans (line 266) | def _get_best_spans( class DPRReaderTokenizerFast (line 301) | class DPRReaderTokenizerFast(CustomDPRReaderTokenizerMixin, BertTokenizer): FILE: src/transformers/models/dpt/configuration_dpt.py class DPTConfig (line 26) | class DPTConfig(PreTrainedConfig): method __post_init__ (line 123) | def __post_init__(self, **kwargs): FILE: src/transformers/models/dpt/convert_dinov2_depth_to_hf.py function get_dpt_config (line 36) | def get_dpt_config(model_name): function create_rename_keys_dpt (line 72) | def create_rename_keys_dpt(config): function create_rename_keys_backbone (line 115) | def create_rename_keys_backbone(config): function read_in_q_k_v (line 159) | def read_in_q_k_v(state_dict, config): function rename_key (line 178) | def rename_key(dct, old, new): function prepare_img (line 184) | def prepare_img(): function get_original_pixel_values (line 203) | def get_original_pixel_values(image): function convert_dpt_checkpoint (line 244) | def convert_dpt_checkpoint(model_name, pytorch_dump_folder_path, push_to... FILE: src/transformers/models/dpt/convert_dpt_beit_to_hf.py function get_dpt_config (line 32) | def get_dpt_config(model_name): function create_rename_keys (line 71) | def create_rename_keys(config): function remove_ignore_keys_ (line 137) | def remove_ignore_keys_(state_dict): function read_in_q_k_v (line 144) | def read_in_q_k_v(state_dict, config): function rename_key (line 161) | def rename_key(dct, old, new): function prepare_img (line 167) | def prepare_img(): function convert_dpt_checkpoint (line 175) | def convert_dpt_checkpoint(model_name, pytorch_dump_folder_path, push_to... FILE: src/transformers/models/dpt/convert_dpt_hybrid_to_pytorch.py function get_dpt_config (line 34) | def get_dpt_config(checkpoint_url): function remove_ignore_keys_ (line 73) | def remove_ignore_keys_(state_dict): function rename_key (line 79) | def rename_key(name): function read_in_q_k_v (line 192) | def read_in_q_k_v(state_dict, config): function prepare_img (line 213) | def prepare_img(): function convert_dpt_checkpoint (line 221) | def convert_dpt_checkpoint(checkpoint_url, pytorch_dump_folder_path, pus... FILE: src/transformers/models/dpt/convert_dpt_swinv2_to_hf.py function get_dpt_config (line 32) | def get_dpt_config(model_name): function create_rename_keys (line 84) | def create_rename_keys(config): function remove_ignore_keys_ (line 150) | def remove_ignore_keys_(state_dict): function read_in_q_k_v (line 157) | def read_in_q_k_v(state_dict, config, model): function rename_key (line 173) | def rename_key(dct, old, new): function prepare_img (line 179) | def prepare_img(): function convert_dpt_checkpoint (line 187) | def convert_dpt_checkpoint(model_name, pytorch_dump_folder_path, verify_... FILE: src/transformers/models/dpt/convert_dpt_to_pytorch.py function get_dpt_config (line 34) | def get_dpt_config(checkpoint_url): function remove_ignore_keys_ (line 61) | def remove_ignore_keys_(state_dict): function rename_key (line 67) | def rename_key(name): function read_in_q_k_v (line 160) | def read_in_q_k_v(state_dict, config): function prepare_img (line 181) | def prepare_img(): function convert_dpt_checkpoint (line 189) | def convert_dpt_checkpoint(checkpoint_url, pytorch_dump_folder_path, pus... FILE: src/transformers/models/dpt/image_processing_dpt.py class DPTImageProcessorKwargs (line 49) | class DPTImageProcessorKwargs(ImagesKwargs, total=False): function get_resize_output_image_size (line 69) | def get_resize_output_image_size( class DPTImageProcessor (line 109) | class DPTImageProcessor(TorchvisionBackend): method __init__ (line 131) | def __init__(self, **kwargs: Unpack[DPTImageProcessorKwargs]): method preprocess (line 135) | def preprocess( method _preprocess_image_like_inputs (line 147) | def _preprocess_image_like_inputs( method reduce_label (line 191) | def reduce_label(self, labels: list["torch.Tensor"]) -> list["torch.Te... method _preprocess (line 201) | def _preprocess( method post_process_semantic_segmentation (line 260) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... method resize (line 305) | def resize( method pad_image (line 345) | def pad_image( method post_process_depth_estimation (line 373) | def post_process_depth_estimation( FILE: src/transformers/models/dpt/image_processing_pil_dpt.py class DPTImageProcessorKwargs (line 45) | class DPTImageProcessorKwargs(ImagesKwargs, total=False): function get_resize_output_image_size (line 66) | def get_resize_output_image_size( class DPTImageProcessorPil (line 106) | class DPTImageProcessorPil(PilBackend): method __init__ (line 124) | def __init__(self, **kwargs: Unpack[DPTImageProcessorKwargs]): method preprocess (line 128) | def preprocess( method _preprocess_image_like_inputs (line 140) | def _preprocess_image_like_inputs( method reduce_label (line 181) | def reduce_label(self, image: np.ndarray) -> np.ndarray: method resize (line 188) | def resize( method pad_image (line 208) | def pad_image(self, image: np.ndarray, size_divisor: int = 1, **kwargs... method _preprocess (line 228) | def _preprocess( method post_process_semantic_segmentation (line 265) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... method post_process_depth_estimation (line 290) | def post_process_depth_estimation( FILE: src/transformers/models/dpt/modeling_dpt.py class BaseModelOutputWithIntermediateActivations (line 52) | class BaseModelOutputWithIntermediateActivations(ModelOutput): class BaseModelOutputWithPoolingAndIntermediateActivations (line 71) | class BaseModelOutputWithPoolingAndIntermediateActivations(ModelOutput): class DPTViTHybridEmbeddings (line 89) | class DPTViTHybridEmbeddings(nn.Module): method __init__ (line 96) | def __init__(self, config: DPTConfig, feature_size: tuple[int, int] | ... method _resize_pos_embed (line 130) | def _resize_pos_embed(self, posemb, grid_size_height, grid_size_width,... method forward (line 144) | def forward( class DPTViTEmbeddings (line 185) | class DPTViTEmbeddings(nn.Module): method __init__ (line 191) | def __init__(self, config): method _resize_pos_embed (line 201) | def _resize_pos_embed(self, posemb, grid_size_height, grid_size_width,... method forward (line 215) | def forward(self, pixel_values: torch.Tensor) -> BaseModelOutputWithIn... class DPTViTPatchEmbeddings (line 240) | class DPTViTPatchEmbeddings(nn.Module): method __init__ (line 246) | def __init__(self, config: DPTConfig): method forward (line 261) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 272) | def eager_attention_forward( class DPTSelfAttention (line 301) | class DPTSelfAttention(nn.Module): method __init__ (line 302) | def __init__(self, config: DPTConfig): method forward (line 322) | def forward( class DPTViTSelfOutput (line 357) | class DPTViTSelfOutput(nn.Module): method __init__ (line 363) | def __init__(self, config: DPTConfig): method forward (line 368) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class DPTViTAttention (line 375) | class DPTViTAttention(nn.Module): method __init__ (line 376) | def __init__(self, config: DPTConfig): method forward (line 381) | def forward( class DPTViTIntermediate (line 392) | class DPTViTIntermediate(nn.Module): method __init__ (line 393) | def __init__(self, config: DPTConfig): method forward (line 401) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DPTViTOutput (line 408) | class DPTViTOutput(nn.Module): method __init__ (line 409) | def __init__(self, config: DPTConfig): method forward (line 414) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class DPTViTLayer (line 422) | class DPTViTLayer(GradientCheckpointingLayer): method __init__ (line 425) | def __init__(self, config: DPTConfig): method forward (line 435) | def forward( class DPTReassembleStage (line 456) | class DPTReassembleStage(nn.Module): method __init__ (line 472) | def __init__(self, config): method _init_reassemble_dpt_hybrid (line 484) | def _init_reassemble_dpt_hybrid(self, config): method _init_reassemble_dpt (line 510) | def _init_reassemble_dpt(self, config): method forward (line 522) | def forward(self, hidden_states: list[torch.Tensor], patch_height=None... function _get_backbone_hidden_size (line 560) | def _get_backbone_hidden_size(config): class DPTReassembleLayer (line 567) | class DPTReassembleLayer(nn.Module): method __init__ (line 568) | def __init__(self, config: DPTConfig, channels: int, factor: int): method forward (line 583) | def forward(self, hidden_state): class DPTFeatureFusionStage (line 589) | class DPTFeatureFusionStage(nn.Module): method __init__ (line 590) | def __init__(self, config: DPTConfig): method forward (line 596) | def forward(self, hidden_states): class DPTPreActResidualLayer (line 613) | class DPTPreActResidualLayer(nn.Module): method __init__ (line 622) | def __init__(self, config: DPTConfig): method forward (line 656) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class DPTFeatureFusionLayer (line 674) | class DPTFeatureFusionLayer(nn.Module): method __init__ (line 684) | def __init__(self, config: DPTConfig, align_corners: bool = True): method forward (line 694) | def forward(self, hidden_state: torch.Tensor, residual: torch.Tensor |... class DPTPreTrainedModel (line 712) | class DPTPreTrainedModel(PreTrainedModel): method _init_weights (line 728) | def _init_weights(self, module): class DPTViTEncoder (line 736) | class DPTViTEncoder(nn.Module): method __init__ (line 737) | def __init__(self, config: DPTConfig): method forward (line 742) | def forward( class DPTModel (line 752) | class DPTModel(DPTPreTrainedModel): method __init__ (line 753) | def __init__(self, config: DPTConfig, add_pooling_layer: bool = True): method get_input_embeddings (line 774) | def get_input_embeddings(self): method forward (line 783) | def forward( class DPTViTPooler (line 805) | class DPTViTPooler(nn.Module): method __init__ (line 806) | def __init__(self, config: DPTConfig): method forward (line 811) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DPTNeck (line 820) | class DPTNeck(nn.Module): method __init__ (line 832) | def __init__(self, config: DPTConfig): method forward (line 849) | def forward( class DPTDepthEstimationHead (line 878) | class DPTDepthEstimationHead(nn.Module): method __init__ (line 885) | def __init__(self, config: DPTConfig): method forward (line 904) | def forward(self, hidden_states: list[torch.Tensor]) -> torch.Tensor: class DPTForDepthEstimation (line 923) | class DPTForDepthEstimation(DPTPreTrainedModel): method __init__ (line 924) | def __init__(self, config): method forward (line 944) | def forward( class DPTSemanticSegmentationHead (line 1038) | class DPTSemanticSegmentationHead(nn.Module): method __init__ (line 1039) | def __init__(self, config: DPTConfig): method forward (line 1053) | def forward(self, hidden_states: list[torch.Tensor]) -> torch.Tensor: class DPTAuxiliaryHead (line 1060) | class DPTAuxiliaryHead(nn.Module): method __init__ (line 1061) | def __init__(self, config: DPTConfig): method forward (line 1073) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class DPTForSemanticSegmentation (line 1079) | class DPTForSemanticSegmentation(DPTPreTrainedModel): method __init__ (line 1080) | def __init__(self, config: DPTConfig): method forward (line 1097) | def forward( FILE: src/transformers/models/dpt/modular_dpt.py function get_resize_output_image_size (line 42) | def get_resize_output_image_size( class DPTImageProcessorKwargs (line 81) | class DPTImageProcessorKwargs(ImagesKwargs, total=False): class DPTImageProcessor (line 102) | class DPTImageProcessor(BeitImageProcessor): method resize (line 122) | def resize( method pad_image (line 162) | def pad_image( method _preprocess (line 190) | def _preprocess( method post_process_depth_estimation (line 248) | def post_process_depth_estimation( FILE: src/transformers/models/edgetam/configuration_edgetam.py class EdgeTamVisionConfig (line 29) | class EdgeTamVisionConfig(PreTrainedConfig): method __post_init__ (line 68) | def __post_init__(self, **kwargs): class EdgeTamPromptEncoderConfig (line 90) | class EdgeTamPromptEncoderConfig(PreTrainedConfig): class EdgeTamMaskDecoderConfig (line 114) | class EdgeTamMaskDecoderConfig(PreTrainedConfig): class EdgeTamConfig (line 152) | class EdgeTamConfig(PreTrainedConfig): method __post_init__ (line 200) | def __post_init__(self, **kwargs): FILE: src/transformers/models/edgetam/convert_edgetam_to_hf.py function get_config (line 42) | def get_config(model_name): function replace_keys (line 111) | def replace_keys(state_dict): function convert_edgetam_checkpoint (line 192) | def convert_edgetam_checkpoint(model_name, checkpoint_path, pytorch_dump... FILE: src/transformers/models/edgetam/modeling_edgetam.py class EdgeTamLayerNorm (line 53) | class EdgeTamLayerNorm(nn.LayerNorm): method __init__ (line 59) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 65) | def forward(self, features: torch.Tensor) -> torch.Tensor: class EdgeTamVisionEncoderOutput (line 81) | class EdgeTamVisionEncoderOutput(BaseModelOutputWithPooling): function eager_attention_forward (line 105) | def eager_attention_forward( class EdgeTamAttention (line 127) | class EdgeTamAttention(nn.Module): method __init__ (line 133) | def __init__(self, config, downsample_rate=None): method forward (line 149) | def forward( class EdgeTamTwoWayAttentionBlock (line 198) | class EdgeTamTwoWayAttentionBlock(GradientCheckpointingLayer): method __init__ (line 199) | def __init__(self, config: EdgeTamMaskDecoderConfig, skip_first_layer_... method forward (line 230) | def forward( class EdgeTamFeedForward (line 275) | class EdgeTamFeedForward(nn.Module): method __init__ (line 276) | def __init__( method forward (line 293) | def forward(self, hidden_states): class EdgeTamPreTrainedModel (line 306) | class EdgeTamPreTrainedModel(PreTrainedModel): method _init_weights (line 317) | def _init_weights(self, module): class EdgeTamSinePositionEmbedding (line 327) | class EdgeTamSinePositionEmbedding(nn.Module): method __init__ (line 333) | def __init__( method forward (line 345) | def forward( class EdgeTamVisionNeck (line 373) | class EdgeTamVisionNeck(nn.Module): method __init__ (line 374) | def __init__(self, config: EdgeTamVisionConfig): method forward (line 394) | def forward(self, hidden_states: torch.Tensor) -> tuple[tuple[torch.Te... class EdgeTamVisionModel (line 430) | class EdgeTamVisionModel(EdgeTamPreTrainedModel): method __init__ (line 437) | def __init__(self, config: EdgeTamVisionConfig): method forward (line 450) | def forward( class EdgeTamImageSegmentationOutput (line 478) | class EdgeTamImageSegmentationOutput(ModelOutput): class EdgeTamPositionalEmbedding (line 510) | class EdgeTamPositionalEmbedding(nn.Module): method __init__ (line 511) | def __init__(self, config: EdgeTamPromptEncoderConfig): method forward (line 517) | def forward(self, input_coords, input_shape=None): class EdgeTamMaskEmbedding (line 535) | class EdgeTamMaskEmbedding(nn.Module): method __init__ (line 536) | def __init__(self, config: EdgeTamPromptEncoderConfig): method forward (line 550) | def forward(self, masks): class EdgeTamPromptEncoder (line 562) | class EdgeTamPromptEncoder(nn.Module): method __init__ (line 563) | def __init__(self, config: EdgeTamPromptEncoderConfig): method _embed_points (line 577) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 602) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 614) | def forward( class EdgeTamTwoWayTransformer (line 657) | class EdgeTamTwoWayTransformer(nn.Module): method __init__ (line 658) | def __init__(self, config: EdgeTamMaskDecoderConfig): method forward (line 671) | def forward( class EdgeTamMaskDecoder (line 714) | class EdgeTamMaskDecoder(nn.Module): method __init__ (line 715) | def __init__(self, config: EdgeTamMaskDecoderConfig): method forward (line 756) | def forward( method _get_stability_scores (line 867) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 879) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... class EdgeTamModel (line 923) | class EdgeTamModel(EdgeTamPreTrainedModel): method __init__ (line 938) | def __init__(self, config: EdgeTamConfig): method get_image_wide_positional_embeddings (line 955) | def get_image_wide_positional_embeddings(self) -> torch.Tensor: method get_image_embeddings (line 969) | def get_image_embeddings( method get_prompt_embeddings (line 997) | def get_prompt_embeddings( method forward (line 1032) | def forward( method get_image_features (line 1209) | def get_image_features( FILE: src/transformers/models/edgetam/modular_edgetam.py class EdgeTamVisionConfig (line 42) | class EdgeTamVisionConfig(PreTrainedConfig): method __post_init__ (line 81) | def __post_init__(self, **kwargs): class EdgeTamPromptEncoderConfig (line 103) | class EdgeTamPromptEncoderConfig(Sam2PromptEncoderConfig): class EdgeTamMaskDecoderConfig (line 109) | class EdgeTamMaskDecoderConfig(Sam2MaskDecoderConfig): class EdgeTamConfig (line 115) | class EdgeTamConfig(Sam2Config): class EdgeTamLayerNorm (line 154) | class EdgeTamLayerNorm(Sam2LayerNorm): class EdgeTamVisionEncoderOutput (line 158) | class EdgeTamVisionEncoderOutput(Sam2VisionEncoderOutput): class EdgeTamAttention (line 162) | class EdgeTamAttention(Sam2Attention): class EdgeTamTwoWayAttentionBlock (line 166) | class EdgeTamTwoWayAttentionBlock(Sam2TwoWayAttentionBlock): class EdgeTamFeedForward (line 170) | class EdgeTamFeedForward(Sam2FeedForward): class EdgeTamPreTrainedModel (line 175) | class EdgeTamPreTrainedModel(Sam2PreTrainedModel): method _init_weights (line 179) | def _init_weights(self, module): class EdgeTamVisionModel (line 193) | class EdgeTamVisionModel(Sam2VisionModel): method get_input_embeddings (line 200) | def get_input_embeddings(self): method forward (line 205) | def forward( class EdgeTamModel (line 231) | class EdgeTamModel(Sam2Model): method get_input_embeddings (line 243) | def get_input_embeddings(self): FILE: src/transformers/models/edgetam_video/configuration_edgetam_video.py class EdgeTamVideoPromptEncoderConfig (line 30) | class EdgeTamVideoPromptEncoderConfig(PreTrainedConfig): class EdgeTamVideoMaskDecoderConfig (line 54) | class EdgeTamVideoMaskDecoderConfig(PreTrainedConfig): class EdgeTamVideoConfig (line 92) | class EdgeTamVideoConfig(PreTrainedConfig): method __post_init__ (line 286) | def __post_init__(self, **kwargs): FILE: src/transformers/models/edgetam_video/convert_edgetam_video_to_hf.py function get_config (line 43) | def get_config(model_name): function replace_keys (line 110) | def replace_keys(state_dict): function convert_edgetam_checkpoint (line 235) | def convert_edgetam_checkpoint(model_name, checkpoint_path, pytorch_dump... FILE: src/transformers/models/edgetam_video/modeling_edgetam_video.py class EdgeTamVideoLayerNorm (line 56) | class EdgeTamVideoLayerNorm(nn.LayerNorm): method __init__ (line 62) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 68) | def forward(self, features: torch.Tensor) -> torch.Tensor: class EdgeTamVideoMemoryFuserCXBlock (line 83) | class EdgeTamVideoMemoryFuserCXBlock(GradientCheckpointingLayer): method __init__ (line 84) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 104) | def forward(self, hidden_states): class EdgeTamVideoVisionEncoderOutput (line 121) | class EdgeTamVideoVisionEncoderOutput(BaseModelOutputWithPooling): class EdgeTamVideoVisionRotaryEmbedding (line 145) | class EdgeTamVideoVisionRotaryEmbedding(nn.Module): method __init__ (line 151) | def __init__(self, config: EdgeTamVideoConfig, end_x: int | None = Non... method forward (line 168) | def forward(self) -> tuple[torch.Tensor, torch.Tensor]: method create_inv_freq (line 172) | def create_inv_freq(self): function eager_attention_forward (line 187) | def eager_attention_forward( class EdgeTamVideoAttention (line 209) | class EdgeTamVideoAttention(nn.Module): method __init__ (line 215) | def __init__(self, config, downsample_rate=None): method forward (line 231) | def forward( function rotate_pairwise (line 280) | def rotate_pairwise(x): function apply_rotary_pos_emb_2d_self_attn (line 298) | def apply_rotary_pos_emb_2d_self_attn( class EdgeTamVideoRoPESelfAttention (line 327) | class EdgeTamVideoRoPESelfAttention(nn.Module): method __init__ (line 330) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 346) | def forward( function apply_rotary_pos_emb_2d_cross_attn (line 388) | def apply_rotary_pos_emb_2d_cross_attn( class EdgeTamVideoRoPECrossAttention (line 463) | class EdgeTamVideoRoPECrossAttention(nn.Module): method __init__ (line 466) | def __init__(self, config: EdgeTamVideoConfig, kv_in_dim: int): method forward (line 484) | def forward( class EdgeTamVideoTwoWayAttentionBlock (line 539) | class EdgeTamVideoTwoWayAttentionBlock(GradientCheckpointingLayer): method __init__ (line 540) | def __init__(self, config: EdgeTamVideoMaskDecoderConfig, skip_first_l... method forward (line 571) | def forward( class EdgeTamVideoPositionEmbeddingSine (line 617) | class EdgeTamVideoPositionEmbeddingSine(nn.Module): method __init__ (line 623) | def __init__( method forward (line 635) | def forward( class EdgeTamVideoMemoryFuser (line 663) | class EdgeTamVideoMemoryFuser(nn.Module): method __init__ (line 664) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 670) | def forward(self, hidden_states): class EdgeTamVideoMaskDownSamplerLayer (line 677) | class EdgeTamVideoMaskDownSamplerLayer(nn.Module): method __init__ (line 678) | def __init__(self, config: EdgeTamVideoConfig, in_channels: int, out_c... method forward (line 690) | def forward(self, x): class EdgeTamVideoMaskDownSampler (line 694) | class EdgeTamVideoMaskDownSampler(nn.Module): method __init__ (line 703) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 718) | def forward(self, x): class EdgeTamVideoMemoryEncoder (line 725) | class EdgeTamVideoMemoryEncoder(nn.Module): method __init__ (line 726) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 737) | def forward( class EdgeTamVideoFeedForward (line 756) | class EdgeTamVideoFeedForward(nn.Module): method __init__ (line 757) | def __init__( method forward (line 774) | def forward(self, hidden_states): class EdgeTamVideoPositionalEmbedding (line 786) | class EdgeTamVideoPositionalEmbedding(nn.Module): method __init__ (line 787) | def __init__(self, config: EdgeTamVideoPromptEncoderConfig): method forward (line 793) | def forward(self, input_coords, input_shape=None): class EdgeTamVideoPreTrainedModel (line 812) | class EdgeTamVideoPreTrainedModel(PreTrainedModel): method _init_weights (line 822) | def _init_weights(self, module): class EdgeTamVideoInferenceCache (line 848) | class EdgeTamVideoInferenceCache: method __init__ (line 851) | def __init__( method cache_vision_features (line 863) | def cache_vision_features(self, frame_idx: int, features: dict): method get_vision_features (line 879) | def get_vision_features(self, frame_idx: int) -> dict | None: method clear_all (line 895) | def clear_all(self): class EdgeTamVideoInferenceSession (line 900) | class EdgeTamVideoInferenceSession: method __init__ (line 923) | def __init__( method num_frames (line 971) | def num_frames(self) -> int | None: method obj_id_to_idx (line 975) | def obj_id_to_idx(self, obj_id: int) -> int: method obj_idx_to_id (line 997) | def obj_idx_to_id(self, obj_idx: int) -> int: method get_obj_num (line 1001) | def get_obj_num(self) -> int: method add_point_inputs (line 1006) | def add_point_inputs(self, obj_idx: int, frame_idx: int, inputs: dict): method remove_point_inputs (line 1016) | def remove_point_inputs(self, obj_idx: int, frame_idx: int): method add_mask_inputs (line 1020) | def add_mask_inputs(self, obj_idx: int, frame_idx: int, inputs: torch.... method remove_mask_inputs (line 1026) | def remove_mask_inputs(self, obj_idx: int, frame_idx: int): method store_output (line 1031) | def store_output( method get_output (line 1068) | def get_output( method add_new_frame (line 1095) | def add_new_frame(self, pixel_values: torch.Tensor, frame_idx: int | N... method get_frame (line 1111) | def get_frame(self, frame_idx: int) -> torch.Tensor: method reset_tracking_data (line 1115) | def reset_tracking_data(self): method reset_inference_session (line 1127) | def reset_inference_session(self): class EdgeTamVideoMemoryAttentionMLP (line 1140) | class EdgeTamVideoMemoryAttentionMLP(nn.Module): method __init__ (line 1141) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 1151) | def forward(self, x): class EdgeTamVideoMemoryAttentionLayer (line 1155) | class EdgeTamVideoMemoryAttentionLayer(nn.Module): method __init__ (line 1156) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 1172) | def forward( class EdgeTamVideoMemoryAttention (line 1206) | class EdgeTamVideoMemoryAttention(nn.Module): method __init__ (line 1207) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 1218) | def forward( class EdgeTamVideoPerceiverMLP (line 1269) | class EdgeTamVideoPerceiverMLP(nn.Module): method __init__ (line 1270) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 1280) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EdgeTamVideoPerceiverAttention (line 1286) | class EdgeTamVideoPerceiverAttention(nn.Module): method __init__ (line 1287) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 1304) | def forward( class EdgeTamVideoPerceiverEncoderLayer (line 1354) | class EdgeTamVideoPerceiverEncoderLayer(nn.Module): method __init__ (line 1355) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 1370) | def forward( function window_partition (line 1403) | def window_partition(hidden_state, window_size): class EdgeTamVideoPerceiverResampler (line 1435) | class EdgeTamVideoPerceiverResampler(nn.Module): method __init__ (line 1436) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 1457) | def forward( method _forward_1d (line 1483) | def _forward_1d( method _forward_2d (line 1508) | def _forward_2d(self, hidden_states: torch.Tensor) -> tuple[torch.Tens... class EdgeTamVideoImageSegmentationOutput (line 1540) | class EdgeTamVideoImageSegmentationOutput(ModelOutput): class EdgeTamVideoSegmentationOutput (line 1581) | class EdgeTamVideoSegmentationOutput(ModelOutput): class EdgeTamVideoMaskEmbedding (line 1599) | class EdgeTamVideoMaskEmbedding(nn.Module): method __init__ (line 1600) | def __init__(self, config: EdgeTamVideoPromptEncoderConfig): method forward (line 1614) | def forward(self, masks): class EdgeTamVideoPromptEncoder (line 1626) | class EdgeTamVideoPromptEncoder(nn.Module): method __init__ (line 1627) | def __init__(self, config: EdgeTamVideoPromptEncoderConfig): method _embed_points (line 1641) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 1666) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 1678) | def forward( class EdgeTamVideoTwoWayTransformer (line 1721) | class EdgeTamVideoTwoWayTransformer(nn.Module): method __init__ (line 1722) | def __init__(self, config: EdgeTamVideoMaskDecoderConfig): method forward (line 1735) | def forward( class EdgeTamVideoMaskDecoder (line 1778) | class EdgeTamVideoMaskDecoder(nn.Module): method __init__ (line 1779) | def __init__(self, config: EdgeTamVideoMaskDecoderConfig): method forward (line 1820) | def forward( method _get_stability_scores (line 1931) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 1943) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... function get_1d_sine_pe (line 1985) | def get_1d_sine_pe(pos_inds, dim, temperature=10000): class EdgeTamVideoModel (line 1999) | class EdgeTamVideoModel(EdgeTamVideoPreTrainedModel): method __init__ (line 2005) | def __init__(self, config: EdgeTamVideoConfig): method get_input_embeddings (line 2056) | def get_input_embeddings(self): method get_image_wide_positional_embeddings (line 2059) | def get_image_wide_positional_embeddings(self) -> torch.Tensor: method get_image_embeddings (line 2073) | def get_image_embeddings( method get_prompt_embeddings (line 2101) | def get_prompt_embeddings( method forward (line 2135) | def forward( method get_image_features (line 2234) | def get_image_features( method _prepare_vision_features (line 2265) | def _prepare_vision_features( method _single_frame_forward (line 2295) | def _single_frame_forward( method _use_mask_as_output (line 2493) | def _use_mask_as_output( method _select_closest_cond_frames (line 2539) | def _select_closest_cond_frames(self, frame_idx, cond_frame_outputs, m... method _gather_memory_frame_outputs (line 2579) | def _gather_memory_frame_outputs( method _build_memory_attention_inputs (line 2626) | def _build_memory_attention_inputs( method _get_object_pointers (line 2662) | def _get_object_pointers( method _process_object_pointers (line 2723) | def _process_object_pointers( method _prepare_memory_conditioned_features (line 2772) | def _prepare_memory_conditioned_features( method _use_multimask (line 2890) | def _use_multimask(self, is_init_cond_frame: bool, point_inputs: dict ... method _run_single_frame_inference (line 2900) | def _run_single_frame_inference( method _encode_new_memory (line 3023) | def _encode_new_memory( method propagate_in_video_iterator (line 3072) | def propagate_in_video_iterator( FILE: src/transformers/models/edgetam_video/modular_edgetam_video.py class EdgeTamVideoPromptEncoderConfig (line 62) | class EdgeTamVideoPromptEncoderConfig(Sam2VideoPromptEncoderConfig): class EdgeTamVideoMaskDecoderConfig (line 68) | class EdgeTamVideoMaskDecoderConfig(Sam2VideoMaskDecoderConfig): class EdgeTamVideoConfig (line 74) | class EdgeTamVideoConfig(PreTrainedConfig): method __post_init__ (line 268) | def __post_init__(self, **kwargs): class EdgeTamVideoLayerNorm (line 296) | class EdgeTamVideoLayerNorm(Sam2VideoLayerNorm): class EdgeTamVideoMemoryFuserCXBlock (line 300) | class EdgeTamVideoMemoryFuserCXBlock(Sam2VideoMemoryFuserCXBlock): class EdgeTamVideoVisionEncoderOutput (line 304) | class EdgeTamVideoVisionEncoderOutput(Sam2VideoVisionEncoderOutput): class EdgeTamVideoVisionRotaryEmbedding (line 308) | class EdgeTamVideoVisionRotaryEmbedding(Sam2VideoVisionRotaryEmbedding): method __init__ (line 309) | def __init__(self, config: EdgeTamVideoConfig, end_x: int | None = Non... class EdgeTamVideoAttention (line 326) | class EdgeTamVideoAttention(Sam2VideoAttention): function apply_rotary_pos_emb_2d_self_attn (line 330) | def apply_rotary_pos_emb_2d_self_attn( function apply_rotary_pos_emb_2d_cross_attn (line 359) | def apply_rotary_pos_emb_2d_cross_attn( class EdgeTamVideoRoPESelfAttention (line 434) | class EdgeTamVideoRoPESelfAttention(nn.Module): method __init__ (line 437) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 453) | def forward( class EdgeTamVideoRoPECrossAttention (line 495) | class EdgeTamVideoRoPECrossAttention(nn.Module): method __init__ (line 498) | def __init__(self, config: EdgeTamVideoConfig, kv_in_dim: int): method forward (line 516) | def forward( class EdgeTamVideoTwoWayAttentionBlock (line 571) | class EdgeTamVideoTwoWayAttentionBlock(Sam2VideoTwoWayAttentionBlock): class EdgeTamVideoPositionEmbeddingSine (line 575) | class EdgeTamVideoPositionEmbeddingSine(Sam2VideoPositionEmbeddingSine): method forward (line 578) | def forward(self, **super_kwargs): class EdgeTamVideoMemoryEncoder (line 582) | class EdgeTamVideoMemoryEncoder(Sam2VideoMemoryEncoder): class EdgeTamVideoFeedForward (line 586) | class EdgeTamVideoFeedForward(Sam2VideoFeedForward): class EdgeTamVideoPreTrainedModel (line 590) | class EdgeTamVideoPreTrainedModel(Sam2VideoPreTrainedModel): method _init_weights (line 591) | def _init_weights(self, module): class EdgeTamVideoInferenceSession (line 599) | class EdgeTamVideoInferenceSession(Sam2VideoInferenceSession): class EdgeTamVideoMemoryAttentionMLP (line 603) | class EdgeTamVideoMemoryAttentionMLP(nn.Module): method __init__ (line 604) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 614) | def forward(self, x): class EdgeTamVideoMemoryAttentionLayer (line 618) | class EdgeTamVideoMemoryAttentionLayer(nn.Module): method __init__ (line 619) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 635) | def forward( class EdgeTamVideoMemoryAttention (line 669) | class EdgeTamVideoMemoryAttention(Sam2VideoMemoryAttention): method __init__ (line 670) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 676) | def forward( class EdgeTamVideoPerceiverMLP (line 727) | class EdgeTamVideoPerceiverMLP(nn.Module): method __init__ (line 728) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 738) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EdgeTamVideoPerceiverAttention (line 744) | class EdgeTamVideoPerceiverAttention(nn.Module): method __init__ (line 745) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 762) | def forward( class EdgeTamVideoPerceiverEncoderLayer (line 812) | class EdgeTamVideoPerceiverEncoderLayer(nn.Module): method __init__ (line 813) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 828) | def forward( class EdgeTamVideoPerceiverResampler (line 861) | class EdgeTamVideoPerceiverResampler(nn.Module): method __init__ (line 862) | def __init__(self, config: EdgeTamVideoConfig): method forward (line 883) | def forward( method _forward_1d (line 909) | def _forward_1d( method _forward_2d (line 934) | def _forward_2d(self, hidden_states: torch.Tensor) -> tuple[torch.Tens... class EdgeTamVideoImageSegmentationOutput (line 964) | class EdgeTamVideoImageSegmentationOutput(Sam2VideoImageSegmentationOutp... class EdgeTamVideoSegmentationOutput (line 968) | class EdgeTamVideoSegmentationOutput(Sam2VideoSegmentationOutput): class EdgeTamVideoModel (line 973) | class EdgeTamVideoModel(Sam2VideoModel): method __init__ (line 977) | def __init__(self, config: EdgeTamVideoConfig): method _build_memory_attention_inputs (line 983) | def _build_memory_attention_inputs( method _prepare_memory_conditioned_features (line 1019) | def _prepare_memory_conditioned_features( method _encode_new_memory (line 1137) | def _encode_new_memory( method forward (line 1179) | def forward( method _use_mask_as_output (line 1276) | def _use_mask_as_output( method _run_single_frame_inference (line 1322) | def _run_single_frame_inference( method _batch_encode_memories (line 1445) | def _batch_encode_memories(self): FILE: src/transformers/models/efficientloftr/configuration_efficientloftr.py class EfficientLoFTRConfig (line 24) | class EfficientLoFTRConfig(PreTrainedConfig): method __post_init__ (line 101) | def __post_init__(self, **kwargs): method validate_architecture (line 126) | def validate_architecture(self): FILE: src/transformers/models/efficientloftr/convert_efficientloftr_to_hf.py function prepare_imgs (line 34) | def prepare_imgs(): function verify_model_outputs (line 41) | def verify_model_outputs(model, device): function convert_old_keys_to_new_keys (line 109) | def convert_old_keys_to_new_keys(state_dict_keys: list[str]): function write_model (line 128) | def write_model( function write_image_processor (line 201) | def write_image_processor(save_dir, model_name, organization, push_to_hu... FILE: src/transformers/models/efficientloftr/image_processing_efficientloftr.py class EfficientLoFTRImageProcessorKwargs (line 36) | class EfficientLoFTRImageProcessorKwargs(ImagesKwargs, total=False): function _is_valid_image (line 45) | def _is_valid_image(image): function validate_and_format_image_pairs (line 51) | def validate_and_format_image_pairs(images: ImageInput): function is_grayscale (line 79) | def is_grayscale( function convert_to_grayscale (line 90) | def convert_to_grayscale( class EfficientLoFTRImageProcessor (line 110) | class EfficientLoFTRImageProcessor(TorchvisionBackend): method __init__ (line 121) | def __init__(self, **kwargs: Unpack[EfficientLoFTRImageProcessorKwargs]): method preprocess (line 125) | def preprocess(self, images: ImageInput, **kwargs: Unpack[EfficientLoF... method _prepare_images_structure (line 128) | def _prepare_images_structure( method _preprocess (line 137) | def _preprocess( method post_process_keypoint_matching (line 180) | def post_process_keypoint_matching( method visualize_keypoint_matching (line 239) | def visualize_keypoint_matching( method _get_color (line 294) | def _get_color(self, score): FILE: src/transformers/models/efficientloftr/image_processing_pil_efficientloftr.py class EfficientLoFTRImageProcessorKwargs (line 35) | class EfficientLoFTRImageProcessorKwargs(ImagesKwargs, total=False): function is_grayscale (line 44) | def is_grayscale(image: np.ndarray): function convert_to_grayscale (line 50) | def convert_to_grayscale(image: ImageInput) -> ImageInput: function validate_and_format_image_pairs (line 79) | def validate_and_format_image_pairs(images: ImageInput): class EfficientLoFTRImageProcessorPil (line 108) | class EfficientLoFTRImageProcessorPil(PilBackend): method __init__ (line 119) | def __init__(self, **kwargs: Unpack[EfficientLoFTRImageProcessorKwargs]): method preprocess (line 123) | def preprocess(self, images: ImageInput, **kwargs: Unpack[EfficientLoF... method _prepare_images_structure (line 126) | def _prepare_images_structure(self, images: ImageInput, **kwargs) -> I... method _preprocess (line 131) | def _preprocess( method post_process_keypoint_matching (line 164) | def post_process_keypoint_matching( method visualize_keypoint_matching (line 225) | def visualize_keypoint_matching( method _get_color (line 273) | def _get_color(self, score): FILE: src/transformers/models/efficientloftr/modeling_efficientloftr.py class EfficientLoFTRKeypointMatchingOutput (line 49) | class EfficientLoFTRKeypointMatchingOutput(ModelOutput): function compute_embeddings (line 77) | def compute_embeddings(inv_freq: torch.Tensor, embed_height: int, embed_... class EfficientLoFTRRotaryEmbedding (line 91) | class EfficientLoFTRRotaryEmbedding(nn.Module): method __init__ (line 95) | def __init__(self, config: EfficientLoFTRConfig, device=None): method compute_default_rope_parameters (line 111) | def compute_default_rope_parameters( method forward (line 144) | def forward( class EfficientLoFTRConvNormLayer (line 166) | class EfficientLoFTRConvNormLayer(nn.Module): method __init__ (line 167) | def __init__(self, config, in_channels, out_channels, kernel_size, str... method forward (line 180) | def forward(self, hidden_state): class EfficientLoFTRRepVGGBlock (line 187) | class EfficientLoFTRRepVGGBlock(GradientCheckpointingLayer): method __init__ (line 192) | def __init__(self, config: EfficientLoFTRConfig, stage_idx: int, block... method forward (line 207) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EfficientLoFTRRepVGGStage (line 217) | class EfficientLoFTRRepVGGStage(nn.Module): method __init__ (line 218) | def __init__(self, config: EfficientLoFTRConfig, stage_idx: int): method forward (line 230) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EfficientLoFTRepVGG (line 236) | class EfficientLoFTRepVGG(nn.Module): method __init__ (line 237) | def __init__(self, config: EfficientLoFTRConfig): method forward (line 246) | def forward(self, hidden_states: torch.Tensor) -> list[torch.Tensor]: class EfficientLoFTRAggregationLayer (line 257) | class EfficientLoFTRAggregationLayer(nn.Module): method __init__ (line 258) | def __init__(self, config: EfficientLoFTRConfig): method forward (line 277) | def forward( function rotate_half (line 296) | def rotate_half(x): function apply_rotary_pos_emb (line 305) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 334) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 347) | def eager_attention_forward( class EfficientLoFTRAttention (line 372) | class EfficientLoFTRAttention(nn.Module): method __init__ (line 375) | def __init__(self, config: EfficientLoFTRConfig, layer_idx: int): method forward (line 398) | def forward( class EfficientLoFTRMLP (line 441) | class EfficientLoFTRMLP(nn.Module): method __init__ (line 442) | def __init__(self, config: EfficientLoFTRConfig): method forward (line 451) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EfficientLoFTRAggregatedAttention (line 459) | class EfficientLoFTRAggregatedAttention(nn.Module): method __init__ (line 460) | def __init__(self, config: EfficientLoFTRConfig, layer_idx: int): method forward (line 468) | def forward( class EfficientLoFTRLocalFeatureTransformerLayer (line 510) | class EfficientLoFTRLocalFeatureTransformerLayer(GradientCheckpointingLa... method __init__ (line 511) | def __init__(self, config: EfficientLoFTRConfig, layer_idx: int): method forward (line 517) | def forward( class EfficientLoFTRLocalFeatureTransformer (line 542) | class EfficientLoFTRLocalFeatureTransformer(nn.Module): method __init__ (line 543) | def __init__(self, config: EfficientLoFTRConfig): method forward (line 552) | def forward( class EfficientLoFTROutConvBlock (line 563) | class EfficientLoFTROutConvBlock(nn.Module): method __init__ (line 564) | def __init__(self, config: EfficientLoFTRConfig, hidden_size: int, int... method forward (line 575) | def forward(self, hidden_states: torch.Tensor, residual_states: torch.... class EfficientLoFTRFineFusionLayer (line 588) | class EfficientLoFTRFineFusionLayer(nn.Module): method __init__ (line 589) | def __init__(self, config: EfficientLoFTRConfig): method forward_pyramid (line 603) | def forward_pyramid( method forward (line 617) | def forward( class EfficientLoFTRPreTrainedModel (line 660) | class EfficientLoFTRPreTrainedModel(PreTrainedModel): method _init_weights (line 679) | def _init_weights(self, module: nn.Module) -> None: method extract_one_channel_pixel_values (line 703) | def extract_one_channel_pixel_values(self, pixel_values: torch.FloatTe... class EfficientLoFTRModel (line 725) | class EfficientLoFTRModel(EfficientLoFTRPreTrainedModel): method __init__ (line 726) | def __init__(self, config: EfficientLoFTRConfig): method forward (line 739) | def forward( function mask_border (line 805) | def mask_border(tensor: torch.Tensor, border_margin: int, value: bool | ... function create_meshgrid (line 836) | def create_meshgrid( function spatial_expectation2d (line 895) | def spatial_expectation2d(input: torch.Tensor, normalized_coordinates: b... class EfficientLoFTRForKeypointMatching (line 948) | class EfficientLoFTRForKeypointMatching(EfficientLoFTRPreTrainedModel): method __init__ (line 963) | def __init__(self, config: EfficientLoFTRConfig): method _get_matches_from_scores (line 972) | def _get_matches_from_scores(self, scores: torch.Tensor) -> tuple[torc... method _coarse_matching (line 1025) | def _coarse_matching( method _get_first_stage_fine_matching (line 1076) | def _get_first_stage_fine_matching( method _get_second_stage_fine_matching (line 1142) | def _get_second_stage_fine_matching( method _fine_matching (line 1217) | def _fine_matching( method forward (line 1311) | def forward( FILE: src/transformers/models/efficientloftr/modular_efficientloftr.py class EfficientLoFTRImageProcessorKwargs (line 17) | class EfficientLoFTRImageProcessorKwargs(ImagesKwargs, total=False): class EfficientLoFTRImageProcessor (line 26) | class EfficientLoFTRImageProcessor(SuperGlueImageProcessor): method post_process_keypoint_matching (line 27) | def post_process_keypoint_matching( class EfficientLoFTRImageProcessorPil (line 87) | class EfficientLoFTRImageProcessorPil(SuperGlueImageProcessorPil): method post_process_keypoint_matching (line 89) | def post_process_keypoint_matching( FILE: src/transformers/models/efficientnet/configuration_efficientnet.py class EfficientNetConfig (line 24) | class EfficientNetConfig(PreTrainedConfig): method __post_init__ (line 90) | def __post_init__(self, **kwargs): FILE: src/transformers/models/efficientnet/convert_efficientnet_to_pytorch.py function get_efficientnet_config (line 122) | def get_efficientnet_config(model_name): function prepare_img (line 143) | def prepare_img(): function convert_image_processor (line 150) | def convert_image_processor(model_name): function rename_keys (line 162) | def rename_keys(original_param_names): function replace_params (line 230) | def replace_params(hf_params, tf_params, key_mapping): function convert_efficientnet_checkpoint (line 251) | def convert_efficientnet_checkpoint(model_name, pytorch_dump_folder_path... FILE: src/transformers/models/efficientnet/image_processing_efficientnet.py class EfficientNetImageProcessorKwargs (line 35) | class EfficientNetImageProcessorKwargs(ImagesKwargs, total=False): class EfficientNetImageProcessor (line 48) | class EfficientNetImageProcessor(TorchvisionBackend): method __init__ (line 66) | def __init__(self, **kwargs: Unpack[EfficientNetImageProcessorKwargs]): method rescale (line 69) | def rescale( method _fuse_mean_std_and_rescale_factor (line 83) | def _fuse_mean_std_and_rescale_factor( method rescale_and_normalize_efficientnet (line 99) | def rescale_and_normalize_efficientnet( method _preprocess (line 125) | def _preprocess( FILE: src/transformers/models/efficientnet/image_processing_pil_efficientnet.py class EfficientNetImageProcessorKwargs (line 31) | class EfficientNetImageProcessorKwargs(ImagesKwargs, total=False): class EfficientNetImageProcessorPil (line 44) | class EfficientNetImageProcessorPil(PilBackend): method __init__ (line 62) | def __init__(self, **kwargs: Unpack[EfficientNetImageProcessorKwargs]): method rescale (line 65) | def rescale( method _preprocess (line 77) | def _preprocess( FILE: src/transformers/models/efficientnet/modeling_efficientnet.py function round_filters (line 36) | def round_filters(config: EfficientNetConfig, num_channels: int): function correct_pad (line 51) | def correct_pad(kernel_size: int | tuple, adjust: bool = True): class EfficientNetEmbeddings (line 71) | class EfficientNetEmbeddings(nn.Module): method __init__ (line 76) | def __init__(self, config: EfficientNetConfig): method forward (line 87) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class EfficientNetDepthwiseConv2d (line 96) | class EfficientNetDepthwiseConv2d(nn.Conv2d): method __init__ (line 97) | def __init__( class EfficientNetExpansionLayer (line 122) | class EfficientNetExpansionLayer(nn.Module): method __init__ (line 127) | def __init__(self, config: EfficientNetConfig, in_dim: int, out_dim: i... method forward (line 139) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class EfficientNetDepthwiseLayer (line 148) | class EfficientNetDepthwiseLayer(nn.Module): method __init__ (line 153) | def __init__( method forward (line 175) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class EfficientNetSqueezeExciteLayer (line 187) | class EfficientNetSqueezeExciteLayer(nn.Module): method __init__ (line 192) | def __init__(self, config: EfficientNetConfig, in_dim: int, expand_dim... method forward (line 213) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class EfficientNetFinalBlockLayer (line 226) | class EfficientNetFinalBlockLayer(nn.Module): method __init__ (line 231) | def __init__( method forward (line 248) | def forward(self, embeddings: torch.FloatTensor, hidden_states: torch.... class EfficientNetBlock (line 259) | class EfficientNetBlock(nn.Module): method __init__ (line 286) | def __init__( method forward (line 327) | def forward(self, hidden_states: torch.FloatTensor) -> torch.Tensor: class EfficientNetEncoder (line 340) | class EfficientNetEncoder(nn.Module): method __init__ (line 349) | def __init__(self, config: EfficientNetConfig): method forward (line 404) | def forward( class EfficientNetPreTrainedModel (line 431) | class EfficientNetPreTrainedModel(PreTrainedModel): method _init_weights (line 439) | def _init_weights(self, module: nn.Module): class EfficientNetModel (line 452) | class EfficientNetModel(EfficientNetPreTrainedModel): method __init__ (line 453) | def __init__(self, config: EfficientNetConfig): method forward (line 471) | def forward( class EfficientNetForImageClassification (line 515) | class EfficientNetForImageClassification(EfficientNetPreTrainedModel): method __init__ (line 516) | def __init__(self, config): method forward (line 529) | def forward( FILE: src/transformers/models/electra/configuration_electra.py class ElectraConfig (line 25) | class ElectraConfig(PreTrainedConfig): FILE: src/transformers/models/electra/convert_electra_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_electra (line 29) | def load_tf_weights_in_electra(model, config, tf_checkpoint_path, discri... function convert_tf_checkpoint_to_pytorch (line 111) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, py... FILE: src/transformers/models/electra/modeling_electra.py class ElectraEmbeddings (line 56) | class ElectraEmbeddings(nn.Module): method __init__ (line 59) | def __init__(self, config): method forward (line 77) | def forward( function eager_attention_forward (line 121) | def eager_attention_forward( class ElectraSelfAttention (line 150) | class ElectraSelfAttention(nn.Module): method __init__ (line 151) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 175) | def forward( class ElectraCrossAttention (line 218) | class ElectraCrossAttention(nn.Module): method __init__ (line 219) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 242) | def forward( class ElectraSelfOutput (line 296) | class ElectraSelfOutput(nn.Module): method __init__ (line 297) | def __init__(self, config): method forward (line 303) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ElectraAttention (line 311) | class ElectraAttention(nn.Module): method __init__ (line 312) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 319) | def forward( class ElectraIntermediate (line 341) | class ElectraIntermediate(nn.Module): method __init__ (line 342) | def __init__(self, config): method forward (line 350) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ElectraOutput (line 357) | class ElectraOutput(nn.Module): method __init__ (line 358) | def __init__(self, config): method forward (line 364) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ElectraLayer (line 372) | class ElectraLayer(GradientCheckpointingLayer): method __init__ (line 373) | def __init__(self, config, layer_idx=None): method forward (line 392) | def forward( method feed_forward_chunk (line 431) | def feed_forward_chunk(self, attention_output): class ElectraEncoder (line 438) | class ElectraEncoder(nn.Module): method __init__ (line 439) | def __init__(self, config): method forward (line 444) | def forward( class ElectraDiscriminatorPredictions (line 470) | class ElectraDiscriminatorPredictions(nn.Module): method __init__ (line 473) | def __init__(self, config): method forward (line 481) | def forward(self, discriminator_hidden_states): class ElectraGeneratorPredictions (line 489) | class ElectraGeneratorPredictions(nn.Module): method __init__ (line 492) | def __init__(self, config): method forward (line 499) | def forward(self, generator_hidden_states): class ElectraPreTrainedModel (line 508) | class ElectraPreTrainedModel(PreTrainedModel): method _init_weights (line 522) | def _init_weights(self, module): class ElectraForPreTrainingOutput (line 535) | class ElectraForPreTrainingOutput(ModelOutput): class ElectraModel (line 550) | class ElectraModel(ElectraPreTrainedModel): method __init__ (line 551) | def __init__(self, config): method get_input_embeddings (line 564) | def get_input_embeddings(self): method set_input_embeddings (line 567) | def set_input_embeddings(self, value): method forward (line 573) | def forward( method _create_attention_masks (line 638) | def _create_attention_masks( class ElectraClassificationHead (line 671) | class ElectraClassificationHead(nn.Module): method __init__ (line 674) | def __init__(self, config): method forward (line 684) | def forward(self, features, **kwargs): class ElectraSequenceSummary (line 695) | class ElectraSequenceSummary(nn.Module): method __init__ (line 721) | def __init__(self, config: ElectraConfig): method forward (line 750) | def forward( class ElectraForSequenceClassification (line 800) | class ElectraForSequenceClassification(ElectraPreTrainedModel): method __init__ (line 801) | def __init__(self, config): method forward (line 813) | def forward( class ElectraForPreTraining (line 880) | class ElectraForPreTraining(ElectraPreTrainedModel): method __init__ (line 881) | def __init__(self, config): method forward (line 891) | def forward( class ElectraForMaskedLM (line 972) | class ElectraForMaskedLM(ElectraPreTrainedModel): method __init__ (line 975) | def __init__(self, config): method get_output_embeddings (line 985) | def get_output_embeddings(self): method set_output_embeddings (line 988) | def set_output_embeddings(self, word_embeddings): method forward (line 993) | def forward( class ElectraForTokenClassification (line 1044) | class ElectraForTokenClassification(ElectraPreTrainedModel): method __init__ (line 1045) | def __init__(self, config): method forward (line 1060) | def forward( class ElectraForQuestionAnswering (line 1102) | class ElectraForQuestionAnswering(ElectraPreTrainedModel): method __init__ (line 1106) | def __init__(self, config): method forward (line 1118) | def forward( class ElectraForMultipleChoice (line 1173) | class ElectraForMultipleChoice(ElectraPreTrainedModel): method __init__ (line 1174) | def __init__(self, config): method forward (line 1186) | def forward( class ElectraForCausalLM (line 1272) | class ElectraForCausalLM(ElectraPreTrainedModel, GenerationMixin): method __init__ (line 1275) | def __init__(self, config): method get_output_embeddings (line 1287) | def get_output_embeddings(self): method set_output_embeddings (line 1290) | def set_output_embeddings(self, new_embeddings): method forward (line 1295) | def forward( FILE: src/transformers/models/emu3/configuration_emu3.py class Emu3VQVAEConfig (line 26) | class Emu3VQVAEConfig(PreTrainedConfig): class Emu3TextConfig (line 78) | class Emu3TextConfig(PreTrainedConfig): class Emu3Config (line 123) | class Emu3Config(PreTrainedConfig): method __post_init__ (line 138) | def __post_init__(self, **kwargs): FILE: src/transformers/models/emu3/convert_emu3_weights_to_hf.py function token_bytes_to_string (line 63) | def token_bytes_to_string(b): function bpe (line 68) | def bpe(mergeable_ranks: dict[bytes, int], token: bytes, max_rank: int |... function generate_vocab_and_merges (line 85) | def generate_vocab_and_merges(encoder): function convert_tiktoken (line 104) | def convert_tiktoken(tokenizer, output_dir): function convert_state_dict_to_hf (line 238) | def convert_state_dict_to_hf(old_state_dict, new_state_dict): function convert_model (line 254) | def convert_model(vq_model_id, llm_model_id, output_dir, hub_model_id=No... function main (line 408) | def main(): FILE: src/transformers/models/emu3/image_processing_emu3.py class Emu3ImageProcessorKwargs (line 48) | class Emu3ImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 60) | def smart_resize( class Emu3ImageProcessor (line 89) | class Emu3ImageProcessor(BaseImageProcessor): method __init__ (line 124) | def __init__( method _preprocess (line 154) | def _preprocess( method _pad_for_batching (line 248) | def _pad_for_batching( method preprocess (line 293) | def preprocess( method postprocess (line 412) | def postprocess( method unnormalize (line 488) | def unnormalize( FILE: src/transformers/models/emu3/modeling_emu3.py class Emu3VQVAEModelOutput (line 51) | class Emu3VQVAEModelOutput(BaseModelOutputWithPooling): function rotate_half (line 60) | def rotate_half(x): function apply_rotary_pos_emb (line 68) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 93) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 105) | def eager_attention_forward( class Emu3Attention (line 131) | class Emu3Attention(nn.Module): method __init__ (line 134) | def __init__(self, config: Emu3Config, layer_idx: int): method forward (line 157) | def forward( class Emu3RMSNorm (line 199) | class Emu3RMSNorm(nn.Module): method __init__ (line 200) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 208) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 215) | def extra_repr(self): class Emu3MLP (line 219) | class Emu3MLP(nn.Module): method __init__ (line 220) | def __init__(self, config): method forward (line 230) | def forward(self, x): class Emu3DecoderLayer (line 235) | class Emu3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 236) | def __init__(self, config: Emu3Config, layer_idx: int): method forward (line 247) | def forward( class Emu3VQVAEVectorQuantizer (line 278) | class Emu3VQVAEVectorQuantizer(nn.Module): method __init__ (line 289) | def __init__(self, config: Emu3VQVAEConfig): method forward (line 294) | def forward(self, hidden_state: torch.Tensor): class Emu3VQVAEEncoderConvDownsample (line 312) | class Emu3VQVAEEncoderConvDownsample(nn.Module): method __init__ (line 313) | def __init__(self, in_channels): method forward (line 317) | def forward(self, hidden_states): class Emu3VQVAEEncoderConvUpsample (line 324) | class Emu3VQVAEEncoderConvUpsample(nn.Module): method __init__ (line 325) | def __init__(self, in_channels): method forward (line 329) | def forward(self, hidden_states): class Emu3VQVAEConv3d (line 335) | class Emu3VQVAEConv3d(nn.Module): method __init__ (line 336) | def __init__( method forward (line 358) | def forward(self, hidden_states: torch.Tensor): class Emu3VQVAESpatialNorm (line 364) | class Emu3VQVAESpatialNorm(nn.Module): method __init__ (line 365) | def __init__( method forward (line 393) | def forward(self, hidden_states: torch.Tensor, quant_states: torch.Ten... class Emu3VQVAETemporalUpsample (line 400) | class Emu3VQVAETemporalUpsample(nn.Module): method __init__ (line 401) | def __init__( method forward (line 414) | def forward(self, hidden_states: torch.Tensor): class Emu3VQVAETemporalDownsample (line 423) | class Emu3VQVAETemporalDownsample(nn.Module): method __init__ (line 424) | def __init__( method forward (line 437) | def forward(self, hidden_states: torch.Tensor): class Emu3VQVAETemporalResnetBlock (line 442) | class Emu3VQVAETemporalResnetBlock(nn.Module): method __init__ (line 443) | def __init__( method forward (line 475) | def forward(self, hidden_states): class Emu3VQVAEResnetBlock (line 491) | class Emu3VQVAEResnetBlock(nn.Module): method __init__ (line 492) | def __init__( method forward (line 536) | def forward(self, hidden_states: torch.Tensor, quant_channels: torch.T... class Emu3VQVAEAttentionBlock (line 554) | class Emu3VQVAEAttentionBlock(nn.Module): method __init__ (line 557) | def __init__(self, config: Emu3VQVAEConfig): method forward (line 580) | def forward( class Emu3VQVAEGroupNorm (line 619) | class Emu3VQVAEGroupNorm(nn.GroupNorm): method __init__ (line 626) | def __init__(self, **kwargs): method forward (line 629) | def forward(self, input, quant_states=None): class Emu3VQVAEMiddleBlock (line 633) | class Emu3VQVAEMiddleBlock(nn.Module): method __init__ (line 634) | def __init__(self, config, in_channels, quant_channels=None): method forward (line 654) | def forward(self, hidden_states: torch.FloatTensor, quant_states: torc... class Emu3VQVAEDownBlock (line 667) | class Emu3VQVAEDownBlock(nn.Module): method __init__ (line 668) | def __init__(self, config): method forward (line 705) | def forward(self, hidden_states: torch.FloatTensor): class Emu3VQVAEUpBlock (line 726) | class Emu3VQVAEUpBlock(nn.Module): method __init__ (line 727) | def __init__(self, config): method forward (line 764) | def forward(self, hidden_states: torch.FloatTensor, quant_states: torc... class Emu3VQVAEEncoder (line 784) | class Emu3VQVAEEncoder(nn.Module): method __init__ (line 785) | def __init__(self, config): method forward (line 824) | def forward(self, pixel_values: torch.LongTensor): class Emu3VQVAEDecoder (line 854) | class Emu3VQVAEDecoder(nn.Module): method __init__ (line 855) | def __init__(self, config: Emu3VQVAEConfig): method forward (line 894) | def forward(self, hidden_states: torch.Tensor, quant_states: torch.Ten... class Emu3VQVAE (line 932) | class Emu3VQVAE(PreTrainedModel): method _init_weights (line 953) | def _init_weights(self, module): method __init__ (line 979) | def __init__(self, config: Emu3VQVAEConfig): method encode (line 1002) | def encode( method decode (line 1035) | def decode(self, hidden_states: torch.Tensor): class Emu3ImageVocabularyMapping (line 1061) | class Emu3ImageVocabularyMapping: method __init__ (line 1066) | def __init__(self, vocab_map): method image_tokens (line 1072) | def image_tokens(self): method image_tokens_str (line 1076) | def image_tokens_str(self): method img2bpe (line 1080) | def img2bpe(self): method bpe2img (line 1084) | def bpe2img(self): method bpe2img_mapping_tensor (line 1088) | def bpe2img_mapping_tensor(self): method img2bpe_mapping_tensor (line 1095) | def img2bpe_mapping_tensor(self): method convert_img2bpe (line 1101) | def convert_img2bpe(self, img_batch: list[torch.Tensor]) -> torch.Tensor: method convert_bpe2img (line 1108) | def convert_bpe2img(self, img_batch: torch.Tensor) -> torch.Tensor: class Emu3PreTrainedModel (line 1116) | class Emu3PreTrainedModel(PreTrainedModel): class Emu3RotaryEmbedding (line 1137) | class Emu3RotaryEmbedding(nn.Module): method __init__ (line 1140) | def __init__(self, config: Emu3Config, device=None): method compute_default_rope_parameters (line 1157) | def compute_default_rope_parameters( method forward (line 1188) | def forward(self, x, position_ids): class Emu3TextModel (line 1203) | class Emu3TextModel(Emu3PreTrainedModel): method __init__ (line 1206) | def __init__(self, config: Emu3TextConfig): method forward (line 1225) | def forward( class Emu3ForCausalLM (line 1279) | class Emu3ForCausalLM(Emu3PreTrainedModel, GenerationMixin): method __init__ (line 1285) | def __init__(self, config): method forward (line 1296) | def forward( class Emu3Model (line 1354) | class Emu3Model(Emu3PreTrainedModel): method __init__ (line 1355) | def __init__(self, config): method get_input_embeddings (line 1364) | def get_input_embeddings(self): method set_input_embeddings (line 1367) | def set_input_embeddings(self, value): method get_image_tokens (line 1370) | def get_image_tokens(self, pixel_values: torch.FloatTensor, image_size... method get_image_features (line 1393) | def get_image_features( method decode_image_tokens (line 1418) | def decode_image_tokens(self, image_tokens: torch.LongTensor, height: ... method get_placeholder_mask (line 1436) | def get_placeholder_mask( method forward (line 1462) | def forward( class Emu3ForConditionalGeneration (line 1509) | class Emu3ForConditionalGeneration(Emu3PreTrainedModel, GenerationMixin): method __init__ (line 1513) | def __init__(self, config): method get_input_embeddings (line 1520) | def get_input_embeddings(self): method set_input_embeddings (line 1523) | def set_input_embeddings(self, value): method get_output_embeddings (line 1526) | def get_output_embeddings(self) -> nn.Module: method decode_image_tokens (line 1529) | def decode_image_tokens(self, **kwargs): method forward (line 1534) | def forward( method prepare_inputs_for_generation (line 1625) | def prepare_inputs_for_generation( FILE: src/transformers/models/emu3/modular_emu3.py class Emu3VQVAEModelOutput (line 47) | class Emu3VQVAEModelOutput(BaseModelOutputWithPooling): class Emu3Attention (line 56) | class Emu3Attention(LlamaAttention): class Emu3DecoderLayer (line 61) | class Emu3DecoderLayer(LlamaDecoderLayer): method __init__ (line 62) | def __init__(self, config: Emu3Config, layer_idx: int): method forward (line 66) | def forward( class Emu3VQVAEVectorQuantizer (line 97) | class Emu3VQVAEVectorQuantizer(nn.Module): method __init__ (line 108) | def __init__(self, config: Emu3VQVAEConfig): method forward (line 113) | def forward(self, hidden_state: torch.Tensor): class Emu3VQVAEEncoderConvDownsample (line 131) | class Emu3VQVAEEncoderConvDownsample(ChameleonVQVAEEncoderConvDownsample): class Emu3VQVAEEncoderConvUpsample (line 135) | class Emu3VQVAEEncoderConvUpsample(nn.Module): method __init__ (line 136) | def __init__(self, in_channels): method forward (line 140) | def forward(self, hidden_states): class Emu3VQVAEConv3d (line 146) | class Emu3VQVAEConv3d(nn.Module): method __init__ (line 147) | def __init__( method forward (line 169) | def forward(self, hidden_states: torch.Tensor): class Emu3VQVAESpatialNorm (line 175) | class Emu3VQVAESpatialNorm(nn.Module): method __init__ (line 176) | def __init__( method forward (line 204) | def forward(self, hidden_states: torch.Tensor, quant_states: torch.Ten... class Emu3VQVAETemporalUpsample (line 211) | class Emu3VQVAETemporalUpsample(nn.Module): method __init__ (line 212) | def __init__( method forward (line 225) | def forward(self, hidden_states: torch.Tensor): class Emu3VQVAETemporalDownsample (line 234) | class Emu3VQVAETemporalDownsample(nn.Module): method __init__ (line 235) | def __init__( method forward (line 248) | def forward(self, hidden_states: torch.Tensor): class Emu3VQVAETemporalResnetBlock (line 253) | class Emu3VQVAETemporalResnetBlock(nn.Module): method __init__ (line 254) | def __init__( method forward (line 286) | def forward(self, hidden_states): class Emu3VQVAEResnetBlock (line 302) | class Emu3VQVAEResnetBlock(nn.Module): method __init__ (line 303) | def __init__( method forward (line 347) | def forward(self, hidden_states: torch.Tensor, quant_channels: torch.T... class Emu3VQVAEAttentionBlock (line 365) | class Emu3VQVAEAttentionBlock(SiglipAttention): method __init__ (line 366) | def __init__(self, config: Emu3VQVAEConfig): class Emu3VQVAEGroupNorm (line 373) | class Emu3VQVAEGroupNorm(nn.GroupNorm): method __init__ (line 380) | def __init__(self, **kwargs): method forward (line 383) | def forward(self, input, quant_states=None): class Emu3VQVAEMiddleBlock (line 387) | class Emu3VQVAEMiddleBlock(nn.Module): method __init__ (line 388) | def __init__(self, config, in_channels, quant_channels=None): method forward (line 408) | def forward(self, hidden_states: torch.FloatTensor, quant_states: torc... class Emu3VQVAEDownBlock (line 421) | class Emu3VQVAEDownBlock(nn.Module): method __init__ (line 422) | def __init__(self, config): method forward (line 459) | def forward(self, hidden_states: torch.FloatTensor): class Emu3VQVAEUpBlock (line 480) | class Emu3VQVAEUpBlock(nn.Module): method __init__ (line 481) | def __init__(self, config): method forward (line 518) | def forward(self, hidden_states: torch.FloatTensor, quant_states: torc... class Emu3VQVAEEncoder (line 538) | class Emu3VQVAEEncoder(nn.Module): method __init__ (line 539) | def __init__(self, config): method forward (line 578) | def forward(self, pixel_values: torch.LongTensor): class Emu3VQVAEDecoder (line 608) | class Emu3VQVAEDecoder(nn.Module): method __init__ (line 609) | def __init__(self, config: Emu3VQVAEConfig): method forward (line 648) | def forward(self, hidden_states: torch.Tensor, quant_states: torch.Ten... class Emu3VQVAE (line 686) | class Emu3VQVAE(PreTrainedModel): method _init_weights (line 707) | def _init_weights(self, module): method __init__ (line 733) | def __init__(self, config: Emu3VQVAEConfig): method encode (line 756) | def encode( method decode (line 789) | def decode(self, hidden_states: torch.Tensor): class Emu3ImageVocabularyMapping (line 815) | class Emu3ImageVocabularyMapping: method __init__ (line 820) | def __init__(self, vocab_map): method image_tokens (line 826) | def image_tokens(self): method image_tokens_str (line 830) | def image_tokens_str(self): method img2bpe (line 834) | def img2bpe(self): method bpe2img (line 838) | def bpe2img(self): method bpe2img_mapping_tensor (line 842) | def bpe2img_mapping_tensor(self): method img2bpe_mapping_tensor (line 849) | def img2bpe_mapping_tensor(self): method convert_img2bpe (line 855) | def convert_img2bpe(self, img_batch: list[torch.Tensor]) -> torch.Tensor: method convert_bpe2img (line 862) | def convert_bpe2img(self, img_batch: torch.Tensor) -> torch.Tensor: class Emu3PreTrainedModel (line 869) | class Emu3PreTrainedModel(ChameleonPreTrainedModel): class Emu3TextModel (line 881) | class Emu3TextModel(LlamaModel, Emu3PreTrainedModel): method __init__ (line 884) | def __init__(self, config: Emu3TextConfig): class Emu3ForCausalLM (line 891) | class Emu3ForCausalLM(LlamaForCausalLM, Emu3PreTrainedModel, GenerationM... method __init__ (line 894) | def __init__(self, config): method forward (line 898) | def forward(**super_kwargs): class Emu3Model (line 920) | class Emu3Model(Emu3PreTrainedModel): method __init__ (line 921) | def __init__(self, config): method get_input_embeddings (line 930) | def get_input_embeddings(self): method set_input_embeddings (line 933) | def set_input_embeddings(self, value): method get_image_tokens (line 936) | def get_image_tokens(self, pixel_values: torch.FloatTensor, image_size... method get_image_features (line 959) | def get_image_features( method decode_image_tokens (line 984) | def decode_image_tokens(self, image_tokens: torch.LongTensor, height: ... method get_placeholder_mask (line 1002) | def get_placeholder_mask( method forward (line 1028) | def forward( class Emu3ForConditionalGeneration (line 1075) | class Emu3ForConditionalGeneration(Emu3PreTrainedModel, GenerationMixin): method __init__ (line 1079) | def __init__(self, config): method get_input_embeddings (line 1086) | def get_input_embeddings(self): method set_input_embeddings (line 1089) | def set_input_embeddings(self, value): method get_output_embeddings (line 1092) | def get_output_embeddings(self) -> nn.Module: method decode_image_tokens (line 1095) | def decode_image_tokens(self, **kwargs): method forward (line 1100) | def forward( method prepare_inputs_for_generation (line 1191) | def prepare_inputs_for_generation( FILE: src/transformers/models/emu3/processing_emu3.py class Emu3TextKwargs (line 29) | class Emu3TextKwargs(TextKwargs, total=False): class Emu3ProcessorKwargs (line 41) | class Emu3ProcessorKwargs(ProcessingKwargs, total=False): class Emu3Processor (line 58) | class Emu3Processor(ProcessorMixin): method __init__ (line 59) | def __init__( method __call__ (line 77) | def __call__( method _get_num_multimodal_tokens (line 156) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method calculate_generate_size (line 190) | def calculate_generate_size(self, ratio, image_area, spatial_factor): method postprocess (line 199) | def postprocess(self, images: ImageInput, **kwargs): method post_process_multimodal_output (line 202) | def post_process_multimodal_output( FILE: src/transformers/models/encodec/configuration_encodec.py class EncodecConfig (line 27) | class EncodecConfig(PreTrainedConfig): method __post_init__ (line 111) | def __post_init__(self, **kwargs): method validate_architecture (line 115) | def validate_architecture(self): method chunk_length (line 124) | def chunk_length(self) -> int | None: method chunk_stride (line 132) | def chunk_stride(self) -> int | None: method hop_length (line 139) | def hop_length(self) -> int: method codebook_nbits (line 143) | def codebook_nbits(self) -> int: method frame_rate (line 147) | def frame_rate(self) -> int: method num_quantizers (line 151) | def num_quantizers(self) -> int: FILE: src/transformers/models/encodec/convert_encodec_checkpoint_to_pytorch.py function set_recursively (line 141) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function should_ignore (line 192) | def should_ignore(name, ignore_keys): function recursively_load_weights (line 206) | def recursively_load_weights(orig_dict, hf_model, model_name): function convert_checkpoint (line 278) | def convert_checkpoint( FILE: src/transformers/models/encodec/feature_extraction_encodec.py class EncodecFeatureExtractor (line 26) | class EncodecFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 52) | def __init__( method chunk_length (line 67) | def chunk_length(self) -> int | None: method chunk_stride (line 75) | def chunk_stride(self) -> int | None: method __call__ (line 81) | def __call__( FILE: src/transformers/models/encodec/modeling_encodec.py class EncodecOutput (line 40) | class EncodecOutput(ModelOutput): class EncodecEncoderOutput (line 54) | class EncodecEncoderOutput(ModelOutput): class EncodecDecoderOutput (line 73) | class EncodecDecoderOutput(ModelOutput): class EncodecConv1d (line 82) | class EncodecConv1d(nn.Module): method __init__ (line 85) | def __init__( method _get_extra_padding_for_conv1d (line 126) | def _get_extra_padding_for_conv1d( method _pad1d (line 139) | def _pad1d(hidden_states: torch.Tensor, paddings: tuple[int, int], mod... method forward (line 157) | def forward(self, hidden_states): class EncodecConvTranspose1d (line 179) | class EncodecConvTranspose1d(nn.Module): method __init__ (line 182) | def __init__(self, config, in_channels: int, out_channels: int, kernel... method forward (line 206) | def forward(self, hidden_states): class EncodecLSTM (line 236) | class EncodecLSTM(nn.Module): method __init__ (line 241) | def __init__(self, config: EncodecConfig, dimension: int): method forward (line 245) | def forward(self, hidden_states): class EncodecResnetBlock (line 252) | class EncodecResnetBlock(nn.Module): method __init__ (line 257) | def __init__(self, config: EncodecConfig, dim: int, dilations: list[in... method forward (line 277) | def forward(self, hidden_states): class EncodecEncoder (line 285) | class EncodecEncoder(nn.Module): method __init__ (line 288) | def __init__(self, config: EncodecConfig): method forward (line 310) | def forward(self, hidden_states): class EncodecDecoder (line 316) | class EncodecDecoder(nn.Module): method __init__ (line 319) | def __init__(self, config: EncodecConfig): method forward (line 344) | def forward(self, hidden_states): class EncodecEuclideanCodebook (line 350) | class EncodecEuclideanCodebook(nn.Module): method __init__ (line 353) | def __init__(self, config: EncodecConfig): method quantize (line 364) | def quantize(self, hidden_states): method encode (line 371) | def encode(self, hidden_states): method decode (line 381) | def decode(self, embed_ind): class EncodecVectorQuantization (line 386) | class EncodecVectorQuantization(nn.Module): method __init__ (line 391) | def __init__(self, config: EncodecConfig): method encode (line 395) | def encode(self, hidden_states): method decode (line 400) | def decode(self, embed_ind): class EncodecResidualVectorQuantizer (line 406) | class EncodecResidualVectorQuantizer(nn.Module): method __init__ (line 409) | def __init__(self, config: EncodecConfig): method get_num_quantizers_for_bandwidth (line 416) | def get_num_quantizers_for_bandwidth(self, bandwidth: float | None = N... method encode (line 424) | def encode(self, embeddings: torch.Tensor, bandwidth: float | None = N... method decode (line 440) | def decode(self, codes: torch.Tensor) -> torch.Tensor: class EncodecPreTrainedModel (line 451) | class EncodecPreTrainedModel(PreTrainedAudioTokenizerBase): method _init_weights (line 457) | def _init_weights(self, module): class EncodecModel (line 496) | class EncodecModel(EncodecPreTrainedModel): method __init__ (line 497) | def __init__(self, config: EncodecConfig): method _encode_frame (line 513) | def _encode_frame(self, input_values: torch.Tensor, bandwidth: float) ... method encode (line 536) | def encode( method _linear_overlap_add (line 618) | def _linear_overlap_add(frames: list[torch.Tensor], stride: int): method _decode_frame (line 664) | def _decode_frame(self, codes: torch.Tensor, scale: torch.Tensor | Non... method decode (line 672) | def decode( method forward (line 728) | def forward( FILE: src/transformers/models/encoder_decoder/configuration_encoder_decoder.py class EncoderDecoderConfig (line 29) | class EncoderDecoderConfig(PreTrainedConfig): method __post_init__ (line 68) | def __post_init__(self, **kwargs): method from_encoder_decoder_configs (line 85) | def from_encoder_decoder_configs( FILE: src/transformers/models/encoder_decoder/modeling_encoder_decoder.py function shift_tokens_right (line 46) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class EncoderDecoderModel (line 65) | class EncoderDecoderModel(PreTrainedModel, GenerationMixin): method __init__ (line 80) | def __init__( method _init_weights (line 166) | def _init_weights(self, module): method get_input_embeddings (line 172) | def get_input_embeddings(self): method get_output_embeddings (line 175) | def get_output_embeddings(self): method set_output_embeddings (line 178) | def set_output_embeddings(self, new_embeddings): method from_encoder_decoder_pretrained (line 182) | def from_encoder_decoder_pretrained( method forward (line 318) | def forward( method prepare_decoder_input_ids_from_labels (line 460) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method resize_token_embeddings (line 463) | def resize_token_embeddings(self, *args, **kwargs): FILE: src/transformers/models/eomt/configuration_eomt.py class EomtConfig (line 28) | class EomtConfig(PreTrainedConfig): FILE: src/transformers/models/eomt/convert_eomt_to_hf.py function convert_old_keys_to_new_keys (line 69) | def convert_old_keys_to_new_keys(state_dict): function split_qkv_tensor (line 81) | def split_qkv_tensor(key, tensor): function convert_state_dict_to_hf (line 91) | def convert_state_dict_to_hf(state_dict): function ensure_model_downloaded (line 117) | def ensure_model_downloaded( function load_model_state_dict (line 155) | def load_model_state_dict(input_path: str) -> dict: function convert_model (line 188) | def convert_model( function main (line 285) | def main(): FILE: src/transformers/models/eomt/image_processing_eomt.py class EomtImageProcessorKwargs (line 42) | class EomtImageProcessorKwargs(ImagesKwargs, total=False): function convert_segmentation_map_to_binary_masks_fast (line 58) | def convert_segmentation_map_to_binary_masks_fast( function get_target_size (line 89) | def get_target_size(size_dict: dict[str, int]) -> tuple[int, int]: function reorder_patches_and_offsets (line 97) | def reorder_patches_and_offsets( function remove_low_and_no_objects (line 109) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... function check_segment_validity (line 137) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 159) | def compute_segments( class EomtImageProcessor (line 214) | class EomtImageProcessor(TorchvisionBackend): method __init__ (line 228) | def __init__(self, **kwargs: Unpack[EomtImageProcessorKwargs]): method _split_image (line 231) | def _split_image(self, images: torch.Tensor, size: SizeDict, image_ind... method _pad (line 259) | def _pad(self, images: torch.Tensor, size: SizeDict) -> torch.Tensor: method preprocess (line 274) | def preprocess( method _preprocess_image_like_inputs (line 289) | def _preprocess_image_like_inputs( method _preprocess (line 367) | def _preprocess( method merge_image_patches (line 424) | def merge_image_patches( method unpad_image (line 481) | def unpad_image( method post_process_semantic_segmentation (line 502) | def post_process_semantic_segmentation( method post_process_panoptic_segmentation (line 546) | def post_process_panoptic_segmentation( method post_process_instance_segmentation (line 604) | def post_process_instance_segmentation( FILE: src/transformers/models/eomt/image_processing_pil_eomt.py function convert_segmentation_map_to_binary_masks (line 43) | def convert_segmentation_map_to_binary_masks( function check_segment_validity (line 81) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... class EomtImageProcessorKwargs (line 104) | class EomtImageProcessorKwargs(ImagesKwargs, total=False): function compute_segments (line 120) | def compute_segments( function get_target_size (line 175) | def get_target_size(size_dict: dict[str, int]) -> tuple[int, int]: function remove_low_and_no_objects (line 184) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... class EomtImageProcessorPil (line 214) | class EomtImageProcessorPil(PilBackend): method __init__ (line 228) | def __init__(self, **kwargs: Unpack[EomtImageProcessorKwargs]): method _split_image (line 231) | def _split_image(self, image: np.ndarray, size: SizeDict, image_index:... method _pad (line 258) | def _pad(self, image: np.ndarray, size: SizeDict) -> np.ndarray: method preprocess (line 281) | def preprocess( method _preprocess_image_like_inputs (line 296) | def _preprocess_image_like_inputs( method _preprocess (line 372) | def _preprocess( method merge_image_patches (line 422) | def merge_image_patches( method unpad_image (line 476) | def unpad_image( method post_process_semantic_segmentation (line 494) | def post_process_semantic_segmentation( method post_process_panoptic_segmentation (line 531) | def post_process_panoptic_segmentation( method post_process_instance_segmentation (line 584) | def post_process_instance_segmentation( FILE: src/transformers/models/eomt/modeling_eomt.py class EomtForUniversalSegmentationOutput (line 62) | class EomtForUniversalSegmentationOutput(ModelOutput): function sample_point (line 94) | def sample_point( function pair_wise_dice_loss (line 126) | def pair_wise_dice_loss(inputs: Tensor, labels: Tensor) -> Tensor: function pair_wise_sigmoid_cross_entropy_loss (line 148) | def pair_wise_sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: t... class EomtHungarianMatcher (line 176) | class EomtHungarianMatcher(nn.Module): method __init__ (line 184) | def __init__( method forward (line 211) | def forward( function dice_loss (line 282) | def dice_loss(inputs: Tensor, labels: Tensor, num_masks: int) -> Tensor: function sigmoid_cross_entropy_loss (line 312) | def sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: torch.Tenso... class EomtLoss (line 332) | class EomtLoss(nn.Module): method __init__ (line 333) | def __init__(self, config: EomtConfig, weight_dict: dict[str, float]): method _max_by_axis (line 368) | def _max_by_axis(self, sizes: list[list[int]]) -> list[int]: method _pad_images_to_max_in_batch (line 376) | def _pad_images_to_max_in_batch(self, tensors: list[Tensor]) -> tuple[... method loss_labels (line 393) | def loss_labels( method loss_masks (line 427) | def loss_masks( method _get_predictions_permutation_indices (line 489) | def _get_predictions_permutation_indices(self, indices): method _get_targets_permutation_indices (line 495) | def _get_targets_permutation_indices(self, indices): method calculate_uncertainty (line 501) | def calculate_uncertainty(self, logits: torch.Tensor) -> torch.Tensor: method sample_points_using_uncertainty (line 518) | def sample_points_using_uncertainty( method forward (line 573) | def forward( method get_num_masks (line 628) | def get_num_masks(self, class_labels: torch.Tensor, device: torch.devi... class EomtPatchEmbeddings (line 644) | class EomtPatchEmbeddings(nn.Module): method __init__ (line 651) | def __init__(self, config): method forward (line 666) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class EomtEmbeddings (line 677) | class EomtEmbeddings(nn.Module): method __init__ (line 682) | def __init__(self, config: EomtConfig) -> None: method forward (line 698) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 714) | def eager_attention_forward( class EomtAttention (line 737) | class EomtAttention(nn.Module): method __init__ (line 740) | def __init__(self, config): method forward (line 760) | def forward( class EomtLayerScale (line 799) | class EomtLayerScale(nn.Module): method __init__ (line 800) | def __init__(self, config) -> None: method forward (line 804) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: function drop_path (line 808) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class EomtDropPath (line 823) | class EomtDropPath(nn.Module): method __init__ (line 826) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 830) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 833) | def extra_repr(self) -> str: class EomtMLP (line 837) | class EomtMLP(nn.Module): method __init__ (line 838) | def __init__(self, config) -> None: method forward (line 849) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class EomtSwiGLUFFN (line 856) | class EomtSwiGLUFFN(nn.Module): method __init__ (line 857) | def __init__(self, config) -> None: method forward (line 866) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class EomtLayer (line 873) | class EomtLayer(GradientCheckpointingLayer): method __init__ (line 876) | def __init__(self, config: EomtConfig) -> None: method forward (line 892) | def forward( class EomtLayerNorm2d (line 915) | class EomtLayerNorm2d(nn.LayerNorm): method __init__ (line 916) | def __init__(self, num_channels, eps=1e-6, affine=True): method forward (line 919) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class EomtScaleLayer (line 926) | class EomtScaleLayer(nn.Module): method __init__ (line 927) | def __init__(self, config: EomtConfig): method forward (line 943) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtScaleBlock (line 951) | class EomtScaleBlock(nn.Module): method __init__ (line 952) | def __init__(self, config: EomtConfig): method forward (line 957) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtMaskHead (line 963) | class EomtMaskHead(nn.Module): method __init__ (line 964) | def __init__(self, config: EomtConfig): method forward (line 973) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtPreTrainedModel (line 981) | class EomtPreTrainedModel(PreTrainedModel): method _init_weights (line 1000) | def _init_weights(self, module: nn.Module) -> None: class EomtForUniversalSegmentation (line 1036) | class EomtForUniversalSegmentation(EomtPreTrainedModel): method __init__ (line 1039) | def __init__(self, config: EomtConfig): method get_loss_dict (line 1067) | def get_loss_dict( method get_loss (line 1091) | def get_loss(self, loss_dict: dict[str, Tensor]) -> Tensor: method forward (line 1097) | def forward( method get_input_embeddings (line 1200) | def get_input_embeddings(self): method predict (line 1203) | def predict(self, logits: torch.Tensor): method _disable_attention_mask (line 1220) | def _disable_attention_mask(attn_mask, prob, num_query_tokens, encoder... FILE: src/transformers/models/eomt/modular_eomt.py class EomtConfig (line 54) | class EomtConfig(ViTConfig): method __post_init__ (line 132) | def __post_init__(self, **kwargs): class EomtForUniversalSegmentationOutput (line 147) | class EomtForUniversalSegmentationOutput(ModelOutput): class EomtLoss (line 178) | class EomtLoss(Mask2FormerLoss): class EomtPatchEmbeddings (line 182) | class EomtPatchEmbeddings(Dinov2PatchEmbeddings): class EomtEmbeddings (line 186) | class EomtEmbeddings(Dinov2Embeddings): method __init__ (line 187) | def __init__(self, config: EomtConfig) -> None: method interpolate_pos_encoding (line 203) | def interpolate_pos_encoding(self): method forward (line 206) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class EomtAttention (line 222) | class EomtAttention(SiglipAttention): class EomtLayerScale (line 226) | class EomtLayerScale(Dinov2LayerScale): class EomtLayer (line 230) | class EomtLayer(Dinov2Layer): method forward (line 231) | def forward( class EomtLayerNorm2d (line 254) | class EomtLayerNorm2d(nn.LayerNorm): method __init__ (line 255) | def __init__(self, num_channels, eps=1e-6, affine=True): method forward (line 258) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class EomtScaleLayer (line 265) | class EomtScaleLayer(nn.Module): method __init__ (line 266) | def __init__(self, config: EomtConfig): method forward (line 282) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtScaleBlock (line 290) | class EomtScaleBlock(nn.Module): method __init__ (line 291) | def __init__(self, config: EomtConfig): method forward (line 296) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtMaskHead (line 302) | class EomtMaskHead(nn.Module): method __init__ (line 303) | def __init__(self, config: EomtConfig): method forward (line 312) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtPreTrainedModel (line 320) | class EomtPreTrainedModel(PreTrainedModel): method _init_weights (line 339) | def _init_weights(self, module: nn.Module) -> None: class EomtForUniversalSegmentation (line 375) | class EomtForUniversalSegmentation(Mask2FormerForUniversalSegmentation): method __init__ (line 376) | def __init__(self, config: EomtConfig): method get_input_embeddings (line 404) | def get_input_embeddings(self): method get_auxiliary_logits (line 407) | def get_auxiliary_logits(self): method predict (line 410) | def predict(self, logits: torch.Tensor): method _disable_attention_mask (line 427) | def _disable_attention_mask(attn_mask, prob, num_query_tokens, encoder... method forward (line 440) | def forward( FILE: src/transformers/models/eomt_dinov3/configuration_eomt_dinov3.py class EomtDinov3Config (line 29) | class EomtDinov3Config(PreTrainedConfig): FILE: src/transformers/models/eomt_dinov3/convert_eomt_dinov3_to_hf.py class CheckpointSpec (line 57) | class CheckpointSpec(NamedTuple): function _build_checkpoint_index (line 109) | def _build_checkpoint_index() -> dict[str, CheckpointSpec]: function resolve_checkpoint_spec (line 123) | def resolve_checkpoint_spec(model_id: str) -> CheckpointSpec: function print_checkpoint_catalog (line 131) | def print_checkpoint_catalog() -> None: function _rename_delta_key (line 164) | def _rename_delta_key(key: str) -> tuple[str | None, bool]: function convert_delta_state_dict (line 179) | def convert_delta_state_dict(state_dict: dict[str, torch.Tensor]) -> tup... function map_dinov3_state_to_eomt (line 195) | def map_dinov3_state_to_eomt(base_state_dict: dict[str, torch.Tensor]) -... function merge_backbone_weights (line 216) | def merge_backbone_weights( function build_eomt_config (line 232) | def build_eomt_config( function convert_checkpoint (line 279) | def convert_checkpoint( function ensure_state_dict (line 307) | def ensure_state_dict(state_dict: dict[str, torch.Tensor]) -> dict[str, ... function convert_model (line 313) | def convert_model( function _prepare_image (line 376) | def _prepare_image(processor: EomtImageProcessorFast) -> torch.Tensor: function _load_original_model (line 382) | def _load_original_model( class BackboneVerificationOutputs (line 419) | class BackboneVerificationOutputs(NamedTuple): function _collect_original_backbone_states (line 428) | def _collect_original_backbone_states(model, pixel_values: torch.Tensor)... function _collect_hf_backbone_states (line 487) | def _collect_hf_backbone_states( function _assert_allclose (line 567) | def _assert_allclose(reference: Iterable[torch.Tensor], actual: Iterable... function verify_conversion (line 573) | def verify_conversion( function parse_args (line 636) | def parse_args() -> argparse.Namespace: function main (line 653) | def main() -> None: FILE: src/transformers/models/eomt_dinov3/modeling_eomt_dinov3.py function rotate_half (line 52) | def rotate_half(x): function eager_attention_forward (line 59) | def eager_attention_forward( function apply_rotary_pos_emb (line 87) | def apply_rotary_pos_emb( class EomtDinov3Attention (line 120) | class EomtDinov3Attention(nn.Module): method __init__ (line 125) | def __init__(self, config: EomtDinov3Config): method forward (line 143) | def forward( class EomtDinov3Embeddings (line 186) | class EomtDinov3Embeddings(nn.Module): method __init__ (line 191) | def __init__(self, config: EomtDinov3Config): method forward (line 202) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... function drop_path (line 222) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class EomtDinov3DropPath (line 237) | class EomtDinov3DropPath(nn.Module): method __init__ (line 240) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 244) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 247) | def extra_repr(self) -> str: class EomtDinov3MLP (line 251) | class EomtDinov3MLP(nn.Module): method __init__ (line 252) | def __init__(self, config): method forward (line 261) | def forward(self, x): class EomtDinov3GatedMLP (line 265) | class EomtDinov3GatedMLP(nn.Module): method __init__ (line 266) | def __init__(self, config): method forward (line 276) | def forward(self, x): class EomtDinov3Layer (line 281) | class EomtDinov3Layer(GradientCheckpointingLayer): method __init__ (line 284) | def __init__(self, config: EomtDinov3Config): method forward (line 300) | def forward( class EomtDinov3LayerScale (line 329) | class EomtDinov3LayerScale(nn.Module): method __init__ (line 330) | def __init__(self, config) -> None: method forward (line 334) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: function get_patches_center_coordinates (line 339) | def get_patches_center_coordinates( function augment_patches_center_coordinates (line 367) | def augment_patches_center_coordinates( class EomtDinov3RotaryEmbedding (line 396) | class EomtDinov3RotaryEmbedding(nn.Module): method __init__ (line 399) | def __init__(self, config: EomtDinov3Config, device=None): method forward (line 412) | def forward(self, pixel_values: torch.Tensor) -> tuple[torch.Tensor, t... method compute_default_rope_parameters (line 447) | def compute_default_rope_parameters( function sample_point (line 476) | def sample_point( function pair_wise_dice_loss (line 508) | def pair_wise_dice_loss(inputs: Tensor, labels: Tensor) -> Tensor: function pair_wise_sigmoid_cross_entropy_loss (line 530) | def pair_wise_sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: t... class EomtDinov3HungarianMatcher (line 558) | class EomtDinov3HungarianMatcher(nn.Module): method __init__ (line 566) | def __init__( method forward (line 593) | def forward( function dice_loss (line 664) | def dice_loss(inputs: Tensor, labels: Tensor, num_masks: int) -> Tensor: function sigmoid_cross_entropy_loss (line 694) | def sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: torch.Tenso... class EomtDinov3Loss (line 714) | class EomtDinov3Loss(nn.Module): method __init__ (line 715) | def __init__(self, config: EomtDinov3Config, weight_dict: dict[str, fl... method _max_by_axis (line 750) | def _max_by_axis(self, sizes: list[list[int]]) -> list[int]: method _pad_images_to_max_in_batch (line 758) | def _pad_images_to_max_in_batch(self, tensors: list[Tensor]) -> tuple[... method loss_labels (line 775) | def loss_labels( method loss_masks (line 809) | def loss_masks( method _get_predictions_permutation_indices (line 871) | def _get_predictions_permutation_indices(self, indices): method _get_targets_permutation_indices (line 877) | def _get_targets_permutation_indices(self, indices): method calculate_uncertainty (line 883) | def calculate_uncertainty(self, logits: torch.Tensor) -> torch.Tensor: method sample_points_using_uncertainty (line 900) | def sample_points_using_uncertainty( method forward (line 955) | def forward( method get_num_masks (line 1010) | def get_num_masks(self, class_labels: torch.Tensor, device: torch.devi... class EomtDinov3ForUniversalSegmentationOutput (line 1037) | class EomtDinov3ForUniversalSegmentationOutput(ModelOutput): class EomtDinov3PreTrainedModel (line 1069) | class EomtDinov3PreTrainedModel(PreTrainedModel): method _init_weights (line 1089) | def _init_weights(self, module: nn.Module) -> None: class EomtDinov3LayerNorm2d (line 1106) | class EomtDinov3LayerNorm2d(nn.LayerNorm): method __init__ (line 1107) | def __init__(self, num_channels, eps=1e-6, affine=True): method forward (line 1110) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class EomtDinov3ScaleLayer (line 1117) | class EomtDinov3ScaleLayer(nn.Module): method __init__ (line 1118) | def __init__(self, config: EomtDinov3Config): method forward (line 1134) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtDinov3ScaleBlock (line 1142) | class EomtDinov3ScaleBlock(nn.Module): method __init__ (line 1143) | def __init__(self, config: EomtDinov3Config): method forward (line 1148) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtDinov3MaskHead (line 1154) | class EomtDinov3MaskHead(nn.Module): method __init__ (line 1155) | def __init__(self, config: EomtDinov3Config): method forward (line 1164) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EomtDinov3ForUniversalSegmentation (line 1176) | class EomtDinov3ForUniversalSegmentation(EomtDinov3PreTrainedModel): method __init__ (line 1179) | def __init__(self, config: EomtDinov3Config): method get_loss_dict (line 1213) | def get_loss_dict( method get_loss (line 1237) | def get_loss(self, loss_dict: dict[str, Tensor]) -> Tensor: method forward (line 1243) | def forward( method get_input_embeddings (line 1348) | def get_input_embeddings(self): method predict (line 1351) | def predict(self, logits: torch.Tensor): method _disable_attention_mask (line 1368) | def _disable_attention_mask(attn_mask, prob, num_query_tokens, encoder... FILE: src/transformers/models/eomt_dinov3/modular_eomt_dinov3.py class EomtDinov3Config (line 52) | class EomtDinov3Config(EomtConfig): class EomtDinov3Attention (line 133) | class EomtDinov3Attention(DINOv3ViTAttention): class EomtDinov3Embeddings (line 137) | class EomtDinov3Embeddings(DINOv3ViTEmbeddings): method __init__ (line 138) | def __init__(self, config: EomtDinov3Config): class EomtDinov3Layer (line 143) | class EomtDinov3Layer(DINOv3ViTLayer): class EomtDinov3LayerScale (line 147) | class EomtDinov3LayerScale(DINOv3ViTLayerScale): class EomtDinov3RotaryEmbedding (line 151) | class EomtDinov3RotaryEmbedding(DINOv3ViTRopePositionEmbedding): method __init__ (line 154) | def __init__(self, config: EomtDinov3Config, device=None): method compute_default_rope_parameters (line 168) | def compute_default_rope_parameters( class EomtDinov3Loss (line 196) | class EomtDinov3Loss(EomtLoss): class EomtDinov3ForUniversalSegmentationOutput (line 200) | class EomtDinov3ForUniversalSegmentationOutput(EomtForUniversalSegmentat... class EomtDinov3PreTrainedModel (line 204) | class EomtDinov3PreTrainedModel(EomtPreTrainedModel): method _init_weights (line 213) | def _init_weights(self, module: nn.Module) -> None: class EomtDinov3ForUniversalSegmentation (line 235) | class EomtDinov3ForUniversalSegmentation(EomtDinov3PreTrainedModel, Eomt... method __init__ (line 236) | def __init__(self, config: EomtDinov3Config): method forward (line 254) | def forward( FILE: src/transformers/models/ernie/configuration_ernie.py class ErnieConfig (line 25) | class ErnieConfig(PreTrainedConfig): FILE: src/transformers/models/ernie/modeling_ernie.py class ErnieEmbeddings (line 57) | class ErnieEmbeddings(nn.Module): method __init__ (line 60) | def __init__(self, config): method forward (line 80) | def forward( function eager_attention_forward (line 134) | def eager_attention_forward( class ErnieSelfAttention (line 162) | class ErnieSelfAttention(nn.Module): method __init__ (line 163) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 187) | def forward( class ErnieCrossAttention (line 229) | class ErnieCrossAttention(nn.Module): method __init__ (line 230) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 253) | def forward( class ErnieSelfOutput (line 306) | class ErnieSelfOutput(nn.Module): method __init__ (line 307) | def __init__(self, config): method forward (line 313) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ErnieAttention (line 320) | class ErnieAttention(nn.Module): method __init__ (line 321) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 328) | def forward( class ErnieIntermediate (line 349) | class ErnieIntermediate(nn.Module): method __init__ (line 350) | def __init__(self, config): method forward (line 358) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ErnieOutput (line 364) | class ErnieOutput(nn.Module): method __init__ (line 365) | def __init__(self, config): method forward (line 371) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ErnieLayer (line 378) | class ErnieLayer(GradientCheckpointingLayer): method __init__ (line 379) | def __init__(self, config, layer_idx=None): method forward (line 398) | def forward( method feed_forward_chunk (line 437) | def feed_forward_chunk(self, attention_output): class ErniePooler (line 443) | class ErniePooler(nn.Module): method __init__ (line 444) | def __init__(self, config): method forward (line 449) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ErniePredictionHeadTransform (line 458) | class ErniePredictionHeadTransform(nn.Module): method __init__ (line 459) | def __init__(self, config): method forward (line 468) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ErnieLMPredictionHead (line 475) | class ErnieLMPredictionHead(nn.Module): method __init__ (line 476) | def __init__(self, config): method forward (line 485) | def forward(self, hidden_states): class ErnieEncoder (line 491) | class ErnieEncoder(nn.Module): method __init__ (line 492) | def __init__(self, config): method forward (line 497) | def forward( class ErniePreTrainedModel (line 524) | class ErniePreTrainedModel(PreTrainedModel): method _init_weights (line 539) | def _init_weights(self, module): class ErnieModel (line 561) | class ErnieModel(ErniePreTrainedModel): method __init__ (line 564) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 581) | def get_input_embeddings(self): method set_input_embeddings (line 584) | def set_input_embeddings(self, value): method forward (line 590) | def forward( method _create_attention_masks (line 664) | def _create_attention_masks( class ErnieForPreTrainingOutput (line 703) | class ErnieForPreTrainingOutput(ModelOutput): class ErniePreTrainingHeads (line 722) | class ErniePreTrainingHeads(nn.Module): method __init__ (line 723) | def __init__(self, config): method forward (line 728) | def forward(self, sequence_output, pooled_output): class ErnieForPreTraining (line 740) | class ErnieForPreTraining(ErniePreTrainedModel): method __init__ (line 746) | def __init__(self, config): method get_output_embeddings (line 755) | def get_output_embeddings(self): method set_output_embeddings (line 758) | def set_output_embeddings(self, new_embeddings): method forward (line 764) | def forward( class ErnieOnlyMLMHead (line 839) | class ErnieOnlyMLMHead(nn.Module): method __init__ (line 840) | def __init__(self, config): method forward (line 844) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class ErnieForCausalLM (line 854) | class ErnieForCausalLM(ErniePreTrainedModel, GenerationMixin): method __init__ (line 860) | def __init__(self, config): method get_output_embeddings (line 872) | def get_output_embeddings(self): method set_output_embeddings (line 875) | def set_output_embeddings(self, new_embeddings): method forward (line 881) | def forward( class ErnieForMaskedLM (line 946) | class ErnieForMaskedLM(ErniePreTrainedModel): method __init__ (line 952) | def __init__(self, config): method get_output_embeddings (line 967) | def get_output_embeddings(self): method set_output_embeddings (line 970) | def set_output_embeddings(self, new_embeddings): method forward (line 976) | def forward( class ErnieOnlyNSPHead (line 1029) | class ErnieOnlyNSPHead(nn.Module): method __init__ (line 1030) | def __init__(self, config): method forward (line 1034) | def forward(self, pooled_output): class ErnieForNextSentencePrediction (line 1044) | class ErnieForNextSentencePrediction(ErniePreTrainedModel): method __init__ (line 1045) | def __init__(self, config): method forward (line 1056) | def forward( class ErnieForSequenceClassification (line 1133) | class ErnieForSequenceClassification(ErniePreTrainedModel): method __init__ (line 1134) | def __init__(self, config): method forward (line 1151) | def forward( class ErnieForMultipleChoice (line 1221) | class ErnieForMultipleChoice(ErniePreTrainedModel): method __init__ (line 1222) | def __init__(self, config): method forward (line 1237) | def forward( class ErnieForTokenClassification (line 1326) | class ErnieForTokenClassification(ErniePreTrainedModel): method __init__ (line 1327) | def __init__(self, config): method forward (line 1343) | def forward( class ErnieForQuestionAnswering (line 1393) | class ErnieForQuestionAnswering(ErniePreTrainedModel): method __init__ (line 1394) | def __init__(self, config): method forward (line 1406) | def forward( FILE: src/transformers/models/ernie/modular_ernie.py class ErnieEmbeddings (line 62) | class ErnieEmbeddings(BertEmbeddings): method __init__ (line 65) | def __init__(self, config): method forward (line 72) | def forward( class ErnieSelfAttention (line 126) | class ErnieSelfAttention(BertSelfAttention): class ErnieCrossAttention (line 130) | class ErnieCrossAttention(BertCrossAttention): class ErnieLayer (line 134) | class ErnieLayer(BertLayer): class ErniePooler (line 138) | class ErniePooler(BertPooler): class ErnieLMPredictionHead (line 142) | class ErnieLMPredictionHead(BertLMPredictionHead): class ErnieEncoder (line 146) | class ErnieEncoder(BertEncoder): class ErniePreTrainedModel (line 151) | class ErniePreTrainedModel(PreTrainedModel): method _init_weights (line 166) | def _init_weights(self, module): class ErnieModel (line 176) | class ErnieModel(BertModel): method __init__ (line 179) | def __init__(self, config, add_pooling_layer=True): method forward (line 195) | def forward( class ErnieForPreTrainingOutput (line 270) | class ErnieForPreTrainingOutput(BertForPreTrainingOutput): class ErnieForPreTraining (line 274) | class ErnieForPreTraining(BertForPreTraining): method forward (line 282) | def forward( class ErnieForCausalLM (line 357) | class ErnieForCausalLM(BertLMHeadModel): method forward (line 360) | def forward( class ErnieForMaskedLM (line 424) | class ErnieForMaskedLM(BertForMaskedLM): method forward (line 432) | def forward( class ErnieForNextSentencePrediction (line 485) | class ErnieForNextSentencePrediction(BertForNextSentencePrediction): method forward (line 488) | def forward( class ErnieForSequenceClassification (line 559) | class ErnieForSequenceClassification(BertForSequenceClassification): method forward (line 562) | def forward( class ErnieForMultipleChoice (line 631) | class ErnieForMultipleChoice(BertForMultipleChoice): method forward (line 634) | def forward( class ErnieForTokenClassification (line 722) | class ErnieForTokenClassification(BertForTokenClassification): method forward (line 725) | def forward( class ErnieForQuestionAnswering (line 774) | class ErnieForQuestionAnswering(BertForQuestionAnswering): method forward (line 777) | def forward( FILE: src/transformers/models/ernie4_5/configuration_ernie4_5.py class Ernie4_5Config (line 25) | class Ernie4_5Config(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): FILE: src/transformers/models/ernie4_5/modeling_ernie4_5.py class Ernie4_5RotaryEmbedding (line 43) | class Ernie4_5RotaryEmbedding(nn.Module): method __init__ (line 46) | def __init__(self, config: Ernie4_5Config, device=None): method compute_default_rope_parameters (line 63) | def compute_default_rope_parameters( method forward (line 94) | def forward(self, x, position_ids): class Ernie4_5MLP (line 109) | class Ernie4_5MLP(nn.Module): method __init__ (line 110) | def __init__(self, config: Ernie4_5Config): method forward (line 121) | def forward(self, x): function rotate_half (line 126) | def rotate_half(x): function repeat_kv (line 133) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 145) | def eager_attention_forward( function apply_rotary_pos_emb (line 170) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Ernie4_5Attention (line 205) | class Ernie4_5Attention(nn.Module): method __init__ (line 208) | def __init__(self, config: Ernie4_5Config, layer_idx: int): method forward (line 224) | def forward( class Ernie4_5RMSNorm (line 266) | class Ernie4_5RMSNorm(nn.Module): method __init__ (line 267) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 275) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 282) | def extra_repr(self): class Ernie4_5DecoderLayer (line 286) | class Ernie4_5DecoderLayer(GradientCheckpointingLayer): method __init__ (line 287) | def __init__(self, config: Ernie4_5Config, layer_idx: int): method forward (line 297) | def forward( class Ernie4_5PreTrainedModel (line 330) | class Ernie4_5PreTrainedModel(PreTrainedModel): class Ernie4_5Model (line 349) | class Ernie4_5Model(Ernie4_5PreTrainedModel): method __init__ (line 350) | def __init__(self, config: Ernie4_5Config): method forward (line 369) | def forward( class Ernie4_5ForCausalLM (line 423) | class Ernie4_5ForCausalLM(Ernie4_5PreTrainedModel, GenerationMixin): method __init__ (line 428) | def __init__(self, config): method forward (line 439) | def forward( FILE: src/transformers/models/ernie4_5/modular_ernie4_5.py class Ernie4_5RotaryEmbedding (line 32) | class Ernie4_5RotaryEmbedding(OlmoRotaryEmbedding): method forward (line 35) | def forward(self, x, position_ids): function apply_rotary_pos_emb (line 50) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Ernie4_5MLP (line 84) | class Ernie4_5MLP(LlamaMLP): method __init__ (line 85) | def __init__(self, config: Ernie4_5Config): class Ernie4_5Attention (line 93) | class Ernie4_5Attention(LlamaAttention): method __init__ (line 94) | def __init__(self, config: Ernie4_5Config, layer_idx: int): class Ernie4_5ForCausalLM (line 105) | class Ernie4_5ForCausalLM(LlamaForCausalLM): method forward (line 108) | def forward(self, **super_kwargs): FILE: src/transformers/models/ernie4_5_moe/configuration_ernie4_5_moe.py class Ernie4_5_MoeConfig (line 25) | class Ernie4_5_MoeConfig(PreTrainedConfig): method __post_init__ (line 114) | def __post_init__(self, **kwargs): FILE: src/transformers/models/ernie4_5_moe/modeling_ernie4_5_moe.py class Ernie4_5_MoeRMSNorm (line 46) | class Ernie4_5_MoeRMSNorm(nn.Module): method __init__ (line 47) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 55) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 62) | def extra_repr(self): class Ernie4_5_MoeMLP (line 66) | class Ernie4_5_MoeMLP(nn.Module): method __init__ (line 67) | def __init__(self, config, intermediate_size=None): method forward (line 78) | def forward(self, x): class Ernie4_5_MoeRotaryEmbedding (line 83) | class Ernie4_5_MoeRotaryEmbedding(nn.Module): method __init__ (line 86) | def __init__(self, config: Ernie4_5_MoeConfig, device=None): method compute_default_rope_parameters (line 103) | def compute_default_rope_parameters( method forward (line 134) | def forward(self, x, position_ids): function rotate_half (line 149) | def rotate_half(x): function apply_rotary_pos_emb (line 156) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 190) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 202) | def eager_attention_forward( class Ernie4_5_MoeAttention (line 228) | class Ernie4_5_MoeAttention(nn.Module): method __init__ (line 231) | def __init__(self, config: Ernie4_5_MoeConfig, layer_idx: int): method forward (line 247) | def forward( class Ernie4_5_MoeStatics (line 288) | class Ernie4_5_MoeStatics(nn.Module): method __init__ (line 295) | def __init__(self, config): method forward (line 306) | def forward(self, hidden_states): class Ernie4_5_MoeExperts (line 316) | class Ernie4_5_MoeExperts(nn.Module): method __init__ (line 319) | def __init__(self, config): method forward (line 328) | def forward( class Ernie4_5_MoeTopKRouter (line 355) | class Ernie4_5_MoeTopKRouter(nn.Module): method __init__ (line 356) | def __init__(self, config): method forward (line 363) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Ernie4_5_MoeSparseMoeBlock (line 382) | class Ernie4_5_MoeSparseMoeBlock(nn.Module): method __init__ (line 383) | def __init__(self, config): method forward (line 395) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Ernie4_5_MoeDecoderLayer (line 412) | class Ernie4_5_MoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 413) | def __init__(self, config, layer_idx): method forward (line 431) | def forward( class Ernie4_5_MoePreTrainedModel (line 464) | class Ernie4_5_MoePreTrainedModel(PreTrainedModel): method _init_weights (line 486) | def _init_weights(self, module): class Ernie4_5_MoeModel (line 496) | class Ernie4_5_MoeModel(Ernie4_5_MoePreTrainedModel): method __init__ (line 497) | def __init__(self, config: Ernie4_5_MoeConfig): method forward (line 516) | def forward( function load_balancing_loss_func (line 572) | def load_balancing_loss_func( class Ernie4_5_MoeForCausalLM (line 655) | class Ernie4_5_MoeForCausalLM(Ernie4_5_MoePreTrainedModel, GenerationMix... method __init__ (line 660) | def __init__(self, config): method forward (line 675) | def forward( FILE: src/transformers/models/ernie4_5_moe/modular_ernie4_5_moe.py class Ernie4_5_MoeRMSNorm (line 43) | class Ernie4_5_MoeRMSNorm(LlamaRMSNorm): class Ernie4_5_MoeMLP (line 47) | class Ernie4_5_MoeMLP(Qwen3MoeMLP): method __init__ (line 48) | def __init__(self, config, intermediate_size=None): class Ernie4_5_MoeRotaryEmbedding (line 56) | class Ernie4_5_MoeRotaryEmbedding(Ernie4_5RotaryEmbedding): method __init__ (line 57) | def __init__(self, config: Ernie4_5_MoeConfig, device=None): class Ernie4_5_MoeAttention (line 61) | class Ernie4_5_MoeAttention(LlamaAttention): method __init__ (line 62) | def __init__(self, config: Ernie4_5_MoeConfig, layer_idx: int): class Ernie4_5_MoeStatics (line 73) | class Ernie4_5_MoeStatics(nn.Module): method __init__ (line 80) | def __init__(self, config): method forward (line 91) | def forward(self, hidden_states): class Ernie4_5_MoeExperts (line 100) | class Ernie4_5_MoeExperts(MixtralExperts): method __init__ (line 101) | def __init__(self, config): class Ernie4_5_MoeTopKRouter (line 107) | class Ernie4_5_MoeTopKRouter(nn.Module): method __init__ (line 108) | def __init__(self, config): method forward (line 115) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Ernie4_5_MoeSparseMoeBlock (line 134) | class Ernie4_5_MoeSparseMoeBlock(nn.Module): method __init__ (line 135) | def __init__(self, config): method forward (line 147) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Ernie4_5_MoeDecoderLayer (line 164) | class Ernie4_5_MoeDecoderLayer(Qwen3MoeDecoderLayer): method __init__ (line 165) | def __init__(self, config, layer_idx): class Ernie4_5_MoePreTrainedModel (line 185) | class Ernie4_5_MoePreTrainedModel(MixtralPreTrainedModel): method _init_weights (line 198) | def _init_weights(self, module): class Ernie4_5_MoeModel (line 208) | class Ernie4_5_MoeModel(Ernie4_5_MoePreTrainedModel): method __init__ (line 209) | def __init__(self, config: Ernie4_5_MoeConfig): method forward (line 228) | def forward( class Ernie4_5_MoeForCausalLM (line 285) | class Ernie4_5_MoeForCausalLM(MixtralForCausalLM): method __init__ (line 286) | def __init__(self, config): method forward (line 301) | def forward(self, **super_kwargs): FILE: src/transformers/models/ernie4_5_vl_moe/configuration_ernie4_5_vl_moe.py class Ernie4_5_VLMoeVisionConfig (line 32) | class Ernie4_5_VLMoeVisionConfig(PreTrainedConfig): class Ernie4_5_VLMoeTextConfig (line 64) | class Ernie4_5_VLMoeTextConfig(PreTrainedConfig): method __post_init__ (line 132) | def __post_init__(self, **kwargs): class Ernie4_5_VLMoeConfig (line 144) | class Ernie4_5_VLMoeConfig(PreTrainedConfig): method __post_init__ (line 188) | def __post_init__(self, **kwargs): class Ernie4_5_VL_MoeConfig (line 202) | class Ernie4_5_VL_MoeConfig(Ernie4_5_VLMoeConfig): method __init__ (line 203) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeTextConfig (line 210) | class Ernie4_5_VL_MoeTextConfig(Ernie4_5_VLMoeTextConfig): method __init__ (line 211) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeVisionConfig (line 218) | class Ernie4_5_VL_MoeVisionConfig(Ernie4_5_VLMoeVisionConfig): method __init__ (line 219) | def __init__(self, *args, **kwargs): FILE: src/transformers/models/ernie4_5_vl_moe/convert_ernie4_5_vl_moe_to_hf.py function load_json (line 157) | def load_json(save_dir, filename): function write_json (line 162) | def write_json(json_object, save_dir, filename): function convert_vision_config_to_hf (line 167) | def convert_vision_config_to_hf(vision_config, original_config, original... function convert_text_config_to_hf (line 186) | def convert_text_config_to_hf(text_config, original_config): function convert_config (line 224) | def convert_config(model_path, save_dir): function convert_tokenizer (line 256) | def convert_tokenizer(original_tokenizer_path, save_dir): function convert_processor (line 307) | def convert_processor(model_path, save_dir): FILE: src/transformers/models/ernie4_5_vl_moe/image_processing_ernie4_5_vl_moe.py class Ernie4_5_VLMoeImageProcessorKwargs (line 36) | class Ernie4_5_VLMoeImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 51) | def smart_resize( class Ernie4_5_VLMoeImageProcessor (line 81) | class Ernie4_5_VLMoeImageProcessor(TorchvisionBackend): method __init__ (line 98) | def __init__(self, **kwargs: Unpack[Ernie4_5_VLMoeImageProcessorKwargs]): method preprocess (line 105) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Ernie4_5_VLM... method _standardize_kwargs (line 108) | def _standardize_kwargs(self, **kwargs) -> dict: method _preprocess (line 120) | def _preprocess( method get_number_of_image_patches (line 213) | def get_number_of_image_patches(self, height: int, width: int, images_... class Ernie4_5_VL_MoeImageProcessor (line 243) | class Ernie4_5_VL_MoeImageProcessor(Ernie4_5_VLMoeImageProcessor): method __init__ (line 244) | def __init__(self, *args, **kwargs): FILE: src/transformers/models/ernie4_5_vl_moe/image_processing_pil_ernie4_5_vl_moe.py class Ernie4_5_VLMoeImageProcessorKwargs (line 35) | class Ernie4_5_VLMoeImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 50) | def smart_resize( class Ernie4_5_VLMoeImageProcessorPil (line 80) | class Ernie4_5_VLMoeImageProcessorPil(PilBackend): method __init__ (line 97) | def __init__(self, **kwargs: Unpack[Ernie4_5_VLMoeImageProcessorKwargs]): method preprocess (line 104) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Ernie4_5_VLM... method _standardize_kwargs (line 107) | def _standardize_kwargs(self, **kwargs) -> dict: method _preprocess (line 119) | def _preprocess( method get_number_of_image_patches (line 207) | def get_number_of_image_patches(self, height: int, width: int, images_... class Ernie4_5_VL_MoeImageProcessorPil (line 237) | class Ernie4_5_VL_MoeImageProcessorPil(Ernie4_5_VLMoeImageProcessorPil): method __init__ (line 238) | def __init__(self, *args, **kwargs): FILE: src/transformers/models/ernie4_5_vl_moe/modeling_ernie4_5_vl_moe.py class Ernie4_5_VLMoeTextRotaryEmbedding (line 50) | class Ernie4_5_VLMoeTextRotaryEmbedding(nn.Module): method __init__ (line 53) | def __init__(self, config, device=None): method compute_default_rope_parameters (line 72) | def compute_default_rope_parameters( method forward (line 114) | def forward(self, x, position_ids): method recomposition_to_3d (line 131) | def recomposition_to_3d(self, freq): function repeat_kv (line 138) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 150) | def eager_attention_forward( function rotate_half_text (line 175) | def rotate_half_text(x): function apply_rotary_pos_emb (line 182) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Ernie4_5_VLMoeTextAttention (line 212) | class Ernie4_5_VLMoeTextAttention(nn.Module): method __init__ (line 215) | def __init__(self, config: Ernie4_5_VLMoeConfig, layer_idx: int): method forward (line 231) | def forward( class Ernie4_5_VLMoeRMSNorm (line 273) | class Ernie4_5_VLMoeRMSNorm(nn.Module): method __init__ (line 274) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 282) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 289) | def extra_repr(self): class Ernie4_5_VLMoeMLP (line 293) | class Ernie4_5_VLMoeMLP(nn.Module): method __init__ (line 294) | def __init__(self, config, intermediate_size=None): method forward (line 305) | def forward(self, x): class Ernie4_5_VLMoeMoeStatics (line 310) | class Ernie4_5_VLMoeMoeStatics(nn.Module): method __init__ (line 317) | def __init__(self, config): method forward (line 328) | def forward(self, hidden_states): class Ernie4_5_VLMoeMoeTopKRouter (line 337) | class Ernie4_5_VLMoeMoeTopKRouter(nn.Module): method __init__ (line 338) | def __init__(self, config): method forward (line 345) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Ernie4_5_VLMoeMoeExperts (line 365) | class Ernie4_5_VLMoeMoeExperts(nn.Module): method __init__ (line 368) | def __init__(self, config, intermediate_size=None): method forward (line 377) | def forward( class Ernie4_5_VLMoeSparseMoeBlock (line 404) | class Ernie4_5_VLMoeSparseMoeBlock(nn.Module): method __init__ (line 405) | def __init__(self, config, intermediate_size): method forward (line 413) | def forward( class Ernie4_5_VLMoeMoeBlock (line 426) | class Ernie4_5_VLMoeMoeBlock(nn.Module): method __init__ (line 435) | def __init__(self, config): method forward (line 448) | def forward( class Ernie4_5_VLMoeDecoderLayer (line 491) | class Ernie4_5_VLMoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 492) | def __init__(self, config, layer_idx): method forward (line 506) | def forward( function rotate_half (line 543) | def rotate_half(x): function apply_rotary_pos_emb_vision (line 550) | def apply_rotary_pos_emb_vision( class Ernie4_5_VLMoeVisionAttention (line 564) | class Ernie4_5_VLMoeVisionAttention(nn.Module): method __init__ (line 565) | def __init__(self, config: Ernie4_5_VLMoeVisionConfig) -> None: method forward (line 578) | def forward( class Ernie4_5_VLMoeVisionBlock (line 647) | class Ernie4_5_VLMoeVisionBlock(GradientCheckpointingLayer): method __init__ (line 648) | def __init__(self, config) -> None: method forward (line 661) | def forward( class Ernie4_5_VLMoePreTrainedModel (line 687) | class Ernie4_5_VLMoePreTrainedModel(PreTrainedModel): method _init_weights (line 706) | def _init_weights(self, module): class Ernie4_5_VLMoeTextModel (line 720) | class Ernie4_5_VLMoeTextModel(Ernie4_5_VLMoePreTrainedModel): method __init__ (line 723) | def __init__(self, config: Ernie4_5_VLMoeTextConfig): method forward (line 742) | def forward( class Ernie4_5VLVisionMLP (line 819) | class Ernie4_5VLVisionMLP(nn.Module): method __init__ (line 820) | def __init__(self, dim: int, hidden_dim: int, hidden_act: str) -> None: method forward (line 826) | def forward(self, x) -> torch.Tensor: class Ernie4_5_VLMoePatchEmbed (line 830) | class Ernie4_5_VLMoePatchEmbed(nn.Module): method __init__ (line 831) | def __init__( method forward (line 843) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Ernie4_5_VLMoeVisionRotaryEmbedding (line 848) | class Ernie4_5_VLMoeVisionRotaryEmbedding(nn.Module): method __init__ (line 851) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 858) | def forward(self, seqlen: int) -> torch.Tensor: class Ernie4_5_VLMoeVisionTransformerPretrainedModel (line 865) | class Ernie4_5_VLMoeVisionTransformerPretrainedModel(Ernie4_5_VLMoePreTr... method __init__ (line 876) | def __init__(self, config) -> None: method rot_pos_emb (line 896) | def rot_pos_emb(self, grid_thw): method forward (line 927) | def forward( class Ernie4_5_VLMoeVisionMLP (line 960) | class Ernie4_5_VLMoeVisionMLP(nn.Module): method __init__ (line 961) | def __init__(self, config, in_dim, out_dim): method forward (line 969) | def forward(self, hidden_states): class Ernie4_5_VLMoeVariableResolutionResamplerModel (line 977) | class Ernie4_5_VLMoeVariableResolutionResamplerModel(nn.Module): method __init__ (line 978) | def __init__(self, config: Ernie4_5_VLMoeConfig): method _temporal_slicing (line 998) | def _temporal_slicing(self, hidden_states, grid_thw): method forward (line 1061) | def forward(self, hidden_states, grid_thw): class Ernie4_5_VLMoeModel (line 1079) | class Ernie4_5_VLMoeModel(Ernie4_5_VLMoePreTrainedModel): method __init__ (line 1086) | def __init__(self, config: Ernie4_5_VLMoeConfig): method get_input_embeddings (line 1096) | def get_input_embeddings(self): method set_input_embeddings (line 1099) | def set_input_embeddings(self, value): method get_vision_position_ids (line 1102) | def get_vision_position_ids( method get_rope_index (line 1158) | def get_rope_index( method get_video_features (line 1266) | def get_video_features( method get_image_features (line 1291) | def get_image_features( method get_placeholder_mask (line 1310) | def get_placeholder_mask( method compute_3d_position_ids (line 1351) | def compute_3d_position_ids( method forward (line 1402) | def forward( function load_balancing_loss_func (line 1482) | def load_balancing_loss_func( class Ernie4_5_VLMoeForConditionalGeneration (line 1564) | class Ernie4_5_VLMoeForConditionalGeneration(Ernie4_5_VLMoePreTrainedMod... method __init__ (line 1569) | def __init__(self, config): method get_input_embeddings (line 1580) | def get_input_embeddings(self): method set_input_embeddings (line 1583) | def set_input_embeddings(self, value): method get_video_features (line 1587) | def get_video_features( method get_image_features (line 1604) | def get_image_features( method forward (line 1620) | def forward( method prepare_inputs_for_generation (line 1709) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1743) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1781) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1837) | def _expand_inputs_for_generation( class Ernie4_5_VL_MoeForConditionalGeneration (line 1927) | class Ernie4_5_VL_MoeForConditionalGeneration(Ernie4_5_VLMoeForCondition... method __init__ (line 1928) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoePreTrainedModel (line 1936) | class Ernie4_5_VL_MoePreTrainedModel(Ernie4_5_VLMoePreTrainedModel): method post_init (line 1937) | def post_init(self): class Ernie4_5_VL_MoeModel (line 1944) | class Ernie4_5_VL_MoeModel(Ernie4_5_VLMoeModel): method __init__ (line 1945) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeTextModel (line 1952) | class Ernie4_5_VL_MoeTextModel(Ernie4_5_VLMoeTextModel): method __init__ (line 1953) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeVisionTransformerPretrainedModel (line 1960) | class Ernie4_5_VL_MoeVisionTransformerPretrainedModel(Ernie4_5_VLMoeVisi... method __init__ (line 1961) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeVariableResolutionResamplerModel (line 1969) | class Ernie4_5_VL_MoeVariableResolutionResamplerModel(Ernie4_5_VLMoeVari... method __init__ (line 1970) | def __init__(self, *args, **kwargs): FILE: src/transformers/models/ernie4_5_vl_moe/modular_ernie4_5_vl_moe.py class Ernie4_5_VLMoeVisionConfig (line 87) | class Ernie4_5_VLMoeVisionConfig(Qwen2VLVisionConfig): class Ernie4_5_VLMoeTextConfig (line 114) | class Ernie4_5_VLMoeTextConfig(Ernie4_5_MoeConfig): method __post_init__ (line 156) | def __post_init__(self, **kwargs): class Ernie4_5_VLMoeConfig (line 168) | class Ernie4_5_VLMoeConfig(PreTrainedConfig): method __post_init__ (line 212) | def __post_init__(self, **kwargs): class Ernie4_5_VLMoeTextRotaryEmbedding (line 226) | class Ernie4_5_VLMoeTextRotaryEmbedding(nn.Module): method __init__ (line 229) | def __init__(self, config, device=None): method compute_default_rope_parameters (line 248) | def compute_default_rope_parameters( method forward (line 290) | def forward(self, x, position_ids): method recomposition_to_3d (line 307) | def recomposition_to_3d(self, freq): function rotate_half_text (line 314) | def rotate_half_text(x): function apply_rotary_pos_emb (line 321) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Ernie4_5_VLMoeTextAttention (line 350) | class Ernie4_5_VLMoeTextAttention(Ernie4_5_MoeAttention): class Ernie4_5_VLMoeRMSNorm (line 354) | class Ernie4_5_VLMoeRMSNorm(Ernie4_5_MoeRMSNorm): class Ernie4_5_VLMoeMLP (line 358) | class Ernie4_5_VLMoeMLP(Ernie4_5_MoeMLP): class Ernie4_5_VLMoeMoeStatics (line 362) | class Ernie4_5_VLMoeMoeStatics(Ernie4_5_MoeStatics): class Ernie4_5_VLMoeMoeTopKRouter (line 366) | class Ernie4_5_VLMoeMoeTopKRouter(Ernie4_5_MoeTopKRouter): method __init__ (line 367) | def __init__(self, config): class Ernie4_5_VLMoeMoeExperts (line 372) | class Ernie4_5_VLMoeMoeExperts(Ernie4_5_MoeExperts): method __init__ (line 373) | def __init__(self, config, intermediate_size=None): class Ernie4_5_VLMoeSparseMoeBlock (line 378) | class Ernie4_5_VLMoeSparseMoeBlock(nn.Module): method __init__ (line 379) | def __init__(self, config, intermediate_size): method forward (line 387) | def forward( class Ernie4_5_VLMoeMoeBlock (line 400) | class Ernie4_5_VLMoeMoeBlock(nn.Module): method __init__ (line 409) | def __init__(self, config): method forward (line 422) | def forward( class Ernie4_5_VLMoeDecoderLayer (line 465) | class Ernie4_5_VLMoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 466) | def __init__(self, config, layer_idx): method forward (line 480) | def forward( class Ernie4_5_VLMoeVisionAttention (line 517) | class Ernie4_5_VLMoeVisionAttention(Qwen2_5_VLVisionAttention): class Ernie4_5_VLMoeVisionBlock (line 521) | class Ernie4_5_VLMoeVisionBlock(Qwen2_5_VLVisionBlock): method __init__ (line 522) | def __init__(self, config) -> None: class Ernie4_5_VLMoePreTrainedModel (line 534) | class Ernie4_5_VLMoePreTrainedModel(Qwen2_5_VLPreTrainedModel): method _init_weights (line 544) | def _init_weights(self, module): class Ernie4_5_VLMoeTextModel (line 557) | class Ernie4_5_VLMoeTextModel(Ernie4_5_MoeModel): method __init__ (line 560) | def __init__(self, config: Ernie4_5_VLMoeTextConfig): method forward (line 567) | def forward( class Ernie4_5VLVisionMLP (line 644) | class Ernie4_5VLVisionMLP(VisionMlp): class Ernie4_5_VLMoePatchEmbed (line 648) | class Ernie4_5_VLMoePatchEmbed(Qwen2_5_VisionPatchEmbed): method __init__ (line 649) | def __init__( method forward (line 661) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Ernie4_5_VLMoeVisionRotaryEmbedding (line 666) | class Ernie4_5_VLMoeVisionRotaryEmbedding(Qwen2_5_VisionRotaryEmbedding): class Ernie4_5_VLMoeVisionTransformerPretrainedModel (line 670) | class Ernie4_5_VLMoeVisionTransformerPretrainedModel(Qwen2VisionTransfor... method __init__ (line 677) | def __init__(self, config) -> None: method get_dtype (line 693) | def get_dtype(self): method get_device (line 696) | def get_device(self): method forward (line 701) | def forward( class Ernie4_5_VLMoeVisionMLP (line 730) | class Ernie4_5_VLMoeVisionMLP(nn.Module): method __init__ (line 731) | def __init__(self, config, in_dim, out_dim): method forward (line 739) | def forward(self, hidden_states): class Ernie4_5_VLMoeVariableResolutionResamplerModel (line 747) | class Ernie4_5_VLMoeVariableResolutionResamplerModel(nn.Module): method __init__ (line 748) | def __init__(self, config: Ernie4_5_VLMoeConfig): method _temporal_slicing (line 768) | def _temporal_slicing(self, hidden_states, grid_thw): method forward (line 831) | def forward(self, hidden_states, grid_thw): class Ernie4_5_VLMoeModel (line 848) | class Ernie4_5_VLMoeModel(Qwen2VLModel): method __init__ (line 852) | def __init__(self, config: Ernie4_5_VLMoeConfig): method get_rope_index (line 859) | def get_rope_index( method get_video_features (line 967) | def get_video_features( method get_image_features (line 986) | def get_image_features( method forward (line 1001) | def forward( class Ernie4_5_VLMoeForConditionalGeneration (line 1081) | class Ernie4_5_VLMoeForConditionalGeneration(Glm4vForConditionalGenerati... method __init__ (line 1082) | def __init__(self, config): method get_video_features (line 1090) | def get_video_features(self, **super_kwargs): method get_image_features (line 1094) | def get_image_features(self, **super_kwargs): method prepare_inputs_for_generation (line 1097) | def prepare_inputs_for_generation( method forward (line 1133) | def forward( class Ernie4_5_VLMoeImageProcessorKwargs (line 1223) | class Ernie4_5_VLMoeImageProcessorKwargs(ImagesKwargs, total=False): class Ernie4_5_VLMoeImageProcessorPil (line 1238) | class Ernie4_5_VLMoeImageProcessorPil(Glm4vImageProcessorPil): method _preprocess (line 1242) | def _preprocess( method get_number_of_image_patches (line 1330) | def get_number_of_image_patches(self, height: int, width: int, images_... class Ernie4_5_VLMoeImageProcessor (line 1360) | class Ernie4_5_VLMoeImageProcessor(Glm4vImageProcessor): method _preprocess (line 1364) | def _preprocess( method get_number_of_image_patches (line 1454) | def get_number_of_image_patches(self, height: int, width: int, images_... class Ernie4_5_VL_MoeForConditionalGeneration (line 1485) | class Ernie4_5_VL_MoeForConditionalGeneration(Ernie4_5_VLMoeForCondition... method __init__ (line 1486) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeConfig (line 1494) | class Ernie4_5_VL_MoeConfig(Ernie4_5_VLMoeConfig): method __init__ (line 1495) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeTextConfig (line 1502) | class Ernie4_5_VL_MoeTextConfig(Ernie4_5_VLMoeTextConfig): method __init__ (line 1503) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeVisionConfig (line 1510) | class Ernie4_5_VL_MoeVisionConfig(Ernie4_5_VLMoeVisionConfig): method __init__ (line 1511) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoePreTrainedModel (line 1518) | class Ernie4_5_VL_MoePreTrainedModel(Ernie4_5_VLMoePreTrainedModel): method post_init (line 1519) | def post_init(self): class Ernie4_5_VL_MoeModel (line 1526) | class Ernie4_5_VL_MoeModel(Ernie4_5_VLMoeModel): method __init__ (line 1527) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeTextModel (line 1534) | class Ernie4_5_VL_MoeTextModel(Ernie4_5_VLMoeTextModel): method __init__ (line 1535) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeVisionTransformerPretrainedModel (line 1542) | class Ernie4_5_VL_MoeVisionTransformerPretrainedModel(Ernie4_5_VLMoeVisi... method __init__ (line 1543) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeVariableResolutionResamplerModel (line 1551) | class Ernie4_5_VL_MoeVariableResolutionResamplerModel(Ernie4_5_VLMoeVari... method __init__ (line 1552) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeImageProcessor (line 1560) | class Ernie4_5_VL_MoeImageProcessor(Ernie4_5_VLMoeImageProcessor): method __init__ (line 1561) | def __init__(self, *args, **kwargs): class Ernie4_5_VL_MoeImageProcessorPil (line 1568) | class Ernie4_5_VL_MoeImageProcessorPil(Ernie4_5_VLMoeImageProcessorPil): method __init__ (line 1569) | def __init__(self, *args, **kwargs): FILE: src/transformers/models/ernie4_5_vl_moe/processing_ernie4_5_vl_moe.py class Ernie4_5_VLMoeProcessorKwargs (line 27) | class Ernie4_5_VLMoeProcessorKwargs(ProcessingKwargs, total=False): class Ernie4_5_VLMoeProcessor (line 37) | class Ernie4_5_VLMoeProcessor(ProcessorMixin): method __init__ (line 53) | def __init__(self, image_processor=None, tokenizer=None, video_process... method save_pretrained (line 70) | def save_pretrained(self, save_directory, push_to_hub: bool = False, *... method __call__ (line 82) | def __call__( method model_input_names (line 197) | def model_input_names(self): method _get_num_multimodal_tokens (line 204) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... FILE: src/transformers/models/ernie4_5_vl_moe/video_processing_ernie4_5_vl_moe.py class Ernie4_5_VLMoeVideoProcessorInitKwargs (line 67) | class Ernie4_5_VLMoeVideoProcessorInitKwargs(VideosKwargs, total=False): class Ernie4_5_VLMoeVideoProcessor (line 102) | class Ernie4_5_VLMoeVideoProcessor(BaseVideoProcessor): method __init__ (line 122) | def __init__(self, **kwargs: Unpack[Ernie4_5_VLMoeVideoProcessorInitKw... method get_video_processor_dict (line 135) | def get_video_processor_dict( method to_dict (line 275) | def to_dict(self) -> dict[str, Any]: method save_pretrained (line 289) | def save_pretrained(self, save_directory: str | os.PathLike, push_to_h... method _standardize_kwargs (line 301) | def _standardize_kwargs( method sample_frames (line 315) | def sample_frames( method _convert_timestamp (line 354) | def _convert_timestamp(self, time_stamp_in_seconds): method _render_image_with_timestamp (line 362) | def _render_image_with_timestamp(self, image: torch.Tensor, timestamp:... method _prepare_input_videos (line 390) | def _prepare_input_videos( method _preprocess (line 449) | def _preprocess( method preprocess (line 545) | def preprocess( FILE: src/transformers/models/esm/configuration_esm.py class StructureModuleConfig (line 29) | class StructureModuleConfig(PreTrainedConfig): class TrunkConfig (line 82) | class TrunkConfig(PreTrainedConfig): method __post_init__ (line 98) | def __post_init__(self, **kwargs): method validate_architecture (line 105) | def validate_architecture(self): class EsmFoldConfig (line 133) | class EsmFoldConfig(PreTrainedConfig): method __post_init__ (line 147) | def __post_init__(self, **kwargs): class EsmConfig (line 157) | class EsmConfig(PreTrainedConfig): method __post_init__ (line 216) | def __post_init__(self, **kwargs): function get_default_vocab_list (line 237) | def get_default_vocab_list(): FILE: src/transformers/models/esm/convert_esm.py function get_esmfold_tokenizer (line 76) | def get_esmfold_tokenizer(): function transfer_and_check_weights (line 86) | def transfer_and_check_weights(original_module, our_module): function convert_esm_checkpoint_to_pytorch (line 94) | def convert_esm_checkpoint_to_pytorch( FILE: src/transformers/models/esm/modeling_esm.py function rotate_half (line 45) | def rotate_half(x): function apply_rotary_pos_emb (line 50) | def apply_rotary_pos_emb(x, cos, sin): function gelu (line 57) | def gelu(x): function symmetrize (line 64) | def symmetrize(x): function average_product_correct (line 69) | def average_product_correct(x): class RotaryEmbedding (line 81) | class RotaryEmbedding(torch.nn.Module): method __init__ (line 90) | def __init__(self, dim: int): method _update_cos_sin_tables (line 101) | def _update_cos_sin_tables(self, x, seq_dimension=2): method forward (line 117) | def forward(self, q: torch.Tensor, k: torch.Tensor) -> tuple[torch.Ten... class EsmContactPredictionHead (line 126) | class EsmContactPredictionHead(nn.Module): method __init__ (line 129) | def __init__( method forward (line 141) | def forward(self, tokens, attentions): class EsmEmbeddings (line 161) | class EsmEmbeddings(nn.Module): method __init__ (line 166) | def __init__(self, config): method forward (line 189) | def forward( method create_position_ids_from_inputs_embeds (line 238) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): function eager_attention_forward (line 257) | def eager_attention_forward( class EsmSelfAttention (line 285) | class EsmSelfAttention(nn.Module): method __init__ (line 286) | def __init__(self, config, position_embedding_type=None, layer_idx=Non... method forward (line 318) | def forward( class EsmSelfOutput (line 365) | class EsmSelfOutput(nn.Module): method __init__ (line 366) | def __init__(self, config): method forward (line 371) | def forward(self, hidden_states, input_tensor): class EsmAttention (line 378) | class EsmAttention(nn.Module): method __init__ (line 379) | def __init__(self, config, layer_idx=None, is_cross_attention=False): method forward (line 386) | def forward( class EsmIntermediate (line 406) | class EsmIntermediate(nn.Module): method __init__ (line 407) | def __init__(self, config): method forward (line 411) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EsmOutput (line 417) | class EsmOutput(nn.Module): method __init__ (line 418) | def __init__(self, config): method forward (line 423) | def forward(self, hidden_states, input_tensor): class EsmLayer (line 430) | class EsmLayer(GradientCheckpointingLayer): method __init__ (line 431) | def __init__(self, config): method forward (line 446) | def forward( method feed_forward_chunk (line 478) | def feed_forward_chunk(self, attention_output): class EsmEncoder (line 485) | class EsmEncoder(nn.Module): method __init__ (line 486) | def __init__(self, config): method forward (line 494) | def forward( class EsmPooler (line 518) | class EsmPooler(nn.Module): method __init__ (line 519) | def __init__(self, config): method forward (line 524) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EsmPreTrainedModel (line 534) | class EsmPreTrainedModel(PreTrainedModel): method _init_weights (line 555) | def _init_weights(self, module): method get_output_embeddings (line 566) | def get_output_embeddings(self): class EsmModel (line 573) | class EsmModel(EsmPreTrainedModel): method __init__ (line 586) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 606) | def get_input_embeddings(self): method set_input_embeddings (line 609) | def set_input_embeddings(self, value): method forward (line 615) | def forward( method _create_attention_masks (line 679) | def _create_attention_masks( method predict_contacts (line 711) | def predict_contacts(self, tokens, attention_mask): class EsmForMaskedLM (line 724) | class EsmForMaskedLM(EsmPreTrainedModel): method __init__ (line 727) | def __init__(self, config): method get_output_embeddings (line 741) | def get_output_embeddings(self): method set_output_embeddings (line 744) | def set_output_embeddings(self, new_embeddings): method forward (line 749) | def forward( method predict_contacts (line 793) | def predict_contacts(self, tokens, attention_mask): class EsmLMHead (line 797) | class EsmLMHead(nn.Module): method __init__ (line 800) | def __init__(self, config): method forward (line 808) | def forward(self, features, **kwargs): class EsmForSequenceClassification (line 824) | class EsmForSequenceClassification(EsmPreTrainedModel): method __init__ (line 825) | def __init__(self, config): method forward (line 837) | def forward( class EsmForTokenClassification (line 897) | class EsmForTokenClassification(EsmPreTrainedModel): method __init__ (line 898) | def __init__(self, config): method forward (line 910) | def forward( class EsmClassificationHead (line 952) | class EsmClassificationHead(nn.Module): method __init__ (line 955) | def __init__(self, config): method forward (line 961) | def forward(self, features, **kwargs): function create_position_ids_from_input_ids (line 971) | def create_position_ids_from_input_ids(input_ids, padding_idx): FILE: src/transformers/models/esm/modeling_esmfold.py class EsmForProteinFoldingOutput (line 60) | class EsmForProteinFoldingOutput(ModelOutput): function is_fp16_enabled (line 137) | def is_fp16_enabled(device_type): function is_deepspeed_initialized (line 146) | def is_deepspeed_initialized(): function collate_dense_tensors (line 159) | def collate_dense_tensors(samples: list[torch.Tensor], pad_v: float = 0)... function flatten_final_dims (line 182) | def flatten_final_dims(t: torch.Tensor, no_dims: int): function permute_final_dims (line 186) | def permute_final_dims(tensor: torch.Tensor, inds: list[int]): function dict_multimap (line 192) | def dict_multimap(fn, dicts): class EsmFoldLinear (line 205) | class EsmFoldLinear(nn.Linear): method __init__ (line 212) | def __init__( class EsmFoldLayerNorm (line 251) | class EsmFoldLayerNorm(nn.Module): method __init__ (line 252) | def __init__(self, c_in, eps=1e-5): method forward (line 261) | def forward(self, x): function softmax_no_cast (line 273) | def softmax_no_cast(t: torch.Tensor, dim: int = -1) -> torch.Tensor: class EsmFoldAttention (line 287) | class EsmFoldAttention(nn.Module): method __init__ (line 292) | def __init__( method _prep_qkv (line 339) | def _prep_qkv(self, q_x: torch.Tensor, kv_x: torch.Tensor) -> tuple[to... method _wrap_up (line 359) | def _wrap_up(self, o: torch.Tensor, q_x: torch.Tensor) -> torch.Tensor: method forward (line 375) | def forward( class EsmFoldTriangleAttention (line 439) | class EsmFoldTriangleAttention(nn.Module): method __init__ (line 440) | def __init__(self, c_in, c_hidden, no_heads, starting=True, inf=1e9): method _chunk (line 465) | def _chunk( method forward (line 489) | def forward( class EsmFoldTriangleMultiplicativeUpdate (line 549) | class EsmFoldTriangleMultiplicativeUpdate(nn.Module): method __init__ (line 554) | def __init__(self, config, _outgoing=True): method _combine_projections (line 571) | def _combine_projections( method _inference_forward (line 597) | def _inference_forward( method forward (line 824) | def forward( class EsmFoldPreTrainedModel (line 879) | class EsmFoldPreTrainedModel(EsmPreTrainedModel): method _init_weights (line 887) | def _init_weights(self, module): class EsmFoldSelfAttention (line 939) | class EsmFoldSelfAttention(nn.Module): method __init__ (line 940) | def __init__(self, embed_dim, num_heads, head_width, gated=False): method forward (line 960) | def forward(self, x, mask=None, bias=None, indices=None): class EsmFoldDropout (line 1001) | class EsmFoldDropout(nn.Module): method __init__ (line 1006) | def __init__(self, r: float, batch_dim: int | list[int]): method forward (line 1015) | def forward(self, x: torch.Tensor) -> torch.Tensor: class EsmFoldSequenceToPair (line 1023) | class EsmFoldSequenceToPair(nn.Module): method __init__ (line 1024) | def __init__(self, sequence_state_dim, inner_dim, pairwise_state_dim): method forward (line 1034) | def forward(self, sequence_state): class EsmFoldPairToSequence (line 1061) | class EsmFoldPairToSequence(nn.Module): method __init__ (line 1062) | def __init__(self, pairwise_state_dim, num_heads): method forward (line 1068) | def forward(self, pairwise_state): class EsmFoldResidueMLP (line 1082) | class EsmFoldResidueMLP(nn.Module): method __init__ (line 1083) | def __init__(self, embed_dim, inner_dim, dropout=0): method forward (line 1094) | def forward(self, x): class EsmFoldTriangularSelfAttentionBlock (line 1098) | class EsmFoldTriangularSelfAttentionBlock(nn.Module): method __init__ (line 1099) | def __init__(self, config): method forward (line 1133) | def forward(self, sequence_state, pairwise_state, mask=None, chunk_siz... class EsmCategoricalMixture (line 1202) | class EsmCategoricalMixture: method __init__ (line 1203) | def __init__(self, param, bins=50, start=0, end=1): method log_prob (line 1209) | def log_prob(self, true): method mean (line 1217) | def mean(self): function categorical_lddt (line 1221) | def categorical_lddt(logits, bins=50): function get_axial_mask (line 1226) | def get_axial_mask(mask): class EsmFoldRelativePosition (line 1248) | class EsmFoldRelativePosition(nn.Module): method __init__ (line 1249) | def __init__(self, config): method forward (line 1257) | def forward(self, residue_index, mask=None): class EsmFoldAngleResnetBlock (line 1284) | class EsmFoldAngleResnetBlock(nn.Module): method __init__ (line 1285) | def __init__(self, config): method forward (line 1293) | def forward(self, a: torch.Tensor) -> torch.Tensor: class EsmFoldAngleResnet (line 1304) | class EsmFoldAngleResnet(nn.Module): method __init__ (line 1309) | def __init__(self, config): method forward (line 1325) | def forward(self, s: torch.Tensor, s_initial: torch.Tensor) -> tuple[t... class EsmFoldInvariantPointAttention (line 1369) | class EsmFoldInvariantPointAttention(nn.Module): method __init__ (line 1374) | def __init__(self, config): method forward (line 1409) | def forward( class EsmFoldBackboneUpdate (line 1567) | class EsmFoldBackboneUpdate(nn.Module): method __init__ (line 1572) | def __init__(self, config): method forward (line 1577) | def forward(self, s: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: class EsmFoldStructureModuleTransitionLayer (line 1590) | class EsmFoldStructureModuleTransitionLayer(nn.Module): method __init__ (line 1591) | def __init__(self, config): method forward (line 1600) | def forward(self, s): class EsmFoldStructureModuleTransition (line 1613) | class EsmFoldStructureModuleTransition(nn.Module): method __init__ (line 1614) | def __init__(self, config): method forward (line 1626) | def forward(self, s): class EsmFoldStructureModule (line 1636) | class EsmFoldStructureModule(nn.Module): method __init__ (line 1637) | def __init__(self, config): method forward (line 1661) | def forward( method _init_residue_constants (line 1774) | def _init_residue_constants(self, float_dtype, device): method torsion_angles_to_frames (line 1819) | def torsion_angles_to_frames(self, r, alpha, f): method frames_and_literature_positions_to_atom14_pos (line 1825) | def frames_and_literature_positions_to_atom14_pos(self, r, f): # [*, ... class EsmFoldingTrunk (line 1838) | class EsmFoldingTrunk(nn.Module): method __init__ (line 1839) | def __init__(self, config): method set_chunk_size (line 1862) | def set_chunk_size(self, chunk_size): method forward (line 1869) | def forward(self, seq_feats, pair_feats, true_aa, residx, mask, no_rec... method distogram (line 1935) | def distogram(coords, min_bin, max_bin, num_bins): class EsmForProteinFolding (line 1967) | class EsmForProteinFolding(EsmPreTrainedModel): method _init_weights (line 1975) | def _init_weights(self, module): method __init__ (line 1980) | def __init__(self, config): method _af2_to_esm_from_vocab_list (line 2038) | def _af2_to_esm_from_vocab_list(vocab_list: list[str]) -> torch.Tensor: method forward (line 2044) | def forward( method af2_idx_to_esm_idx (line 2178) | def af2_idx_to_esm_idx(self, aa, mask): method compute_language_model_representations (line 2185) | def compute_language_model_representations(self, esmaa: torch.Tensor) ... method bert_mask (line 2210) | def bert_mask(self, aa, esmaa, mask, pattern): method infer (line 2220) | def infer( method output_to_pdb (line 2260) | def output_to_pdb(output: dict) -> list[str]: method infer_pdb (line 2281) | def infer_pdb(self, seqs, *args, **kwargs) -> str: method infer_pdbs (line 2287) | def infer_pdbs(self, seqs: list[str], *args, **kwargs) -> list[str]: FILE: src/transformers/models/esm/openfold_utils/chunk_utils.py function _fetch_dims (line 25) | def _fetch_dims(tree: dict | list | tuple | torch.Tensor) -> list[tuple[... function _flat_idx_to_idx (line 42) | def _flat_idx_to_idx(flat_idx: int, dims: tuple[int, ...]) -> tuple[int,... function _get_minimal_slice_set (line 52) | def _get_minimal_slice_set( function _chunk_slice (line 167) | def _chunk_slice(t: torch.Tensor, flat_start: int, flat_end: int, no_bat... function chunk_layer (line 195) | def chunk_layer( class ChunkSizeTuner (line 315) | class ChunkSizeTuner: method __init__ (line 316) | def __init__( method _determine_favorable_chunk_size (line 326) | def _determine_favorable_chunk_size(self, fn: Callable, args: tuple, m... method _compare_arg_caches (line 357) | def _compare_arg_caches(self, ac1: Iterable, ac2: Iterable) -> bool: method tune_chunk_size (line 372) | def tune_chunk_size( FILE: src/transformers/models/esm/openfold_utils/data_transforms.py function make_atom14_masks (line 24) | def make_atom14_masks(protein: dict[str, torch.Tensor]) -> dict[str, tor... function make_atom14_masks_np (line 87) | def make_atom14_masks_np(batch: dict[str, torch.Tensor]) -> dict[str, np... FILE: src/transformers/models/esm/openfold_utils/feats.py function pseudo_beta_fn (line 28) | def pseudo_beta_fn(aatype: torch.Tensor, all_atom_positions: torch.Tenso... function pseudo_beta_fn (line 32) | def pseudo_beta_fn( function pseudo_beta_fn (line 37) | def pseudo_beta_fn(aatype, all_atom_positions, all_atom_masks): function atom14_to_atom37 (line 58) | def atom14_to_atom37(atom14: torch.Tensor, batch: dict[str, torch.Tensor... function build_template_angle_feat (line 71) | def build_template_angle_feat(template_feats: dict[str, torch.Tensor]) -... function build_template_pair_feat (line 89) | def build_template_pair_feat( function build_extra_msa_feat (line 150) | def build_extra_msa_feat(batch: dict[str, torch.Tensor]) -> torch.Tensor: function torsion_angles_to_frames (line 160) | def torsion_angles_to_frames( function frames_and_literature_positions_to_atom14_pos (line 222) | def frames_and_literature_positions_to_atom14_pos( FILE: src/transformers/models/esm/openfold_utils/loss.py function _calculate_bin_centers (line 20) | def _calculate_bin_centers(boundaries: torch.Tensor) -> torch.Tensor: function _calculate_expected_aligned_error (line 27) | def _calculate_expected_aligned_error( function compute_predicted_aligned_error (line 38) | def compute_predicted_aligned_error( function compute_tm (line 73) | def compute_tm( FILE: src/transformers/models/esm/openfold_utils/protein.py class Protein (line 35) | class Protein: function from_proteinnet_string (line 72) | def from_proteinnet_string(proteinnet_str: str) -> Protein: function get_pdb_headers (line 121) | def get_pdb_headers(prot: Protein, chain_id: int = 0) -> list[str]: function add_pdb_headers (line 141) | def add_pdb_headers(prot: Protein, pdb_str: str) -> str: function to_pdb (line 191) | def to_pdb(prot: Protein) -> str: function ideal_atom_mask (line 284) | def ideal_atom_mask(prot: Protein) -> np.ndarray: function from_prediction (line 299) | def from_prediction( FILE: src/transformers/models/esm/openfold_utils/residue_constants.py function map_structure_with_atom_order (line 387) | def map_structure_with_atom_order(in_list: list, first_call: bool = True... function load_stereo_chemical_props (line 402) | def load_stereo_chemical_props() -> tuple[ function sequence_to_onehot (line 602) | def sequence_to_onehot(sequence: str, mapping: Mapping[str, int], map_un... function _make_standard_atom_mask (line 748) | def _make_standard_atom_mask() -> np.ndarray: function chi_angle_atom (line 766) | def chi_angle_atom(atom_index: int) -> np.ndarray: function _make_rigid_transformation_4x4 (line 808) | def _make_rigid_transformation_4x4(ex: np.ndarray, ey: np.ndarray, trans... function _make_rigid_group_constants (line 837) | def _make_rigid_group_constants() -> None: function make_atom14_dists_bounds (line 911) | def make_atom14_dists_bounds( function _make_atom14_ambiguity_feats (line 963) | def _make_atom14_ambiguity_feats() -> None: function aatype_to_str_sequence (line 978) | def aatype_to_str_sequence(aatype: Sequence[int]) -> str: FILE: src/transformers/models/esm/openfold_utils/rigid_utils.py function rot_matmul (line 26) | def rot_matmul(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor: function rot_vec_mul (line 57) | def rot_vec_mul(r: torch.Tensor, t: torch.Tensor) -> torch.Tensor: function identity_rot_mats (line 79) | def identity_rot_mats( function identity_trans (line 94) | def identity_trans( function identity_quats (line 105) | def identity_quats( function _to_mat (line 124) | def _to_mat(pairs: list[tuple[str, int]]) -> np.ndarray: function quat_to_rot (line 145) | def quat_to_rot(quat: torch.Tensor) -> torch.Tensor: function rot_to_quat (line 168) | def rot_to_quat(rot: torch.Tensor) -> torch.Tensor: function _get_quat (line 224) | def _get_quat(quat_key: str, dtype: torch.dtype, device: torch.device) -... function quat_multiply (line 228) | def quat_multiply(quat1: torch.Tensor, quat2: torch.Tensor) -> torch.Ten... function quat_multiply_by_vec (line 235) | def quat_multiply_by_vec(quat: torch.Tensor, vec: torch.Tensor) -> torch... function invert_rot_mat (line 242) | def invert_rot_mat(rot_mat: torch.Tensor) -> torch.Tensor: function invert_quat (line 246) | def invert_quat(quat: torch.Tensor) -> torch.Tensor: class Rotation (line 253) | class Rotation: method __init__ (line 261) | def __init__( method identity (line 296) | def identity( method __getitem__ (line 336) | def __getitem__(self, index: Any) -> Rotation: method __mul__ (line 359) | def __mul__(self, right: torch.Tensor) -> Rotation: method __rmul__ (line 381) | def __rmul__(self, left: torch.Tensor) -> Rotation: method shape (line 396) | def shape(self) -> torch.Size: method dtype (line 413) | def dtype(self) -> torch.dtype: method device (line 428) | def device(self) -> torch.device: method requires_grad (line 443) | def requires_grad(self) -> bool: method get_rot_mats (line 457) | def get_rot_mats(self) -> torch.Tensor: method get_quats (line 471) | def get_quats(self) -> torch.Tensor: method get_cur_rot (line 487) | def get_cur_rot(self) -> torch.Tensor: method compose_q_update_vec (line 503) | def compose_q_update_vec(self, q_update_vec: torch.Tensor, normalize_q... method compose_r (line 525) | def compose_r(self, r: Rotation) -> Rotation: method compose_q (line 540) | def compose_q(self, r: Rotation, normalize_quats: bool = True) -> Rota... method apply (line 558) | def apply(self, pts: torch.Tensor) -> torch.Tensor: method invert_apply (line 571) | def invert_apply(self, pts: torch.Tensor) -> torch.Tensor: method invert (line 585) | def invert(self) -> Rotation: method unsqueeze (line 605) | def unsqueeze(self, dim: int) -> Rotation: method cat (line 627) | def cat(rs: Sequence[Rotation], dim: int) -> Rotation: method map_tensor_fn (line 649) | def map_tensor_fn(self, fn: Callable[[torch.Tensor], torch.Tensor]) ->... method cuda (line 671) | def cuda(self) -> Rotation: method to (line 685) | def to(self, device: torch.device | None, dtype: torch.dtype | None) -... method detach (line 711) | def detach(self) -> Rotation: class Rigid (line 730) | class Rigid: method __init__ (line 737) | def __init__(self, rots: Rotation | None, trans: torch.Tensor | None): method identity (line 787) | def identity( method __getitem__ (line 814) | def __getitem__(self, index: Any) -> Rigid: method __mul__ (line 839) | def __mul__(self, right: torch.Tensor) -> Rigid: method __rmul__ (line 857) | def __rmul__(self, left: torch.Tensor) -> Rigid: method shape (line 870) | def shape(self) -> torch.Size: method device (line 880) | def device(self) -> torch.device: method get_rots (line 889) | def get_rots(self) -> Rotation: method get_trans (line 898) | def get_trans(self) -> torch.Tensor: method compose_q_update_vec (line 907) | def compose_q_update_vec(self, q_update_vec: torch.Tensor) -> Rigid: method compose (line 925) | def compose(self, r: Rigid) -> Rigid: method apply (line 939) | def apply(self, pts: torch.Tensor) -> torch.Tensor: method invert_apply (line 951) | def invert_apply(self, pts: torch.Tensor) -> torch.Tensor: method invert (line 963) | def invert(self) -> Rigid: method map_tensor_fn (line 975) | def map_tensor_fn(self, fn: Callable[[torch.Tensor], torch.Tensor]) ->... method to_tensor_4x4 (line 991) | def to_tensor_4x4(self) -> torch.Tensor: method from_tensor_4x4 (line 1005) | def from_tensor_4x4(t: torch.Tensor) -> Rigid: method to_tensor_7 (line 1022) | def to_tensor_7(self) -> torch.Tensor: method from_tensor_7 (line 1037) | def from_tensor_7(t: torch.Tensor, normalize_quats: bool = False) -> R... method from_3_points (line 1048) | def from_3_points( method unsqueeze (line 1088) | def unsqueeze(self, dim: int) -> Rigid: method cat (line 1105) | def cat(ts: Sequence[Rigid], dim: int) -> Rigid: method apply_rot_fn (line 1122) | def apply_rot_fn(self, fn: Callable[[Rotation], Rotation]) -> Rigid: method apply_trans_fn (line 1133) | def apply_trans_fn(self, fn: Callable[[torch.Tensor], torch.Tensor]) -... method scale_translation (line 1145) | def scale_translation(self, trans_scale_factor: float) -> Rigid: method stop_rot_gradient (line 1157) | def stop_rot_gradient(self) -> Rigid: method make_transform_from_reference (line 1167) | def make_transform_from_reference( method cuda (line 1236) | def cuda(self) -> Rigid: FILE: src/transformers/models/esm/openfold_utils/tensor_utils.py function add (line 25) | def add(m1: torch.Tensor, m2: torch.Tensor, inplace: bool) -> torch.Tensor: function permute_final_dims (line 36) | def permute_final_dims(tensor: torch.Tensor, inds: list[int]) -> torch.T... function flatten_final_dims (line 42) | def flatten_final_dims(t: torch.Tensor, no_dims: int) -> torch.Tensor: function masked_mean (line 46) | def masked_mean(mask: torch.Tensor, value: torch.Tensor, dim: int, eps: ... function pts_to_distogram (line 51) | def pts_to_distogram( function dict_multimap (line 59) | def dict_multimap(fn: Callable[[list], Any], dicts: list[dict]) -> dict: function one_hot (line 72) | def one_hot(x: torch.Tensor, v_bins: torch.Tensor) -> torch.Tensor: function batched_gather (line 79) | def batched_gather(data: torch.Tensor, inds: torch.Tensor, dim: int = 0,... function dict_map (line 97) | def dict_map( function tree_map (line 111) | def tree_map(fn: Callable[[T], Any], tree: T, leaf_type: type[T]) -> Any... function tree_map (line 115) | def tree_map(fn: Callable[[T], Any], tree: dict, leaf_type: type[T]) -> ... function tree_map (line 119) | def tree_map(fn: Callable[[T], Any], tree: list, leaf_type: type[T]) -> ... function tree_map (line 123) | def tree_map(fn: Callable[[T], Any], tree: tuple, leaf_type: type[T]) ->... function tree_map (line 126) | def tree_map(fn, tree, leaf_type): FILE: src/transformers/models/esm/tokenization_esm.py function load_vocab_file (line 27) | def load_vocab_file(vocab_file): class EsmTokenizer (line 33) | class EsmTokenizer(PreTrainedTokenizer): method __init__ (line 41) | def __init__( method _convert_id_to_token (line 69) | def _convert_id_to_token(self, index: int) -> str: method _convert_token_to_id (line 72) | def _convert_token_to_id(self, token: str) -> int: method _tokenize (line 75) | def _tokenize(self, text, **kwargs): method get_vocab (line 78) | def get_vocab(self): method token_to_id (line 83) | def token_to_id(self, token: str) -> int: method id_to_token (line 86) | def id_to_token(self, index: int) -> str: method build_inputs_with_special_tokens (line 89) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 103) | def get_special_tokens_mask( method save_vocabulary (line 134) | def save_vocabulary(self, save_directory, filename_prefix): method vocab_size (line 141) | def vocab_size(self) -> int: FILE: src/transformers/models/eurobert/configuration_eurobert.py class EuroBertConfig (line 31) | class EuroBertConfig(LlamaConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): FILE: src/transformers/models/eurobert/modeling_eurobert.py class EuroBertRMSNorm (line 45) | class EuroBertRMSNorm(nn.Module): method __init__ (line 46) | def __init__(self, hidden_size, eps=1e-5) -> None: method forward (line 54) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 61) | def extra_repr(self): function rotate_half (line 65) | def rotate_half(x): function apply_rotary_pos_emb (line 73) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 98) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 110) | def eager_attention_forward( class EuroBertAttention (line 136) | class EuroBertAttention(nn.Module): method __init__ (line 139) | def __init__(self, config: EuroBertConfig, layer_idx: int): method forward (line 162) | def forward( class EuroBertMLP (line 203) | class EuroBertMLP(nn.Module): method __init__ (line 204) | def __init__(self, config): method forward (line 214) | def forward(self, x): class EuroBertDecoderLayer (line 219) | class EuroBertDecoderLayer(GradientCheckpointingLayer): method __init__ (line 220) | def __init__(self, config: EuroBertConfig, layer_idx: int): method forward (line 230) | def forward( class EuroBertPreTrainedModel (line 263) | class EuroBertPreTrainedModel(PreTrainedModel): class EuroBertRotaryEmbedding (line 281) | class EuroBertRotaryEmbedding(nn.Module): method __init__ (line 284) | def __init__(self, config: EuroBertConfig, device=None): method compute_default_rope_parameters (line 301) | def compute_default_rope_parameters( method forward (line 332) | def forward(self, x, position_ids): class EuroBertModel (line 347) | class EuroBertModel(EuroBertPreTrainedModel): method __init__ (line 348) | def __init__(self, config: EuroBertConfig): method forward (line 367) | def forward( class EuroBertForMaskedLM (line 409) | class EuroBertForMaskedLM(EuroBertPreTrainedModel): method __init__ (line 414) | def __init__(self, config: EuroBertConfig): method forward (line 424) | def forward( class EuroBertForSequenceClassification (line 475) | class EuroBertForSequenceClassification(EuroBertPreTrainedModel): method __init__ (line 476) | def __init__(self, config: EuroBertConfig): method forward (line 489) | def forward( class EuroBertForTokenClassification (line 567) | class EuroBertForTokenClassification(EuroBertPreTrainedModel): method __init__ (line 568) | def __init__(self, config: EuroBertConfig): method get_input_embeddings (line 576) | def get_input_embeddings(self): method set_input_embeddings (line 579) | def set_input_embeddings(self, value): method forward (line 584) | def forward( FILE: src/transformers/models/eurobert/modular_eurobert.py class EuroBertConfig (line 33) | class EuroBertConfig(LlamaConfig): method __post_init__ (line 78) | def __post_init__(self, **kwargs): class EuroBertRMSNorm (line 84) | class EuroBertRMSNorm(LlamaRMSNorm): method __init__ (line 85) | def __init__(self, hidden_size, eps=1e-5): class EuroBertAttention (line 89) | class EuroBertAttention(LlamaAttention): method __init__ (line 90) | def __init__(self, config: EuroBertConfig, layer_idx: int): class EuroBertPreTrainedModel (line 95) | class EuroBertPreTrainedModel(LlamaPreTrainedModel): class EuroBertModel (line 99) | class EuroBertModel(LlamaModel): method forward (line 100) | def forward( class EuroBertForMaskedLM (line 142) | class EuroBertForMaskedLM(EuroBertPreTrainedModel): method __init__ (line 147) | def __init__(self, config: EuroBertConfig): method forward (line 157) | def forward( class EuroBertForSequenceClassification (line 208) | class EuroBertForSequenceClassification(EuroBertPreTrainedModel): method __init__ (line 209) | def __init__(self, config: EuroBertConfig): method forward (line 222) | def forward( class EuroBertForTokenClassification (line 300) | class EuroBertForTokenClassification(EuroBertPreTrainedModel): method __init__ (line 301) | def __init__(self, config: EuroBertConfig): method get_input_embeddings (line 309) | def get_input_embeddings(self): method set_input_embeddings (line 312) | def set_input_embeddings(self, value): method forward (line 317) | def forward( FILE: src/transformers/models/evolla/configuration_evolla.py class SaProtConfig (line 28) | class SaProtConfig(PreTrainedConfig): class EvollaConfig (line 61) | class EvollaConfig(PreTrainedConfig): method __post_init__ (line 135) | def __post_init__(self, **kwargs): FILE: src/transformers/models/evolla/modeling_evolla.py function create_position_ids_from_input_ids (line 52) | def create_position_ids_from_input_ids(input_ids, padding_idx): class EvollaSaProtEmbeddings (line 68) | class EvollaSaProtEmbeddings(nn.Module): method __init__ (line 73) | def __init__(self, config): method forward (line 98) | def forward( method create_position_ids_from_inputs_embeds (line 147) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): function rotate_half_esm (line 165) | def rotate_half_esm(x): function apply_rotary_pos_emb_esm (line 170) | def apply_rotary_pos_emb_esm(x, cos, sin): class EvollaSaProtRotaryEmbedding (line 177) | class EvollaSaProtRotaryEmbedding(nn.Module): method __init__ (line 186) | def __init__(self, dim: int): method _update_cos_sin_tables (line 197) | def _update_cos_sin_tables(self, x, seq_dimension=2): method forward (line 213) | def forward(self, q: torch.Tensor, k: torch.Tensor) -> tuple[torch.Ten... function eager_attention_forward (line 222) | def eager_attention_forward( class EvollaSaProtSelfAttention (line 250) | class EvollaSaProtSelfAttention(nn.Module): method __init__ (line 251) | def __init__(self, config, position_embedding_type=None, layer_idx=Non... method forward (line 283) | def forward( class EvollaSaProtSelfOutput (line 330) | class EvollaSaProtSelfOutput(nn.Module): method __init__ (line 331) | def __init__(self, config): method forward (line 336) | def forward(self, hidden_states, input_tensor): class EvollaSaProtAttention (line 343) | class EvollaSaProtAttention(nn.Module): method __init__ (line 344) | def __init__(self, config, layer_idx=None, is_cross_attention=False): method forward (line 351) | def forward( function gelu (line 371) | def gelu(x): class EvollaSaProtIntermediate (line 378) | class EvollaSaProtIntermediate(nn.Module): method __init__ (line 379) | def __init__(self, config): method forward (line 383) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EvollaSaProtOutput (line 389) | class EvollaSaProtOutput(nn.Module): method __init__ (line 390) | def __init__(self, config): method forward (line 395) | def forward(self, hidden_states, input_tensor): class EvollaSaProtLayer (line 402) | class EvollaSaProtLayer(GradientCheckpointingLayer): method __init__ (line 403) | def __init__(self, config): method forward (line 418) | def forward( method feed_forward_chunk (line 450) | def feed_forward_chunk(self, attention_output): class EvollaSaProtEncoder (line 457) | class EvollaSaProtEncoder(nn.Module): method __init__ (line 458) | def __init__(self, config): method forward (line 466) | def forward( class EvollaSaProtPooler (line 489) | class EvollaSaProtPooler(nn.Module): method __init__ (line 490) | def __init__(self, config): method forward (line 495) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EvollaSaProtPreTrainedModel (line 505) | class EvollaSaProtPreTrainedModel(PreTrainedModel): method _init_weights (line 521) | def _init_weights(self, module): class EvollaSaProtProteinEncoder (line 528) | class EvollaSaProtProteinEncoder(EvollaSaProtPreTrainedModel): method __init__ (line 529) | def __init__(self, config: SaProtConfig): method get_input_embeddings (line 535) | def get_input_embeddings(self): method set_input_embeddings (line 538) | def set_input_embeddings(self, value): method forward (line 543) | def forward( class EvollaSequenceCompressorAttention (line 574) | class EvollaSequenceCompressorAttention(nn.Module): method __init__ (line 575) | def __init__(self, dim, dim_head=64, heads=8): method forward (line 588) | def forward(self, x, latents, mask): class EvollaFeedForward (line 632) | class EvollaFeedForward(nn.Module): method __init__ (line 633) | def __init__(self, dim, mult=4): method forward (line 642) | def forward(self, x): class EvollaSequenceCompressorResampler (line 646) | class EvollaSequenceCompressorResampler(nn.Module): method __init__ (line 647) | def __init__(self, config: EvollaConfig): method forward (line 668) | def forward(self, embeds, mask): class EvollaProteinEncoderModelOutput (line 690) | class EvollaProteinEncoderModelOutput(ModelOutput): class EvollaProteinEncoder (line 697) | class EvollaProteinEncoder(nn.Module): method __init__ (line 698) | def __init__(self, config: EvollaConfig): method forward (line 704) | def forward(self, input_ids: torch.LongTensor, attention_mask: torch.F... class EvollaSequenceAlignerCrossAttention (line 715) | class EvollaSequenceAlignerCrossAttention(nn.Module): method __init__ (line 716) | def __init__( method cross_attention (line 767) | def cross_attention( method forward (line 879) | def forward( class EvollaRMSNorm (line 954) | class EvollaRMSNorm(nn.Module): method __init__ (line 955) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 963) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 970) | def extra_repr(self): class EvollaRotaryEmbedding (line 974) | class EvollaRotaryEmbedding(nn.Module): method __init__ (line 977) | def __init__(self, config: EvollaConfig, device=None): method compute_default_rope_parameters (line 994) | def compute_default_rope_parameters( method forward (line 1025) | def forward(self, x, position_ids): class EvollaMLP (line 1039) | class EvollaMLP(nn.Module): method __init__ (line 1040) | def __init__(self, config): method forward (line 1050) | def forward(self, x): function rotate_half (line 1055) | def rotate_half(x): function apply_rotary_pos_emb (line 1063) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 1088) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class EvollaAttention (line 1101) | class EvollaAttention(nn.Module): method __init__ (line 1104) | def __init__(self, config: EvollaConfig, layer_idx: int): method forward (line 1127) | def forward( class EvollaDecoderLayer (line 1168) | class EvollaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1169) | def __init__(self, config: EvollaConfig, layer_idx: int): method forward (line 1184) | def forward( class EvollaPreTrainedModel (line 1239) | class EvollaPreTrainedModel(PreTrainedModel): method _init_weights (line 1261) | def _init_weights(self, module): class EvollaModel (line 1272) | class EvollaModel(EvollaPreTrainedModel): method __init__ (line 1273) | def __init__(self, config: EvollaConfig): method get_input_embeddings (line 1294) | def get_input_embeddings(self): method set_input_embeddings (line 1297) | def set_input_embeddings(self, value): method forward (line 1303) | def forward( class EvollaForProteinText2Text (line 1399) | class EvollaForProteinText2Text(EvollaPreTrainedModel, GenerationMixin): method __init__ (line 1400) | def __init__(self, config): method get_input_embeddings (line 1408) | def get_input_embeddings(self): method set_input_embeddings (line 1411) | def set_input_embeddings(self, value): method forward (line 1416) | def forward( FILE: src/transformers/models/evolla/modular_evolla.py class EvollaSaProtEmbeddings (line 63) | class EvollaSaProtEmbeddings(EsmEmbeddings): method __init__ (line 64) | def __init__(self, config): function rotate_half_esm (line 70) | def rotate_half_esm(x): function apply_rotary_pos_emb_esm (line 75) | def apply_rotary_pos_emb_esm(x, cos, sin): class EvollaSaProtRotaryEmbedding (line 82) | class EvollaSaProtRotaryEmbedding(nn.Module): method __init__ (line 91) | def __init__(self, dim: int): method _update_cos_sin_tables (line 102) | def _update_cos_sin_tables(self, x, seq_dimension=2): method forward (line 118) | def forward(self, q: torch.Tensor, k: torch.Tensor) -> tuple[torch.Ten... class EvollaSaProtSelfAttention (line 127) | class EvollaSaProtSelfAttention(EsmSelfAttention): method __init__ (line 128) | def __init__(self, config, position_embedding_type=None, layer_idx=Non... class EvollaSaProtSelfOutput (line 161) | class EvollaSaProtSelfOutput(EsmSelfOutput): class EvollaSaProtAttention (line 165) | class EvollaSaProtAttention(EsmAttention): class EvollaSaProtIntermediate (line 169) | class EvollaSaProtIntermediate(EsmIntermediate): class EvollaSaProtOutput (line 173) | class EvollaSaProtOutput(EsmOutput): class EvollaSaProtLayer (line 177) | class EvollaSaProtLayer(EsmLayer): class EvollaSaProtEncoder (line 181) | class EvollaSaProtEncoder(EsmEncoder): class EvollaSaProtPooler (line 185) | class EvollaSaProtPooler(EsmPooler): class EvollaSaProtPreTrainedModel (line 190) | class EvollaSaProtPreTrainedModel(PreTrainedModel): method _init_weights (line 206) | def _init_weights(self, module): class EvollaSaProtProteinEncoder (line 213) | class EvollaSaProtProteinEncoder(EvollaSaProtPreTrainedModel): method __init__ (line 214) | def __init__(self, config: SaProtConfig): method get_input_embeddings (line 220) | def get_input_embeddings(self): method set_input_embeddings (line 223) | def set_input_embeddings(self, value): method forward (line 228) | def forward( class EvollaSequenceCompressorAttention (line 259) | class EvollaSequenceCompressorAttention(nn.Module): method __init__ (line 260) | def __init__(self, dim, dim_head=64, heads=8): method forward (line 273) | def forward(self, x, latents, mask): class EvollaFeedForward (line 317) | class EvollaFeedForward(nn.Module): method __init__ (line 318) | def __init__(self, dim, mult=4): method forward (line 327) | def forward(self, x): class EvollaSequenceCompressorResampler (line 331) | class EvollaSequenceCompressorResampler(nn.Module): method __init__ (line 332) | def __init__(self, config: EvollaConfig): method forward (line 353) | def forward(self, embeds, mask): class EvollaProteinEncoderModelOutput (line 375) | class EvollaProteinEncoderModelOutput(ModelOutput): class EvollaProteinEncoder (line 382) | class EvollaProteinEncoder(nn.Module): method __init__ (line 383) | def __init__(self, config: EvollaConfig): method forward (line 389) | def forward(self, input_ids: torch.LongTensor, attention_mask: torch.F... class EvollaSequenceAlignerCrossAttention (line 400) | class EvollaSequenceAlignerCrossAttention(nn.Module): method __init__ (line 401) | def __init__( method cross_attention (line 452) | def cross_attention( method forward (line 564) | def forward( class EvollaRMSNorm (line 638) | class EvollaRMSNorm(LlamaRMSNorm): class EvollaRotaryEmbedding (line 642) | class EvollaRotaryEmbedding(LlamaRotaryEmbedding): class EvollaMLP (line 646) | class EvollaMLP(LlamaMLP): class EvollaAttention (line 650) | class EvollaAttention(LlamaAttention): class EvollaDecoderLayer (line 654) | class EvollaDecoderLayer(LlamaDecoderLayer): method __init__ (line 655) | def __init__(self, config: EvollaConfig, layer_idx: int): method forward (line 663) | def forward( class EvollaPreTrainedModel (line 717) | class EvollaPreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 728) | def _init_weights(self, module): class EvollaModel (line 739) | class EvollaModel(EvollaPreTrainedModel): method __init__ (line 740) | def __init__(self, config: EvollaConfig): method get_input_embeddings (line 761) | def get_input_embeddings(self): method set_input_embeddings (line 764) | def set_input_embeddings(self, value): method forward (line 770) | def forward( class EvollaForProteinText2Text (line 866) | class EvollaForProteinText2Text(EvollaPreTrainedModel, GenerationMixin): method __init__ (line 867) | def __init__(self, config): method get_input_embeddings (line 875) | def get_input_embeddings(self): method set_input_embeddings (line 878) | def set_input_embeddings(self, value): method forward (line 883) | def forward( FILE: src/transformers/models/evolla/processing_evolla.py class EvollaProcessor (line 29) | class EvollaProcessor(ProcessorMixin): method __init__ (line 30) | def __init__(self, protein_tokenizer, tokenizer=None, protein_max_leng... method process_proteins (line 50) | def process_proteins(self, proteins, protein_max_length=1024): method process_text (line 63) | def process_text( method __call__ (line 88) | def __call__( method batch_decode (line 174) | def batch_decode(self, *args, **kwargs): method decode (line 177) | def decode(self, *args, **kwargs): method protein_batch_decode (line 180) | def protein_batch_decode(self, *args, **kwargs): method protein_decode (line 183) | def protein_decode(self, *args, **kwargs): FILE: src/transformers/models/exaone4/configuration_exaone4.py class Exaone4Config (line 30) | class Exaone4Config(PreTrainedConfig): method __post_init__ (line 100) | def __post_init__(self, **kwargs): FILE: src/transformers/models/exaone4/modeling_exaone4.py class Exaone4RMSNorm (line 50) | class Exaone4RMSNorm(nn.Module): method __init__ (line 51) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 59) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self): class Exaone4RotaryEmbedding (line 70) | class Exaone4RotaryEmbedding(nn.Module): method __init__ (line 73) | def __init__(self, config: Exaone4Config, device=None): method compute_default_rope_parameters (line 90) | def compute_default_rope_parameters( method forward (line 121) | def forward(self, x, position_ids): function rotate_half (line 135) | def rotate_half(x): function apply_rotary_pos_emb (line 143) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 168) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 180) | def eager_attention_forward( class Exaone4Attention (line 205) | class Exaone4Attention(nn.Module): method __init__ (line 206) | def __init__(self, config: Exaone4Config, layer_idx: int): method forward (line 231) | def forward( class Exaone4MLP (line 279) | class Exaone4MLP(nn.Module): method __init__ (line 280) | def __init__(self, config): method forward (line 290) | def forward(self, x): class Exaone4DecoderLayer (line 295) | class Exaone4DecoderLayer(GradientCheckpointingLayer): method __init__ (line 296) | def __init__(self, config: Exaone4Config, layer_idx: int): method forward (line 305) | def forward( class Exaone4PreTrainedModel (line 337) | class Exaone4PreTrainedModel(PreTrainedModel): class Exaone4Model (line 357) | class Exaone4Model(Exaone4PreTrainedModel): method __init__ (line 358) | def __init__(self, config: Exaone4Config): method forward (line 376) | def forward( class Exaone4ForCausalLM (line 441) | class Exaone4ForCausalLM(Exaone4PreTrainedModel, GenerationMixin): method __init__ (line 446) | def __init__(self, config): method forward (line 457) | def forward( class Exaone4ForSequenceClassification (line 528) | class Exaone4ForSequenceClassification(GenericForSequenceClassification,... class Exaone4ForTokenClassification (line 532) | class Exaone4ForTokenClassification(GenericForTokenClassification, Exaon... class Exaone4ForQuestionAnswering (line 536) | class Exaone4ForQuestionAnswering(GenericForQuestionAnswering, Exaone4Pr... FILE: src/transformers/models/exaone4/modular_exaone4.py class Exaone4Config (line 59) | class Exaone4Config(PreTrainedConfig): method __post_init__ (line 129) | def __post_init__(self, **kwargs): class Exaone4RMSNorm (line 143) | class Exaone4RMSNorm(LlamaRMSNorm): class Exaone4RotaryEmbedding (line 147) | class Exaone4RotaryEmbedding(Gemma2RotaryEmbedding): class Exaone4Attention (line 151) | class Exaone4Attention(nn.Module): method __init__ (line 152) | def __init__(self, config: Exaone4Config, layer_idx: int): method forward (line 177) | def forward( class Exaone4MLP (line 225) | class Exaone4MLP(Olmo2MLP): class Exaone4DecoderLayer (line 229) | class Exaone4DecoderLayer(Olmo2DecoderLayer): class Exaone4PreTrainedModel (line 233) | class Exaone4PreTrainedModel(LlamaPreTrainedModel): class Exaone4Model (line 238) | class Exaone4Model(Exaone4PreTrainedModel, LlamaModel): method __init__ (line 239) | def __init__(self, config: Exaone4Config): method forward (line 251) | def forward( class Exaone4ForCausalLM (line 315) | class Exaone4ForCausalLM(LlamaForCausalLM): method forward (line 316) | def forward( class Exaone4ForSequenceClassification (line 372) | class Exaone4ForSequenceClassification(LlamaForSequenceClassification): class Exaone4ForTokenClassification (line 376) | class Exaone4ForTokenClassification(LlamaForTokenClassification): class Exaone4ForQuestionAnswering (line 380) | class Exaone4ForQuestionAnswering(LlamaForQuestionAnswering): FILE: src/transformers/models/exaone_moe/configuration_exaone_moe.py class ExaoneMoeConfig (line 29) | class ExaoneMoeConfig(PreTrainedConfig): method __post_init__ (line 116) | def __post_init__(self, **kwargs): FILE: src/transformers/models/exaone_moe/modeling_exaone_moe.py class ExaoneMoeRMSNorm (line 47) | class ExaoneMoeRMSNorm(nn.Module): method __init__ (line 48) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 56) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 63) | def extra_repr(self): function rotate_half (line 67) | def rotate_half(x): function apply_rotary_pos_emb (line 75) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 100) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 112) | def eager_attention_forward( class ExaoneMoeAttention (line 137) | class ExaoneMoeAttention(nn.Module): method __init__ (line 138) | def __init__(self, config: ExaoneMoeConfig, layer_idx: int): method forward (line 163) | def forward( class ExaoneMoeMLP (line 211) | class ExaoneMoeMLP(nn.Module): method __init__ (line 212) | def __init__(self, config, intermediate_size=None): method forward (line 222) | def forward(self, x): class ExaoneMoeTopkRouter (line 227) | class ExaoneMoeTopkRouter(nn.Module): method __init__ (line 228) | def __init__(self, config): method forward (line 234) | def forward(self, hidden_states): class ExaoneMoeExperts (line 241) | class ExaoneMoeExperts(nn.Module): method __init__ (line 244) | def __init__(self, config): method forward (line 253) | def forward( class ExaoneMoeSparseMoEBlock (line 280) | class ExaoneMoeSparseMoEBlock(nn.Module): method __init__ (line 285) | def __init__(self, config): method route_tokens_to_experts (line 300) | def route_tokens_to_experts(self, router_logits): method forward (line 325) | def forward(self, hidden_states): class ExaoneMoeDecoderLayer (line 336) | class ExaoneMoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 337) | def __init__(self, config: ExaoneMoeConfig, layer_idx: int): method forward (line 347) | def forward( class ExaoneMoePreTrainedModel (line 380) | class ExaoneMoePreTrainedModel(PreTrainedModel): method _init_weights (line 404) | def _init_weights(self, module): class ExaoneMoeRotaryEmbedding (line 414) | class ExaoneMoeRotaryEmbedding(nn.Module): method __init__ (line 417) | def __init__(self, config: ExaoneMoeConfig, device=None): method compute_default_rope_parameters (line 434) | def compute_default_rope_parameters( method forward (line 465) | def forward(self, x, position_ids): class ExaoneMoeModel (line 480) | class ExaoneMoeModel(ExaoneMoePreTrainedModel): method __init__ (line 481) | def __init__(self, config: ExaoneMoeConfig): method forward (line 499) | def forward( class ExaoneMoeForCausalLM (line 564) | class ExaoneMoeForCausalLM(ExaoneMoePreTrainedModel, GenerationMixin): method __init__ (line 569) | def __init__(self, config): method forward (line 580) | def forward( FILE: src/transformers/models/exaone_moe/modular_exaone_moe.py class ExaoneMoeConfig (line 47) | class ExaoneMoeConfig(Exaone4Config): method __post_init__ (line 114) | def __post_init__(self, **kwargs): class ExaoneMoeAttention (line 123) | class ExaoneMoeAttention(Exaone4Attention): class ExaoneMoeMLP (line 127) | class ExaoneMoeMLP(Qwen2MoeMLP): class ExaoneMoeTopkRouter (line 131) | class ExaoneMoeTopkRouter(DeepseekV3TopkRouter): method __init__ (line 132) | def __init__(self, config): class ExaoneMoeExperts (line 139) | class ExaoneMoeExperts(DeepseekV3NaiveMoe): method __init__ (line 140) | def __init__(self, config): class ExaoneMoeSparseMoEBlock (line 145) | class ExaoneMoeSparseMoEBlock(DeepseekV3MoE): method __init__ (line 146) | def __init__(self, config): class ExaoneMoeDecoderLayer (line 155) | class ExaoneMoeDecoderLayer(OlmoeDecoderLayer): method __init__ (line 156) | def __init__(self, config: ExaoneMoeConfig, layer_idx: int): class ExaoneMoePreTrainedModel (line 163) | class ExaoneMoePreTrainedModel(Exaone4PreTrainedModel): method _init_weights (line 176) | def _init_weights(self, module): class ExaoneMoeModel (line 186) | class ExaoneMoeModel(Exaone4Model): class ExaoneMoeForCausalLM (line 190) | class ExaoneMoeForCausalLM(Exaone4ForCausalLM): method forward (line 191) | def forward( FILE: src/transformers/models/falcon/configuration_falcon.py class FalconConfig (line 25) | class FalconConfig(PreTrainedConfig): method __post_init__ (line 91) | def __post_init__(self, **kwargs): method head_dim (line 102) | def head_dim(self): method rotary (line 106) | def rotary(self): FILE: src/transformers/models/falcon/modeling_falcon.py class FalconLinear (line 60) | class FalconLinear(nn.Linear): method forward (line 61) | def forward(self, input: torch.Tensor) -> torch.Tensor: function rotate_half (line 69) | def rotate_half(x): function apply_rotary_pos_emb (line 77) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class FalconRotaryEmbedding (line 103) | class FalconRotaryEmbedding(nn.Module): method __init__ (line 106) | def __init__(self, config: FalconConfig, device=None): method compute_default_rope_parameters (line 123) | def compute_default_rope_parameters( method forward (line 154) | def forward(self, x, position_ids): function build_alibi_tensor (line 168) | def build_alibi_tensor(attention_mask: torch.Tensor, num_heads: int, dty... function dropout_add (line 197) | def dropout_add(x: torch.Tensor, residual: torch.Tensor, prob: float, tr... class FalconAttention (line 216) | class FalconAttention(nn.Module): method __init__ (line 217) | def __init__(self, config: FalconConfig, layer_idx=None): method _split_heads (line 259) | def _split_heads(self, fused_qkv: torch.Tensor) -> tuple[torch.Tensor,... method _merge_heads (line 291) | def _merge_heads(self, x: torch.Tensor) -> torch.Tensor: method forward (line 316) | def forward( class FalconFlashAttention2 (line 430) | class FalconFlashAttention2(FalconAttention): method __init__ (line 437) | def __init__(self, *args, **kwargs): method forward (line 445) | def forward( class FalconMLP (line 531) | class FalconMLP(nn.Module): method __init__ (line 532) | def __init__(self, config: FalconConfig): method forward (line 541) | def forward(self, x: torch.Tensor) -> torch.Tensor: class FalconDecoderLayer (line 554) | class FalconDecoderLayer(GradientCheckpointingLayer): method __init__ (line 555) | def __init__(self, config: FalconConfig, layer_idx=None): method forward (line 580) | def forward( class FalconPreTrainedModel (line 640) | class FalconPreTrainedModel(PreTrainedModel): method _init_weights (line 650) | def _init_weights(self, module: nn.Module): method _check_and_enable_sdpa (line 660) | def _check_and_enable_sdpa(cls, config, hard_check_only: bool = False): class FalconModel (line 671) | class FalconModel(FalconPreTrainedModel): method __init__ (line 672) | def __init__(self, config: FalconConfig): method get_input_embeddings (line 693) | def get_input_embeddings(self): method set_input_embeddings (line 696) | def set_input_embeddings(self, new_embeddings: torch.Tensor): method forward (line 700) | def forward( class FalconForCausalLM (line 842) | class FalconForCausalLM(FalconPreTrainedModel, GenerationMixin): method __init__ (line 845) | def __init__(self, config: FalconConfig): method set_output_embeddings (line 853) | def set_output_embeddings(self, new_embeddings: torch.Tensor): method forward (line 857) | def forward( class FalconForSequenceClassification (line 944) | class FalconForSequenceClassification(FalconPreTrainedModel): method __init__ (line 945) | def __init__(self, config: FalconConfig): method forward (line 955) | def forward( class FalconForTokenClassification (line 1061) | class FalconForTokenClassification(FalconPreTrainedModel): method __init__ (line 1062) | def __init__(self, config: FalconConfig): method forward (line 1080) | def forward( class FalconForQuestionAnswering (line 1149) | class FalconForQuestionAnswering(FalconPreTrainedModel): method __init__ (line 1150) | def __init__(self, config): method forward (line 1159) | def forward( FILE: src/transformers/models/falcon_h1/configuration_falcon_h1.py class FalconH1Config (line 25) | class FalconH1Config(PreTrainedConfig): method __post_init__ (line 106) | def __post_init__(self, **kwargs): method validate_architecture (line 124) | def validate_architecture(self): method layers_block_type (line 135) | def layers_block_type(self): FILE: src/transformers/models/falcon_h1/convert_mamba_ssm_checkpoint.py function convert_falcon_h1_to_hf (line 40) | def convert_falcon_h1_to_hf(input_model_path, output_path): FILE: src/transformers/models/falcon_h1/modeling_falcon_h1.py class FalconH1RotaryEmbedding (line 56) | class FalconH1RotaryEmbedding(nn.Module): method __init__ (line 59) | def __init__(self, config: FalconH1Config, device=None): method compute_default_rope_parameters (line 76) | def compute_default_rope_parameters( method forward (line 107) | def forward(self, x, position_ids): function rotate_half (line 121) | def rotate_half(x): function apply_rotary_pos_emb (line 129) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 154) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 166) | def eager_attention_forward( class FalconH1Attention (line 192) | class FalconH1Attention(nn.Module): method __init__ (line 195) | def __init__(self, config: FalconH1Config, layer_idx: int): method forward (line 219) | def forward( class FalconH1RMSNormGated (line 260) | class FalconH1RMSNormGated(torch.nn.Module): method __init__ (line 261) | def __init__(self, hidden_size, eps=1e-6, n_groups=1, norm_before_gate... method forward (line 268) | def forward(self, hidden_states, gate=None): function pad_tensor_by_size (line 300) | def pad_tensor_by_size(input_tensor: torch.Tensor, pad_size: int): function reshape_into_chunks (line 311) | def reshape_into_chunks(input_tensor, pad_size, chunk_size): function segment_sum (line 331) | def segment_sum(input_tensor): function apply_mask_to_padding_states (line 351) | def apply_mask_to_padding_states(hidden_states, attention_mask): class FalconH1Mixer (line 364) | class FalconH1Mixer(nn.Module): method __init__ (line 371) | def __init__(self, config: FalconH1Config, layer_idx: int): method cuda_kernels_forward (line 477) | def cuda_kernels_forward( method torch_forward (line 663) | def torch_forward( method forward (line 860) | def forward( class FalconH1MLP (line 877) | class FalconH1MLP(nn.Module): method __init__ (line 878) | def __init__(self, config: FalconH1Config): method forward (line 889) | def forward(self, x): class FalconH1RMSNorm (line 896) | class FalconH1RMSNorm(nn.Module): method __init__ (line 897) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 905) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 912) | def extra_repr(self): class FalconH1DecoderLayer (line 916) | class FalconH1DecoderLayer(GradientCheckpointingLayer): method __init__ (line 917) | def __init__(self, config: FalconH1Config, layer_idx: int): method forward (line 935) | def forward( function compute_mup_vector (line 998) | def compute_mup_vector(config): class FalconH1PreTrainedModel (line 1036) | class FalconH1PreTrainedModel(PreTrainedModel): method _init_weights (line 1052) | def _init_weights(self, module): class FalconH1Model (line 1066) | class FalconH1Model(FalconH1PreTrainedModel): method __init__ (line 1067) | def __init__(self, config: FalconH1Config): method forward (line 1097) | def forward( method _update_mamba_mask (line 1152) | def _update_mamba_mask(self, attention_mask, past_key_values): class FalconH1ForCausalLM (line 1167) | class FalconH1ForCausalLM(FalconH1PreTrainedModel, GenerationMixin): method __init__ (line 1172) | def __init__(self, config): method forward (line 1183) | def forward( method prepare_inputs_for_generation (line 1239) | def prepare_inputs_for_generation( FILE: src/transformers/models/falcon_h1/modular_falcon_h1.py class FalconH1RotaryEmbedding (line 63) | class FalconH1RotaryEmbedding(LlamaRotaryEmbedding): class FalconH1Attention (line 67) | class FalconH1Attention(LlamaAttention): method __init__ (line 68) | def __init__(self, config: FalconH1Config, layer_idx: int): method forward (line 72) | def forward( class FalconH1RMSNormGated (line 113) | class FalconH1RMSNormGated(MambaRMSNormGated): method __init__ (line 114) | def __init__(self, hidden_size, eps=1e-6, n_groups=1, norm_before_gate... method forward (line 121) | def forward(self, hidden_states, gate=None): class FalconH1Mixer (line 151) | class FalconH1Mixer(nn.Module): method __init__ (line 158) | def __init__(self, config: FalconH1Config, layer_idx: int): method cuda_kernels_forward (line 264) | def cuda_kernels_forward( method torch_forward (line 450) | def torch_forward( method forward (line 647) | def forward( class FalconH1MLP (line 664) | class FalconH1MLP(LlamaMLP): method __init__ (line 665) | def __init__(self, config: FalconH1Config): method forward (line 669) | def forward(self, x): class FalconH1RMSNorm (line 675) | class FalconH1RMSNorm(LlamaRMSNorm): class FalconH1DecoderLayer (line 679) | class FalconH1DecoderLayer(GradientCheckpointingLayer): method __init__ (line 680) | def __init__(self, config: FalconH1Config, layer_idx: int): method forward (line 698) | def forward( class FalconH1PreTrainedModel (line 762) | class FalconH1PreTrainedModel(PreTrainedModel): method _init_weights (line 778) | def _init_weights(self, module): function compute_mup_vector (line 790) | def compute_mup_vector(config): class FalconH1Model (line 829) | class FalconH1Model(FalconH1PreTrainedModel): method __init__ (line 830) | def __init__(self, config: FalconH1Config): method forward (line 860) | def forward( method _update_mamba_mask (line 915) | def _update_mamba_mask(self, attention_mask, past_key_values): class FalconH1ForCausalLM (line 929) | class FalconH1ForCausalLM(LlamaForCausalLM): method forward (line 932) | def forward( method prepare_inputs_for_generation (line 988) | def prepare_inputs_for_generation( FILE: src/transformers/models/falcon_mamba/configuration_falcon_mamba.py class FalconMambaConfig (line 30) | class FalconMambaConfig(PreTrainedConfig): method __post_init__ (line 101) | def __post_init__(self, **kwargs): method layer_types (line 109) | def layer_types(self): FILE: src/transformers/models/falcon_mamba/modeling_falcon_mamba.py function rms_forward (line 60) | def rms_forward(hidden_states, variance_epsilon=1e-6): class FalconMambaMixer (line 79) | class FalconMambaMixer(nn.Module): method __init__ (line 87) | def __init__(self, config: FalconMambaConfig, layer_idx: int, initiali... method init_falcon_mamba_weights (line 153) | def init_falcon_mamba_weights(self): method warn_slow_implementation (line 176) | def warn_slow_implementation(self): method cuda_kernels_forward (line 199) | def cuda_kernels_forward( method slow_forward (line 315) | def slow_forward(self, method forward (line 439) | def forward( class FalconMambaRMSNorm (line 454) | class FalconMambaRMSNorm(nn.Module): method __init__ (line 455) | def __init__(self, hidden_size, eps=1e-6): method forward (line 463) | def forward(self, hidden_states): method extra_repr (line 468) | def extra_repr(self): class FalconMambaBlock (line 472) | class FalconMambaBlock(GradientCheckpointingLayer): method __init__ (line 473) | def __init__(self, config, layer_idx): method forward (line 481) | def forward( class FalconMambaPreTrainedModel (line 499) | class FalconMambaPreTrainedModel(PreTrainedModel): method _init_weights (line 507) | def _init_weights(self, module): class FalconMambaOutput (line 550) | class FalconMambaOutput(ModelOutput): class FalconMambaCausalLMOutput (line 570) | class FalconMambaCausalLMOutput(ModelOutput): class FalconMambaModel (line 590) | class FalconMambaModel(FalconMambaPreTrainedModel): method __init__ (line 591) | def __init__(self, config): method get_input_embeddings (line 604) | def get_input_embeddings(self): method set_input_embeddings (line 607) | def set_input_embeddings(self, new_embeddings): method forward (line 611) | def forward( class FalconMambaForCausalLM (line 680) | class FalconMambaForCausalLM(FalconMambaPreTrainedModel, GenerationMixin): method __init__ (line 683) | def __init__(self, config): method get_input_embeddings (line 690) | def get_input_embeddings(self): method set_input_embeddings (line 693) | def set_input_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 696) | def prepare_inputs_for_generation( method forward (line 722) | def forward( FILE: src/transformers/models/falcon_mamba/modular_falcon_mamba.py class FalconMambaConfig (line 60) | class FalconMambaConfig(MambaConfig): method layer_types (line 105) | def layer_types(self): function rms_forward (line 109) | def rms_forward(hidden_states, variance_epsilon=1e-6): class FalconMambaMixer (line 128) | class FalconMambaMixer(MambaMixer): method warn_slow_implementation (line 129) | def warn_slow_implementation(self): method __init__ (line 152) | def __init__(self, config: FalconMambaConfig, layer_idx: int, initiali... method cuda_kernels_forward (line 164) | def cuda_kernels_forward( method slow_forward (line 279) | def slow_forward( method forward (line 403) | def forward( method init_falcon_mamba_weights (line 418) | def init_falcon_mamba_weights(self): class FalconMambaRMSNorm (line 424) | class FalconMambaRMSNorm(MambaRMSNorm): method forward (line 425) | def forward(self, hidden_states): class FalconMambaBlock (line 431) | class FalconMambaBlock(MambaBlock): class FalconMambaPreTrainedModel (line 436) | class FalconMambaPreTrainedModel(MambaPreTrainedModel): class FalconMambaOutput (line 440) | class FalconMambaOutput(MambaOutput): class FalconMambaCausalLMOutput (line 444) | class FalconMambaCausalLMOutput(MambaCausalLMOutput): class FalconMambaModel (line 448) | class FalconMambaModel(MambaModel, FalconMambaPreTrainedModel): method __init__ (line 449) | def __init__(self, config): method load_hook (line 462) | def load_hook(self, state_dict, prefix, *args): class FalconMambaForCausalLM (line 466) | class FalconMambaForCausalLM(MambaForCausalLM): FILE: src/transformers/models/fast_vlm/configuration_fast_vlm.py class FastVlmConfig (line 31) | class FastVlmConfig(PreTrainedConfig): method __post_init__ (line 64) | def __post_init__(self, **kwargs): method validate_architecture (line 98) | def validate_architecture(self): FILE: src/transformers/models/fast_vlm/convert_fastvlm_weights_to_hf.py function map_to_stage (line 58) | def map_to_stage(number): function load_original_state_dict (line 72) | def load_original_state_dict(model_id): function convert_state_dict_to_hf (line 87) | def convert_state_dict_to_hf(state_dict): function convert_fastvlm_to_hf (line 125) | def convert_fastvlm_to_hf(text_model_id, vision_model_id, output_hub_pat... function main (line 219) | def main(): FILE: src/transformers/models/fast_vlm/modeling_fast_vlm.py class FastVlmMultiModalProjector (line 39) | class FastVlmMultiModalProjector(nn.Module): method __init__ (line 40) | def __init__(self, config: FastVlmConfig): method forward (line 52) | def forward(self, image_features): class FastVlmPreTrainedModel (line 60) | class FastVlmPreTrainedModel(PreTrainedModel): class FastVlmModelOutputWithPast (line 81) | class FastVlmModelOutputWithPast(BaseModelOutputWithPast): class FastVlmModel (line 101) | class FastVlmModel(FastVlmPreTrainedModel): method __init__ (line 102) | def __init__(self, config: FastVlmConfig): method get_input_embeddings (line 110) | def get_input_embeddings(self): method set_input_embeddings (line 113) | def set_input_embeddings(self, value): method get_image_features (line 121) | def get_image_features( method get_placeholder_mask (line 148) | def get_placeholder_mask( method forward (line 174) | def forward( class FastVlmCausalLMOutputWithPast (line 235) | class FastVlmCausalLMOutputWithPast(ModelOutput): class FastVlmForConditionalGeneration (line 264) | class FastVlmForConditionalGeneration(FastVlmPreTrainedModel, Generation... method __init__ (line 267) | def __init__(self, config: FastVlmConfig): method get_input_embeddings (line 273) | def get_input_embeddings(self): method set_input_embeddings (line 276) | def set_input_embeddings(self, value): method get_output_embeddings (line 279) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 283) | def get_image_features( method forward (line 299) | def forward( method prepare_inputs_for_generation (line 392) | def prepare_inputs_for_generation( FILE: src/transformers/models/fast_vlm/modular_fast_vlm.py class FastVlmConfig (line 41) | class FastVlmConfig(LlavaConfig): method __post_init__ (line 69) | def __post_init__(self, **kwargs): method validate_architecture (line 103) | def validate_architecture(self): class FastVlmMultiModalProjector (line 116) | class FastVlmMultiModalProjector(LlavaMultiModalProjector): method __init__ (line 117) | def __init__(self, config: FastVlmConfig): class FastVlmPreTrainedModel (line 130) | class FastVlmPreTrainedModel(LlavaPreTrainedModel): class FastVlmModelOutputWithPast (line 134) | class FastVlmModelOutputWithPast(LlavaModelOutputWithPast): class FastVlmModel (line 138) | class FastVlmModel(LlavaModel): method __init__ (line 139) | def __init__(self, config: FastVlmConfig): method get_image_features (line 147) | def get_image_features( method forward (line 176) | def forward( class FastVlmCausalLMOutputWithPast (line 231) | class FastVlmCausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class FastVlmForConditionalGeneration (line 240) | class FastVlmForConditionalGeneration(LlavaForConditionalGeneration): method forward (line 243) | def forward( FILE: src/transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py class FastSpeech2ConformerConfig (line 27) | class FastSpeech2ConformerConfig(PreTrainedConfig): method __post_init__ (line 206) | def __post_init__(self, **kwargs): method validate_architecture (line 231) | def validate_architecture(self): class FastSpeech2ConformerHifiGanConfig (line 267) | class FastSpeech2ConformerHifiGanConfig(PreTrainedConfig): method __post_init__ (line 320) | def __post_init__(self, **kwargs): class FastSpeech2ConformerWithHifiGanConfig (line 328) | class FastSpeech2ConformerWithHifiGanConfig(PreTrainedConfig): method __post_init__ (line 366) | def __post_init__(self, **kwargs): FILE: src/transformers/models/fastspeech2_conformer/convert_fastspeech2_conformer_original_pytorch_checkpoint_to_pytorch.py function remap_model_yaml_config (line 87) | def remap_model_yaml_config(yaml_config_path): function convert_espnet_state_dict_to_hf (line 103) | def convert_espnet_state_dict_to_hf(state_dict): function convert_FastSpeech2ConformerModel_checkpoint (line 154) | def convert_FastSpeech2ConformerModel_checkpoint( FILE: src/transformers/models/fastspeech2_conformer/convert_hifigan.py function load_weights (line 29) | def load_weights(checkpoint, hf_model, config): function remap_hifigan_yaml_config (line 61) | def remap_hifigan_yaml_config(yaml_config_path): function convert_hifigan_checkpoint (line 92) | def convert_hifigan_checkpoint( FILE: src/transformers/models/fastspeech2_conformer/convert_model_with_hifigan.py function convert_FastSpeech2ConformerWithHifiGan_checkpoint (line 41) | def convert_FastSpeech2ConformerWithHifiGan_checkpoint( FILE: src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py class FastSpeech2ConformerModelOutput (line 43) | class FastSpeech2ConformerModelOutput(ModelOutput): class FastSpeech2ConformerWithHifiGanOutput (line 73) | class FastSpeech2ConformerWithHifiGanOutput(FastSpeech2ConformerModelOut... function length_regulator (line 90) | def length_regulator(encoded_embeddings, duration_labels, speaking_speed... class FastSpeech2ConformerDurationPredictor (line 137) | class FastSpeech2ConformerDurationPredictor(nn.Module): method __init__ (line 151) | def __init__(self, config: FastSpeech2ConformerConfig): method forward (line 169) | def forward(self, encoder_hidden_states): class FastSpeech2ConformerBatchNormConvLayer (line 197) | class FastSpeech2ConformerBatchNormConvLayer(nn.Module): method __init__ (line 198) | def __init__(self, config, layer_id=0): method forward (line 228) | def forward(self, hidden_states): class FastSpeech2ConformerSpeechDecoderPostnet (line 237) | class FastSpeech2ConformerSpeechDecoderPostnet(nn.Module): method __init__ (line 238) | def __init__(self, config): method forward (line 246) | def forward(self, hidden_states: torch.Tensor): class FastSpeech2ConformerPredictorLayer (line 255) | class FastSpeech2ConformerPredictorLayer(nn.Module): method __init__ (line 256) | def __init__(self, input_channels, num_chans, kernel_size, dropout_rate): method forward (line 269) | def forward(self, hidden_states): class FastSpeech2ConformerVariancePredictor (line 283) | class FastSpeech2ConformerVariancePredictor(nn.Module): method __init__ (line 284) | def __init__( method forward (line 310) | def forward(self, encoder_hidden_states, padding_masks=None): class FastSpeech2ConformerVarianceEmbedding (line 336) | class FastSpeech2ConformerVarianceEmbedding(nn.Module): method __init__ (line 337) | def __init__( method forward (line 354) | def forward(self, hidden_states): class FastSpeech2ConformerAttention (line 362) | class FastSpeech2ConformerAttention(nn.Module): method __init__ (line 368) | def __init__(self, config: FastSpeech2ConformerConfig, module_config): method shift_relative_position_tensor (line 389) | def shift_relative_position_tensor(self, pos_tensor): method forward (line 403) | def forward( class FastSpeech2ConformerConvolutionModule (line 474) | class FastSpeech2ConformerConvolutionModule(nn.Module): method __init__ (line 475) | def __init__(self, config: FastSpeech2ConformerConfig, module_config=N... method forward (line 509) | def forward(self, hidden_states, attention_mask=None): class FastSpeech2ConformerEncoderLayer (line 546) | class FastSpeech2ConformerEncoderLayer(nn.Module): method __init__ (line 547) | def __init__(self, config: FastSpeech2ConformerConfig, module_config): method forward (line 582) | def forward( class FastSpeech2ConformerMultiLayeredConv1d (line 663) | class FastSpeech2ConformerMultiLayeredConv1d(nn.Module): method __init__ (line 672) | def __init__(self, config: FastSpeech2ConformerConfig, module_config): method forward (line 690) | def forward(self, hidden_states): class FastSpeech2ConformerRelPositionalEncoding (line 709) | class FastSpeech2ConformerRelPositionalEncoding(nn.Module): method __init__ (line 720) | def __init__(self, config: FastSpeech2ConformerConfig, module_config): method extend_pos_enc (line 733) | def extend_pos_enc(self, x, pos_enc=None): method forward (line 764) | def forward(self, feature_representation): class FastSpeech2ConformerEncoder (line 780) | class FastSpeech2ConformerEncoder(nn.Module): method __init__ (line 793) | def __init__( method forward (line 813) | def forward( class FastSpeech2ConformerLoss (line 880) | class FastSpeech2ConformerLoss(nn.Module): method __init__ (line 881) | def __init__(self, config: FastSpeech2ConformerConfig): method forward (line 900) | def forward( class FastSpeech2ConformerPreTrainedModel (line 991) | class FastSpeech2ConformerPreTrainedModel(PreTrainedModel): method _init_weights (line 998) | def _init_weights(self, module): method _set_gradient_checkpointing (line 1027) | def _set_gradient_checkpointing(self, module, value=False): class FastSpeech2ConformerModel (line 1037) | class FastSpeech2ConformerModel(FastSpeech2ConformerPreTrainedModel): method __init__ (line 1047) | def __init__(self, config: FastSpeech2ConformerConfig): method forward (line 1115) | def forward( class HifiGanResidualBlock (line 1308) | class HifiGanResidualBlock(nn.Module): method __init__ (line 1309) | def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_... method get_padding (line 1340) | def get_padding(self, kernel_size, dilation=1): method apply_weight_norm (line 1343) | def apply_weight_norm(self): method remove_weight_norm (line 1353) | def remove_weight_norm(self): method forward (line 1359) | def forward(self, hidden_states): class FastSpeech2ConformerHifiGan (line 1376) | class FastSpeech2ConformerHifiGan(PreTrainedModel): method __init__ (line 1380) | def __init__(self, config: FastSpeech2ConformerHifiGanConfig): method _init_weights (line 1418) | def _init_weights(self, module): method apply_weight_norm (line 1424) | def apply_weight_norm(self): method remove_weight_norm (line 1436) | def remove_weight_norm(self): method forward (line 1451) | def forward(self, spectrogram: torch.FloatTensor, **kwargs) -> torch.F... class FastSpeech2ConformerWithHifiGan (line 1499) | class FastSpeech2ConformerWithHifiGan(PreTrainedModel): method __init__ (line 1502) | def __init__(self, config: FastSpeech2ConformerWithHifiGanConfig): method forward (line 1513) | def forward( FILE: src/transformers/models/fastspeech2_conformer/tokenization_fastspeech2_conformer.py class FastSpeech2ConformerTokenizer (line 30) | class FastSpeech2ConformerTokenizer(PreTrainedTokenizer): method __init__ (line 53) | def __init__( method vocab_size (line 87) | def vocab_size(self): method get_vocab (line 90) | def get_vocab(self): method prepare_for_tokenization (line 94) | def prepare_for_tokenization(self, text, is_split_into_words=False, **... method _tokenize (line 111) | def _tokenize(self, text): method _convert_token_to_id (line 123) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 127) | def _convert_id_to_token(self, index): method decode (line 132) | def decode(self, token_ids, **kwargs): method convert_tokens_to_string (line 139) | def convert_tokens_to_string(self, tokens, **kwargs): method save_vocabulary (line 145) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method __getstate__ (line 168) | def __getstate__(self): method __setstate__ (line 173) | def __setstate__(self, d): FILE: src/transformers/models/flaubert/configuration_flaubert.py class FlaubertConfig (line 24) | class FlaubertConfig(PreTrainedConfig): FILE: src/transformers/models/flaubert/modeling_flaubert.py function create_sinusoidal_embeddings (line 47) | def create_sinusoidal_embeddings(n_pos, dim, out): function get_masks (line 57) | def get_masks(slen, lengths, causal, padding_mask=None): class MultiHeadAttention (line 83) | class MultiHeadAttention(nn.Module): method __init__ (line 84) | def __init__(self, n_heads, dim, config, layer_idx: int = 0): method forward (line 98) | def forward( class TransformerFFN (line 164) | class TransformerFFN(nn.Module): method __init__ (line 165) | def __init__(self, in_dim, dim_hidden, out_dim, config): method forward (line 174) | def forward(self, input): method ff_chunk (line 177) | def ff_chunk(self, input): class FlaubertPredLayer (line 191) | class FlaubertPredLayer(nn.Module): method __init__ (line 196) | def __init__(self, config): method forward (line 214) | def forward(self, x, y=None): class FlaubertSquadHeadOutput (line 240) | class FlaubertSquadHeadOutput(ModelOutput): class FlaubertPoolerStartLogits (line 267) | class FlaubertPoolerStartLogits(nn.Module): method __init__ (line 276) | def __init__(self, config: FlaubertConfig): method forward (line 280) | def forward(self, hidden_states: torch.FloatTensor, p_mask: torch.Floa... class FlaubertPoolerEndLogits (line 304) | class FlaubertPoolerEndLogits(nn.Module): method __init__ (line 314) | def __init__(self, config: FlaubertConfig): method forward (line 321) | def forward( class FlaubertPoolerAnswerClass (line 374) | class FlaubertPoolerAnswerClass(nn.Module): method __init__ (line 383) | def __init__(self, config: FlaubertConfig): method forward (line 389) | def forward( class FlaubertSQuADHead (line 440) | class FlaubertSQuADHead(nn.Module): method __init__ (line 450) | def __init__(self, config: FlaubertConfig): method forward (line 460) | def forward( class FlaubertSequenceSummary (line 553) | class FlaubertSequenceSummary(nn.Module): method __init__ (line 579) | def __init__(self, config: FlaubertConfig): method forward (line 608) | def forward( class FlaubertPreTrainedModel (line 654) | class FlaubertPreTrainedModel(PreTrainedModel): method dummy_inputs (line 659) | def dummy_inputs(self): method _init_weights (line 669) | def _init_weights(self, module): class FlaubertModel (line 699) | class FlaubertModel(FlaubertPreTrainedModel): method __init__ (line 700) | def __init__(self, config): # , dico, is_encoder, with_output): method get_input_embeddings (line 767) | def get_input_embeddings(self): method set_input_embeddings (line 771) | def set_input_embeddings(self, new_embeddings): method forward (line 775) | def forward( class FlaubertWithLMHeadModel (line 951) | class FlaubertWithLMHeadModel(FlaubertPreTrainedModel, GenerationMixin): method __init__ (line 954) | def __init__(self, config): method get_output_embeddings (line 962) | def get_output_embeddings(self): method set_output_embeddings (line 965) | def set_output_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 968) | def prepare_inputs_for_generation(self, input_ids, **kwargs): method forward (line 984) | def forward( class FlaubertForSequenceClassification (line 1060) | class FlaubertForSequenceClassification(FlaubertPreTrainedModel): method __init__ (line 1061) | def __init__(self, config): method forward (line 1073) | def forward( class FlaubertForTokenClassification (line 1166) | class FlaubertForTokenClassification(FlaubertPreTrainedModel): method __init__ (line 1167) | def __init__(self, config): method forward (line 1179) | def forward( class FlaubertForQuestionAnsweringSimple (line 1259) | class FlaubertForQuestionAnsweringSimple(FlaubertPreTrainedModel): method __init__ (line 1260) | def __init__(self, config): method forward (line 1270) | def forward( class FlaubertForQuestionAnsweringOutput (line 1364) | class FlaubertForQuestionAnsweringOutput(ModelOutput): class FlaubertForQuestionAnswering (line 1394) | class FlaubertForQuestionAnswering(FlaubertPreTrainedModel): method __init__ (line 1395) | def __init__(self, config): method forward (line 1405) | def forward( class FlaubertForMultipleChoice (line 1513) | class FlaubertForMultipleChoice(FlaubertPreTrainedModel): method __init__ (line 1514) | def __init__(self, config, *inputs, **kwargs): method forward (line 1525) | def forward( FILE: src/transformers/models/flaubert/tokenization_flaubert.py function convert_to_unicode (line 33) | def convert_to_unicode(text): function get_pairs (line 50) | def get_pairs(word): function replace_unicode_punct (line 64) | def replace_unicode_punct(text): function remove_non_printing_char (line 108) | def remove_non_printing_char(text): class FlaubertTokenizer (line 121) | class FlaubertTokenizer(PreTrainedTokenizer): method __init__ (line 176) | def __init__( method do_lower_case (line 262) | def do_lower_case(self): method moses_punct_norm (line 266) | def moses_punct_norm(self, text, lang): method moses_tokenize (line 275) | def moses_tokenize(self, text, lang): method moses_pipeline (line 284) | def moses_pipeline(self, text, lang): method ja_tokenize (line 291) | def ja_tokenize(self, text): method vocab_size (line 314) | def vocab_size(self): method get_vocab (line 318) | def get_vocab(self): method bpe (line 322) | def bpe(self, token): method preprocess_text (line 366) | def preprocess_text(self, text): method _tokenize (line 376) | def _tokenize(self, text, bypass_tokenizer=False): method _convert_token_to_id (line 414) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 419) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 424) | def convert_tokens_to_string(self, tokens): method build_inputs_with_special_tokens (line 430) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 458) | def get_special_tokens_mask( method save_vocabulary (line 487) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method __getstate__ (line 516) | def __getstate__(self): method __setstate__ (line 522) | def __setstate__(self, d): FILE: src/transformers/models/flava/configuration_flava.py class FlavaImageConfig (line 29) | class FlavaImageConfig(PreTrainedConfig): class FlavaTextConfig (line 71) | class FlavaTextConfig(PreTrainedConfig): class FlavaMultimodalConfig (line 109) | class FlavaMultimodalConfig(PreTrainedConfig): class FlavaImageCodebookConfig (line 147) | class FlavaImageCodebookConfig(PreTrainedConfig): class FlavaConfig (line 183) | class FlavaConfig(PreTrainedConfig): method __post_init__ (line 266) | def __post_init__(self, **kwargs): FILE: src/transformers/models/flava/convert_dalle_to_flava_codebook.py function rreplace (line 23) | def rreplace(s, old, new, occurrence): function count_parameters (line 28) | def count_parameters(state_dict): function upgrade_state_dict (line 33) | def upgrade_state_dict(state_dict): function convert_dalle_checkpoint (line 56) | def convert_dalle_checkpoint(checkpoint_path, pytorch_dump_folder_path, ... FILE: src/transformers/models/flava/convert_flava_original_pytorch_to_hf.py function count_parameters (line 24) | def count_parameters(state_dict): function upgrade_state_dict (line 29) | def upgrade_state_dict(state_dict, codebook_state_dict): function convert_flava_checkpoint (line 61) | def convert_flava_checkpoint(checkpoint_path, codebook_path, pytorch_dum... FILE: src/transformers/models/flava/image_processing_flava.py class FlavaImageProcessorKwargs (line 51) | class FlavaImageProcessorKwargs(ImagesKwargs, total=False): class FlavaMaskingGenerator (line 137) | class FlavaMaskingGenerator: method __init__ (line 138) | def __init__( method __repr__ (line 160) | def __repr__(self): method get_shape (line 172) | def get_shape(self): method _mask (line 175) | def _mask(self, mask, max_mask_patches): method __call__ (line 197) | def __call__(self): class FlavaImageProcessor (line 214) | class FlavaImageProcessor(TorchvisionBackend): method __init__ (line 250) | def __init__(self, **kwargs: Unpack[FlavaImageProcessorKwargs]): method preprocess (line 254) | def preprocess(self, images: ImageInput, **kwargs: Unpack[FlavaImagePr... method from_dict (line 258) | def from_dict(cls, image_processor_dict: dict[str, Any], **kwargs): method masking_generator (line 271) | def masking_generator( method map_pixels (line 289) | def map_pixels(self, image: "torch.Tensor") -> "torch.Tensor": method _standardize_kwargs (line 292) | def _standardize_kwargs( method _preprocess_image (line 338) | def _preprocess_image( method _preprocess (line 383) | def _preprocess( FILE: src/transformers/models/flava/image_processing_pil_flava.py class FlavaImageProcessorKwargs (line 64) | class FlavaImageProcessorKwargs(ImagesKwargs, total=False): class FlavaMaskingGenerator (line 151) | class FlavaMaskingGenerator: method __init__ (line 152) | def __init__( method __repr__ (line 174) | def __repr__(self): method get_shape (line 186) | def get_shape(self): method _mask (line 189) | def _mask(self, mask, max_mask_patches): method __call__ (line 211) | def __call__(self): class FlavaImageProcessorPil (line 228) | class FlavaImageProcessorPil(PilBackend): method __init__ (line 262) | def __init__(self, **kwargs: Unpack[FlavaImageProcessorKwargs]): method preprocess (line 266) | def preprocess(self, images: ImageInput, **kwargs: Unpack[FlavaImagePr... method from_dict (line 270) | def from_dict(cls, image_processor_dict: dict[str, Any], **kwargs): method masking_generator (line 283) | def masking_generator( method map_pixels (line 302) | def map_pixels(self, image: np.ndarray) -> np.ndarray: method _standardize_kwargs (line 305) | def _standardize_kwargs( method _preprocess_image (line 351) | def _preprocess_image( method _preprocess (line 384) | def _preprocess( FILE: src/transformers/models/flava/modeling_flava.py class FlavaModelOutput (line 61) | class FlavaModelOutput(ModelOutput): method to_tuple (line 84) | def to_tuple(self) -> tuple[Any]: class FlavaLosses (line 97) | class FlavaLosses(ModelOutput): method all_none (line 122) | def all_none(self) -> bool: class FlavaForPreTrainingOutput (line 141) | class FlavaForPreTrainingOutput(ModelOutput): method to_tuple (line 219) | def to_tuple(self) -> tuple[Any]: class FlavaImageEmbeddings (line 233) | class FlavaImageEmbeddings(nn.Module): method __init__ (line 238) | def __init__(self, config: FlavaImageConfig, use_mask_token: bool = Fa... method interpolate_pos_encoding (line 257) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 297) | def forward( class PatchEmbeddings (line 333) | class PatchEmbeddings(nn.Module): method __init__ (line 338) | def __init__( method forward (line 357) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... class FlavaTextEmbeddings (line 369) | class FlavaTextEmbeddings(nn.Module): method __init__ (line 372) | def __init__(self, config): method forward (line 388) | def forward( class FlavaSelfAttention (line 423) | class FlavaSelfAttention(nn.Module): method __init__ (line 424) | def __init__(self, config: FlavaPossibleConfigs) -> None: method forward (line 442) | def forward( class FlavaSelfOutput (line 491) | class FlavaSelfOutput(nn.Module): method __init__ (line 497) | def __init__(self, config: FlavaPossibleConfigs) -> None: method forward (line 502) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class FlavaAttention (line 509) | class FlavaAttention(nn.Module): method __init__ (line 510) | def __init__(self, config: FlavaPossibleConfigs) -> None: method forward (line 515) | def forward( class FlavaIntermediate (line 531) | class FlavaIntermediate(nn.Module): method __init__ (line 532) | def __init__(self, config: FlavaPossibleConfigs) -> None: method forward (line 541) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class FlavaOutput (line 548) | class FlavaOutput(nn.Module): method __init__ (line 549) | def __init__(self, config: FlavaPossibleConfigs) -> None: method forward (line 555) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class FlavaLayer (line 564) | class FlavaLayer(GradientCheckpointingLayer): method __init__ (line 567) | def __init__(self, config: FlavaPossibleConfigs) -> None: method forward (line 579) | def forward( class FlavaEncoder (line 608) | class FlavaEncoder(nn.Module): method __init__ (line 609) | def __init__(self, config: FlavaConfig) -> None: method forward (line 615) | def forward( class FlavaPooler (line 647) | class FlavaPooler(nn.Module): method __init__ (line 648) | def __init__(self, config: FlavaPossibleConfigs): method forward (line 653) | def forward(self, hidden_states: torch.Tensor): class FlavaPreTrainedModel (line 663) | class FlavaPreTrainedModel(PreTrainedModel): method _init_weights (line 670) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class FlavaImageModel (line 691) | class FlavaImageModel(FlavaPreTrainedModel): method __init__ (line 698) | def __init__(self, config: FlavaImageConfig, add_pooling_layer: bool =... method get_input_embeddings (line 715) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 718) | def set_input_embeddings(self, value: nn.Module): method forward (line 722) | def forward( class FlavaTextModel (line 773) | class FlavaTextModel(FlavaPreTrainedModel): method __init__ (line 779) | def __init__(self, config: FlavaTextConfig, add_pooling_layer: bool = ... method get_input_embeddings (line 795) | def get_input_embeddings(self) -> PatchEmbeddings: method set_input_embeddings (line 798) | def set_input_embeddings(self, value: nn.Module): method forward (line 802) | def forward( class FlavaMultimodalModel (line 873) | class FlavaMultimodalModel(FlavaPreTrainedModel): method __init__ (line 879) | def __init__(self, config: FlavaMultimodalConfig, add_pooling_layer=Tr... method forward (line 898) | def forward( class FlavaModel (line 955) | class FlavaModel(FlavaPreTrainedModel): method __init__ (line 958) | def __init__(self, config: FlavaConfig): method get_text_features (line 1003) | def get_text_features( method get_image_features (line 1054) | def get_image_features( method forward (line 1099) | def forward( class FlavaImageCodebookResPath (line 1244) | class FlavaImageCodebookResPath(nn.Module): method __init__ (line 1245) | def __init__(self, in_size: int, out_size: int, **kwargs): method forward (line 1261) | def forward(self, x: torch.Tensor) -> torch.Tensor: class FlavaImageCodebookBlock (line 1265) | class FlavaImageCodebookBlock(nn.Module): method __init__ (line 1266) | def __init__(self, in_size: int, out_size: int, num_layers: int, **kwa... method forward (line 1278) | def forward(self, x: torch.Tensor) -> torch.Tensor: class FlavaImageCodebookLayerGroup (line 1282) | class FlavaImageCodebookLayerGroup(nn.Module): method __init__ (line 1283) | def __init__(self, num_blocks: int, num_layers: int, in_size: int, out... method forward (line 1297) | def forward(self, x: torch.Tensor) -> torch.Tensor: class FlavaImageCodebook (line 1309) | class FlavaImageCodebook(FlavaPreTrainedModel): method __init__ (line 1316) | def __init__( method get_codebook_indices (line 1360) | def get_codebook_indices(self, pixel_values: torch.Tensor) -> torch.Te... method get_codebook_probs (line 1390) | def get_codebook_probs(self, pixel_values: torch.Tensor) -> torch.Tensor: method forward (line 1394) | def forward(self, pixel_values: torch.FloatTensor, **kwargs) -> torch.... class FlavaPredictionHeadTransform (line 1431) | class FlavaPredictionHeadTransform(nn.Module): method __init__ (line 1432) | def __init__(self, config): method forward (line 1441) | def forward(self, hidden_states): class FlavaMaskedPredictionHead (line 1448) | class FlavaMaskedPredictionHead(nn.Module): method __init__ (line 1449) | def __init__(self, config, weight=None): method forward (line 1458) | def forward(self, x): class FlavaITMHead (line 1464) | class FlavaITMHead(nn.Module): method __init__ (line 1465) | def __init__(self, config): method forward (line 1471) | def forward(self, x): class FlavaGlobalContrastiveHead (line 1477) | class FlavaGlobalContrastiveHead(nn.Module): method __init__ (line 1478) | def __init__(self, config): method forward (line 1483) | def forward(self, image_embeddings, text_embeddings, logit_scale): class FlavaForPreTraining (line 1522) | class FlavaForPreTraining(FlavaPreTrainedModel): method __init__ (line 1531) | def __init__(self, config: FlavaConfig, image_codebook: nn.Module | No... method _resize_to_2d (line 1566) | def _resize_to_2d(self, x: torch.Tensor): method forward (line 1572) | def forward( FILE: src/transformers/models/flava/processing_flava.py class FlavaProcessor (line 23) | class FlavaProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): FILE: src/transformers/models/flex_olmo/configuration_flex_olmo.py class FlexOlmoConfig (line 31) | class FlexOlmoConfig(PreTrainedConfig): method __post_init__ (line 91) | def __post_init__(self, **kwargs): FILE: src/transformers/models/flex_olmo/modeling_flex_olmo.py class FlexOlmoRMSNorm (line 47) | class FlexOlmoRMSNorm(nn.Module): method __init__ (line 48) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 56) | def forward(self, hidden_states) -> torch.Tensor: method extra_repr (line 63) | def extra_repr(self): class FlexOlmoRotaryEmbedding (line 67) | class FlexOlmoRotaryEmbedding(nn.Module): method __init__ (line 70) | def __init__(self, config: FlexOlmoConfig, device=None): method compute_default_rope_parameters (line 87) | def compute_default_rope_parameters( method forward (line 118) | def forward(self, x, position_ids): class FlexOlmoMLP (line 131) | class FlexOlmoMLP(nn.Module): method __init__ (line 132) | def __init__(self, config): method forward (line 142) | def forward(self, x): function repeat_kv (line 147) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 159) | def eager_attention_forward( function apply_rotary_pos_emb (line 184) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function rotate_half (line 210) | def rotate_half(x): class FlexOlmoAttention (line 218) | class FlexOlmoAttention(nn.Module): method __init__ (line 221) | def __init__(self, config: FlexOlmoConfig, layer_idx: int | None = None): method forward (line 246) | def forward( class FlexOlmoTopKRouter (line 291) | class FlexOlmoTopKRouter(nn.Module): method __init__ (line 292) | def __init__(self, config): method forward (line 300) | def forward(self, hidden_states): class FlexOlmoExperts (line 313) | class FlexOlmoExperts(nn.Module): method __init__ (line 316) | def __init__(self, config: FlexOlmoConfig): method forward (line 325) | def forward( class FlexOlmoSparseMoeBlock (line 352) | class FlexOlmoSparseMoeBlock(nn.Module): method __init__ (line 353) | def __init__(self, config): method forward (line 358) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class FlexOlmoDecoderLayer (line 368) | class FlexOlmoDecoderLayer(GradientCheckpointingLayer): method __init__ (line 369) | def __init__(self, config: FlexOlmoConfig, layer_idx: int): method forward (line 377) | def forward( class FlexOlmoPreTrainedModel (line 409) | class FlexOlmoPreTrainedModel(PreTrainedModel): method _init_weights (line 428) | def _init_weights(self, module): class FlexOlmoModel (line 439) | class FlexOlmoModel(FlexOlmoPreTrainedModel): method __init__ (line 440) | def __init__(self, config: FlexOlmoConfig): method forward (line 459) | def forward( function load_balancing_loss_func (line 515) | def load_balancing_loss_func( class FlexOlmoForCausalLM (line 598) | class FlexOlmoForCausalLM(FlexOlmoPreTrainedModel, GenerationMixin): method __init__ (line 603) | def __init__(self, config): method forward (line 617) | def forward( FILE: src/transformers/models/flex_olmo/modular_flex_olmo.py class FlexOlmoConfig (line 41) | class FlexOlmoConfig(PreTrainedConfig): method __post_init__ (line 101) | def __post_init__(self, **kwargs): class FlexOlmoRMSNorm (line 108) | class FlexOlmoRMSNorm(Olmo2RMSNorm): class FlexOlmoRotaryEmbedding (line 114) | class FlexOlmoRotaryEmbedding(Olmo2RotaryEmbedding): class FlexOlmoMLP (line 118) | class FlexOlmoMLP(OlmoeMLP): class FlexOlmoAttention (line 124) | class FlexOlmoAttention(Olmo2Attention): class FlexOlmoTopKRouter (line 128) | class FlexOlmoTopKRouter(OlmoeTopKRouter): class FlexOlmoSparseMoeBlock (line 132) | class FlexOlmoSparseMoeBlock(OlmoeSparseMoeBlock): class FlexOlmoDecoderLayer (line 138) | class FlexOlmoDecoderLayer(OlmoeDecoderLayer): method __init__ (line 139) | def __init__(self, config: FlexOlmoConfig, layer_idx: int): method forward (line 146) | def forward( class FlexOlmoPreTrainedModel (line 179) | class FlexOlmoPreTrainedModel(MixtralPreTrainedModel): class FlexOlmoModel (line 191) | class FlexOlmoModel(MixtralModel): method forward (line 195) | def forward( class FlexOlmoForCausalLM (line 251) | class FlexOlmoForCausalLM(OlmoeForCausalLM): FILE: src/transformers/models/florence2/configuration_florence2.py class Florence2VisionConfig (line 32) | class Florence2VisionConfig(PreTrainedConfig): class Florence2Config (line 88) | class Florence2Config(PreTrainedConfig): method __post_init__ (line 123) | def __post_init__(self, **kwargs): FILE: src/transformers/models/florence2/convert_florence2_original_pytorch_to_hf.py function convert_config (line 31) | def convert_config(original_config: dict): function vision_conv_embeddings (line 42) | def vision_conv_embeddings(idx): function vision_spatial_block (line 77) | def vision_spatial_block(stage_idx, block_idx): function vision_channel_block (line 185) | def vision_channel_block(stage_idx, block_idx): function multi_modal_projector (line 293) | def multi_modal_projector(): function language_model (line 322) | def language_model(state_dict): function convert_florence2_checkpoint (line 332) | def convert_florence2_checkpoint(hf_model_id, pytorch_dump_folder, outpu... FILE: src/transformers/models/florence2/modeling_florence2.py function drop_path (line 56) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class Florence2VisionDropPath (line 71) | class Florence2VisionDropPath(nn.Module): method __init__ (line 74) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 78) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 81) | def extra_repr(self) -> str: class Florence2VisionLearnedAbsolutePositionEmbedding2D (line 85) | class Florence2VisionLearnedAbsolutePositionEmbedding2D(nn.Module): method __init__ (line 90) | def __init__(self, config: Florence2Config): method forward (line 97) | def forward(self, pixel_values, pixel_mask=None): class Florence2VisionPositionalEmbeddingCosine1D (line 110) | class Florence2VisionPositionalEmbeddingCosine1D(nn.Module): method __init__ (line 115) | def __init__(self, config: Florence2Config): method get_sinusoid_embeddings (line 130) | def get_sinusoid_embeddings(max_positions: int, embed_dim: int): method forward (line 137) | def forward(self, seq_embeds: torch.Tensor) -> torch.Tensor: class Florence2VisionMLP (line 145) | class Florence2VisionMLP(nn.Module): method __init__ (line 146) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): method forward (line 153) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Florence2VisionConvEmbed (line 160) | class Florence2VisionConvEmbed(nn.Module): method __init__ (line 163) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): method forward (line 185) | def forward(self, hidden_states: torch.Tensor): function eager_attention_forward (line 200) | def eager_attention_forward( class Florence2VisionChannelAttention (line 228) | class Florence2VisionChannelAttention(nn.Module): method __init__ (line 229) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): method forward (line 238) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionChannelBlock (line 267) | class Florence2VisionChannelBlock(nn.Module): method __init__ (line 268) | def __init__( method forward (line 301) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionWindowAttention (line 329) | class Florence2VisionWindowAttention(nn.Module): method __init__ (line 330) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): method forward (line 343) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionSpatialBlock (line 406) | class Florence2VisionSpatialBlock(nn.Module): method __init__ (line 407) | def __init__( method forward (line 437) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionBlock (line 466) | class Florence2VisionBlock(nn.Module): method __init__ (line 467) | def __init__( method forward (line 486) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionPreTrainedModel (line 493) | class Florence2VisionPreTrainedModel(PreTrainedModel): class Florence2VisionBackbone (line 509) | class Florence2VisionBackbone(Florence2VisionPreTrainedModel): method __init__ (line 510) | def __init__(self, config: Florence2VisionConfig): method forward (line 558) | def forward( class Florence2MultiModalProjector (line 573) | class Florence2MultiModalProjector(nn.Module): method __init__ (line 574) | def __init__(self, config: Florence2Config): method forward (line 583) | def forward(self, image_features): class Florence2Seq2SeqModelOutput (line 605) | class Florence2Seq2SeqModelOutput(Seq2SeqModelOutput): class Florence2Seq2SeqLMOutput (line 622) | class Florence2Seq2SeqLMOutput(Seq2SeqLMOutput): class Florence2PreTrainedModel (line 637) | class Florence2PreTrainedModel(PreTrainedModel): method _init_weights (line 653) | def _init_weights(self, module): class Florence2Model (line 671) | class Florence2Model(Florence2PreTrainedModel): method __init__ (line 672) | def __init__(self, config: Florence2Config): method get_input_embeddings (line 680) | def get_input_embeddings(self): method set_input_embeddings (line 683) | def set_input_embeddings(self, value): method get_image_features (line 690) | def get_image_features( method get_placeholder_mask (line 702) | def get_placeholder_mask( method forward (line 728) | def forward( method get_encoder (line 791) | def get_encoder(self, modality=None): function shift_tokens_right (line 798) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class Florence2ForConditionalGeneration (line 819) | class Florence2ForConditionalGeneration(Florence2PreTrainedModel, Genera... method __init__ (line 824) | def __init__(self, config: Florence2Config): method get_input_embeddings (line 830) | def get_input_embeddings(self): method set_input_embeddings (line 833) | def set_input_embeddings(self, value): method get_output_embeddings (line 836) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 840) | def get_image_features( method forward (line 847) | def forward( method prepare_inputs_for_generation (line 939) | def prepare_inputs_for_generation( method get_placeholder_mask (line 971) | def get_placeholder_mask( method _prepare_encoder_decoder_kwargs_for_generation (line 978) | def _prepare_encoder_decoder_kwargs_for_generation( FILE: src/transformers/models/florence2/modular_florence2.py class Florence2VisionConfig (line 53) | class Florence2VisionConfig(PreTrainedConfig): class Florence2Config (line 109) | class Florence2Config(PreTrainedConfig): method __post_init__ (line 144) | def __post_init__(self, **kwargs): class Florence2ProcessorKwargs (line 160) | class Florence2ProcessorKwargs(LlavaProcessorKwargs): class Florence2Processor (line 165) | class Florence2Processor(ProcessorMixin): method __init__ (line 166) | def __init__( method _construct_prompts (line 230) | def _construct_prompts(self, text: str | list[str]) -> list[str]: method __call__ (line 256) | def __call__( method batch_decode (line 326) | def batch_decode(self, *args, **kwargs): method decode (line 333) | def decode(self, *args, **kwargs): method model_input_names (line 341) | def model_input_names(self): method _get_num_multimodal_tokens (line 346) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method post_process_image_text_to_text (line 368) | def post_process_image_text_to_text(self, generated_outputs, skip_spec... method post_process_generation (line 386) | def post_process_generation(self, text=None, sequence=None, task=None,... class Florence2PostProcessor (line 463) | class Florence2PostProcessor: method __init__ (line 473) | def __init__(self, config, tokenizer): method quantize (line 482) | def quantize(self, locations: "torch.Tensor", size: tuple[int, int]) -... method dequantize (line 517) | def dequantize(self, locations: "torch.Tensor", size: tuple[int, int])... method decode_with_spans (line 553) | def decode_with_spans(self, token_ids: list[int]) -> tuple[str, list[t... method parse_ocr_from_text_and_spans (line 577) | def parse_ocr_from_text_and_spans( method parse_phrase_grounding_from_text_and_spans (line 622) | def parse_phrase_grounding_from_text_and_spans( method _find_matched_token_indices (line 663) | def _find_matched_token_indices(self, cur_span: tuple[int, int], token... method parse_description_with_bboxes_from_text_and_spans (line 666) | def parse_description_with_bboxes_from_text_and_spans( method parse_description_with_polygons_from_text_and_spans (line 719) | def parse_description_with_polygons_from_text_and_spans( method __call__ (line 805) | def __call__(self, text=None, sequence=None, image_size=None, parse_ta... class Florence2VisionDropPath (line 882) | class Florence2VisionDropPath(BeitDropPath): class Florence2VisionLearnedAbsolutePositionEmbedding2D (line 886) | class Florence2VisionLearnedAbsolutePositionEmbedding2D(nn.Module): method __init__ (line 891) | def __init__(self, config: Florence2Config): method forward (line 898) | def forward(self, pixel_values, pixel_mask=None): class Florence2VisionPositionalEmbeddingCosine1D (line 911) | class Florence2VisionPositionalEmbeddingCosine1D(nn.Module): method __init__ (line 916) | def __init__(self, config: Florence2Config): method get_sinusoid_embeddings (line 931) | def get_sinusoid_embeddings(max_positions: int, embed_dim: int): method forward (line 938) | def forward(self, seq_embeds: torch.Tensor) -> torch.Tensor: class Florence2VisionMLP (line 946) | class Florence2VisionMLP(Llama4VisionMLP): method __init__ (line 947) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): class Florence2VisionConvEmbed (line 954) | class Florence2VisionConvEmbed(nn.Module): method __init__ (line 957) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): method forward (line 979) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionChannelAttention (line 994) | class Florence2VisionChannelAttention(nn.Module): method __init__ (line 995) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): method forward (line 1004) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionChannelBlock (line 1033) | class Florence2VisionChannelBlock(nn.Module): method __init__ (line 1034) | def __init__( method forward (line 1067) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionWindowAttention (line 1095) | class Florence2VisionWindowAttention(nn.Module): method __init__ (line 1096) | def __init__(self, config: Florence2VisionConfig, stage_idx: int): method forward (line 1109) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionSpatialBlock (line 1172) | class Florence2VisionSpatialBlock(nn.Module): method __init__ (line 1173) | def __init__( method forward (line 1203) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionBlock (line 1232) | class Florence2VisionBlock(nn.Module): method __init__ (line 1233) | def __init__( method forward (line 1252) | def forward(self, hidden_states: torch.Tensor): class Florence2VisionPreTrainedModel (line 1259) | class Florence2VisionPreTrainedModel(PreTrainedModel): class Florence2VisionBackbone (line 1275) | class Florence2VisionBackbone(Florence2VisionPreTrainedModel): method __init__ (line 1276) | def __init__(self, config: Florence2VisionConfig): method forward (line 1324) | def forward( class Florence2MultiModalProjector (line 1339) | class Florence2MultiModalProjector(nn.Module): method __init__ (line 1340) | def __init__(self, config: Florence2Config): method forward (line 1349) | def forward(self, image_features): class Florence2Seq2SeqModelOutput (line 1371) | class Florence2Seq2SeqModelOutput(Seq2SeqModelOutput): class Florence2Seq2SeqLMOutput (line 1388) | class Florence2Seq2SeqLMOutput(Seq2SeqLMOutput): class Florence2PreTrainedModel (line 1403) | class Florence2PreTrainedModel(LlavaPreTrainedModel): method _init_weights (line 1409) | def _init_weights(self, module): class Florence2Model (line 1427) | class Florence2Model(LlavaModel): method __init__ (line 1428) | def __init__(self, config: Florence2Config): method get_encoder (line 1432) | def get_encoder(self, modality=None): method get_image_features (line 1442) | def get_image_features( method forward (line 1456) | def forward( class Florence2ForConditionalGeneration (line 1525) | class Florence2ForConditionalGeneration(LlavaForConditionalGeneration): method get_image_features (line 1531) | def get_image_features( method forward (line 1538) | def forward( method get_placeholder_mask (line 1630) | def get_placeholder_mask( method _prepare_encoder_decoder_kwargs_for_generation (line 1637) | def _prepare_encoder_decoder_kwargs_for_generation( FILE: src/transformers/models/florence2/processing_florence2.py class Florence2ProcessorKwargs (line 36) | class Florence2ProcessorKwargs(ProcessingKwargs, total=False): class Florence2Processor (line 43) | class Florence2Processor(ProcessorMixin): method __init__ (line 44) | def __init__( method _construct_prompts (line 108) | def _construct_prompts(self, text: str | list[str]) -> list[str]: method __call__ (line 134) | def __call__( method batch_decode (line 204) | def batch_decode(self, *args, **kwargs): method decode (line 211) | def decode(self, *args, **kwargs): method model_input_names (line 219) | def model_input_names(self): method _get_num_multimodal_tokens (line 224) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method post_process_image_text_to_text (line 246) | def post_process_image_text_to_text(self, generated_outputs, skip_spec... method post_process_generation (line 264) | def post_process_generation(self, text=None, sequence=None, task=None,... class Florence2PostProcessor (line 341) | class Florence2PostProcessor: method __init__ (line 351) | def __init__(self, config, tokenizer): method quantize (line 360) | def quantize(self, locations: "torch.Tensor", size: tuple[int, int]) -... method dequantize (line 395) | def dequantize(self, locations: "torch.Tensor", size: tuple[int, int])... method decode_with_spans (line 431) | def decode_with_spans(self, token_ids: list[int]) -> tuple[str, list[t... method parse_ocr_from_text_and_spans (line 455) | def parse_ocr_from_text_and_spans( method parse_phrase_grounding_from_text_and_spans (line 500) | def parse_phrase_grounding_from_text_and_spans( method _find_matched_token_indices (line 541) | def _find_matched_token_indices(self, cur_span: tuple[int, int], token... method parse_description_with_bboxes_from_text_and_spans (line 544) | def parse_description_with_bboxes_from_text_and_spans( method parse_description_with_polygons_from_text_and_spans (line 597) | def parse_description_with_polygons_from_text_and_spans( method __call__ (line 683) | def __call__(self, text=None, sequence=None, image_size=None, parse_ta... FILE: src/transformers/models/fnet/configuration_fnet.py class FNetConfig (line 24) | class FNetConfig(PreTrainedConfig): FILE: src/transformers/models/fnet/convert_fnet_original_flax_checkpoint_to_pytorch.py function convert_flax_checkpoint_to_pytorch (line 28) | def convert_flax_checkpoint_to_pytorch(flax_checkpoint_path, fnet_config... FILE: src/transformers/models/fnet/modeling_fnet.py function _two_dim_matmul (line 53) | def _two_dim_matmul(x, matrix_dim_one, matrix_dim_two): function two_dim_matmul (line 62) | def two_dim_matmul(x, matrix_dim_one, matrix_dim_two): function fftn (line 67) | def fftn(x): class FNetEmbeddings (line 83) | class FNetEmbeddings(nn.Module): method __init__ (line 86) | def __init__(self, config): method forward (line 106) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class FNetBasicFourierTransform (line 142) | class FNetBasicFourierTransform(nn.Module): method __init__ (line 143) | def __init__(self, config): method _init_fourier_transform (line 147) | def _init_fourier_transform(self, config): method forward (line 170) | def forward(self, hidden_states): class FNetBasicOutput (line 180) | class FNetBasicOutput(nn.Module): method __init__ (line 181) | def __init__(self, config): method forward (line 185) | def forward(self, hidden_states, input_tensor): class FNetFourierTransform (line 190) | class FNetFourierTransform(nn.Module): method __init__ (line 191) | def __init__(self, config): method forward (line 196) | def forward(self, hidden_states): class FNetIntermediate (line 204) | class FNetIntermediate(nn.Module): method __init__ (line 205) | def __init__(self, config): method forward (line 213) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class FNetOutput (line 220) | class FNetOutput(nn.Module): method __init__ (line 221) | def __init__(self, config): method forward (line 227) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class FNetLayer (line 234) | class FNetLayer(GradientCheckpointingLayer): method __init__ (line 235) | def __init__(self, config): method forward (line 243) | def forward(self, hidden_states): method feed_forward_chunk (line 255) | def feed_forward_chunk(self, fourier_output): class FNetEncoder (line 261) | class FNetEncoder(nn.Module): method __init__ (line 262) | def __init__(self, config): method forward (line 268) | def forward(self, hidden_states, output_hidden_states=False, return_di... class FNetPooler (line 289) | class FNetPooler(nn.Module): method __init__ (line 290) | def __init__(self, config): method forward (line 295) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class FNetPredictionHeadTransform (line 305) | class FNetPredictionHeadTransform(nn.Module): method __init__ (line 306) | def __init__(self, config): method forward (line 315) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class FNetLMPredictionHead (line 322) | class FNetLMPredictionHead(nn.Module): method __init__ (line 323) | def __init__(self, config): method forward (line 329) | def forward(self, hidden_states): class FNetOnlyMLMHead (line 335) | class FNetOnlyMLMHead(nn.Module): method __init__ (line 336) | def __init__(self, config): method forward (line 340) | def forward(self, sequence_output): class FNetOnlyNSPHead (line 346) | class FNetOnlyNSPHead(nn.Module): method __init__ (line 347) | def __init__(self, config): method forward (line 351) | def forward(self, pooled_output): class FNetPreTrainingHeads (line 357) | class FNetPreTrainingHeads(nn.Module): method __init__ (line 358) | def __init__(self, config): method forward (line 363) | def forward(self, sequence_output, pooled_output): class FNetPreTrainedModel (line 370) | class FNetPreTrainedModel(PreTrainedModel): method _init_weights (line 375) | def _init_weights(self, module): class FNetForPreTrainingOutput (line 388) | class FNetForPreTrainingOutput(ModelOutput): class FNetModel (line 407) | class FNetModel(FNetPreTrainedModel): method __init__ (line 415) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 431) | def get_input_embeddings(self): method set_input_embeddings (line 434) | def set_input_embeddings(self, value): method forward (line 438) | def forward( class FNetForPreTraining (line 515) | class FNetForPreTraining(FNetPreTrainedModel): method __init__ (line 521) | def __init__(self, config): method get_output_embeddings (line 530) | def get_output_embeddings(self): method set_output_embeddings (line 533) | def set_output_embeddings(self, new_embeddings): method forward (line 538) | def forward( class FNetForMaskedLM (line 609) | class FNetForMaskedLM(FNetPreTrainedModel): method __init__ (line 615) | def __init__(self, config): method get_output_embeddings (line 624) | def get_output_embeddings(self): method set_output_embeddings (line 627) | def set_output_embeddings(self, new_embeddings): method forward (line 632) | def forward( class FNetForNextSentencePrediction (line 680) | class FNetForNextSentencePrediction(FNetPreTrainedModel): method __init__ (line 681) | def __init__(self, config): method forward (line 691) | def forward( class FNetForSequenceClassification (line 763) | class FNetForSequenceClassification(FNetPreTrainedModel): method __init__ (line 764) | def __init__(self, config): method forward (line 776) | def forward( class FNetForMultipleChoice (line 838) | class FNetForMultipleChoice(FNetPreTrainedModel): method __init__ (line 839) | def __init__(self, config): method forward (line 850) | def forward( class FNetForTokenClassification (line 931) | class FNetForTokenClassification(FNetPreTrainedModel): method __init__ (line 932) | def __init__(self, config): method forward (line 945) | def forward( class FNetForQuestionAnswering (line 990) | class FNetForQuestionAnswering(FNetPreTrainedModel): method __init__ (line 991) | def __init__(self, config): method forward (line 1003) | def forward( FILE: src/transformers/models/fnet/tokenization_fnet.py class FNetTokenizer (line 23) | class FNetTokenizer(AlbertTokenizer): FILE: src/transformers/models/focalnet/configuration_focalnet.py class FocalNetConfig (line 25) | class FocalNetConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 90) | def __post_init__(self, **kwargs): FILE: src/transformers/models/focalnet/convert_focalnet_to_hf_format.py function get_focalnet_config (line 30) | def get_focalnet_config(model_name): function rename_key (line 90) | def rename_key(name): function convert_focalnet_checkpoint (line 123) | def convert_focalnet_checkpoint(model_name, pytorch_dump_folder_path, pu... FILE: src/transformers/models/focalnet/modeling_focalnet.py class FocalNetEncoderOutput (line 43) | class FocalNetEncoderOutput(ModelOutput): class FocalNetModelOutput (line 64) | class FocalNetModelOutput(ModelOutput): class FocalNetMaskedImageModelingOutput (line 88) | class FocalNetMaskedImageModelingOutput(ModelOutput): class FocalNetImageClassifierOutput (line 114) | class FocalNetImageClassifierOutput(ModelOutput): class FocalNetEmbeddings (line 134) | class FocalNetEmbeddings(nn.Module): method __init__ (line 139) | def __init__(self, config, use_mask_token=False): method forward (line 157) | def forward( class FocalNetPatchEmbeddings (line 174) | class FocalNetPatchEmbeddings(nn.Module): method __init__ (line 175) | def __init__( method maybe_pad (line 217) | def maybe_pad(self, pixel_values, height, width): method forward (line 226) | def forward(self, pixel_values: torch.FloatTensor | None) -> tuple[tor... function drop_path (line 246) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class FocalNetDropPath (line 262) | class FocalNetDropPath(nn.Module): method __init__ (line 265) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 269) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 272) | def extra_repr(self) -> str: class FocalNetModulation (line 276) | class FocalNetModulation(nn.Module): method __init__ (line 277) | def __init__(self, config, index, dim, focal_factor=2, bias=True, proj... method forward (line 310) | def forward(self, hidden_state): class FocalNetMlp (line 347) | class FocalNetMlp(nn.Module): method __init__ (line 348) | def __init__(self, config, in_features, hidden_features=None, out_feat... method forward (line 357) | def forward(self, hidden_state): class FocalNetLayer (line 366) | class FocalNetLayer(nn.Module): method __init__ (line 382) | def __init__(self, config, index, dim, input_resolution, drop_path=0.0): method forward (line 414) | def forward(self, hidden_state, input_dimensions): class FocalNetStage (line 435) | class FocalNetStage(GradientCheckpointingLayer): method __init__ (line 436) | def __init__(self, config, index, input_resolution): method forward (line 480) | def forward(self, hidden_states: torch.Tensor, input_dimensions: tuple... class FocalNetEncoder (line 501) | class FocalNetEncoder(nn.Module): method __init__ (line 502) | def __init__(self, config, grid_size): method forward (line 520) | def forward( class FocalNetPreTrainedModel (line 577) | class FocalNetPreTrainedModel(PreTrainedModel): method _init_weights (line 585) | def _init_weights(self, module): class FocalNetModel (line 598) | class FocalNetModel(FocalNetPreTrainedModel): method __init__ (line 599) | def __init__(self, config, add_pooling_layer=True, use_mask_token=False): method get_input_embeddings (line 620) | def get_input_embeddings(self): method forward (line 624) | def forward( class FocalNetForMaskedImageModeling (line 688) | class FocalNetForMaskedImageModeling(FocalNetPreTrainedModel): method __init__ (line 689) | def __init__(self, config): method forward (line 707) | def forward( class FocalNetForImageClassification (line 795) | class FocalNetForImageClassification(FocalNetPreTrainedModel): method __init__ (line 797) | def __init__(self, config): method forward (line 812) | def forward( class FocalNetBackbone (line 859) | class FocalNetBackbone(BackboneMixin, FocalNetPreTrainedModel): method __init__ (line 862) | def __init__(self, config: FocalNetConfig): method forward (line 874) | def forward( FILE: src/transformers/models/fsmt/configuration_fsmt.py class FSMTConfig (line 24) | class FSMTConfig(PreTrainedConfig): method __post_init__ (line 103) | def __post_init__(self, **kwargs): FILE: src/transformers/models/fsmt/convert_fsmt_original_pytorch_checkpoint_to_pytorch.py function rewrite_dict_keys (line 77) | def rewrite_dict_keys(d): function convert_fsmt_checkpoint_to_pytorch (line 89) | def convert_fsmt_checkpoint_to_pytorch(fsmt_checkpoint_path, pytorch_dum... FILE: src/transformers/models/fsmt/modeling_fsmt.py function invert_mask (line 174) | def invert_mask(attention_mask): function triu_onnx (line 180) | def triu_onnx(x, diagonal=0): function _prepare_fsmt_decoder_inputs (line 191) | def _prepare_fsmt_decoder_inputs( class PretrainedFSMTModel (line 218) | class PretrainedFSMTModel(PreTrainedModel): method _init_weights (line 223) | def _init_weights(self, module): method dummy_inputs (line 239) | def dummy_inputs(self): function _make_linear_from_emb (line 249) | def _make_linear_from_emb(emb): function _check_shapes (line 257) | def _check_shapes(shape_1, shape2): function shift_tokens_right (line 262) | def shift_tokens_right(input_ids, pad_token_id): function make_padding_mask (line 275) | def make_padding_mask(input_ids, padding_idx=1): class EncoderLayer (line 286) | class EncoderLayer(nn.Module): method __init__ (line 287) | def __init__(self, config: FSMTConfig): method forward (line 299) | def forward(self, x, encoder_padding_mask, output_attentions=False): class FSMTEncoder (line 332) | class FSMTEncoder(nn.Module): method __init__ (line 340) | def __init__(self, config: FSMTConfig): method forward (line 353) | def forward( class DecoderLayer (line 439) | class DecoderLayer(nn.Module): method __init__ (line 440) | def __init__(self, config: FSMTConfig, layer_idx=None): method forward (line 467) | def forward( class FSMTDecoder (line 522) | class FSMTDecoder(nn.Module): method __init__ (line 531) | def __init__(self, config: FSMTConfig): method forward (line 545) | def forward( function _reorder_buffer (line 666) | def _reorder_buffer(attn_cache, new_order): class Attention (line 673) | class Attention(nn.Module): method __init__ (line 676) | def __init__( method forward (line 701) | def forward( function fill_with_neg_inf (line 800) | def fill_with_neg_inf(t): function _get_shape (line 806) | def _get_shape(t): class FSMTModel (line 811) | class FSMTModel(PretrainedFSMTModel): method __init__ (line 817) | def __init__(self, config: FSMTConfig): method forward (line 824) | def forward( method get_input_embeddings (line 929) | def get_input_embeddings(self): method set_input_embeddings (line 932) | def set_input_embeddings(self, value): method get_output_embeddings (line 935) | def get_output_embeddings(self): method set_output_embeddings (line 938) | def set_output_embeddings(self, value): class FSMTForConditionalGeneration (line 947) | class FSMTForConditionalGeneration(PretrainedFSMTModel, GenerationMixin): method __init__ (line 950) | def __init__(self, config: FSMTConfig): method forward (line 959) | def forward( method prepare_decoder_input_ids_from_labels (line 1054) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method get_output_embeddings (line 1057) | def get_output_embeddings(self): method set_output_embeddings (line 1060) | def set_output_embeddings(self, value): class SinusoidalPositionalEmbedding (line 1064) | class SinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 1075) | def __init__(self, num_positions, embedding_dim, padding_idx): method make_weight (line 1078) | def make_weight(self, num_positions, embedding_dim, padding_idx): method get_embedding (line 1087) | def get_embedding(num_embeddings, embedding_dim, padding_idx): method make_positions (line 1107) | def make_positions(tensor, padding_idx: int): method forward (line 1120) | def forward( FILE: src/transformers/models/fsmt/tokenization_fsmt.py function get_pairs (line 34) | def get_pairs(word): function replace_unicode_punct (line 47) | def replace_unicode_punct(text): function remove_non_printing_char (line 90) | def remove_non_printing_char(text): class FSMTTokenizer (line 112) | class FSMTTokenizer(PreTrainedTokenizer): method __init__ (line 161) | def __init__( method get_vocab (line 228) | def get_vocab(self) -> dict[str, int]: method vocab_size (line 233) | def vocab_size(self) -> int: method moses_punct_norm (line 236) | def moses_punct_norm(self, text, lang): method moses_tokenize (line 242) | def moses_tokenize(self, text, lang): method moses_detokenize (line 250) | def moses_detokenize(self, tokens, lang): method moses_pipeline (line 256) | def moses_pipeline(self, text, lang): method src_vocab_size (line 263) | def src_vocab_size(self): method tgt_vocab_size (line 267) | def tgt_vocab_size(self): method get_src_vocab (line 270) | def get_src_vocab(self): method get_tgt_vocab (line 273) | def get_tgt_vocab(self): method bpe (line 276) | def bpe(self, token): method _tokenize (line 320) | def _tokenize(self, text, lang="en", bypass_tokenizer=False): method _convert_token_to_id (line 359) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 363) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 367) | def convert_tokens_to_string(self, tokens): method build_inputs_with_special_tokens (line 377) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 403) | def get_special_tokens_mask( method save_vocabulary (line 431) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method __getstate__ (line 467) | def __getstate__(self): method __setstate__ (line 472) | def __setstate__(self, d): FILE: src/transformers/models/funnel/configuration_funnel.py class FunnelConfig (line 24) | class FunnelConfig(PreTrainedConfig): method __post_init__ (line 75) | def __post_init__(self, **kwargs): method validate_architecture (line 79) | def validate_architecture(self): method num_hidden_layers (line 97) | def num_hidden_layers(self): method num_hidden_layers (line 101) | def num_hidden_layers(self, value): method num_blocks (line 107) | def num_blocks(self): method num_blocks (line 111) | def num_blocks(self, value): FILE: src/transformers/models/funnel/convert_funnel_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_funnel (line 30) | def load_tf_weights_in_funnel(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 120) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, py... FILE: src/transformers/models/funnel/modeling_funnel.py class FunnelEmbeddings (line 44) | class FunnelEmbeddings(nn.Module): method __init__ (line 45) | def __init__(self, config: FunnelConfig) -> None: method forward (line 51) | def forward( class FunnelAttentionStructure (line 61) | class FunnelAttentionStructure(nn.Module): method __init__ (line 68) | def __init__(self, config: FunnelConfig) -> None: method init_attention_inputs (line 77) | def init_attention_inputs( method token_type_ids_to_mat (line 97) | def token_type_ids_to_mat(self, token_type_ids: torch.Tensor) -> torch... method get_position_embeds (line 105) | def get_position_embeds( method stride_pool_pos (line 185) | def stride_pool_pos(self, pos_id: torch.Tensor, block_index: int): method relative_pos (line 200) | def relative_pos(self, pos: torch.Tensor, stride: int, pooled_pos=None... method stride_pool (line 214) | def stride_pool( method pool_tensor (line 247) | def pool_tensor( method pre_attention_pooling (line 285) | def pre_attention_pooling( method post_attention_pooling (line 307) | def post_attention_pooling(self, attention_inputs: tuple[torch.Tensor]... function _relative_shift_gather (line 321) | def _relative_shift_gather(positional_attn: torch.Tensor, context_len: i... class FunnelRelMultiheadAttention (line 337) | class FunnelRelMultiheadAttention(nn.Module): method __init__ (line 338) | def __init__(self, config: FunnelConfig, block_index: int) -> None: method relative_positional_attention (line 361) | def relative_positional_attention(self, position_embeds, q_head, conte... method relative_token_type_attention (line 403) | def relative_token_type_attention(self, token_type_mat, q_head, cls_ma... method forward (line 427) | def forward( class FunnelPositionwiseFFN (line 481) | class FunnelPositionwiseFFN(nn.Module): method __init__ (line 482) | def __init__(self, config: FunnelConfig) -> None: method forward (line 491) | def forward(self, hidden: torch.Tensor) -> torch.Tensor: class FunnelLayer (line 500) | class FunnelLayer(nn.Module): method __init__ (line 501) | def __init__(self, config: FunnelConfig, block_index: int) -> None: method forward (line 506) | def forward( class FunnelEncoder (line 519) | class FunnelEncoder(nn.Module): method __init__ (line 520) | def __init__(self, config: FunnelConfig) -> None: method forward (line 531) | def forward( function upsample (line 582) | def upsample( class FunnelDecoder (line 604) | class FunnelDecoder(nn.Module): method __init__ (line 605) | def __init__(self, config: FunnelConfig) -> None: method forward (line 611) | def forward( class FunnelDiscriminatorPredictions (line 653) | class FunnelDiscriminatorPredictions(nn.Module): method __init__ (line 656) | def __init__(self, config: FunnelConfig) -> None: method forward (line 662) | def forward(self, discriminator_hidden_states: torch.Tensor) -> torch.... class FunnelPreTrainedModel (line 670) | class FunnelPreTrainedModel(PreTrainedModel): method _init_weights (line 675) | def _init_weights(self, module): class FunnelClassificationHead (line 700) | class FunnelClassificationHead(nn.Module): method __init__ (line 701) | def __init__(self, config: FunnelConfig, n_labels: int) -> None: method forward (line 707) | def forward(self, hidden: torch.Tensor) -> torch.Tensor: class FunnelForPreTrainingOutput (line 720) | class FunnelForPreTrainingOutput(ModelOutput): class FunnelBaseModel (line 740) | class FunnelBaseModel(FunnelPreTrainedModel): method __init__ (line 741) | def __init__(self, config: FunnelConfig) -> None: method get_input_embeddings (line 750) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 753) | def set_input_embeddings(self, new_embeddings: nn.Embedding) -> None: method forward (line 757) | def forward( class FunnelModel (line 807) | class FunnelModel(FunnelPreTrainedModel): method __init__ (line 808) | def __init__(self, config: FunnelConfig) -> None: method get_input_embeddings (line 818) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 821) | def set_input_embeddings(self, new_embeddings: nn.Embedding) -> None: method forward (line 825) | def forward( class FunnelForPreTraining (line 906) | class FunnelForPreTraining(FunnelPreTrainedModel): method __init__ (line 907) | def __init__(self, config: FunnelConfig) -> None: method forward (line 916) | def forward( class FunnelForMaskedLM (line 987) | class FunnelForMaskedLM(FunnelPreTrainedModel): method __init__ (line 990) | def __init__(self, config: FunnelConfig) -> None: method get_output_embeddings (line 999) | def get_output_embeddings(self) -> nn.Linear: method set_output_embeddings (line 1002) | def set_output_embeddings(self, new_embeddings: nn.Embedding) -> None: method forward (line 1006) | def forward( class FunnelForSequenceClassification (line 1062) | class FunnelForSequenceClassification(FunnelPreTrainedModel): method __init__ (line 1063) | def __init__(self, config: FunnelConfig) -> None: method forward (line 1074) | def forward( class FunnelForMultipleChoice (line 1144) | class FunnelForMultipleChoice(FunnelPreTrainedModel): method __init__ (line 1145) | def __init__(self, config: FunnelConfig) -> None: method forward (line 1154) | def forward( class FunnelForTokenClassification (line 1217) | class FunnelForTokenClassification(FunnelPreTrainedModel): method __init__ (line 1218) | def __init__(self, config: FunnelConfig) -> None: method forward (line 1230) | def forward( class FunnelForQuestionAnswering (line 1280) | class FunnelForQuestionAnswering(FunnelPreTrainedModel): method __init__ (line 1281) | def __init__(self, config: FunnelConfig) -> None: method forward (line 1292) | def forward( FILE: src/transformers/models/funnel/tokenization_funnel.py class FunnelTokenizer (line 41) | class FunnelTokenizer(TokenizersBackend): method __init__ (line 91) | def __init__( FILE: src/transformers/models/fuyu/configuration_fuyu.py class FuyuConfig (line 29) | class FuyuConfig(PreTrainedConfig): method __post_init__ (line 69) | def __post_init__(self, **kwargs): FILE: src/transformers/models/fuyu/convert_fuyu_model_weights_to_hf.py function rename_state_dict (line 67) | def rename_state_dict(state_dict): function convert_fuyu_checkpoint (line 80) | def convert_fuyu_checkpoint(pytorch_dump_folder_path, ada_lib_path, pt_m... function main (line 93) | def main(): FILE: src/transformers/models/fuyu/image_processing_fuyu.py function make_list_of_list_of_images (line 43) | def make_list_of_list_of_images( class FuyuImagesKwargs (line 58) | class FuyuImagesKwargs(ImagesKwargs, total=False): class FuyuBatchFeature (line 73) | class FuyuBatchFeature(BatchFeature): method convert_to_tensors (line 80) | def convert_to_tensors(self, tensor_type: str | TensorType | None = No... method to (line 123) | def to(self, *args, **kwargs) -> "BatchFeature": class FuyuImageProcessor (line 185) | class FuyuImageProcessor(TorchvisionBackend): method __init__ (line 207) | def __init__(self, **kwargs: Unpack[FuyuImagesKwargs]): method _prepare_images_structure (line 210) | def _prepare_images_structure( method resize (line 218) | def resize( method _preprocess (line 258) | def _preprocess( method get_num_patches (line 328) | def get_num_patches(self, image_height: int, image_width: int, patch_s... method patchify_image (line 354) | def patchify_image(self, image: torch.Tensor, patch_size: SizeDict | N... method preprocess_with_tokenizer_info (line 381) | def preprocess_with_tokenizer_info( method _standardize_kwargs (line 515) | def _standardize_kwargs( FILE: src/transformers/models/fuyu/image_processing_pil_fuyu.py class FuyuBatchFeature (line 44) | class FuyuBatchFeature(BatchFeature): method convert_to_tensors (line 51) | def convert_to_tensors(self, tensor_type: str | TensorType | None = No... method to (line 94) | def to(self, *args, **kwargs) -> "BatchFeature": class FuyuImagesKwargs (line 156) | class FuyuImagesKwargs(ImagesKwargs, total=False): function make_list_of_list_of_images (line 172) | def make_list_of_list_of_images( class FuyuImageProcessorPil (line 189) | class FuyuImageProcessorPil(PilBackend): method __init__ (line 211) | def __init__(self, **kwargs: Unpack[FuyuImagesKwargs]): method _prepare_images_structure (line 214) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method resize (line 218) | def resize( method _preprocess (line 252) | def _preprocess( method get_num_patches (line 329) | def get_num_patches(self, image_height: int, image_width: int, patch_s... method patchify_image (line 355) | def patchify_image( method preprocess_with_tokenizer_info (line 431) | def preprocess_with_tokenizer_info( method _standardize_kwargs (line 569) | def _standardize_kwargs(self, patch_size: dict[str, int] | SizeDict | ... FILE: src/transformers/models/fuyu/modeling_fuyu.py class FuyuPreTrainedModel (line 33) | class FuyuPreTrainedModel(PreTrainedModel): class FuyuModel (line 51) | class FuyuModel(FuyuPreTrainedModel): method __init__ (line 52) | def __init__(self, config: FuyuConfig): method get_input_embeddings (line 65) | def get_input_embeddings(self): method set_input_embeddings (line 68) | def set_input_embeddings(self, value): method gather_continuous_embeddings (line 71) | def gather_continuous_embeddings( method get_image_features (line 117) | def get_image_features( method get_placeholder_mask (line 127) | def get_placeholder_mask( method forward (line 153) | def forward( class FuyuForCausalLM (line 214) | class FuyuForCausalLM(FuyuPreTrainedModel, GenerationMixin): method __init__ (line 217) | def __init__(self, config: FuyuConfig): method get_input_embeddings (line 223) | def get_input_embeddings(self): method set_input_embeddings (line 226) | def set_input_embeddings(self, value): method forward (line 231) | def forward( method prepare_inputs_for_generation (line 313) | def prepare_inputs_for_generation( FILE: src/transformers/models/fuyu/processing_fuyu.py class FuyuProcessorKwargs (line 58) | class FuyuProcessorKwargs(ProcessingKwargs, total=False): function full_unpacked_stream_to_tensor (line 76) | def full_unpacked_stream_to_tensor( function construct_full_unpacked_stream (line 107) | def construct_full_unpacked_stream( function _replace_string_repr_with_token_tags (line 135) | def _replace_string_repr_with_token_tags(prompt: str) -> str: function _segment_prompt_into_text_token_conversions (line 143) | def _segment_prompt_into_text_token_conversions(prompt: str) -> list: function _transform_coordinates_and_tokenize (line 168) | def _transform_coordinates_and_tokenize(prompt: str, scale_factor: float... function _transform_within_tags (line 200) | def _transform_within_tags(text: str, scale_factor: float, tokenizer) ->... function _tokenize_prompts_with_image_and_batch (line 235) | def _tokenize_prompts_with_image_and_batch( function original_to_transformed_h_coords (line 309) | def original_to_transformed_h_coords(original_coords, scale_h): function original_to_transformed_w_coords (line 314) | def original_to_transformed_w_coords(original_coords, scale_w): function scale_point_to_transformed_image (line 318) | def scale_point_to_transformed_image(x: float, y: float, scale_factor: f... function scale_bbox_to_transformed_image (line 324) | def scale_bbox_to_transformed_image( class FuyuProcessor (line 336) | class FuyuProcessor(ProcessorMixin): method _load_tokenizer_from_pretrained (line 338) | def _load_tokenizer_from_pretrained( method __init__ (line 353) | def __init__(self, image_processor, tokenizer, **kwargs): method _left_pad_inputs_with_attention_mask (line 365) | def _left_pad_inputs_with_attention_mask(self, model_inputs: list[dict... method get_sample_encoding (line 419) | def get_sample_encoding( method __call__ (line 486) | def __call__( method _get_num_multimodal_tokens (line 573) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method post_process_box_coordinates (line 616) | def post_process_box_coordinates(self, outputs, target_sizes=None): method post_process_image_text_to_text (line 725) | def post_process_image_text_to_text(self, generated_outputs, skip_spec... method model_input_names (line 756) | def model_input_names(self): FILE: src/transformers/models/gemma/configuration_gemma.py class GemmaConfig (line 32) | class GemmaConfig(PreTrainedConfig): FILE: src/transformers/models/gemma/convert_gemma_weights_to_hf.py function write_model (line 58) | def write_model(save_path, input_base_path, config, push_to_hub=False, d... function write_tokenizer (line 118) | def write_tokenizer(input_tokenizer_path, save_path, push_to_hub=False): function main (line 134) | def main(): FILE: src/transformers/models/gemma/modeling_gemma.py class GemmaTextScaledWordEmbedding (line 50) | class GemmaTextScaledWordEmbedding(nn.Embedding): method __init__ (line 55) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 60) | def forward(self, input_ids: torch.Tensor): class GemmaRMSNorm (line 64) | class GemmaRMSNorm(nn.Module): method __init__ (line 65) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 70) | def _norm(self, x): method forward (line 73) | def forward(self, x): method extra_repr (line 80) | def extra_repr(self): class GemmaMLP (line 84) | class GemmaMLP(nn.Module): method __init__ (line 85) | def __init__(self, config): method forward (line 95) | def forward(self, x): class GemmaRotaryEmbedding (line 100) | class GemmaRotaryEmbedding(nn.Module): method __init__ (line 103) | def __init__(self, config: GemmaConfig, device=None): method compute_default_rope_parameters (line 120) | def compute_default_rope_parameters( method forward (line 151) | def forward(self, x, position_ids): function rotate_half (line 165) | def rotate_half(x): function apply_rotary_pos_emb (line 173) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 198) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 210) | def eager_attention_forward( class GemmaAttention (line 236) | class GemmaAttention(nn.Module): method __init__ (line 239) | def __init__(self, config: GemmaConfig, layer_idx: int): method forward (line 262) | def forward( class GemmaDecoderLayer (line 303) | class GemmaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 304) | def __init__(self, config: GemmaConfig, layer_idx: int): method forward (line 314) | def forward( class GemmaPreTrainedModel (line 347) | class GemmaPreTrainedModel(PreTrainedModel): method _init_weights (line 365) | def _init_weights(self, module): class GemmaModel (line 375) | class GemmaModel(GemmaPreTrainedModel): method __init__ (line 376) | def __init__(self, config: GemmaConfig): method forward (line 397) | def forward( class GemmaForCausalLM (line 451) | class GemmaForCausalLM(GemmaPreTrainedModel, GenerationMixin): method __init__ (line 456) | def __init__(self, config): method forward (line 467) | def forward( class GemmaForSequenceClassification (line 524) | class GemmaForSequenceClassification(GenericForSequenceClassification, G... class GemmaForTokenClassification (line 528) | class GemmaForTokenClassification(GenericForTokenClassification, GemmaPr... FILE: src/transformers/models/gemma/modular_gemma.py class GemmaConfig (line 51) | class GemmaConfig(PreTrainedConfig): class GemmaTextScaledWordEmbedding (line 105) | class GemmaTextScaledWordEmbedding(nn.Embedding): method __init__ (line 110) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 115) | def forward(self, input_ids: torch.Tensor): class GemmaRMSNorm (line 119) | class GemmaRMSNorm(nn.Module): method __init__ (line 120) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 125) | def _norm(self, x): method forward (line 128) | def forward(self, x): method extra_repr (line 135) | def extra_repr(self): class GemmaMLP (line 139) | class GemmaMLP(LlamaMLP): method __init__ (line 140) | def __init__(self, config): class GemmaRotaryEmbedding (line 147) | class GemmaRotaryEmbedding(LlamaRotaryEmbedding): class GemmaAttention (line 151) | class GemmaAttention(LlamaAttention): method __init__ (line 154) | def __init__(self, config: GemmaConfig, layer_idx: int): class GemmaPreTrainedModel (line 159) | class GemmaPreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 161) | def _init_weights(self, module): class GemmaModel (line 170) | class GemmaModel(LlamaModel): method __init__ (line 171) | def __init__(self, config: GemmaConfig): method forward (line 178) | def forward( class GemmaForCausalLM (line 231) | class GemmaForCausalLM(LlamaForCausalLM): method forward (line 232) | def forward(**super_kwargs): class GemmaForSequenceClassification (line 253) | class GemmaForSequenceClassification(LlamaForSequenceClassification): class GemmaForTokenClassification (line 257) | class GemmaForTokenClassification(LlamaForTokenClassification): FILE: src/transformers/models/gemma/tokenization_gemma.py class GemmaTokenizer (line 26) | class GemmaTokenizer(TokenizersBackend): method __init__ (line 59) | def __init__( FILE: src/transformers/models/gemma2/configuration_gemma2.py class Gemma2Config (line 30) | class Gemma2Config(PreTrainedConfig): method __post_init__ (line 94) | def __post_init__(self, **kwargs): method validate_architecture (line 102) | def validate_architecture(self): FILE: src/transformers/models/gemma2/convert_gemma2_weights_to_hf.py function write_model (line 74) | def write_model(save_path, input_base_path, config, push_to_hub=False, d... function write_tokenizer (line 151) | def write_tokenizer(input_tokenizer_path, save_path, push_to_hub=False): function main (line 167) | def main(): FILE: src/transformers/models/gemma2/modeling_gemma2.py class Gemma2RMSNorm (line 49) | class Gemma2RMSNorm(nn.Module): method __init__ (line 50) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 55) | def _norm(self, x): method forward (line 58) | def forward(self, x): method extra_repr (line 65) | def extra_repr(self): class Gemma2MLP (line 69) | class Gemma2MLP(nn.Module): method __init__ (line 70) | def __init__(self, config): method forward (line 80) | def forward(self, x): class Gemma2RotaryEmbedding (line 85) | class Gemma2RotaryEmbedding(nn.Module): method __init__ (line 88) | def __init__(self, config: Gemma2Config, device=None): method compute_default_rope_parameters (line 105) | def compute_default_rope_parameters( method forward (line 136) | def forward(self, x, position_ids): function rotate_half (line 150) | def rotate_half(x): function apply_rotary_pos_emb (line 158) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 183) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 195) | def eager_attention_forward( class Gemma2Attention (line 230) | class Gemma2Attention(nn.Module): method __init__ (line 233) | def __init__(self, config: Gemma2Config, layer_idx: int): method forward (line 259) | def forward( class Gemma2DecoderLayer (line 302) | class Gemma2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 303) | def __init__(self, config: Gemma2Config, layer_idx: int): method forward (line 315) | def forward( class Gemma2TextScaledWordEmbedding (line 349) | class Gemma2TextScaledWordEmbedding(nn.Embedding): method __init__ (line 354) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 359) | def forward(self, input_ids: torch.Tensor): class Gemma2PreTrainedModel (line 364) | class Gemma2PreTrainedModel(PreTrainedModel): method _init_weights (line 382) | def _init_weights(self, module): class Gemma2Model (line 392) | class Gemma2Model(Gemma2PreTrainedModel): method __init__ (line 393) | def __init__(self, config: Gemma2Config): method forward (line 414) | def forward( class Gemma2ForCausalLM (line 477) | class Gemma2ForCausalLM(Gemma2PreTrainedModel, GenerationMixin): method __init__ (line 482) | def __init__(self, config): method forward (line 493) | def forward( class Gemma2ForSequenceClassification (line 555) | class Gemma2ForSequenceClassification(GenericForSequenceClassification, ... class Gemma2ForTokenClassification (line 559) | class Gemma2ForTokenClassification(GenericForTokenClassification, Gemma2... FILE: src/transformers/models/gemma2/modular_gemma2.py class Gemma2Config (line 57) | class Gemma2Config(PreTrainedConfig): method __post_init__ (line 121) | def __post_init__(self, **kwargs): method validate_architecture (line 129) | def validate_architecture(self): class Gemma2RMSNorm (line 138) | class Gemma2RMSNorm(GemmaRMSNorm): class Gemma2MLP (line 142) | class Gemma2MLP(GemmaMLP): method __init__ (line 143) | def __init__(self, config): class Gemma2RotaryEmbedding (line 148) | class Gemma2RotaryEmbedding(GemmaRotaryEmbedding): method __init__ (line 149) | def __init__(self, config: Gemma2Config, device=None): method forward (line 167) | def forward(self, x, position_ids): function eager_attention_forward (line 181) | def eager_attention_forward( class Gemma2Attention (line 215) | class Gemma2Attention(GemmaAttention): method __init__ (line 216) | def __init__(self, config: Gemma2Config, layer_idx: int): method forward (line 226) | def forward( class Gemma2DecoderLayer (line 269) | class Gemma2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 270) | def __init__(self, config: Gemma2Config, layer_idx: int): method forward (line 282) | def forward( class Gemma2PreTrainedModel (line 316) | class Gemma2PreTrainedModel(GemmaPreTrainedModel): class Gemma2Model (line 320) | class Gemma2Model(GemmaModel): method __init__ (line 321) | def __init__(self, config: Gemma2Config): method forward (line 328) | def forward( class Gemma2ForCausalLM (line 390) | class Gemma2ForCausalLM(GemmaForCausalLM): method __init__ (line 391) | def __init__(self, config): method forward (line 396) | def forward( class Gemma2ForSequenceClassification (line 458) | class Gemma2ForSequenceClassification(GemmaForSequenceClassification): class Gemma2ForTokenClassification (line 462) | class Gemma2ForTokenClassification(GemmaForTokenClassification): FILE: src/transformers/models/gemma3/configuration_gemma3.py class Gemma3TextConfig (line 35) | class Gemma3TextConfig(PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): method validate_architecture (line 119) | def validate_architecture(self): method convert_rope_params_to_dict (line 127) | def convert_rope_params_to_dict(self, **kwargs): class Gemma3Config (line 159) | class Gemma3Config(PreTrainedConfig): method __post_init__ (line 209) | def __post_init__(self, **kwargs): FILE: src/transformers/models/gemma3/convert_gemma3_weights.py function get_chat_template (line 326) | def get_chat_template() -> str | None: function convert_siglip_weight (line 337) | def convert_siglip_weight( function convert_transformer_weights (line 424) | def convert_transformer_weights( function convert (line 540) | def convert( function main (line 594) | def main(*args): FILE: src/transformers/models/gemma3/image_processing_gemma3.py class Gemma3ImageProcessorKwargs (line 39) | class Gemma3ImageProcessorKwargs(ImagesKwargs, total=False): class Gemma3ImageProcessor (line 58) | class Gemma3ImageProcessor(TorchvisionBackend): method __init__ (line 75) | def __init__(self, **kwargs: Unpack[Gemma3ImageProcessorKwargs]): method preprocess (line 79) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Gemma3ImageP... method pan_and_scan_batched (line 82) | def pan_and_scan_batched( method _process_images_for_pan_and_scan (line 150) | def _process_images_for_pan_and_scan( method _preprocess (line 167) | def _preprocess( FILE: src/transformers/models/gemma3/image_processing_pil_gemma3.py class Gemma3ImageProcessorKwargs (line 39) | class Gemma3ImageProcessorKwargs(ImagesKwargs, total=False): class Gemma3ImageProcessorPil (line 58) | class Gemma3ImageProcessorPil(PilBackend): method __init__ (line 75) | def __init__(self, **kwargs: Unpack[Gemma3ImageProcessorKwargs]): method preprocess (line 79) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Gemma3ImageP... method pan_and_scan (line 82) | def pan_and_scan( method _process_images_for_pan_and_scan (line 151) | def _process_images_for_pan_and_scan( method _preprocess (line 172) | def _preprocess( FILE: src/transformers/models/gemma3/modeling_gemma3.py class Gemma3ModelOutputWithPast (line 62) | class Gemma3ModelOutputWithPast(BaseModelOutputWithPast): class Gemma3CausalLMOutputWithPast (line 78) | class Gemma3CausalLMOutputWithPast(ModelOutput): class Gemma3TextScaledWordEmbedding (line 102) | class Gemma3TextScaledWordEmbedding(nn.Embedding): method __init__ (line 107) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 112) | def forward(self, input_ids: torch.Tensor): class Gemma3MLP (line 116) | class Gemma3MLP(nn.Module): method __init__ (line 117) | def __init__(self, config: Gemma3TextConfig): method forward (line 127) | def forward(self, x): class Gemma3RMSNorm (line 132) | class Gemma3RMSNorm(nn.Module): method __init__ (line 133) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 138) | def _norm(self, x): method forward (line 141) | def forward(self, x): method extra_repr (line 148) | def extra_repr(self): class Gemma3RotaryEmbedding (line 152) | class Gemma3RotaryEmbedding(nn.Module): method __init__ (line 155) | def __init__(self, config: Gemma3TextConfig, device=None, layer_type=N... method compute_default_rope_parameters (line 179) | def compute_default_rope_parameters( method forward (line 216) | def forward(self, x, position_ids, layer_type=None): function rotate_half (line 233) | def rotate_half(x): function apply_rotary_pos_emb (line 241) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 266) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 278) | def eager_attention_forward( class Gemma3Attention (line 313) | class Gemma3Attention(nn.Module): method __init__ (line 316) | def __init__(self, config: Gemma3TextConfig, layer_idx: int): method forward (line 346) | def forward( class Gemma3DecoderLayer (line 391) | class Gemma3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 392) | def __init__(self, config: Gemma3TextConfig, layer_idx: int): method forward (line 404) | def forward( class Gemma3PreTrainedModel (line 438) | class Gemma3PreTrainedModel(PreTrainedModel): method _init_weights (line 462) | def _init_weights(self, module): function _bidirectional_window_overlay (line 481) | def _bidirectional_window_overlay(sliding_window: int) -> Callable[[int,... class Gemma3TextModel (line 495) | class Gemma3TextModel(Gemma3PreTrainedModel): method __init__ (line 499) | def __init__(self, config: Gemma3TextConfig): method forward (line 521) | def forward( class Gemma3ForCausalLM (line 592) | class Gemma3ForCausalLM(Gemma3PreTrainedModel, GenerationMixin): method __init__ (line 598) | def __init__(self, config: Gemma3TextConfig): method forward (line 609) | def forward( class Gemma3MultiModalProjector (line 671) | class Gemma3MultiModalProjector(nn.Module): method __init__ (line 672) | def __init__(self, config: Gemma3Config): method forward (line 688) | def forward(self, vision_outputs: torch.Tensor): function token_type_ids_mask_function (line 707) | def token_type_ids_mask_function( function create_causal_mask_mapping (line 748) | def create_causal_mask_mapping( class Gemma3Model (line 807) | class Gemma3Model(Gemma3PreTrainedModel): method __init__ (line 811) | def __init__(self, config: Gemma3Config): method get_input_embeddings (line 821) | def get_input_embeddings(self): method set_input_embeddings (line 824) | def set_input_embeddings(self, value): method get_image_features (line 829) | def get_image_features( method get_placeholder_mask (line 838) | def get_placeholder_mask( method forward (line 864) | def forward( class Gemma3ForConditionalGeneration (line 966) | class Gemma3ForConditionalGeneration(Gemma3PreTrainedModel, GenerationMi... method __init__ (line 972) | def __init__(self, config: Gemma3Config): method get_input_embeddings (line 978) | def get_input_embeddings(self): method set_input_embeddings (line 981) | def set_input_embeddings(self, value): method get_image_features (line 985) | def get_image_features(self, pixel_values: torch.FloatTensor, **kwargs... method forward (line 990) | def forward( method prepare_inputs_for_generation (line 1098) | def prepare_inputs_for_generation( method create_masks_for_generate (line 1138) | def create_masks_for_generate( class Gemma3ForSequenceClassification (line 1161) | class Gemma3ForSequenceClassification(Gemma3PreTrainedModel): method __init__ (line 1162) | def __init__(self, config): method get_input_embeddings (line 1171) | def get_input_embeddings(self): method set_input_embeddings (line 1174) | def set_input_embeddings(self, value): method forward (line 1179) | def forward( class Gemma3TextForSequenceClassification (line 1249) | class Gemma3TextForSequenceClassification(GenericForSequenceClassificati... FILE: src/transformers/models/gemma3/modular_gemma3.py class Gemma3TextConfig (line 64) | class Gemma3TextConfig(Gemma2Config, PreTrainedConfig): method __post_init__ (line 109) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 124) | def convert_rope_params_to_dict(self, **kwargs): class Gemma3Config (line 156) | class Gemma3Config(PreTrainedConfig): method __post_init__ (line 206) | def __post_init__(self, **kwargs): class Gemma3ModelOutputWithPast (line 222) | class Gemma3ModelOutputWithPast(PaligemmaModelOutputWithPast): class Gemma3CausalLMOutputWithPast (line 226) | class Gemma3CausalLMOutputWithPast(PaliGemmaCausalLMOutputWithPast): class Gemma3TextScaledWordEmbedding (line 230) | class Gemma3TextScaledWordEmbedding(nn.Embedding): method __init__ (line 235) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 240) | def forward(self, input_ids: torch.Tensor): class Gemma3MLP (line 244) | class Gemma3MLP(Gemma2MLP): method __init__ (line 245) | def __init__(self, config: Gemma3TextConfig): class Gemma3RMSNorm (line 249) | class Gemma3RMSNorm(Gemma2RMSNorm): method __init__ (line 250) | def __init__(self, dim: int, eps: float = 1e-6): class Gemma3RotaryEmbedding (line 254) | class Gemma3RotaryEmbedding(Gemma2RotaryEmbedding): method __init__ (line 255) | def __init__(self, config: Gemma3TextConfig, device=None, layer_type=N... method compute_default_rope_parameters (line 279) | def compute_default_rope_parameters( method forward (line 316) | def forward(self, x, position_ids, layer_type=None): class Gemma3Attention (line 334) | class Gemma3Attention(Gemma2Attention): method __init__ (line 335) | def __init__(self, config: Gemma3TextConfig, layer_idx: int): method forward (line 344) | def forward( class Gemma3DecoderLayer (line 389) | class Gemma3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 390) | def __init__(self, config: Gemma3TextConfig, layer_idx: int): method forward (line 402) | def forward( class Gemma3PreTrainedModel (line 438) | class Gemma3PreTrainedModel(Gemma2PreTrainedModel): method _init_weights (line 449) | def _init_weights(self, module): function _bidirectional_window_overlay (line 468) | def _bidirectional_window_overlay(sliding_window: int) -> Callable[[int,... class Gemma3TextModel (line 481) | class Gemma3TextModel(Gemma2Model): method __init__ (line 485) | def __init__(self, config: Gemma3TextConfig): method forward (line 493) | def forward( class Gemma3ForCausalLM (line 563) | class Gemma3ForCausalLM(Gemma2ForCausalLM): method __init__ (line 566) | def __init__(self, config: Gemma3TextConfig): class Gemma3MultiModalProjector (line 571) | class Gemma3MultiModalProjector(nn.Module): method __init__ (line 572) | def __init__(self, config: Gemma3Config): method forward (line 588) | def forward(self, vision_outputs: torch.Tensor): function create_causal_mask_mapping (line 608) | def create_causal_mask_mapping( class Gemma3Model (line 662) | class Gemma3Model(PaliGemmaModel): method __init__ (line 666) | def __init__(self, config: Gemma3Config): method get_image_features (line 672) | def get_image_features( method forward (line 683) | def forward( class Gemma3ForConditionalGeneration (line 751) | class Gemma3ForConditionalGeneration(PaliGemmaForConditionalGeneration): method forward (line 758) | def forward( method prepare_inputs_for_generation (line 866) | def prepare_inputs_for_generation( class Gemma3ForSequenceClassification (line 905) | class Gemma3ForSequenceClassification(Gemma3PreTrainedModel): method __init__ (line 906) | def __init__(self, config): method get_input_embeddings (line 915) | def get_input_embeddings(self): method set_input_embeddings (line 918) | def set_input_embeddings(self, value): method forward (line 923) | def forward( class Gemma3TextForSequenceClassification (line 993) | class Gemma3TextForSequenceClassification(GenericForSequenceClassificati... FILE: src/transformers/models/gemma3/processing_gemma3.py class Gemma3ProcessorKwargs (line 24) | class Gemma3ProcessorKwargs(ProcessingKwargs, total=False): class Gemma3Processor (line 41) | class Gemma3Processor(ProcessorMixin): method __init__ (line 42) | def __init__( method __call__ (line 65) | def __call__( method _get_num_multimodal_tokens (line 133) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 157) | def model_input_names(self): FILE: src/transformers/models/gemma3n/configuration_gemma3n.py class Gemma3nTextConfig (line 39) | class Gemma3nTextConfig(PreTrainedConfig): method __post_init__ (line 132) | def __post_init__(self, **kwargs): method validate_architecture (line 163) | def validate_architecture(self): method convert_rope_params_to_dict (line 171) | def convert_rope_params_to_dict(self, **kwargs): class Gemma3nAudioConfig (line 203) | class Gemma3nAudioConfig(PreTrainedConfig): class Gemma3nVisionConfig (line 303) | class Gemma3nVisionConfig(PreTrainedConfig): method from_dict (line 343) | def from_dict(cls, config_dict: dict[str, Any], **kwargs): method to_dict (line 385) | def to_dict(self) -> dict[str, Any]: class Gemma3nConfig (line 396) | class Gemma3nConfig(PreTrainedConfig): method __post_init__ (line 456) | def __post_init__(self, **kwargs): FILE: src/transformers/models/gemma3n/convert_gemma3n_weights.py function convert_audio_encoder_weights (line 231) | def convert_audio_encoder_weights( function convert_transformer_weights (line 348) | def convert_transformer_weights( function convert_vision_weights (line 513) | def convert_vision_weights( function convert (line 646) | def convert(checkpoint_path: str, config: Gemma3nConfig) -> dict[str, to... function main (line 698) | def main(*args): FILE: src/transformers/models/gemma3n/feature_extraction_gemma3n.py function create_fb_matrix (line 28) | def create_fb_matrix( function _unfold (line 89) | def _unfold(array: np.ndarray, dimension: int, size: int, step: int) -> ... class Gemma3nAudioFeatureExtractor (line 108) | class Gemma3nAudioFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 154) | def __init__( method _extract_spectrogram (line 222) | def _extract_spectrogram(self, waveform: np.ndarray, attention_mask: n... method __call__ (line 267) | def __call__( FILE: src/transformers/models/gemma3n/modeling_gemma3n.py class Gemma3nAudioEncoderModelOutput (line 56) | class Gemma3nAudioEncoderModelOutput(BaseModelOutputWithPooling): class Gemma3nModelOutputWithPast (line 71) | class Gemma3nModelOutputWithPast(BaseModelOutputWithPast): class Gemma3nCausalLMOutputWithPast (line 97) | class Gemma3nCausalLMOutputWithPast(ModelOutput): class Gemma3nRMSNorm (line 126) | class Gemma3nRMSNorm(nn.Module): method __init__ (line 127) | def __init__(self, dim: int, eps: float = 1e-6, with_scale: bool = True): method _norm (line 137) | def _norm(self, x): method forward (line 140) | def forward(self, x: torch.Tensor) -> torch.Tensor: method extra_repr (line 146) | def extra_repr(self): class Gemma3nAudioRelativePositionEmbedding (line 153) | class Gemma3nAudioRelativePositionEmbedding(nn.Module): method __init__ (line 154) | def __init__(self, config: Gemma3nAudioConfig): method _get_timing_signal_1d_pos (line 177) | def _get_timing_signal_1d_pos(self, position: torch.Tensor, dtype: tor... method _relative_shift (line 183) | def _relative_shift( method forward (line 244) | def forward(self, queries: torch.Tensor, keys: torch.Tensor) -> torch.... class Gemma3nAudioAttention (line 323) | class Gemma3nAudioAttention(nn.Module): method __init__ (line 324) | def __init__(self, config: Gemma3nAudioConfig): method create_local_causal_valid_mask (line 358) | def create_local_causal_valid_mask(self): method _pad_dim1 (line 371) | def _pad_dim1(self, x: torch.Tensor, pad_left: int, pad_right: int) ->... method _convert_to_block (line 378) | def _convert_to_block(self, hidden_states: torch.Tensor) -> torch.Tensor: method _extract_block_context (line 400) | def _extract_block_context(self, hidden_states: torch.Tensor) -> torch... method forward (line 448) | def forward(self, hidden_states: torch.Tensor, mask: torch.BoolTensor)... class Gemma3nAudioCumulativeGroupNorm (line 551) | class Gemma3nAudioCumulativeGroupNorm(nn.Module): method __init__ (line 568) | def __init__( method forward (line 586) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Gemma3nAudioSSCPConvBlock (line 660) | class Gemma3nAudioSSCPConvBlock(nn.Module): method __init__ (line 667) | def __init__( method forward (line 710) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioSubSampleConvProjection (line 729) | class Gemma3nAudioSubSampleConvProjection(nn.Module): method __init__ (line 730) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 787) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioConformerAttention (line 802) | class Gemma3nAudioConformerAttention(nn.Module): method __init__ (line 803) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 813) | def forward(self, audio_encodings: torch.Tensor, audio_mel_mask: torch... class Gemma3nAudioConformerFeedForward (line 830) | class Gemma3nAudioConformerFeedForward(nn.Module): method __init__ (line 831) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 843) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioConformerLightConv1d (line 855) | class Gemma3nAudioConformerLightConv1d(nn.Module): method __init__ (line 856) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 877) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioConformerBlock (line 898) | class Gemma3nAudioConformerBlock(nn.Module): method __init__ (line 899) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 910) | def forward(self, audio_encodings: torch.Tensor, audio_mel_mask: torch... class Gemma3nTextScaledWordEmbedding (line 925) | class Gemma3nTextScaledWordEmbedding(nn.Embedding): method __init__ (line 930) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 935) | def forward(self, input_ids: torch.Tensor): class Gemma3nTextLaurelBlock (line 939) | class Gemma3nTextLaurelBlock(nn.Module): method __init__ (line 942) | def __init__(self, config: Gemma3nTextConfig): method forward (line 950) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Gemma3nTextMLP (line 957) | class Gemma3nTextMLP(nn.Module): method __init__ (line 958) | def __init__(self, config: Gemma3nTextConfig, layer_idx: int = 0): method forward (line 969) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method _gaussian_topk (line 978) | def _gaussian_topk(self, inputs: torch.Tensor) -> torch.Tensor: class Gemma3nTextAltUp (line 995) | class Gemma3nTextAltUp(nn.Module): method __init__ (line 1007) | def __init__(self, config: Gemma3nTextConfig): method compute_router_modalities (line 1017) | def compute_router_modalities(self, x: torch.Tensor) -> torch.Tensor: method predict (line 1022) | def predict(self, hidden_states: torch.Tensor) -> torch.Tensor: method correct (line 1050) | def correct(self, predictions: torch.Tensor, activated: torch.Tensor) ... method forward (line 1081) | def forward(self, corrected: torch.Tensor) -> torch.Tensor: method scale_corrected_output (line 1089) | def scale_corrected_output(self, corrected: torch.Tensor) -> torch.Ten... function rotate_half (line 1094) | def rotate_half(x): function repeat_kv (line 1101) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 1113) | def eager_attention_forward( function apply_rotary_pos_emb (line 1147) | def apply_rotary_pos_emb(x: torch.Tensor, cos: torch.Tensor, sin: torch.... class Gemma3nTextAttention (line 1170) | class Gemma3nTextAttention(nn.Module): method __init__ (line 1173) | def __init__(self, config: Gemma3nTextConfig, layer_idx: int): method forward (line 1217) | def forward( class Gemma3nTextDecoderLayer (line 1279) | class Gemma3nTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1280) | def __init__(self, config: Gemma3nTextConfig, layer_idx: int): method forward (line 1301) | def forward( class Gemma3nPreTrainedModel (line 1354) | class Gemma3nPreTrainedModel(PreTrainedModel): method _init_weights (line 1373) | def _init_weights(self, module): class Gemma3nAudioEncoder (line 1413) | class Gemma3nAudioEncoder(Gemma3nPreTrainedModel): method __init__ (line 1423) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 1435) | def forward( class Gemma3nRotaryEmbedding (line 1494) | class Gemma3nRotaryEmbedding(nn.Module): method __init__ (line 1497) | def __init__(self, config: Gemma3nTextConfig, device=None, layer_type=... method compute_default_rope_parameters (line 1521) | def compute_default_rope_parameters( method forward (line 1558) | def forward(self, x, position_ids, layer_type=None): class Gemma3nTextModel (line 1576) | class Gemma3nTextModel(Gemma3nPreTrainedModel): method __init__ (line 1580) | def __init__(self, config: Gemma3nTextConfig): method forward (line 1632) | def forward( method get_per_layer_inputs (line 1737) | def get_per_layer_inputs(self, input_ids: torch.LongTensor) -> torch.T... method project_per_layer_inputs (line 1744) | def project_per_layer_inputs( class Gemma3nForCausalLM (line 1773) | class Gemma3nForCausalLM(Gemma3nPreTrainedModel, GenerationMixin): method __init__ (line 1779) | def __init__(self, config: Gemma3nTextConfig): method forward (line 1790) | def forward( class Gemma3nMultimodalEmbedder (line 1852) | class Gemma3nMultimodalEmbedder(nn.Module): method __init__ (line 1855) | def __init__( method forward (line 1874) | def forward( class Gemma3nModel (line 1908) | class Gemma3nModel(Gemma3nPreTrainedModel): method __init__ (line 1912) | def __init__(self, config: Gemma3nConfig): method get_input_embeddings (line 1925) | def get_input_embeddings(self): method set_input_embeddings (line 1928) | def set_input_embeddings(self, value): method get_image_features (line 1933) | def get_image_features( method get_placeholder_mask (line 1953) | def get_placeholder_mask( method forward (line 1998) | def forward( method get_audio_features (line 2136) | def get_audio_features( class Gemma3nForConditionalGeneration (line 2163) | class Gemma3nForConditionalGeneration(Gemma3nPreTrainedModel, Generation... method __init__ (line 2166) | def __init__(self, config: Gemma3nConfig): method get_input_embeddings (line 2172) | def get_input_embeddings(self): method set_input_embeddings (line 2175) | def set_input_embeddings(self, value): method get_image_features (line 2179) | def get_image_features(self, pixel_values: torch.FloatTensor, **kwargs... method forward (line 2184) | def forward( method prepare_inputs_for_generation (line 2305) | def prepare_inputs_for_generation( FILE: src/transformers/models/gemma3n/modular_gemma3n.py class Gemma3nTextConfig (line 68) | class Gemma3nTextConfig(Gemma3TextConfig): method __post_init__ (line 145) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 176) | def convert_rope_params_to_dict(self, **kwargs): class Gemma3nAudioConfig (line 208) | class Gemma3nAudioConfig(PreTrainedConfig): class Gemma3nVisionConfig (line 308) | class Gemma3nVisionConfig(TimmWrapperConfig): class Gemma3nConfig (line 350) | class Gemma3nConfig(PreTrainedConfig): method __post_init__ (line 410) | def __post_init__(self, **kwargs): class Gemma3nAudioEncoderModelOutput (line 434) | class Gemma3nAudioEncoderModelOutput(BaseModelOutputWithPooling): class Gemma3nModelOutputWithPast (line 443) | class Gemma3nModelOutputWithPast(PaligemmaModelOutputWithPast): class Gemma3nCausalLMOutputWithPast (line 461) | class Gemma3nCausalLMOutputWithPast(PaliGemmaCausalLMOutputWithPast): class Gemma3nRMSNorm (line 483) | class Gemma3nRMSNorm(Gemma3RMSNorm): method __init__ (line 484) | def __init__(self, dim: int, eps: float = 1e-6, with_scale: bool = True): method _norm (line 494) | def _norm(self, x): method forward (line 497) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Gemma3nAudioRelativePositionEmbedding (line 507) | class Gemma3nAudioRelativePositionEmbedding(nn.Module): method __init__ (line 508) | def __init__(self, config: Gemma3nAudioConfig): method _get_timing_signal_1d_pos (line 531) | def _get_timing_signal_1d_pos(self, position: torch.Tensor, dtype: tor... method _relative_shift (line 537) | def _relative_shift( method forward (line 598) | def forward(self, queries: torch.Tensor, keys: torch.Tensor) -> torch.... class Gemma3nAudioAttention (line 677) | class Gemma3nAudioAttention(nn.Module): method __init__ (line 678) | def __init__(self, config: Gemma3nAudioConfig): method create_local_causal_valid_mask (line 712) | def create_local_causal_valid_mask(self): method _pad_dim1 (line 725) | def _pad_dim1(self, x: torch.Tensor, pad_left: int, pad_right: int) ->... method _convert_to_block (line 732) | def _convert_to_block(self, hidden_states: torch.Tensor) -> torch.Tensor: method _extract_block_context (line 754) | def _extract_block_context(self, hidden_states: torch.Tensor) -> torch... method forward (line 802) | def forward(self, hidden_states: torch.Tensor, mask: torch.BoolTensor)... class Gemma3nAudioCumulativeGroupNorm (line 905) | class Gemma3nAudioCumulativeGroupNorm(nn.Module): method __init__ (line 922) | def __init__( method forward (line 940) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Gemma3nAudioSSCPConvBlock (line 1014) | class Gemma3nAudioSSCPConvBlock(nn.Module): method __init__ (line 1021) | def __init__( method forward (line 1064) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioSubSampleConvProjection (line 1083) | class Gemma3nAudioSubSampleConvProjection(nn.Module): method __init__ (line 1084) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 1141) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioConformerAttention (line 1156) | class Gemma3nAudioConformerAttention(nn.Module): method __init__ (line 1157) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 1167) | def forward(self, audio_encodings: torch.Tensor, audio_mel_mask: torch... class Gemma3nAudioConformerFeedForward (line 1184) | class Gemma3nAudioConformerFeedForward(nn.Module): method __init__ (line 1185) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 1197) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioConformerLightConv1d (line 1209) | class Gemma3nAudioConformerLightConv1d(nn.Module): method __init__ (line 1210) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 1231) | def forward(self, audio_encodings: torch.Tensor) -> torch.Tensor: class Gemma3nAudioConformerBlock (line 1252) | class Gemma3nAudioConformerBlock(nn.Module): method __init__ (line 1253) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 1264) | def forward(self, audio_encodings: torch.Tensor, audio_mel_mask: torch... class Gemma3nTextScaledWordEmbedding (line 1282) | class Gemma3nTextScaledWordEmbedding(Gemma3TextScaledWordEmbedding): class Gemma3nTextLaurelBlock (line 1286) | class Gemma3nTextLaurelBlock(nn.Module): method __init__ (line 1289) | def __init__(self, config: Gemma3nTextConfig): method forward (line 1297) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Gemma3nTextMLP (line 1304) | class Gemma3nTextMLP(Gemma2MLP): method __init__ (line 1305) | def __init__(self, config: Gemma3nTextConfig, layer_idx: int = 0): method forward (line 1310) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method _gaussian_topk (line 1319) | def _gaussian_topk(self, inputs: torch.Tensor) -> torch.Tensor: class Gemma3nTextAltUp (line 1336) | class Gemma3nTextAltUp(nn.Module): method __init__ (line 1348) | def __init__(self, config: Gemma3nTextConfig): method compute_router_modalities (line 1358) | def compute_router_modalities(self, x: torch.Tensor) -> torch.Tensor: method predict (line 1363) | def predict(self, hidden_states: torch.Tensor) -> torch.Tensor: method correct (line 1391) | def correct(self, predictions: torch.Tensor, activated: torch.Tensor) ... method forward (line 1422) | def forward(self, corrected: torch.Tensor) -> torch.Tensor: method scale_corrected_output (line 1430) | def scale_corrected_output(self, corrected: torch.Tensor) -> torch.Ten... function apply_rotary_pos_emb (line 1435) | def apply_rotary_pos_emb(x: torch.Tensor, cos: torch.Tensor, sin: torch.... class Gemma3nTextAttention (line 1457) | class Gemma3nTextAttention(Gemma3Attention): method __init__ (line 1458) | def __init__(self, config: Gemma3nTextConfig, layer_idx: int): method forward (line 1479) | def forward( class Gemma3nTextDecoderLayer (line 1541) | class Gemma3nTextDecoderLayer(Gemma3DecoderLayer): method __init__ (line 1542) | def __init__(self, config: Gemma3nTextConfig, layer_idx: int): method forward (line 1556) | def forward( class Gemma3nPreTrainedModel (line 1608) | class Gemma3nPreTrainedModel(Gemma2PreTrainedModel): method _init_weights (line 1618) | def _init_weights(self, module): class Gemma3nAudioEncoder (line 1658) | class Gemma3nAudioEncoder(Gemma3nPreTrainedModel): method __init__ (line 1668) | def __init__(self, config: Gemma3nAudioConfig): method forward (line 1680) | def forward( class Gemma3nRotaryEmbedding (line 1739) | class Gemma3nRotaryEmbedding(Gemma3RotaryEmbedding): class Gemma3nTextModel (line 1744) | class Gemma3nTextModel(Gemma3TextModel): method __init__ (line 1747) | def __init__(self, config: Gemma3nTextConfig): method get_per_layer_inputs (line 1784) | def get_per_layer_inputs(self, input_ids: torch.LongTensor) -> torch.T... method project_per_layer_inputs (line 1791) | def project_per_layer_inputs( method forward (line 1822) | def forward( class Gemma3nForCausalLM (line 1929) | class Gemma3nForCausalLM(Gemma3ForCausalLM): class Gemma3nMultimodalEmbedder (line 1933) | class Gemma3nMultimodalEmbedder(nn.Module): method __init__ (line 1936) | def __init__( method forward (line 1955) | def forward( class Gemma3nModel (line 1989) | class Gemma3nModel(PaliGemmaModel): method __init__ (line 1990) | def __init__(self, config: Gemma3nConfig): method get_image_features (line 2001) | def get_image_features( method get_placeholder_mask (line 2021) | def get_placeholder_mask( method forward (line 2066) | def forward( method get_audio_features (line 2204) | def get_audio_features( class Gemma3nForConditionalGeneration (line 2231) | class Gemma3nForConditionalGeneration(PaliGemmaForConditionalGeneration): method forward (line 2234) | def forward( method prepare_inputs_for_generation (line 2355) | def prepare_inputs_for_generation( method create_masks_for_generate (line 2396) | def create_masks_for_generate(self, **super_kwargs): FILE: src/transformers/models/gemma3n/processing_gemma3n.py class Gemma3nProcessorKwargs (line 25) | class Gemma3nProcessorKwargs(ProcessingKwargs, total=False): class Gemma3nProcessor (line 32) | class Gemma3nProcessor(ProcessorMixin): method __init__ (line 33) | def __init__( method __call__ (line 72) | def __call__( method model_input_names (line 137) | def model_input_names(self): FILE: src/transformers/models/git/configuration_git.py class GitVisionConfig (line 27) | class GitVisionConfig(PreTrainedConfig): class GitConfig (line 62) | class GitConfig(PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): FILE: src/transformers/models/git/convert_git_to_pytorch.py function get_git_config (line 46) | def get_git_config(model_name): function create_rename_keys (line 71) | def create_rename_keys(config, prefix=""): function rename_key (line 155) | def rename_key(dct, old, new): function read_in_q_k_v (line 161) | def read_in_q_k_v(state_dict, config, prefix=""): function prepare_img (line 185) | def prepare_img(model_name): function prepare_video (line 197) | def prepare_video(): function convert_git_checkpoint (line 255) | def convert_git_checkpoint(model_name, pytorch_dump_folder_path, push_to... FILE: src/transformers/models/git/modeling_git.py class GitVisionModelOutput (line 63) | class GitVisionModelOutput(ModelOutput): function token_type_ids_mask_function (line 76) | def token_type_ids_mask_function( function create_causal_mask_mapping (line 118) | def create_causal_mask_mapping( class GitEmbeddings (line 172) | class GitEmbeddings(nn.Module): method __init__ (line 175) | def __init__(self, config): method forward (line 187) | def forward( class GitSelfAttention (line 217) | class GitSelfAttention(nn.Module): method __init__ (line 218) | def __init__(self, config, layer_idx=None): method forward (line 246) | def forward( class GitSelfOutput (line 298) | class GitSelfOutput(nn.Module): method __init__ (line 299) | def __init__(self, config): method forward (line 305) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class GitAttention (line 317) | class GitAttention(nn.Module): method __init__ (line 318) | def __init__(self, config, layer_idx=None): method forward (line 323) | def forward( class GitIntermediate (line 341) | class GitIntermediate(nn.Module): method __init__ (line 342) | def __init__(self, config): method forward (line 350) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GitOutput (line 357) | class GitOutput(nn.Module): method __init__ (line 358) | def __init__(self, config): method forward (line 364) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class GitLayer (line 371) | class GitLayer(GradientCheckpointingLayer): method __init__ (line 372) | def __init__(self, config, layer_idx=None): method forward (line 380) | def forward( method feed_forward_chunk (line 399) | def feed_forward_chunk(self, attention_output): class GitEncoder (line 405) | class GitEncoder(nn.Module): method __init__ (line 406) | def __init__(self, config): method forward (line 412) | def forward( class GitPreTrainedModel (line 435) | class GitPreTrainedModel(PreTrainedModel): method _init_weights (line 442) | def _init_weights(self, module): class GitVisionEmbeddings (line 466) | class GitVisionEmbeddings(nn.Module): method __init__ (line 467) | def __init__(self, config: GitVisionConfig): method interpolate_pos_encoding (line 489) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 530) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class GitVisionMLP (line 549) | class GitVisionMLP(nn.Module): method __init__ (line 550) | def __init__(self, config): method forward (line 557) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 565) | def eager_attention_forward( class GitVisionAttention (line 588) | class GitVisionAttention(nn.Module): method __init__ (line 591) | def __init__(self, config): method forward (line 611) | def forward( class GitVisionEncoderLayer (line 651) | class GitVisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 652) | def __init__(self, config: GitVisionConfig): method forward (line 660) | def forward( class GitVisionEncoder (line 685) | class GitVisionEncoder(nn.Module): method __init__ (line 694) | def __init__(self, config: GitVisionConfig): method forward (line 700) | def forward( class GitVisionTransformer (line 734) | class GitVisionTransformer(nn.Module): method __init__ (line 736) | def __init__(self, config: GitVisionConfig): method forward (line 747) | def forward( class GitVisionModel (line 778) | class GitVisionModel(GitPreTrainedModel): method __init__ (line 788) | def __init__(self, config: GitVisionConfig): method get_input_embeddings (line 794) | def get_input_embeddings(self) -> nn.Module: method forward (line 800) | def forward( class GitProjection (line 834) | class GitProjection(nn.Module): method __init__ (line 835) | def __init__(self, config: GitConfig): method forward (line 843) | def forward(self, embeddings: torch.Tensor) -> torch.Tensor: class GitModel (line 852) | class GitModel(GitPreTrainedModel): method __init__ (line 858) | def __init__(self, config): method get_input_embeddings (line 877) | def get_input_embeddings(self): method set_input_embeddings (line 880) | def set_input_embeddings(self, value): method forward (line 886) | def forward( class GitForCausalLM (line 1028) | class GitForCausalLM(GitPreTrainedModel, GenerationMixin): method __init__ (line 1031) | def __init__(self, config): method get_output_embeddings (line 1040) | def get_output_embeddings(self): method set_output_embeddings (line 1043) | def set_output_embeddings(self, new_embeddings): method forward (line 1049) | def forward( method prepare_inputs_for_generation (line 1237) | def prepare_inputs_for_generation( FILE: src/transformers/models/git/processing_git.py class GitProcessor (line 23) | class GitProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, image_processor, tokenizer): FILE: src/transformers/models/glm/configuration_glm.py class GlmConfig (line 26) | class GlmConfig(PreTrainedConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm/convert_glm_weights_to_hf.py function load_weights (line 40) | def load_weights(input_dir: str): function map_old_key_to_new (line 64) | def map_old_key_to_new(old_key): function convert_state_dict (line 78) | def convert_state_dict(original_state_dict: dict, config: GlmConfig): function convert_config (line 104) | def convert_config(original_config: dict): function convert_glm_tokenizer (line 136) | def convert_glm_tokenizer(input_dir, use_post_processor=False): function convert_glm_model (line 156) | def convert_glm_model(input_dir, output_dir, use_post_processor=False): FILE: src/transformers/models/glm/modeling_glm.py class GlmMLP (line 47) | class GlmMLP(nn.Module): method __init__ (line 48) | def __init__(self, config): method forward (line 56) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class GlmRotaryEmbedding (line 65) | class GlmRotaryEmbedding(nn.Module): method __init__ (line 68) | def __init__(self, config: GlmConfig, device=None): method compute_default_rope_parameters (line 85) | def compute_default_rope_parameters( method forward (line 118) | def forward(self, x, position_ids): function repeat_kv (line 132) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 144) | def eager_attention_forward( function rotate_half (line 169) | def rotate_half(x): function apply_rotary_pos_emb (line 176) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class GlmAttention (line 217) | class GlmAttention(nn.Module): method __init__ (line 220) | def __init__(self, config: GlmConfig, layer_idx: int | None = None): method forward (line 241) | def forward( class GlmRMSNorm (line 283) | class GlmRMSNorm(nn.Module): method __init__ (line 284) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 292) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 299) | def extra_repr(self): class GlmDecoderLayer (line 303) | class GlmDecoderLayer(GradientCheckpointingLayer): method __init__ (line 304) | def __init__(self, config: GlmConfig, layer_idx: int): method forward (line 314) | def forward( class GlmPreTrainedModel (line 347) | class GlmPreTrainedModel(PreTrainedModel): class GlmModel (line 366) | class GlmModel(GlmPreTrainedModel): method __init__ (line 367) | def __init__(self, config: GlmConfig): method forward (line 386) | def forward( class GlmForCausalLM (line 440) | class GlmForCausalLM(GlmPreTrainedModel, GenerationMixin): method __init__ (line 445) | def __init__(self, config): method forward (line 456) | def forward( class GlmForSequenceClassification (line 513) | class GlmForSequenceClassification(GenericForSequenceClassification, Glm... class GlmForTokenClassification (line 517) | class GlmForTokenClassification(GenericForTokenClassification, GlmPreTra... FILE: src/transformers/models/glm/modular_glm.py class GlmMLP (line 37) | class GlmMLP(Phi3MLP): class GlmRotaryEmbedding (line 41) | class GlmRotaryEmbedding(LlamaRotaryEmbedding): method compute_default_rope_parameters (line 43) | def compute_default_rope_parameters( function rotate_half (line 75) | def rotate_half(x): function apply_rotary_pos_emb (line 82) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class GlmAttention (line 122) | class GlmAttention(LlamaAttention): method __init__ (line 123) | def __init__(self, config: GlmConfig, layer_idx: int | None = None): class GlmForCausalLM (line 128) | class GlmForCausalLM(LlamaForCausalLM): class GlmForSequenceClassification (line 132) | class GlmForSequenceClassification(LlamaForSequenceClassification): class GlmForTokenClassification (line 136) | class GlmForTokenClassification(LlamaForTokenClassification): FILE: src/transformers/models/glm4/configuration_glm4.py class Glm4Config (line 26) | class Glm4Config(PreTrainedConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm4/convert_glm4_weights_to_hf.py function load_weights (line 45) | def load_weights(input_dir: str): function map_old_key_to_new (line 69) | def map_old_key_to_new(old_key): function convert_state_dict (line 83) | def convert_state_dict(original_state_dict: dict, config: Glm4Config): function convert_config (line 109) | def convert_config(original_config: dict): function convert_glm4_tokenizer (line 141) | def convert_glm4_tokenizer(input_dir, use_post_processor=False): function convert_glm4_model (line 161) | def convert_glm4_model(input_dir, output_dir, use_post_processor=False): FILE: src/transformers/models/glm4/modeling_glm4.py class Glm4MLP (line 49) | class Glm4MLP(nn.Module): method __init__ (line 50) | def __init__(self, config): method forward (line 58) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class Glm4DecoderLayer (line 67) | class Glm4DecoderLayer(GradientCheckpointingLayer): method __init__ (line 68) | def __init__(self, config: Glm4Config, layer_idx: int): method forward (line 79) | def forward( function repeat_kv (line 113) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 125) | def eager_attention_forward( function rotate_half (line 150) | def rotate_half(x): function apply_rotary_pos_emb (line 157) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Glm4Attention (line 198) | class Glm4Attention(nn.Module): method __init__ (line 201) | def __init__(self, config: Glm4Config, layer_idx: int | None = None): method forward (line 222) | def forward( class Glm4RotaryEmbedding (line 263) | class Glm4RotaryEmbedding(nn.Module): method __init__ (line 266) | def __init__(self, config: Glm4Config, device=None): method compute_default_rope_parameters (line 283) | def compute_default_rope_parameters( method forward (line 316) | def forward(self, x, position_ids): class Glm4RMSNorm (line 331) | class Glm4RMSNorm(nn.Module): method __init__ (line 332) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 340) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 347) | def extra_repr(self): class Glm4PreTrainedModel (line 352) | class Glm4PreTrainedModel(PreTrainedModel): class Glm4Model (line 371) | class Glm4Model(Glm4PreTrainedModel): method __init__ (line 372) | def __init__(self, config: Glm4Config): method forward (line 391) | def forward( class Glm4ForCausalLM (line 445) | class Glm4ForCausalLM(Glm4PreTrainedModel, GenerationMixin): method __init__ (line 450) | def __init__(self, config): method forward (line 461) | def forward( class Glm4ForSequenceClassification (line 523) | class Glm4ForSequenceClassification(GenericForSequenceClassification, Gl... class Glm4ForTokenClassification (line 527) | class Glm4ForTokenClassification(GenericForTokenClassification, Glm4PreT... FILE: src/transformers/models/glm4/modular_glm4.py class Glm4MLP (line 35) | class Glm4MLP(Phi3MLP): class Glm4DecoderLayer (line 39) | class Glm4DecoderLayer(GradientCheckpointingLayer): method __init__ (line 40) | def __init__(self, config: Glm4Config, layer_idx: int): method forward (line 51) | def forward( class Glm4Attention (line 85) | class Glm4Attention(GlmAttention): class Glm4ForCausalLM (line 89) | class Glm4ForCausalLM(GlmForCausalLM): method forward (line 90) | def forward( class Glm4ForSequenceClassification (line 119) | class Glm4ForSequenceClassification(GlmForSequenceClassification): class Glm4ForTokenClassification (line 123) | class Glm4ForTokenClassification(GlmForTokenClassification): FILE: src/transformers/models/glm46v/configuration_glm46v.py class Glm46VConfig (line 31) | class Glm46VConfig(PreTrainedConfig): method __post_init__ (line 69) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm46v/image_processing_glm46v.py class Glm46VImageProcessorKwargs (line 35) | class Glm46VImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 50) | def smart_resize( class Glm46VImageProcessor (line 87) | class Glm46VImageProcessor(TorchvisionBackend): method __init__ (line 104) | def __init__(self, **kwargs: Unpack[Glm46VImageProcessorKwargs]): method preprocess (line 111) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Glm46VImageP... method _standardize_kwargs (line 114) | def _standardize_kwargs(self, **kwargs) -> dict: method _preprocess (line 126) | def _preprocess( method get_number_of_image_patches (line 228) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/glm46v/image_processing_pil_glm46v.py class Glm46VImageProcessorKwargs (line 33) | class Glm46VImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 49) | def smart_resize( class Glm46VImageProcessorPil (line 86) | class Glm46VImageProcessorPil(PilBackend): method __init__ (line 103) | def __init__(self, **kwargs: Unpack[Glm46VImageProcessorKwargs]): method preprocess (line 110) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Glm46VImageP... method _standardize_kwargs (line 113) | def _standardize_kwargs(self, **kwargs) -> dict: method _preprocess (line 125) | def _preprocess( method get_number_of_image_patches (line 226) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/glm46v/modeling_glm46v.py class Glm46VPreTrainedModel (line 45) | class Glm46VPreTrainedModel(PreTrainedModel): class Glm46VModelOutputWithPast (line 66) | class Glm46VModelOutputWithPast(ModelOutput): class Glm46VModel (line 85) | class Glm46VModel(Glm46VPreTrainedModel): method __init__ (line 91) | def __init__(self, config): method get_input_embeddings (line 100) | def get_input_embeddings(self): method set_input_embeddings (line 103) | def set_input_embeddings(self, value): method get_vision_position_ids (line 106) | def get_vision_position_ids( method get_rope_index (line 162) | def get_rope_index( method get_video_features (line 281) | def get_video_features( method get_image_features (line 312) | def get_image_features( method get_placeholder_mask (line 332) | def get_placeholder_mask( method compute_3d_position_ids (line 374) | def compute_3d_position_ids( method forward (line 425) | def forward( class Glm46VCausalLMOutputWithPast (line 498) | class Glm46VCausalLMOutputWithPast(ModelOutput): class Glm46VForConditionalGeneration (line 521) | class Glm46VForConditionalGeneration(Glm46VPreTrainedModel, GenerationMi... method __init__ (line 526) | def __init__(self, config): method get_input_embeddings (line 533) | def get_input_embeddings(self): method set_input_embeddings (line 536) | def set_input_embeddings(self, value): method get_video_features (line 540) | def get_video_features( method get_image_features (line 557) | def get_image_features( method forward (line 573) | def forward( method prepare_inputs_for_generation (line 664) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 702) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 740) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 796) | def _expand_inputs_for_generation( FILE: src/transformers/models/glm46v/modular_glm46v.py class Glm46VConfig (line 32) | class Glm46VConfig(PreTrainedConfig): method __post_init__ (line 70) | def __post_init__(self, **kwargs): class Glm46VPreTrainedModel (line 86) | class Glm46VPreTrainedModel(Glm4vPreTrainedModel): method _init_weights (line 90) | def _init_weights(self, module): class Glm46VModel (line 94) | class Glm46VModel(Glm4vModel): method __init__ (line 97) | def __init__(self, config): class Glm46VForConditionalGeneration (line 103) | class Glm46VForConditionalGeneration(Glm4vForConditionalGeneration): class Glm46VProcessor (line 107) | class Glm46VProcessor(Glm4vProcessor): method replace_frame_token_id (line 108) | def replace_frame_token_id(self, timestamp_sec): class Glm46VImageProcessorPil (line 112) | class Glm46VImageProcessorPil(Glm4vImageProcessorPil): class Glm46VImageProcessor (line 116) | class Glm46VImageProcessor(Glm4vImageProcessor): class Glm46VVideoProcessor (line 120) | class Glm46VVideoProcessor(Glm4vVideoProcessor): method sample_frames (line 121) | def sample_frames( FILE: src/transformers/models/glm46v/processing_glm46v.py class Glm46VProcessorKwargs (line 35) | class Glm46VProcessorKwargs(ProcessingKwargs, total=False): class Glm46VProcessor (line 47) | class Glm46VProcessor(ProcessorMixin): method __init__ (line 48) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 66) | def __call__( method _get_num_multimodal_tokens (line 175) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... method post_process_image_text_to_text (line 213) | def post_process_image_text_to_text( method model_input_names (line 241) | def model_input_names(self): method create_mm_token_type_ids (line 246) | def create_mm_token_type_ids(self, input_ids: list) -> list[list[int]]: method replace_frame_token_id (line 267) | def replace_frame_token_id(self, timestamp_sec): FILE: src/transformers/models/glm46v/video_processing_glm46v.py class Glm46VVideoProcessorInitKwargs (line 42) | class Glm46VVideoProcessorInitKwargs(VideosKwargs, total=False): class Glm46VVideoProcessor (line 62) | class Glm46VVideoProcessor(BaseVideoProcessor): method __init__ (line 83) | def __init__(self, **kwargs: Unpack[Glm46VVideoProcessorInitKwargs]): method _standardize_kwargs (line 86) | def _standardize_kwargs(self, **kwargs) -> dict: method sample_frames (line 97) | def sample_frames( method _preprocess (line 173) | def _preprocess( FILE: src/transformers/models/glm4_moe/configuration_glm4_moe.py class Glm4MoeConfig (line 29) | class Glm4MoeConfig(PreTrainedConfig): method __post_init__ (line 109) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm4_moe/modeling_glm4_moe.py class Glm4MoeRotaryEmbedding (line 46) | class Glm4MoeRotaryEmbedding(nn.Module): method __init__ (line 49) | def __init__(self, config: Glm4MoeConfig, device=None): method compute_default_rope_parameters (line 66) | def compute_default_rope_parameters( method forward (line 99) | def forward(self, x, position_ids): function repeat_kv (line 113) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 125) | def eager_attention_forward( function rotate_half (line 150) | def rotate_half(x): function apply_rotary_pos_emb (line 157) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Glm4MoeAttention (line 194) | class Glm4MoeAttention(nn.Module): method __init__ (line 197) | def __init__(self, config: Glm4MoeConfig, layer_idx: int | None = None): method forward (line 223) | def forward( class Glm4MoeMLP (line 272) | class Glm4MoeMLP(nn.Module): method __init__ (line 273) | def __init__(self, config, intermediate_size=None): method forward (line 283) | def forward(self, x): class Glm4MoeTopkRouter (line 288) | class Glm4MoeTopkRouter(nn.Module): method __init__ (line 289) | def __init__(self, config: Glm4MoeConfig): method forward (line 302) | def forward(self, hidden_states): class Glm4MoeRMSNorm (line 309) | class Glm4MoeRMSNorm(nn.Module): method __init__ (line 310) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 318) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 325) | def extra_repr(self): class Glm4MoeNaiveMoe (line 330) | class Glm4MoeNaiveMoe(nn.Module): method __init__ (line 333) | def __init__(self, config): method forward (line 342) | def forward( class Glm4MoeMoE (line 369) | class Glm4MoeMoE(nn.Module): method __init__ (line 374) | def __init__(self, config): method route_tokens_to_experts (line 389) | def route_tokens_to_experts(self, router_logits): method forward (line 414) | def forward(self, hidden_states): class Glm4MoeDecoderLayer (line 425) | class Glm4MoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 426) | def __init__(self, config: Glm4MoeConfig, layer_idx: int): method forward (line 440) | def forward( class Glm4MoePreTrainedModel (line 473) | class Glm4MoePreTrainedModel(PreTrainedModel): method _init_weights (line 493) | def _init_weights(self, module): class Glm4MoeModel (line 504) | class Glm4MoeModel(Glm4MoePreTrainedModel): method __init__ (line 505) | def __init__(self, config: Glm4MoeConfig): method forward (line 524) | def forward( class Glm4MoeForCausalLM (line 578) | class Glm4MoeForCausalLM(Glm4MoePreTrainedModel, GenerationMixin): method __init__ (line 583) | def __init__(self, config): method forward (line 594) | def forward( FILE: src/transformers/models/glm4_moe/modular_glm4_moe.py class Glm4MoeConfig (line 42) | class Glm4MoeConfig(PreTrainedConfig): method __post_init__ (line 122) | def __post_init__(self, **kwargs): class Glm4MoeRotaryEmbedding (line 127) | class Glm4MoeRotaryEmbedding(GlmRotaryEmbedding): class Glm4MoeAttention (line 131) | class Glm4MoeAttention(CohereAttention): method __init__ (line 132) | def __init__(self, config: Glm4MoeConfig, layer_idx: int | None = None): class Glm4MoeMLP (line 159) | class Glm4MoeMLP(DeepseekV3MLP): class Glm4MoeTopkRouter (line 163) | class Glm4MoeTopkRouter(DeepseekV3TopkRouter): method __init__ (line 164) | def __init__(self, config: Glm4MoeConfig): class Glm4MoeRMSNorm (line 178) | class Glm4MoeRMSNorm(DeepseekV3RMSNorm): class Glm4MoeDecoderLayer (line 182) | class Glm4MoeDecoderLayer(DeepseekV3DecoderLayer): class Glm4MoePreTrainedModel (line 186) | class Glm4MoePreTrainedModel(DeepseekV3PreTrainedModel): class Glm4MoeModel (line 190) | class Glm4MoeModel(DeepseekV3Model): class Glm4MoeForCausalLM (line 194) | class Glm4MoeForCausalLM(DeepseekV3ForCausalLM): FILE: src/transformers/models/glm4_moe_lite/configuration_glm4_moe_lite.py class Glm4MoeLiteConfig (line 31) | class Glm4MoeLiteConfig(PreTrainedConfig): method __post_init__ (line 111) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm4_moe_lite/modeling_glm4_moe_lite.py class Glm4MoeLiteRotaryEmbedding (line 48) | class Glm4MoeLiteRotaryEmbedding(nn.Module): method __init__ (line 51) | def __init__(self, config: Glm4MoeLiteConfig, device=None): method compute_default_rope_parameters (line 68) | def compute_default_rope_parameters( method forward (line 101) | def forward(self, x, position_ids): function rotate_half (line 115) | def rotate_half(x): function apply_rotary_pos_emb (line 123) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 148) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 160) | def eager_attention_forward( function apply_rotary_pos_emb_interleave (line 185) | def apply_rotary_pos_emb_interleave(q, k, cos, sin, position_ids=None, u... function yarn_get_mscale (line 223) | def yarn_get_mscale(scale=1, mscale=1): class Glm4MoeLiteAttention (line 229) | class Glm4MoeLiteAttention(nn.Module): method __init__ (line 232) | def __init__(self, config: Glm4MoeLiteConfig, layer_idx: int): method forward (line 281) | def forward( class Glm4MoeLiteMLP (line 347) | class Glm4MoeLiteMLP(nn.Module): method __init__ (line 348) | def __init__(self, config, intermediate_size=None): method forward (line 358) | def forward(self, x): class Glm4MoeLiteTopkRouter (line 363) | class Glm4MoeLiteTopkRouter(nn.Module): method __init__ (line 364) | def __init__(self, config: Glm4MoeLiteConfig): method forward (line 377) | def forward(self, hidden_states): class Glm4MoeLiteRMSNorm (line 384) | class Glm4MoeLiteRMSNorm(nn.Module): method __init__ (line 385) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 393) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 400) | def extra_repr(self): class Glm4MoeLiteNaiveMoe (line 405) | class Glm4MoeLiteNaiveMoe(nn.Module): method __init__ (line 408) | def __init__(self, config): method forward (line 417) | def forward( class Glm4MoeLiteMoE (line 444) | class Glm4MoeLiteMoE(nn.Module): method __init__ (line 449) | def __init__(self, config): method route_tokens_to_experts (line 464) | def route_tokens_to_experts(self, router_logits): method forward (line 489) | def forward(self, hidden_states): class Glm4MoeLiteDecoderLayer (line 500) | class Glm4MoeLiteDecoderLayer(GradientCheckpointingLayer): method __init__ (line 501) | def __init__(self, config: Glm4MoeLiteConfig, layer_idx: int): method forward (line 514) | def forward( class Glm4MoeLitePreTrainedModel (line 547) | class Glm4MoeLitePreTrainedModel(PreTrainedModel): method _init_weights (line 567) | def _init_weights(self, module): class Glm4MoeLiteModel (line 578) | class Glm4MoeLiteModel(Glm4MoeLitePreTrainedModel): method __init__ (line 579) | def __init__(self, config: Glm4MoeLiteConfig): method forward (line 598) | def forward( class Glm4MoeLiteForCausalLM (line 652) | class Glm4MoeLiteForCausalLM(Glm4MoeLitePreTrainedModel, GenerationMixin): method __init__ (line 657) | def __init__(self, config): method forward (line 668) | def forward( FILE: src/transformers/models/glm4_moe_lite/modular_glm4_moe_lite.py class Glm4MoeLiteConfig (line 39) | class Glm4MoeLiteConfig(PreTrainedConfig): method __post_init__ (line 119) | def __post_init__(self, **kwargs): class Glm4MoeLiteRotaryEmbedding (line 127) | class Glm4MoeLiteRotaryEmbedding(Glm4MoeRotaryEmbedding): class Glm4MoeLiteAttention (line 131) | class Glm4MoeLiteAttention(DeepseekV3Attention): class Glm4MoeLiteMLP (line 135) | class Glm4MoeLiteMLP(Glm4MoeMLP): class Glm4MoeLiteTopkRouter (line 139) | class Glm4MoeLiteTopkRouter(Glm4MoeTopkRouter): class Glm4MoeLiteRMSNorm (line 143) | class Glm4MoeLiteRMSNorm(Glm4MoeRMSNorm): class Glm4MoeLiteNaiveMoe (line 147) | class Glm4MoeLiteNaiveMoe(Glm4MoeNaiveMoe): class Glm4MoeLiteMoE (line 151) | class Glm4MoeLiteMoE(Glm4MoeMoE): class Glm4MoeLiteDecoderLayer (line 155) | class Glm4MoeLiteDecoderLayer(Glm4MoeDecoderLayer, nn.Module): method __init__ (line 156) | def __init__(self, config: Glm4MoeLiteConfig, layer_idx: int): class Glm4MoeLitePreTrainedModel (line 170) | class Glm4MoeLitePreTrainedModel(Glm4MoePreTrainedModel): class Glm4MoeLiteModel (line 174) | class Glm4MoeLiteModel(Glm4MoeModel): class Glm4MoeLiteForCausalLM (line 178) | class Glm4MoeLiteForCausalLM(Glm4MoeForCausalLM): FILE: src/transformers/models/glm4v/configuration_glm4v.py class Glm4vVisionConfig (line 29) | class Glm4vVisionConfig(PreTrainedConfig): class Glm4vTextConfig (line 71) | class Glm4vTextConfig(PreTrainedConfig): method __post_init__ (line 122) | def __post_init__(self, **kwargs): class Glm4vConfig (line 131) | class Glm4vConfig(PreTrainedConfig): method __post_init__ (line 169) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm4v/convert_glm4v_mgt_weights_to_hf.py class UnpicklerWrapper (line 27) | class UnpicklerWrapper(pickle.Unpickler): method find_class (line 28) | def find_class(self, mod_name, name): function dict_access_multi (line 41) | def dict_access_multi(a_dict, keys): function _build_neox_to_llama_perm (line 47) | def _build_neox_to_llama_perm(rotary_dim: int) -> torch.Tensor: function _apply_rope_permute (line 55) | def _apply_rope_permute(q_or_k: torch.Tensor, blocks: int, head_dim: int... function merge_qkv (line 80) | def merge_qkv( function merge_qkv_vit (line 132) | def merge_qkv_vit(sd_list, original_tp, num_attention_heads, multi_query... function merge_glu (line 159) | def merge_glu(sd_list): function merge_glu_vit (line 167) | def merge_glu_vit(sd_list, original_tp=None): function split_glu (line 175) | def split_glu(sd, cnt, idx): function merge_tensors (line 185) | def merge_tensors( function save_sharded_model (line 203) | def save_sharded_model(state_dict, output_path, max_shard_size_gb=5, num... function merge_tp_weights (line 282) | def merge_tp_weights(model_path, output_path, vllm_config_path=None): function parse_args (line 741) | def parse_args(): FILE: src/transformers/models/glm4v/image_processing_glm4v.py class Glm4vImageProcessorKwargs (line 38) | class Glm4vImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 53) | def smart_resize( class Glm4vImageProcessor (line 90) | class Glm4vImageProcessor(TorchvisionBackend): method __init__ (line 107) | def __init__(self, **kwargs: Unpack[Glm4vImageProcessorKwargs]): method preprocess (line 114) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Glm4vImagePr... method _standardize_kwargs (line 117) | def _standardize_kwargs(self, **kwargs) -> dict: method _preprocess (line 129) | def _preprocess( method get_number_of_image_patches (line 231) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/glm4v/image_processing_pil_glm4v.py function smart_resize (line 37) | def smart_resize( class Glm4vImageProcessorKwargs (line 73) | class Glm4vImageProcessorKwargs(ImagesKwargs, total=False): class Glm4vImageProcessorPil (line 89) | class Glm4vImageProcessorPil(PilBackend): method __init__ (line 106) | def __init__(self, **kwargs: Unpack[Glm4vImageProcessorKwargs]): method preprocess (line 113) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Glm4vImagePr... method _standardize_kwargs (line 116) | def _standardize_kwargs(self, **kwargs) -> dict: method _preprocess (line 128) | def _preprocess( method get_number_of_image_patches (line 229) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/glm4v/modeling_glm4v.py class Glm4vRMSNorm (line 49) | class Glm4vRMSNorm(nn.Module): method __init__ (line 50) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 58) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 65) | def extra_repr(self): class Glm4VisionMlp (line 69) | class Glm4VisionMlp(nn.Module): method __init__ (line 70) | def __init__(self, config, bias: bool = False): method forward (line 79) | def forward(self, hidden_state): class Glm4vVisionPatchEmbed (line 83) | class Glm4vVisionPatchEmbed(nn.Module): method __init__ (line 84) | def __init__(self, config: Glm4vVisionConfig) -> None: method forward (line 94) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Glm4vVisionRotaryEmbedding (line 103) | class Glm4vVisionRotaryEmbedding(nn.Module): method __init__ (line 106) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 113) | def forward(self, seqlen: int) -> torch.Tensor: class Glm4vVisionPatchMerger (line 119) | class Glm4vVisionPatchMerger(nn.Module): method __init__ (line 120) | def __init__(self, dim: int, context_dim: int, hidden_act: str, bias: ... method forward (line 130) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Glm4vVisionEmbeddings (line 136) | class Glm4vVisionEmbeddings(nn.Module): method __init__ (line 137) | def __init__(self, config: Glm4vVisionConfig): method forward (line 149) | def forward(self, embeddings, lengths, image_shapes, h_coords, w_coord... function rotate_half (line 211) | def rotate_half(x): function apply_rotary_pos_emb_vision (line 218) | def apply_rotary_pos_emb_vision( function repeat_kv (line 232) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 244) | def eager_attention_forward( class Glm4vVisionAttention (line 269) | class Glm4vVisionAttention(nn.Module): method __init__ (line 270) | def __init__(self, config: Glm4vVisionConfig) -> None: method forward (line 283) | def forward( class Glm4vVisionBlock (line 352) | class Glm4vVisionBlock(GradientCheckpointingLayer): method __init__ (line 353) | def __init__(self, config) -> None: method forward (line 361) | def forward( class Glm4vTextRotaryEmbedding (line 386) | class Glm4vTextRotaryEmbedding(nn.Module): method __init__ (line 389) | def __init__(self, config: Glm4vTextConfig, device=None): method compute_default_rope_parameters (line 407) | def compute_default_rope_parameters( method forward (line 440) | def forward(self, x, position_ids): method apply_mrope (line 456) | def apply_mrope(self, freqs, mrope_section): function rotate_half_llm (line 463) | def rotate_half_llm(x): function apply_rotary_pos_emb (line 470) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Glm4vTextAttention (line 510) | class Glm4vTextAttention(nn.Module): method __init__ (line 516) | def __init__(self, config: Glm4vTextConfig, layer_idx: int | None = No... method forward (line 536) | def forward( class Glm4vTextMLP (line 580) | class Glm4vTextMLP(nn.Module): method __init__ (line 581) | def __init__(self, config): method forward (line 589) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class Glm4vTextDecoderLayer (line 598) | class Glm4vTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 599) | def __init__(self, config: Glm4vTextConfig, layer_idx: int): method forward (line 610) | def forward( class Glm4vModelOutputWithPast (line 654) | class Glm4vModelOutputWithPast(ModelOutput): class Glm4vPreTrainedModel (line 673) | class Glm4vPreTrainedModel(PreTrainedModel): method _init_weights (line 686) | def _init_weights(self, module): class Glm4vVisionModel (line 693) | class Glm4vVisionModel(Glm4vPreTrainedModel): method __init__ (line 702) | def __init__(self, config) -> None: method rot_pos_emb (line 730) | def rot_pos_emb(self, grid_thw): method forward (line 762) | def forward( class Glm4vTextModel (line 823) | class Glm4vTextModel(Glm4vPreTrainedModel): method __init__ (line 831) | def __init__(self, config: Glm4vTextConfig): method forward (line 850) | def forward( class Glm4vModel (line 928) | class Glm4vModel(Glm4vPreTrainedModel): method __init__ (line 934) | def __init__(self, config): method get_input_embeddings (line 943) | def get_input_embeddings(self): method set_input_embeddings (line 946) | def set_input_embeddings(self, value): method get_vision_position_ids (line 949) | def get_vision_position_ids( method get_rope_index (line 1005) | def get_rope_index( method get_video_features (line 1124) | def get_video_features( method get_image_features (line 1155) | def get_image_features( method get_placeholder_mask (line 1175) | def get_placeholder_mask( method compute_3d_position_ids (line 1217) | def compute_3d_position_ids( method forward (line 1268) | def forward( class Glm4vCausalLMOutputWithPast (line 1341) | class Glm4vCausalLMOutputWithPast(ModelOutput): class Glm4vForConditionalGeneration (line 1364) | class Glm4vForConditionalGeneration(Glm4vPreTrainedModel, GenerationMixin): method __init__ (line 1369) | def __init__(self, config): method get_input_embeddings (line 1376) | def get_input_embeddings(self): method set_input_embeddings (line 1379) | def set_input_embeddings(self, value): method get_video_features (line 1383) | def get_video_features( method get_image_features (line 1400) | def get_image_features( method forward (line 1416) | def forward( method prepare_inputs_for_generation (line 1507) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1545) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1583) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1639) | def _expand_inputs_for_generation( FILE: src/transformers/models/glm4v/modular_glm4v.py class Glm4vVisionConfig (line 73) | class Glm4vVisionConfig(PreTrainedConfig): class Glm4vTextConfig (line 115) | class Glm4vTextConfig(PreTrainedConfig): method __post_init__ (line 166) | def __post_init__(self, **kwargs): class Glm4vConfig (line 175) | class Glm4vConfig(PreTrainedConfig): method __post_init__ (line 213) | def __post_init__(self, **kwargs): class Glm4vRMSNorm (line 228) | class Glm4vRMSNorm(Glm4RMSNorm): class Glm4VisionMlp (line 232) | class Glm4VisionMlp(Qwen2_5_VLMLP): method __init__ (line 233) | def __init__(self, config, bias: bool = False): class Glm4vVisionPatchEmbed (line 238) | class Glm4vVisionPatchEmbed(Qwen2_5_VisionPatchEmbed): method __init__ (line 239) | def __init__(self, config: Glm4vVisionConfig) -> None: class Glm4vVisionRotaryEmbedding (line 250) | class Glm4vVisionRotaryEmbedding(Qwen2_5_VisionRotaryEmbedding): class Glm4vVisionPatchMerger (line 254) | class Glm4vVisionPatchMerger(nn.Module): method __init__ (line 255) | def __init__(self, dim: int, context_dim: int, hidden_act: str, bias: ... method forward (line 265) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Glm4vVisionEmbeddings (line 271) | class Glm4vVisionEmbeddings(nn.Module): method __init__ (line 272) | def __init__(self, config: Glm4vVisionConfig): method forward (line 284) | def forward(self, embeddings, lengths, image_shapes, h_coords, w_coord... class Glm4vVisionAttention (line 346) | class Glm4vVisionAttention(Qwen2_5_VLVisionAttention): method __init__ (line 347) | def __init__(self, config: Glm4vVisionConfig) -> None: class Glm4vVisionBlock (line 354) | class Glm4vVisionBlock(Qwen2_5_VLVisionBlock): method __init__ (line 355) | def __init__(self, config) -> None: class Glm4vTextRotaryEmbedding (line 363) | class Glm4vTextRotaryEmbedding(Glm4RotaryEmbedding): method __init__ (line 364) | def __init__(self, config: Glm4vTextConfig, device=None): method forward (line 368) | def forward(self, x, position_ids): method apply_mrope (line 384) | def apply_mrope(self, freqs, mrope_section): function rotate_half_llm (line 391) | def rotate_half_llm(x): function apply_rotary_pos_emb (line 398) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Glm4vTextAttention (line 438) | class Glm4vTextAttention(nn.Module): method __init__ (line 444) | def __init__(self, config: Glm4vTextConfig, layer_idx: int | None = No... method forward (line 464) | def forward( class Glm4vTextMLP (line 508) | class Glm4vTextMLP(Glm4MLP): class Glm4vTextDecoderLayer (line 512) | class Glm4vTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 513) | def __init__(self, config: Glm4vTextConfig, layer_idx: int): method forward (line 524) | def forward( class Glm4vModelOutputWithPast (line 562) | class Glm4vModelOutputWithPast(Qwen2_5_VLModelOutputWithPast): class Glm4vPreTrainedModel (line 566) | class Glm4vPreTrainedModel(Qwen2_5_VLPreTrainedModel): method _init_weights (line 569) | def _init_weights(self, module): class Glm4vVisionModel (line 576) | class Glm4vVisionModel(Glm4vPreTrainedModel): method __init__ (line 585) | def __init__(self, config) -> None: method rot_pos_emb (line 613) | def rot_pos_emb(self, grid_thw): method forward (line 645) | def forward( class Glm4vTextModel (line 705) | class Glm4vTextModel(Qwen2_5_VLTextModel): method __init__ (line 711) | def __init__(self, config: Glm4vTextConfig): method forward (line 724) | def forward( class Glm4vModel (line 801) | class Glm4vModel(Qwen2VLModel): method __init__ (line 804) | def __init__(self, config): method get_video_features (line 810) | def get_video_features( method get_placeholder_mask (line 839) | def get_placeholder_mask( method get_rope_index (line 881) | def get_rope_index( method forward (line 1000) | def forward( class Glm4vCausalLMOutputWithPast (line 1067) | class Glm4vCausalLMOutputWithPast(Qwen2_5_VLCausalLMOutputWithPast): class Glm4vForConditionalGeneration (line 1071) | class Glm4vForConditionalGeneration(Qwen2_5_VLForConditionalGeneration): method forward (line 1072) | def forward( method prepare_inputs_for_generation (line 1163) | def prepare_inputs_for_generation( method _get_image_nums_and_video_nums (line 1201) | def _get_image_nums_and_video_nums( class Glm4vProcessorKwargs (line 1258) | class Glm4vProcessorKwargs(Qwen2VLProcessorKwargs): class Glm4vProcessor (line 1269) | class Glm4vProcessor(Qwen2VLProcessor): method __init__ (line 1270) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 1277) | def __call__( method create_mm_token_type_ids (line 1386) | def create_mm_token_type_ids(self, input_ids: list) -> list[list[int]]: method replace_frame_token_id (line 1407) | def replace_frame_token_id(self, timestamp_sec): FILE: src/transformers/models/glm4v/processing_glm4v.py class Glm4vProcessorKwargs (line 34) | class Glm4vProcessorKwargs(ProcessingKwargs, total=False): class Glm4vProcessor (line 46) | class Glm4vProcessor(ProcessorMixin): method __init__ (line 47) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 65) | def __call__( method _get_num_multimodal_tokens (line 174) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... method post_process_image_text_to_text (line 212) | def post_process_image_text_to_text( method model_input_names (line 240) | def model_input_names(self): method create_mm_token_type_ids (line 245) | def create_mm_token_type_ids(self, input_ids: list) -> list[list[int]]: method replace_frame_token_id (line 266) | def replace_frame_token_id(self, timestamp_sec): FILE: src/transformers/models/glm4v/video_processing_glm4v.py class Glm4vVideoProcessorInitKwargs (line 41) | class Glm4vVideoProcessorInitKwargs(VideosKwargs, total=False): class Glm4vVideoProcessor (line 61) | class Glm4vVideoProcessor(BaseVideoProcessor): method __init__ (line 82) | def __init__(self, **kwargs: Unpack[Glm4vVideoProcessorInitKwargs]): method _standardize_kwargs (line 85) | def _standardize_kwargs(self, **kwargs) -> dict: method sample_frames (line 96) | def sample_frames( method _preprocess (line 146) | def _preprocess( FILE: src/transformers/models/glm4v_moe/configuration_glm4v_moe.py class Glm4vMoeTextConfig (line 29) | class Glm4vMoeTextConfig(PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): class Glm4vMoeVisionConfig (line 111) | class Glm4vMoeVisionConfig(PreTrainedConfig): class Glm4vMoeConfig (line 153) | class Glm4vMoeConfig(PreTrainedConfig): method __post_init__ (line 192) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm4v_moe/convert_glm4v_moe_mgt_weights_to_hf.py class UnpicklerWrapper (line 27) | class UnpicklerWrapper(pickle.Unpickler): method find_class (line 28) | def find_class(self, mod_name, name): function dict_access_multi (line 41) | def dict_access_multi(a_dict, keys): function merge_qkv (line 47) | def merge_qkv( function merge_glu (line 91) | def merge_glu(sd_list): function merge_glu_vit (line 99) | def merge_glu_vit(sd_list, original_tp=None): function split_glu (line 107) | def split_glu(sd, cnt, idx): function find_expert_weight (line 117) | def find_expert_weight(input_dict, layer_num, fc1=True): function merge_tensors (line 138) | def merge_tensors( function save_sharded_model (line 156) | def save_sharded_model(state_dict, output_path, max_shard_size_gb=5, num... function merge_tp_weights (line 235) | def merge_tp_weights(model_path, output_path, vllm_config_path=None): function parse_args (line 745) | def parse_args(): FILE: src/transformers/models/glm4v_moe/modeling_glm4v_moe.py function repeat_kv (line 48) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 60) | def eager_attention_forward( function rotate_half (line 85) | def rotate_half(x): function apply_rotary_pos_emb (line 92) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Glm4vMoeTextAttention (line 129) | class Glm4vMoeTextAttention(nn.Module): method __init__ (line 132) | def __init__(self, config: Glm4vMoeTextConfig, layer_idx: int | None =... method forward (line 154) | def forward( class Glm4vMoeTextTopkRouter (line 199) | class Glm4vMoeTextTopkRouter(nn.Module): method __init__ (line 200) | def __init__(self, config: Glm4vMoeTextConfig): method forward (line 213) | def forward(self, hidden_states): class Glm4vMoeTextNaiveMoe (line 220) | class Glm4vMoeTextNaiveMoe(nn.Module): method __init__ (line 223) | def __init__(self, config): method forward (line 232) | def forward( class Glm4vMoeTextMoE (line 259) | class Glm4vMoeTextMoE(nn.Module): method __init__ (line 264) | def __init__(self, config: Glm4vMoeTextConfig): method route_tokens_to_experts (line 279) | def route_tokens_to_experts(self, router_logits): method forward (line 304) | def forward(self, hidden_states): class Glm4vMoeTextMLP (line 315) | class Glm4vMoeTextMLP(nn.Module): method __init__ (line 316) | def __init__(self, config, intermediate_size=None): method forward (line 326) | def forward(self, x): class Glm4vMoeTextRMSNorm (line 332) | class Glm4vMoeTextRMSNorm(nn.Module): method __init__ (line 333) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 341) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 348) | def extra_repr(self): class Glm4vMoeTextDecoderLayer (line 352) | class Glm4vMoeTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 353) | def __init__(self, config: Glm4vMoeTextConfig, layer_idx: int): method forward (line 367) | def forward( class Glm4vMoePreTrainedModel (line 400) | class Glm4vMoePreTrainedModel(PreTrainedModel): method _init_weights (line 418) | def _init_weights(self, module): class Glm4vMoeCausalLMOutputWithPast (line 437) | class Glm4vMoeCausalLMOutputWithPast(ModelOutput): class Glm4vMoeVisionRotaryEmbedding (line 462) | class Glm4vMoeVisionRotaryEmbedding(nn.Module): method __init__ (line 465) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 472) | def forward(self, seqlen: int) -> torch.Tensor: class Glm4vMoeRMSNorm (line 479) | class Glm4vMoeRMSNorm(nn.Module): method __init__ (line 480) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 488) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 495) | def extra_repr(self): class Glm4vMoeisionMlp (line 499) | class Glm4vMoeisionMlp(nn.Module): method __init__ (line 500) | def __init__(self, config, bias: bool = False): method forward (line 509) | def forward(self, hidden_state): class Glm4vMoeVisionPatchEmbed (line 513) | class Glm4vMoeVisionPatchEmbed(nn.Module): method __init__ (line 514) | def __init__(self, config: Glm4vMoeVisionConfig) -> None: method forward (line 524) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Glm4vMoeVisionPatchMerger (line 533) | class Glm4vMoeVisionPatchMerger(nn.Module): method __init__ (line 534) | def __init__(self, dim: int, context_dim: int, hidden_act: str, bias: ... method forward (line 544) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Glm4vMoeVisionEmbeddings (line 550) | class Glm4vMoeVisionEmbeddings(nn.Module): method __init__ (line 551) | def __init__(self, config: Glm4vMoeVisionConfig): method forward (line 563) | def forward(self, embeddings, lengths, image_shapes, h_coords, w_coord... function apply_rotary_pos_emb_vision (line 625) | def apply_rotary_pos_emb_vision( class Glm4vMoeVisionAttention (line 639) | class Glm4vMoeVisionAttention(nn.Module): method __init__ (line 640) | def __init__(self, config: Glm4vMoeVisionConfig) -> None: method forward (line 653) | def forward( class Glm4vMoeVisionBlock (line 722) | class Glm4vMoeVisionBlock(GradientCheckpointingLayer): method __init__ (line 723) | def __init__(self, config) -> None: method forward (line 731) | def forward( class Glm4vMoeVisionModel (line 757) | class Glm4vMoeVisionModel(Glm4vMoePreTrainedModel): method __init__ (line 766) | def __init__(self, config) -> None: method rot_pos_emb (line 794) | def rot_pos_emb(self, grid_thw): method forward (line 826) | def forward( class Glm4vMoeTextRotaryEmbedding (line 886) | class Glm4vMoeTextRotaryEmbedding(nn.Module): method __init__ (line 889) | def __init__(self, config: Glm4vMoeTextConfig, device=None): method compute_default_rope_parameters (line 907) | def compute_default_rope_parameters( method forward (line 940) | def forward(self, x, position_ids): method apply_mrope (line 956) | def apply_mrope(self, freqs, mrope_section): class Glm4vMoeTextModel (line 964) | class Glm4vMoeTextModel(Glm4vMoePreTrainedModel): method __init__ (line 973) | def __init__(self, config: Glm4vMoeTextConfig): method forward (line 992) | def forward( class Glm4vMoeModelOutputWithPast (line 1077) | class Glm4vMoeModelOutputWithPast(ModelOutput): class Glm4vMoeModel (line 1097) | class Glm4vMoeModel(Glm4vMoePreTrainedModel): method __init__ (line 1103) | def __init__(self, config): method get_input_embeddings (line 1112) | def get_input_embeddings(self): method set_input_embeddings (line 1115) | def set_input_embeddings(self, value): method get_vision_position_ids (line 1118) | def get_vision_position_ids( method get_rope_index (line 1174) | def get_rope_index( method get_video_features (line 1293) | def get_video_features( method get_image_features (line 1324) | def get_image_features( method get_placeholder_mask (line 1344) | def get_placeholder_mask( method compute_3d_position_ids (line 1386) | def compute_3d_position_ids( method forward (line 1437) | def forward( function load_balancing_loss_func (line 1504) | def load_balancing_loss_func( class Glm4vMoeForConditionalGeneration (line 1586) | class Glm4vMoeForConditionalGeneration(Glm4vMoePreTrainedModel, Generati... method __init__ (line 1591) | def __init__(self, config): method get_input_embeddings (line 1600) | def get_input_embeddings(self): method set_input_embeddings (line 1603) | def set_input_embeddings(self, value): method get_video_features (line 1607) | def get_video_features( method get_image_features (line 1624) | def get_image_features( method forward (line 1640) | def forward( method prepare_inputs_for_generation (line 1745) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1783) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1821) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1877) | def _expand_inputs_for_generation( FILE: src/transformers/models/glm4v_moe/modular_glm4v_moe.py class Glm4vMoeTextConfig (line 60) | class Glm4vMoeTextConfig(Glm4MoeConfig): method __post_init__ (line 109) | def __post_init__(self, **kwargs): class Glm4vMoeConfig (line 115) | class Glm4vMoeConfig(Glm4vConfig): class Glm4vMoeTextAttention (line 143) | class Glm4vMoeTextAttention(Glm4Attention): method __init__ (line 144) | def __init__(self, config: Glm4vMoeTextConfig, layer_idx: int | None =... method forward (line 148) | def forward( class Glm4vMoeTextTopkRouter (line 193) | class Glm4vMoeTextTopkRouter(Glm4MoeTopkRouter, nn.Module): method __init__ (line 194) | def __init__(self, config: Glm4vMoeTextConfig): class Glm4vMoeTextNaiveMoe (line 198) | class Glm4vMoeTextNaiveMoe(DeepseekV3NaiveMoe): class Glm4vMoeTextMoE (line 202) | class Glm4vMoeTextMoE(Glm4MoeMoE): method __init__ (line 203) | def __init__(self, config: Glm4vMoeTextConfig): class Glm4vMoeTextMLP (line 213) | class Glm4vMoeTextMLP(Glm4MoeMLP): class Glm4vMoeTextDecoderLayer (line 217) | class Glm4vMoeTextDecoderLayer(Glm4MoeDecoderLayer): method __init__ (line 218) | def __init__(self, config: Glm4vMoeTextConfig, layer_idx: int): class Glm4vMoePreTrainedModel (line 222) | class Glm4vMoePreTrainedModel(Glm4MoePreTrainedModel): method _init_weights (line 230) | def _init_weights(self, module): class Glm4vMoeCausalLMOutputWithPast (line 237) | class Glm4vMoeCausalLMOutputWithPast(Qwen3VLMoeCausalLMOutputWithPast): class Glm4vMoeVisionRotaryEmbedding (line 241) | class Glm4vMoeVisionRotaryEmbedding(Glm4vVisionRotaryEmbedding): class Glm4vMoeVisionModel (line 246) | class Glm4vMoeVisionModel(Glm4vVisionModel): class Glm4vMoeTextModel (line 251) | class Glm4vMoeTextModel(Glm4vTextModel): method forward (line 258) | def forward( class Glm4vMoeModelOutputWithPast (line 337) | class Glm4vMoeModelOutputWithPast(Qwen3VLMoeModelOutputWithPast): class Glm4vMoeForConditionalGeneration (line 341) | class Glm4vMoeForConditionalGeneration(Glm4vForConditionalGeneration): method __init__ (line 342) | def __init__(self, config): method forward (line 349) | def forward( FILE: src/transformers/models/glm_image/configuration_glm_image.py class GlmImageVQVAEConfig (line 30) | class GlmImageVQVAEConfig(PreTrainedConfig): class GlmImageVisionConfig (line 43) | class GlmImageVisionConfig(PreTrainedConfig): class GlmImageTextConfig (line 80) | class GlmImageTextConfig(PreTrainedConfig): method __post_init__ (line 138) | def __post_init__(self, **kwargs): class GlmImageConfig (line 147) | class GlmImageConfig(PreTrainedConfig): method __post_init__ (line 183) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm_image/image_processing_glm_image.py class GlmImageImageProcessorKwargs (line 35) | class GlmImageImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 56) | def smart_resize( class GlmImageImageProcessor (line 98) | class GlmImageImageProcessor(TorchvisionBackend): method __init__ (line 114) | def __init__(self, **kwargs: Unpack[GlmImageImageProcessorKwargs]): method _standardize_kwargs (line 131) | def _standardize_kwargs( method preprocess (line 147) | def preprocess( method _preprocess (line 154) | def _preprocess( method get_number_of_image_patches (line 240) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/glm_image/image_processing_pil_glm_image.py class GlmImageImageProcessorKwargs (line 34) | class GlmImageImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 55) | def smart_resize( class GlmImageImageProcessorPil (line 97) | class GlmImageImageProcessorPil(PilBackend): method __init__ (line 113) | def __init__(self, **kwargs: Unpack[GlmImageImageProcessorKwargs]): method _standardize_kwargs (line 130) | def _standardize_kwargs( method preprocess (line 146) | def preprocess( method _preprocess (line 153) | def _preprocess( method get_number_of_image_patches (line 236) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/glm_image/modeling_glm_image.py class GlmImageVisionMLP (line 46) | class GlmImageVisionMLP(nn.Module): method __init__ (line 47) | def __init__(self, config): method forward (line 54) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function repeat_kv (line 61) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 73) | def eager_attention_forward( class GlmImageVisionAttention (line 98) | class GlmImageVisionAttention(nn.Module): method __init__ (line 99) | def __init__(self, config: GlmImageVisionConfig) -> None: method forward (line 112) | def forward( class GlmImageVisionPatchEmbed (line 176) | class GlmImageVisionPatchEmbed(nn.Module): method __init__ (line 177) | def __init__(self, config: GlmImageVisionConfig) -> None: method forward (line 185) | def forward(self, hidden_states) -> torch.Tensor: class GlmImageVisionEmbeddings (line 192) | class GlmImageVisionEmbeddings(nn.Module): method __init__ (line 193) | def __init__(self, config: GlmImageVisionConfig) -> None: method forward (line 205) | def forward(self, embeddings, lengths, image_shapes, h_coords, w_coord... class GlmImageVisionBlock (line 267) | class GlmImageVisionBlock(GradientCheckpointingLayer): method __init__ (line 268) | def __init__(self, config: GlmImageVisionConfig) -> None: method forward (line 276) | def forward( function rotate_half (line 304) | def rotate_half(x): function apply_rotary_pos_emb (line 311) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class GlmImageTextAttention (line 348) | class GlmImageTextAttention(nn.Module): method __init__ (line 351) | def __init__(self, config: GlmImageTextConfig, layer_idx: int | None =... method forward (line 373) | def forward( class GlmImagePreTrainedModel (line 419) | class GlmImagePreTrainedModel(PreTrainedModel): method _init_weights (line 433) | def _init_weights(self, module): class GlmImageModelOutputWithPast (line 443) | class GlmImageModelOutputWithPast(ModelOutput): class GlmImageVQVAEVectorQuantizer (line 461) | class GlmImageVQVAEVectorQuantizer(nn.Module): method __init__ (line 472) | def __init__(self, config: GlmImageVQVAEConfig): method forward (line 480) | def forward(self, hidden_state: torch.Tensor): class GlmImageVQVAEModelOutput (line 515) | class GlmImageVQVAEModelOutput(BaseModelOutputWithPooling): class GlmImageVQVAE (line 538) | class GlmImageVQVAE(GlmImagePreTrainedModel): method __init__ (line 545) | def __init__(self, config: GlmImageVQVAEConfig): method encode (line 555) | def encode(self, hidden_states) -> GlmImageVQVAEModelOutput: class GlmImageVisionModel (line 566) | class GlmImageVisionModel(GlmImagePreTrainedModel): method __init__ (line 576) | def __init__(self, config: GlmImageVisionConfig) -> None: method rot_pos_emb (line 592) | def rot_pos_emb(self, grid_thw): method forward (line 621) | def forward( class GlmImageRMSNorm (line 662) | class GlmImageRMSNorm(nn.Module): method __init__ (line 663) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 671) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 678) | def extra_repr(self): class GlmImageTextRotaryEmbedding (line 682) | class GlmImageTextRotaryEmbedding(nn.Module): method __init__ (line 685) | def __init__(self, config: GlmImageTextConfig, device=None): method compute_default_rope_parameters (line 703) | def compute_default_rope_parameters( method forward (line 736) | def forward(self, x, position_ids): method apply_mrope (line 752) | def apply_mrope(self, freqs, mrope_section): class GlmImageTextMLP (line 759) | class GlmImageTextMLP(nn.Module): method __init__ (line 760) | def __init__(self, config): method forward (line 768) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class GlmImageTextDecoderLayer (line 777) | class GlmImageTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 778) | def __init__(self, config: GlmImageTextConfig, layer_idx: int): method forward (line 789) | def forward( class GlmImageTextModel (line 828) | class GlmImageTextModel(GlmImagePreTrainedModel): method __init__ (line 836) | def __init__(self, config: GlmImageTextConfig): method forward (line 855) | def forward( class GlmImageModel (line 933) | class GlmImageModel(GlmImagePreTrainedModel): method __init__ (line 939) | def __init__(self, config): method get_input_embeddings (line 954) | def get_input_embeddings(self): method set_input_embeddings (line 957) | def set_input_embeddings(self, value): method get_vision_position_ids (line 960) | def get_vision_position_ids( method get_rope_index (line 1016) | def get_rope_index( method get_image_features (line 1187) | def get_image_features( method get_placeholder_mask (line 1207) | def get_placeholder_mask( method compute_3d_position_ids (line 1238) | def compute_3d_position_ids( method forward (line 1279) | def forward( method get_image_tokens (line 1379) | def get_image_tokens( class GlmImageCausalLMOutputWithPast (line 1417) | class GlmImageCausalLMOutputWithPast(ModelOutput): class GlmImageForConditionalGeneration (line 1440) | class GlmImageForConditionalGeneration(GlmImagePreTrainedModel, Generati... method __init__ (line 1447) | def __init__(self, config): method get_image_features (line 1456) | def get_image_features( method get_image_tokens (line 1470) | def get_image_tokens(self, hidden_states: torch.FloatTensor, image_gri... method forward (line 1473) | def forward( method prepare_inputs_for_generation (line 1561) | def prepare_inputs_for_generation( method _get_image_nums (line 1596) | def _get_image_nums( method _expand_inputs_for_generation (line 1611) | def _expand_inputs_for_generation( FILE: src/transformers/models/glm_image/modular_glm_image.py class GlmImageVQVAEConfig (line 63) | class GlmImageVQVAEConfig(PreTrainedConfig): class GlmImageVisionConfig (line 76) | class GlmImageVisionConfig(Glm4vVisionConfig): class GlmImageTextConfig (line 113) | class GlmImageTextConfig(Glm4vTextConfig): class GlmImageConfig (line 144) | class GlmImageConfig(PreTrainedConfig): method __post_init__ (line 180) | def __post_init__(self, **kwargs): class GlmImageVisionMLP (line 199) | class GlmImageVisionMLP(SiglipMLP): class GlmImageVisionAttention (line 203) | class GlmImageVisionAttention(Glm4vVisionAttention): method __init__ (line 204) | def __init__(self, config: GlmImageVisionConfig) -> None: method forward (line 209) | def forward( class GlmImageVisionPatchEmbed (line 273) | class GlmImageVisionPatchEmbed(Glm4vVisionPatchEmbed): method __init__ (line 274) | def __init__(self, config: GlmImageVisionConfig) -> None: method forward (line 281) | def forward(self, hidden_states): class GlmImageVisionEmbeddings (line 288) | class GlmImageVisionEmbeddings(Glm4vVisionEmbeddings): method __init__ (line 289) | def __init__(self, config: GlmImageVisionConfig) -> None: class GlmImageVisionBlock (line 294) | class GlmImageVisionBlock(Glm4vVisionBlock): method __init__ (line 295) | def __init__(self, config: GlmImageVisionConfig): method forward (line 302) | def forward( class GlmImageTextAttention (line 330) | class GlmImageTextAttention(Glm4vMoeTextAttention): class GlmImagePreTrainedModel (line 334) | class GlmImagePreTrainedModel(Glm4vPreTrainedModel): method _init_weights (line 339) | def _init_weights(self, module): class GlmImageModelOutputWithPast (line 343) | class GlmImageModelOutputWithPast(Glm4vModelOutputWithPast): class GlmImageVQVAEVectorQuantizer (line 347) | class GlmImageVQVAEVectorQuantizer(ChameleonVQVAEVectorQuantizer): method __init__ (line 348) | def __init__(self, config: GlmImageVQVAEConfig): method forward (line 356) | def forward(self, hidden_state: torch.Tensor): class GlmImageVQVAEModelOutput (line 389) | class GlmImageVQVAEModelOutput(ChameleonVQVAEModelOutput): class GlmImageVQVAE (line 393) | class GlmImageVQVAE(ChameleonVQVAE): method __init__ (line 399) | def __init__(self, config: GlmImageVQVAEConfig): method encode (line 403) | def encode(self, hidden_states): class GlmImageVisionModel (line 414) | class GlmImageVisionModel(Glm4vVisionModel): method __init__ (line 419) | def __init__(self, config: GlmImageVisionConfig): method rot_pos_emb (line 431) | def rot_pos_emb(self, grid_thw): method forward (line 460) | def forward( class GlmImageTextModel (line 500) | class GlmImageTextModel(Glm4vTextModel): class GlmImageModel (line 504) | class GlmImageModel(Glm4vModel): method __init__ (line 505) | def __init__(self, config): method get_rope_index (line 520) | def get_rope_index( method get_image_tokens (line 689) | def get_image_tokens( method get_video_features (line 720) | def get_video_features(self): method get_image_features (line 725) | def get_image_features( method get_placeholder_mask (line 745) | def get_placeholder_mask( method compute_3d_position_ids (line 776) | def compute_3d_position_ids( method forward (line 815) | def forward( class GlmImageCausalLMOutputWithPast (line 916) | class GlmImageCausalLMOutputWithPast(Glm4vCausalLMOutputWithPast): class GlmImageForConditionalGeneration (line 920) | class GlmImageForConditionalGeneration(GlmImagePreTrainedModel, Generati... method __init__ (line 927) | def __init__(self, config): method get_image_features (line 936) | def get_image_features( method get_image_tokens (line 950) | def get_image_tokens(self, hidden_states: torch.FloatTensor, image_gri... method forward (line 953) | def forward( method prepare_inputs_for_generation (line 1041) | def prepare_inputs_for_generation( method _get_image_nums (line 1076) | def _get_image_nums( method _expand_inputs_for_generation (line 1091) | def _expand_inputs_for_generation( function smart_resize (line 1201) | def smart_resize( class GlmImageImageProcessor (line 1242) | class GlmImageImageProcessor(Qwen2VLImageProcessor): class GlmImageImageProcessorPil (line 1246) | class GlmImageImageProcessorPil(Qwen2VLImageProcessorPil): class GlmImageImagesKwargs (line 1250) | class GlmImageImagesKwargs(ImagesKwargs, total=False): class GlmImageProcessorKwargs (line 1262) | class GlmImageProcessorKwargs(Qwen2VLProcessorKwargs): class GlmImageProcessor (line 1278) | class GlmImageProcessor(ProcessorMixin): method __init__ (line 1293) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 1301) | def __call__( method _build_prompt_with_target_shape (line 1430) | def _build_prompt_with_target_shape( method _build_target_image_grid_thw (line 1454) | def _build_target_image_grid_thw( FILE: src/transformers/models/glm_image/processing_glm_image.py class GlmImageImagesKwargs (line 32) | class GlmImageImagesKwargs(ImagesKwargs, total=False): class GlmImageProcessorKwargs (line 44) | class GlmImageProcessorKwargs(ProcessingKwargs, total=False): class GlmImageProcessor (line 59) | class GlmImageProcessor(ProcessorMixin): method __init__ (line 74) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 82) | def __call__( method _build_prompt_with_target_shape (line 211) | def _build_prompt_with_target_shape( method _build_target_image_grid_thw (line 235) | def _build_target_image_grid_thw( FILE: src/transformers/models/glm_moe_dsa/configuration_glm_moe_dsa.py class GlmMoeDsaConfig (line 30) | class GlmMoeDsaConfig(PreTrainedConfig): method __post_init__ (line 121) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm_moe_dsa/modeling_glm_moe_dsa.py class GlmMoeDsaRMSNorm (line 47) | class GlmMoeDsaRMSNorm(nn.Module): method __init__ (line 48) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 56) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 63) | def extra_repr(self): function rotate_half (line 67) | def rotate_half(x): function apply_rotary_pos_emb (line 74) | def apply_rotary_pos_emb( class GlmMoeDsaIndexer (line 105) | class GlmMoeDsaIndexer(nn.Module): method __init__ (line 119) | def __init__(self, config: "GlmMoeDsaConfig", layer_idx: int): method forward (line 145) | def forward( function repeat_kv (line 232) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 244) | def eager_attention_forward( class GlmMoeDsaAttention (line 269) | class GlmMoeDsaAttention(nn.Module): method __init__ (line 289) | def __init__(self, config: GlmMoeDsaConfig, layer_idx: int): method forward (line 338) | def forward( class GlmMoeDsaMLP (line 451) | class GlmMoeDsaMLP(nn.Module): method __init__ (line 452) | def __init__(self, config, intermediate_size=None): method forward (line 462) | def forward(self, x): class GlmMoeDsaTopkRouter (line 467) | class GlmMoeDsaTopkRouter(nn.Module): method __init__ (line 468) | def __init__(self, config: GlmMoeDsaConfig): method forward (line 481) | def forward(self, hidden_states): class GlmMoeDsaNaiveMoe (line 488) | class GlmMoeDsaNaiveMoe(nn.Module): method __init__ (line 491) | def __init__(self, config): method forward (line 500) | def forward( class GlmMoeDsaMoE (line 527) | class GlmMoeDsaMoE(nn.Module): method __init__ (line 532) | def __init__(self, config): method route_tokens_to_experts (line 547) | def route_tokens_to_experts(self, router_logits): method forward (line 572) | def forward(self, hidden_states): class GlmMoeDsaDecoderLayer (line 583) | class GlmMoeDsaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 584) | def __init__(self, config: GlmMoeDsaConfig, layer_idx: int): method forward (line 597) | def forward( class GlmMoeDsaPreTrainedModel (line 630) | class GlmMoeDsaPreTrainedModel(PreTrainedModel): method _init_weights (line 654) | def _init_weights(self, module): class GlmMoeDsaRotaryEmbedding (line 664) | class GlmMoeDsaRotaryEmbedding(nn.Module): method __init__ (line 667) | def __init__(self, config: GlmMoeDsaConfig, device=None): method compute_default_rope_parameters (line 684) | def compute_default_rope_parameters( method forward (line 717) | def forward(self, x, position_ids): class GlmMoeDsaModel (line 732) | class GlmMoeDsaModel(GlmMoeDsaPreTrainedModel): method __init__ (line 733) | def __init__(self, config: GlmMoeDsaConfig): method forward (line 752) | def forward( class GlmMoeDsaForCausalLM (line 806) | class GlmMoeDsaForCausalLM(GlmMoeDsaPreTrainedModel, GenerationMixin): method __init__ (line 811) | def __init__(self, config): method forward (line 822) | def forward( FILE: src/transformers/models/glm_moe_dsa/modular_glm_moe_dsa.py function apply_rotary_pos_emb (line 46) | def apply_rotary_pos_emb( class GlmMoeDsaConfig (line 79) | class GlmMoeDsaConfig(Glm4MoeLiteConfig): method __post_init__ (line 137) | def __post_init__(self, **kwargs): class GlmMoeDsaRMSNorm (line 148) | class GlmMoeDsaRMSNorm(Glm4MoeRMSNorm): class GlmMoeDsaIndexer (line 152) | class GlmMoeDsaIndexer(nn.Module): method __init__ (line 166) | def __init__(self, config: "GlmMoeDsaConfig", layer_idx: int): method forward (line 192) | def forward( class GlmMoeDsaAttention (line 279) | class GlmMoeDsaAttention(nn.Module): method __init__ (line 299) | def __init__(self, config: GlmMoeDsaConfig, layer_idx: int): method forward (line 348) | def forward( class GlmMoeDsaDecoderLayer (line 461) | class GlmMoeDsaDecoderLayer(Glm4MoeLiteDecoderLayer): class GlmMoeDsaPreTrainedModel (line 465) | class GlmMoeDsaPreTrainedModel(Glm4MoePreTrainedModel): class GlmMoeDsaModel (line 477) | class GlmMoeDsaModel(Glm4MoeModel): class GlmMoeDsaForCausalLM (line 481) | class GlmMoeDsaForCausalLM(Glm4MoeForCausalLM): FILE: src/transformers/models/glm_ocr/configuration_glm_ocr.py class GlmOcrVisionConfig (line 30) | class GlmOcrVisionConfig(PreTrainedConfig): class GlmOcrTextConfig (line 72) | class GlmOcrTextConfig(PreTrainedConfig): method __post_init__ (line 123) | def __post_init__(self, **kwargs): class GlmOcrConfig (line 132) | class GlmOcrConfig(PreTrainedConfig): method __post_init__ (line 171) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glm_ocr/modeling_glm_ocr.py class GlmOcrRMSNorm (line 50) | class GlmOcrRMSNorm(nn.Module): method __init__ (line 51) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 59) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self): class GlmOcrVisionMlp (line 70) | class GlmOcrVisionMlp(nn.Module): method __init__ (line 71) | def __init__(self, config, bias: bool = True): method forward (line 80) | def forward(self, hidden_state): function repeat_kv (line 84) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 96) | def eager_attention_forward( function rotate_half_llm (line 121) | def rotate_half_llm(x): function apply_rotary_pos_emb (line 128) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class GlmOcrTextAttention (line 168) | class GlmOcrTextAttention(nn.Module): method __init__ (line 174) | def __init__(self, config: GlmOcrTextConfig, layer_idx: int | None = N... method forward (line 193) | def forward( class GlmOcrTextMLP (line 237) | class GlmOcrTextMLP(nn.Module): method __init__ (line 238) | def __init__(self, config): method forward (line 246) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class GlmOcrTextDecoderLayer (line 255) | class GlmOcrTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 256) | def __init__(self, config: GlmOcrTextConfig, layer_idx: int): method forward (line 267) | def forward( class GlmOcrVisionRotaryEmbedding (line 305) | class GlmOcrVisionRotaryEmbedding(nn.Module): method __init__ (line 308) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 315) | def forward(self, seqlen: int) -> torch.Tensor: class GlmOcrPreTrainedModel (line 322) | class GlmOcrPreTrainedModel(PreTrainedModel): method _init_weights (line 336) | def _init_weights(self, module): class GlmOcrModelOutputWithPast (line 349) | class GlmOcrModelOutputWithPast(ModelOutput): function rotate_half (line 367) | def rotate_half(x): function apply_rotary_pos_emb_vision (line 374) | def apply_rotary_pos_emb_vision( class GlmOcrVisionAttention (line 388) | class GlmOcrVisionAttention(nn.Module): method __init__ (line 389) | def __init__(self, config: GlmOcrVisionConfig) -> None: method forward (line 404) | def forward( class GlmOcrVisionBlock (line 476) | class GlmOcrVisionBlock(GradientCheckpointingLayer): method __init__ (line 477) | def __init__(self, config) -> None: method forward (line 485) | def forward( class GlmOcrVisionPatchMerger (line 510) | class GlmOcrVisionPatchMerger(nn.Module): method __init__ (line 511) | def __init__(self, dim: int, context_dim: int, hidden_act: str, bias: ... method forward (line 521) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class GlmOcrVisionPatchEmbed (line 527) | class GlmOcrVisionPatchEmbed(nn.Module): method __init__ (line 528) | def __init__(self, config: GlmOcrVisionConfig) -> None: method forward (line 538) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GlmOcrVisionModel (line 547) | class GlmOcrVisionModel(GlmOcrPreTrainedModel): method __init__ (line 556) | def __init__(self, config) -> None: method rot_pos_emb (line 582) | def rot_pos_emb(self, grid_thw): method forward (line 614) | def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor,... class GlmOcrTextRotaryEmbedding (line 661) | class GlmOcrTextRotaryEmbedding(nn.Module): method __init__ (line 664) | def __init__(self, config: GlmOcrTextConfig, device=None): method compute_default_rope_parameters (line 682) | def compute_default_rope_parameters( method forward (line 715) | def forward(self, x, position_ids): method apply_mrope (line 731) | def apply_mrope(self, freqs, mrope_section): class GlmOcrTextModel (line 739) | class GlmOcrTextModel(GlmOcrPreTrainedModel): method __init__ (line 747) | def __init__(self, config: GlmOcrTextConfig): method forward (line 766) | def forward( class GlmOcrModel (line 844) | class GlmOcrModel(GlmOcrPreTrainedModel): method __init__ (line 850) | def __init__(self, config): method get_input_embeddings (line 859) | def get_input_embeddings(self): method set_input_embeddings (line 862) | def set_input_embeddings(self, value): method get_vision_position_ids (line 865) | def get_vision_position_ids( method get_rope_index (line 921) | def get_rope_index( method get_video_features (line 1040) | def get_video_features( method get_image_features (line 1071) | def get_image_features( method get_placeholder_mask (line 1091) | def get_placeholder_mask( method compute_3d_position_ids (line 1133) | def compute_3d_position_ids( method forward (line 1184) | def forward( class GlmOcrCausalLMOutputWithPast (line 1257) | class GlmOcrCausalLMOutputWithPast(ModelOutput): class GlmOcrForConditionalGeneration (line 1280) | class GlmOcrForConditionalGeneration(GlmOcrPreTrainedModel, GenerationMi... method __init__ (line 1285) | def __init__(self, config): method get_input_embeddings (line 1292) | def get_input_embeddings(self): method set_input_embeddings (line 1295) | def set_input_embeddings(self, value): method get_video_features (line 1299) | def get_video_features( method get_image_features (line 1316) | def get_image_features( method forward (line 1332) | def forward( method prepare_inputs_for_generation (line 1423) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1461) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1499) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1555) | def _expand_inputs_for_generation( FILE: src/transformers/models/glm_ocr/modular_glm_ocr.py class GlmOcrRMSNorm (line 46) | class GlmOcrRMSNorm(Glm4vRMSNorm): class GlmOcrVisionMlp (line 50) | class GlmOcrVisionMlp(Glm4VisionMlp): method __init__ (line 51) | def __init__(self, config, bias: bool = True): class GlmOcrVisionConfig (line 58) | class GlmOcrVisionConfig(Glm4vVisionConfig): class GlmOcrTextConfig (line 68) | class GlmOcrTextConfig(Glm4vTextConfig): class GlmOcrConfig (line 96) | class GlmOcrConfig(Glm4vConfig): class GlmOcrTextAttention (line 128) | class GlmOcrTextAttention(Glm4vTextAttention, nn.Module): method __init__ (line 129) | def __init__(self, config: GlmOcrTextConfig, layer_idx: int | None = N... class GlmOcrTextDecoderLayer (line 137) | class GlmOcrTextDecoderLayer(Glm4vTextDecoderLayer): class GlmOcrPreTrainedModel (line 141) | class GlmOcrPreTrainedModel(Glm4vPreTrainedModel): class GlmOcrModelOutputWithPast (line 145) | class GlmOcrModelOutputWithPast(Glm4vModelOutputWithPast): class GlmOcrVisionAttention (line 149) | class GlmOcrVisionAttention(Glm4vVisionAttention): method __init__ (line 150) | def __init__(self, config: GlmOcrVisionConfig) -> None: method forward (line 157) | def forward( class GlmOcrVisionBlock (line 229) | class GlmOcrVisionBlock(Glm4vVisionBlock): method __init__ (line 230) | def __init__(self, config) -> None: class GlmOcrVisionPatchMerger (line 235) | class GlmOcrVisionPatchMerger(Glm4vVisionPatchMerger): class GlmOcrVisionModel (line 239) | class GlmOcrVisionModel(Glm4vVisionModel): method __init__ (line 240) | def __init__(self, config) -> None: method forward (line 250) | def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor,... class GlmOcrTextModel (line 297) | class GlmOcrTextModel(Glm4vTextModel): class GlmOcrModel (line 304) | class GlmOcrModel(Glm4vModel): class GlmOcrForConditionalGeneration (line 308) | class GlmOcrForConditionalGeneration(Glm4vForConditionalGeneration): FILE: src/transformers/models/glmasr/configuration_glmasr.py class GlmAsrEncoderConfig (line 25) | class GlmAsrEncoderConfig(PreTrainedConfig): method __post_init__ (line 56) | def __post_init__(self, **kwargs): class GlmAsrConfig (line 66) | class GlmAsrConfig(PreTrainedConfig): method __post_init__ (line 105) | def __post_init__(self, **kwargs): FILE: src/transformers/models/glmasr/convert_glmasr_weights_to_hf.py function permute_rope (line 68) | def permute_rope(tensor, config): function convert_key (line 105) | def convert_key(key, mapping): function main (line 111) | def main(): FILE: src/transformers/models/glmasr/modeling_glmasr.py class GlmAsrRotaryEmbedding (line 45) | class GlmAsrRotaryEmbedding(nn.Module): method __init__ (line 48) | def __init__(self, config: GlmAsrConfig, device=None): method compute_default_rope_parameters (line 65) | def compute_default_rope_parameters( method forward (line 98) | def forward(self, x, position_ids): function rotate_half (line 112) | def rotate_half(x): function repeat_kv (line 119) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 131) | def eager_attention_forward( function apply_rotary_pos_emb (line 156) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_di... class GlmAsrAttention (line 175) | class GlmAsrAttention(nn.Module): method __init__ (line 178) | def __init__(self, config: GlmAsrConfig, layer_idx: int): method forward (line 192) | def forward( class GlmAsrMLP (line 228) | class GlmAsrMLP(nn.Module): method __init__ (line 229) | def __init__(self, config): method forward (line 235) | def forward(self, hidden_states: torch.Tensor): class GlmAsrEncoderLayer (line 242) | class GlmAsrEncoderLayer(GradientCheckpointingLayer): method __init__ (line 243) | def __init__(self, config: GlmAsrConfig, layer_idx: int): method forward (line 253) | def forward( class GlmAsrPreTrainedModel (line 278) | class GlmAsrPreTrainedModel(PreTrainedModel): class GlmAsrEncoder (line 290) | class GlmAsrEncoder(GlmAsrPreTrainedModel): method __init__ (line 300) | def __init__(self, config: GlmAsrEncoderConfig): method forward (line 316) | def forward(self, input_features, **kwargs: Unpack[TransformersKwargs]): class GlmAsrMultiModalProjector (line 333) | class GlmAsrMultiModalProjector(nn.Module): method __init__ (line 339) | def __init__(self, config: GlmAsrConfig): method forward (line 345) | def forward(self, audio_features): class GlmAsrForConditionalGeneration (line 357) | class GlmAsrForConditionalGeneration(GlmAsrPreTrainedModel, GenerationMi... method __init__ (line 362) | def __init__(self, config): method get_input_embeddings (line 372) | def get_input_embeddings(self): method set_input_embeddings (line 375) | def set_input_embeddings(self, value): method get_output_embeddings (line 378) | def get_output_embeddings(self): method set_output_embeddings (line 381) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 384) | def set_decoder(self, decoder): method get_decoder (line 387) | def get_decoder(self): method get_audio_features (line 394) | def get_audio_features( method forward (line 430) | def forward( method prepare_inputs_for_generation (line 497) | def prepare_inputs_for_generation(self, *args, is_first_iteration: boo... FILE: src/transformers/models/glmasr/modular_glmasr.py class GlmAsrProcessorKwargs (line 49) | class GlmAsrProcessorKwargs(AudioFlamingo3ProcessorKwargs): ... class GlmAsrProcessor (line 52) | class GlmAsrProcessor(AudioFlamingo3Processor): method __init__ (line 77) | def __init__( method _get_audio_token_length (line 95) | def _get_audio_token_length(self, audio_lengths: "torch.Tensor") -> "t... method apply_transcription_request (line 103) | def apply_transcription_request( class GlmAsrRotaryEmbedding (line 185) | class GlmAsrRotaryEmbedding(GlmRotaryEmbedding): ... function apply_rotary_pos_emb (line 188) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_di... class GlmAsrAttention (line 206) | class GlmAsrAttention(LlamaAttention): method __init__ (line 207) | def __init__(self, config: GlmAsrConfig, layer_idx: int): method forward (line 215) | def forward( class GlmAsrMLP (line 251) | class GlmAsrMLP(nn.Module): method __init__ (line 252) | def __init__(self, config): method forward (line 258) | def forward(self, hidden_states: torch.Tensor): class GlmAsrEncoderLayer (line 265) | class GlmAsrEncoderLayer(GradientCheckpointingLayer): method __init__ (line 266) | def __init__(self, config: GlmAsrConfig, layer_idx: int): method forward (line 276) | def forward( class GlmAsrPreTrainedModel (line 300) | class GlmAsrPreTrainedModel(AudioFlamingo3PreTrainedModel): ... class GlmAsrEncoder (line 304) | class GlmAsrEncoder(GlmAsrPreTrainedModel): method __init__ (line 314) | def __init__(self, config: GlmAsrEncoderConfig): method forward (line 330) | def forward(self, input_features, **kwargs: Unpack[TransformersKwargs]): class GlmAsrMultiModalProjector (line 347) | class GlmAsrMultiModalProjector(AudioFlamingo3MultiModalProjector): method __init__ (line 348) | def __init__(self, config: GlmAsrConfig): class GlmAsrForConditionalGeneration (line 359) | class GlmAsrForConditionalGeneration(AudioFlamingo3ForConditionalGenerat... method get_audio_features (line 364) | def get_audio_features( method forward (line 388) | def forward( FILE: src/transformers/models/glmasr/processing_glmasr.py class GlmAsrProcessorKwargs (line 40) | class GlmAsrProcessorKwargs(ProcessingKwargs, total=False): class GlmAsrProcessor (line 57) | class GlmAsrProcessor(ProcessorMixin): method __init__ (line 82) | def __init__( method _get_audio_token_length (line 97) | def _get_audio_token_length(self, audio_lengths: "torch.Tensor") -> "t... method _expand_audio_tokens (line 105) | def _expand_audio_tokens(self, text, padding_mask, per_sample_windows): method _get_audio_tokens_mask (line 113) | def _get_audio_tokens_mask(self, input_ids): method __call__ (line 116) | def __call__( method model_input_names (line 212) | def model_input_names(self) -> list[str]: method apply_transcription_request (line 217) | def apply_transcription_request( method decode (line 298) | def decode(self, *args, strip_prefix=False, **kwargs): method batch_decode (line 311) | def batch_decode(self, *args, **kwargs): method _strip_assistant_prefix_and_quotes (line 315) | def _strip_assistant_prefix_and_quotes(self, text: str) -> str: FILE: src/transformers/models/glpn/configuration_glpn.py class GLPNConfig (line 24) | class GLPNConfig(PreTrainedConfig): FILE: src/transformers/models/glpn/convert_glpn_to_pytorch.py function rename_keys (line 32) | def rename_keys(state_dict): function read_in_k_v (line 97) | def read_in_k_v(state_dict, config): function prepare_img (line 116) | def prepare_img(): function convert_glpn_checkpoint (line 125) | def convert_glpn_checkpoint(checkpoint_path, pytorch_dump_folder_path, p... FILE: src/transformers/models/glpn/image_processing_glpn.py class GLPNImageProcessorKwargs (line 40) | class GLPNImageProcessorKwargs(ImagesKwargs, total=False): class GLPNImageProcessor (line 51) | class GLPNImageProcessor(TorchvisionBackend): method __init__ (line 62) | def __init__(self, **kwargs: Unpack[GLPNImageProcessorKwargs]): method _validate_preprocess_kwargs (line 65) | def _validate_preprocess_kwargs(self, **kwargs): method preprocess (line 71) | def preprocess(self, images: ImageInput, **kwargs: Unpack[GLPNImagePro... method resize (line 74) | def resize( method _preprocess (line 93) | def _preprocess( method post_process_depth_estimation (line 126) | def post_process_depth_estimation( FILE: src/transformers/models/glpn/image_processing_pil_glpn.py class GLPNImageProcessorKwargs (line 35) | class GLPNImageProcessorKwargs(ImagesKwargs, total=False): class GLPNImageProcessorPil (line 46) | class GLPNImageProcessorPil(PilBackend): method __init__ (line 57) | def __init__(self, **kwargs: Unpack[GLPNImageProcessorKwargs]): method _validate_preprocess_kwargs (line 60) | def _validate_preprocess_kwargs(self, **kwargs): method preprocess (line 66) | def preprocess(self, images: ImageInput, **kwargs: Unpack[GLPNImagePro... method resize (line 69) | def resize( method _preprocess (line 83) | def _preprocess( method post_process_depth_estimation (line 115) | def post_process_depth_estimation( FILE: src/transformers/models/glpn/modeling_glpn.py function drop_path (line 32) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class GLPNDropPath (line 48) | class GLPNDropPath(nn.Module): method __init__ (line 51) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 55) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 58) | def extra_repr(self) -> str: class GLPNOverlapPatchEmbeddings (line 63) | class GLPNOverlapPatchEmbeddings(nn.Module): method __init__ (line 66) | def __init__(self, patch_size, stride, num_channels, hidden_size): method forward (line 78) | def forward(self, pixel_values): class GLPNEfficientSelfAttention (line 89) | class GLPNEfficientSelfAttention(nn.Module): method __init__ (line 93) | def __init__(self, config, hidden_size, num_attention_heads, sequence_... method forward (line 120) | def forward( class GLPNSelfOutput (line 179) | class GLPNSelfOutput(nn.Module): method __init__ (line 180) | def __init__(self, config, hidden_size): method forward (line 185) | def forward(self, hidden_states, input_tensor): class GLPNAttention (line 192) | class GLPNAttention(nn.Module): method __init__ (line 193) | def __init__(self, config, hidden_size, num_attention_heads, sequence_... method forward (line 203) | def forward(self, hidden_states, height, width, output_attentions=False): class GLPNDWConv (line 212) | class GLPNDWConv(nn.Module): method __init__ (line 213) | def __init__(self, dim=768): method forward (line 217) | def forward(self, hidden_states, height, width): class GLPNMixFFN (line 227) | class GLPNMixFFN(nn.Module): method __init__ (line 228) | def __init__(self, config, in_features, hidden_features=None, out_feat... method forward (line 240) | def forward(self, hidden_states, height, width): class GLPNLayer (line 251) | class GLPNLayer(nn.Module): method __init__ (line 254) | def __init__(self, config, hidden_size, num_attention_heads, drop_path... method forward (line 268) | def forward(self, hidden_states, height, width, output_attentions=False): class GLPNEncoder (line 294) | class GLPNEncoder(nn.Module): method __init__ (line 295) | def __init__(self, config): method forward (line 343) | def forward( class GLPNPreTrainedModel (line 383) | class GLPNPreTrainedModel(PreTrainedModel): class GLPNModel (line 392) | class GLPNModel(GLPNPreTrainedModel): method __init__ (line 394) | def __init__(self, config): method forward (line 406) | def forward( class GLPNSelectiveFeatureFusion (line 438) | class GLPNSelectiveFeatureFusion(nn.Module): method __init__ (line 444) | def __init__(self, in_channel=64): method forward (line 465) | def forward(self, local_features, global_features): class GLPNDecoderStage (line 482) | class GLPNDecoderStage(nn.Module): method __init__ (line 483) | def __init__(self, in_channels, out_channels): method forward (line 490) | def forward(self, hidden_state, residual=None): class GLPNDecoder (line 502) | class GLPNDecoder(nn.Module): method __init__ (line 503) | def __init__(self, config): method forward (line 517) | def forward(self, hidden_states: list[torch.Tensor]) -> list[torch.Ten... class SiLogLoss (line 529) | class SiLogLoss(nn.Module): method __init__ (line 538) | def __init__(self, lambd=0.5): method forward (line 542) | def forward(self, pred, target): class GLPNDepthEstimationHead (line 550) | class GLPNDepthEstimationHead(nn.Module): method __init__ (line 551) | def __init__(self, config): method forward (line 563) | def forward(self, hidden_states: list[torch.Tensor]) -> torch.Tensor: class GLPNForDepthEstimation (line 580) | class GLPNForDepthEstimation(GLPNPreTrainedModel): method __init__ (line 581) | def __init__(self, config): method forward (line 592) | def forward( FILE: src/transformers/models/got_ocr2/configuration_got_ocr2.py class GotOcr2VisionConfig (line 31) | class GotOcr2VisionConfig(PreTrainedConfig): class GotOcr2Config (line 69) | class GotOcr2Config(PreTrainedConfig): method __post_init__ (line 98) | def __post_init__(self, **kwargs): FILE: src/transformers/models/got_ocr2/convert_got_ocr2_weights_to_hf.py function convert_old_keys_to_new_keys (line 63) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function load_original_state_dict (line 78) | def load_original_state_dict(model_id): function get_got_ocr2_config (line 91) | def get_got_ocr2_config(): function write_model (line 97) | def write_model( class GotOcr2Converter (line 159) | class GotOcr2Converter(TikTokenConverter): method __init__ (line 160) | def __init__( function write_tokenizer (line 182) | def write_tokenizer(tokenizer_path: str, save_dir: str, push_to_hub: boo... function write_image_processor (line 222) | def write_image_processor(save_dir: str, push_to_hub: bool = False): function main (line 238) | def main(): FILE: src/transformers/models/got_ocr2/image_processing_got_ocr2.py class GotOcr2ImageProcessorKwargs (line 32) | class GotOcr2ImageProcessorKwargs(ImagesKwargs, total=False): function get_all_supported_aspect_ratios (line 51) | def get_all_supported_aspect_ratios(min_image_tiles: int, max_image_tile... function get_optimal_tiled_canvas (line 86) | def get_optimal_tiled_canvas( class GotOcr2ImageProcessor (line 125) | class GotOcr2ImageProcessor(TorchvisionBackend): method __init__ (line 139) | def __init__(self, **kwargs: Unpack[GotOcr2ImageProcessorKwargs]): method crop_image_to_patches (line 142) | def crop_image_to_patches( method _preprocess (line 208) | def _preprocess( method get_number_of_image_patches (line 271) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/got_ocr2/image_processing_pil_got_ocr2.py class GotOcr2ImageProcessorKwargs (line 40) | class GotOcr2ImageProcessorKwargs(ImagesKwargs, total=False): function get_all_supported_aspect_ratios (line 60) | def get_all_supported_aspect_ratios(min_image_tiles: int, max_image_tile... function get_optimal_tiled_canvas (line 96) | def get_optimal_tiled_canvas( class GotOcr2ImageProcessorPil (line 135) | class GotOcr2ImageProcessorPil(PilBackend): method __init__ (line 149) | def __init__(self, **kwargs: Unpack[GotOcr2ImageProcessorKwargs]): method crop_image_to_patches (line 152) | def crop_image_to_patches( method _preprocess (line 223) | def _preprocess( method get_number_of_image_patches (line 274) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/got_ocr2/modeling_got_ocr2.py class GotOcr2MLPBlock (line 44) | class GotOcr2MLPBlock(nn.Module): method __init__ (line 45) | def __init__(self, config): method forward (line 51) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GotOcr2VisionAttention (line 58) | class GotOcr2VisionAttention(nn.Module): method __init__ (line 61) | def __init__(self, config, window_size): method get_rel_pos (line 86) | def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor)... method get_decomposed_rel_pos (line 118) | def get_decomposed_rel_pos( method forward (line 160) | def forward(self, hidden_states: torch.Tensor, output_attentions=None)... class GotOcr2VisionLayer (line 191) | class GotOcr2VisionLayer(GradientCheckpointingLayer): method __init__ (line 192) | def __init__(self, config, window_size): method window_partition (line 200) | def window_partition(self, hidden_states: torch.Tensor, window_size: i... method window_unpartition (line 224) | def window_unpartition( method forward (line 254) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.FloatTen... class GotOcr2PreTrainedModel (line 276) | class GotOcr2PreTrainedModel(PreTrainedModel): method _init_weights (line 290) | def _init_weights(self, module): class GotOcr2VisionEncoderOutput (line 308) | class GotOcr2VisionEncoderOutput(ModelOutput): class GotOcr2PatchEmbeddings (line 320) | class GotOcr2PatchEmbeddings(nn.Module): method __init__ (line 327) | def __init__(self, config): method forward (line 341) | def forward(self, pixel_values): class GotOcr2LayerNorm (line 355) | class GotOcr2LayerNorm(nn.LayerNorm): method __init__ (line 361) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 367) | def forward(self, features: torch.Tensor) -> torch.Tensor: class GotOcr2VisionNeck (line 381) | class GotOcr2VisionNeck(nn.Module): method __init__ (line 382) | def __init__(self, config: GotOcr2VisionConfig): method forward (line 391) | def forward(self, hidden_states): class GotOcr2VisionEncoder (line 401) | class GotOcr2VisionEncoder(GotOcr2PreTrainedModel): method __init__ (line 405) | def __init__(self, config: GotOcr2VisionConfig): method get_input_embeddings (line 436) | def get_input_embeddings(self): method forward (line 441) | def forward( class GotOcr2MultiModalProjector (line 458) | class GotOcr2MultiModalProjector(nn.Module): method __init__ (line 459) | def __init__(self, config: GotOcr2Config): method forward (line 471) | def forward(self, vision_embeddings: torch.Tensor) -> torch.Tensor: class GotOcr2CausalLMOutputWithPast (line 485) | class GotOcr2CausalLMOutputWithPast(ModelOutput): class GotOcr2ModelOutputWithPast (line 515) | class GotOcr2ModelOutputWithPast(BaseModelOutputWithPast): class GotOcr2Model (line 535) | class GotOcr2Model(GotOcr2PreTrainedModel): method __init__ (line 536) | def __init__(self, config: GotOcr2Config): method get_input_embeddings (line 544) | def get_input_embeddings(self): method set_input_embeddings (line 547) | def set_input_embeddings(self, value): method get_image_features (line 554) | def get_image_features( method get_placeholder_mask (line 565) | def get_placeholder_mask( method forward (line 591) | def forward( class GotOcr2ForConditionalGeneration (line 642) | class GotOcr2ForConditionalGeneration(GotOcr2PreTrainedModel, Generation... method __init__ (line 645) | def __init__(self, config: GotOcr2Config): method get_input_embeddings (line 651) | def get_input_embeddings(self): method set_input_embeddings (line 654) | def set_input_embeddings(self, value): method get_output_embeddings (line 657) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 661) | def get_image_features( method forward (line 668) | def forward( method prepare_inputs_for_generation (line 750) | def prepare_inputs_for_generation( FILE: src/transformers/models/got_ocr2/modular_got_ocr2.py class GotOcr2VisionConfig (line 49) | class GotOcr2VisionConfig(PreTrainedConfig): class GotOcr2Config (line 87) | class GotOcr2Config(PreTrainedConfig): method __post_init__ (line 116) | def __post_init__(self, **kwargs): class GotOcr2MLPBlock (line 150) | class GotOcr2MLPBlock(SamMLPBlock): class GotOcr2VisionAttention (line 154) | class GotOcr2VisionAttention(SamVisionAttention): class GotOcr2VisionLayer (line 158) | class GotOcr2VisionLayer(SamVisionLayer): method __init__ (line 159) | def __init__(self, config, window_size): class GotOcr2PreTrainedModel (line 168) | class GotOcr2PreTrainedModel(SamPreTrainedModel): method _init_weights (line 211) | def _init_weights(self, module): class GotOcr2VisionEncoder (line 172) | class GotOcr2VisionEncoder(SamVisionEncoder, GotOcr2PreTrainedModel): class GotOcr2MultiModalProjector (line 176) | class GotOcr2MultiModalProjector(nn.Module): method __init__ (line 177) | def __init__(self, config: GotOcr2Config): method forward (line 189) | def forward(self, vision_embeddings: torch.Tensor) -> torch.Tensor: class GotOcr2CausalLMOutputWithPast (line 197) | class GotOcr2CausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class GotOcr2ModelOutputWithPast (line 201) | class GotOcr2ModelOutputWithPast(LlavaModelOutputWithPast): class GotOcr2PreTrainedModel (line 205) | class GotOcr2PreTrainedModel(LlavaPreTrainedModel): method _init_weights (line 211) | def _init_weights(self, module): class GotOcr2Model (line 222) | class GotOcr2Model(LlavaModel): method __init__ (line 223) | def __init__(self, config: GotOcr2Config): method get_image_features (line 231) | def get_image_features( method forward (line 244) | def forward( class GotOcr2ForConditionalGeneration (line 290) | class GotOcr2ForConditionalGeneration(LlavaForConditionalGeneration): method forward (line 293) | def forward( method get_image_features (line 376) | def get_image_features( FILE: src/transformers/models/got_ocr2/processing_got_ocr2.py class GotOcr2TextKwargs (line 31) | class GotOcr2TextKwargs(TextKwargs, total=False): class GotOcr2ImagesKwargs (line 41) | class GotOcr2ImagesKwargs(ImagesKwargs, total=False): class GotOcr2ProcessorKwargs (line 77) | class GotOcr2ProcessorKwargs(ProcessingKwargs, total=False): function preprocess_box_annotation (line 95) | def preprocess_box_annotation(box: list | tuple, image_size: tuple[int, ... class GotOcr2Processor (line 112) | class GotOcr2Processor(ProcessorMixin): method __init__ (line 113) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method _make_list_of_inputs (line 125) | def _make_list_of_inputs(self, images, text, box, color, multi_page): method __call__ (line 148) | def __call__( FILE: src/transformers/models/gpt2/configuration_gpt2.py class GPT2Config (line 25) | class GPT2Config(PreTrainedConfig): FILE: src/transformers/models/gpt2/convert_gpt2_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_gpt2 (line 29) | def load_tf_weights_in_gpt2(model, config, gpt2_checkpoint_path): function convert_gpt2_checkpoint_to_pytorch (line 85) | def convert_gpt2_checkpoint_to_pytorch(gpt2_checkpoint_path, gpt2_config... FILE: src/transformers/models/gpt2/modeling_gpt2.py function eager_attention_forward (line 54) | def eager_attention_forward(module, query, key, value, attention_mask, s... class GPT2Attention (line 75) | class GPT2Attention(nn.Module): method __init__ (line 76) | def __init__(self, config, is_cross_attention=False, layer_idx=None): method _upcast_and_reordered_attn (line 113) | def _upcast_and_reordered_attn(self, query, key, value, attention_mask... method forward (line 144) | def forward( class GPT2MLP (line 229) | class GPT2MLP(nn.Module): method __init__ (line 230) | def __init__(self, intermediate_size, config): method forward (line 238) | def forward(self, hidden_states: tuple[torch.FloatTensor] | None) -> t... class GPT2Block (line 246) | class GPT2Block(GradientCheckpointingLayer): method __init__ (line 247) | def __init__(self, config, layer_idx=None): method forward (line 262) | def forward( class GPT2SequenceSummary (line 313) | class GPT2SequenceSummary(nn.Module): method __init__ (line 339) | def __init__(self, config: GPT2Config): method forward (line 368) | def forward( class GPT2PreTrainedModel (line 413) | class GPT2PreTrainedModel(PreTrainedModel): method _init_weights (line 433) | def _init_weights(self, module): class GPT2DoubleHeadsModelOutput (line 467) | class GPT2DoubleHeadsModelOutput(ModelOutput): class GPT2Model (line 494) | class GPT2Model(GPT2PreTrainedModel): method __init__ (line 495) | def __init__(self, config): method get_input_embeddings (line 513) | def get_input_embeddings(self): method set_input_embeddings (line 516) | def set_input_embeddings(self, new_embeddings): method forward (line 522) | def forward( class GPT2LMHeadModel (line 645) | class GPT2LMHeadModel(GPT2PreTrainedModel, GenerationMixin): method __init__ (line 648) | def __init__(self, config): method forward (line 658) | def forward( class GPT2DoubleHeadsModel (line 736) | class GPT2DoubleHeadsModel(GPT2PreTrainedModel, GenerationMixin): method __init__ (line 739) | def __init__(self, config): method forward (line 751) | def forward( class GPT2ForSequenceClassification (line 867) | class GPT2ForSequenceClassification(GPT2PreTrainedModel): method __init__ (line 868) | def __init__(self, config): method forward (line 879) | def forward( class GPT2ForTokenClassification (line 977) | class GPT2ForTokenClassification(GPT2PreTrainedModel): method __init__ (line 978) | def __init__(self, config): method forward (line 997) | def forward( class GPT2ForQuestionAnswering (line 1057) | class GPT2ForQuestionAnswering(GPT2PreTrainedModel): method __init__ (line 1058) | def __init__(self, config): method forward (line 1069) | def forward( FILE: src/transformers/models/gpt2/tokenization_gpt2.py class GPT2Tokenizer (line 31) | class GPT2Tokenizer(TokenizersBackend): method __init__ (line 94) | def __init__( FILE: src/transformers/models/gpt_bigcode/configuration_gpt_bigcode.py class GPTBigCodeConfig (line 24) | class GPTBigCodeConfig(PreTrainedConfig): method __post_init__ (line 82) | def __post_init__(self, **kwargs): FILE: src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py function upcast_masked_softmax (line 55) | def upcast_masked_softmax( function upcast_softmax (line 66) | def upcast_softmax(x: torch.Tensor, scale: float, softmax_dtype: torch.d... function masked_softmax (line 74) | def masked_softmax(x: torch.Tensor, mask: torch.Tensor, mask_value: torc... function repeat_kv (line 80) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 92) | def eager_attention_forward( class GPTBigCodeAttention (line 118) | class GPTBigCodeAttention(nn.Module): method __init__ (line 119) | def __init__(self, config, is_cross_attention=False, layer_idx=None): method forward (line 165) | def forward( class GPTBigCodeMLP (line 244) | class GPTBigCodeMLP(nn.Module): method __init__ (line 245) | def __init__(self, intermediate_size, config): method forward (line 254) | def forward(self, hidden_states: tuple[torch.FloatTensor] | None) -> t... class GPTBigCodeBlock (line 262) | class GPTBigCodeBlock(GradientCheckpointingLayer): method __init__ (line 263) | def __init__(self, config, layer_idx=None): method forward (line 284) | def forward( class GPTBigCodePreTrainedModel (line 335) | class GPTBigCodePreTrainedModel(PreTrainedModel): method _init_weights (line 350) | def _init_weights(self, module): class GPTBigCodeModel (line 369) | class GPTBigCodeModel(GPTBigCodePreTrainedModel): method __init__ (line 370) | def __init__(self, config): method get_input_embeddings (line 392) | def get_input_embeddings(self): method set_input_embeddings (line 395) | def set_input_embeddings(self, new_embeddings): method forward (line 401) | def forward( class GPTBigCodeForCausalLM (line 509) | class GPTBigCodeForCausalLM(GPTBigCodePreTrainedModel, GenerationMixin): method __init__ (line 512) | def __init__(self, config): method forward (line 522) | def forward( class GPTBigCodeForSequenceClassification (line 601) | class GPTBigCodeForSequenceClassification(GPTBigCodePreTrainedModel): method __init__ (line 602) | def __init__(self, config): method forward (line 613) | def forward( class GPTBigCodeForTokenClassification (line 714) | class GPTBigCodeForTokenClassification(GPTBigCodePreTrainedModel): method __init__ (line 715) | def __init__(self, config): method forward (line 734) | def forward( FILE: src/transformers/models/gpt_neo/configuration_gpt_neo.py class GPTNeoConfig (line 24) | class GPTNeoConfig(PreTrainedConfig): method __post_init__ (line 73) | def __post_init__(self, **kwargs): method validate_architecture (line 79) | def validate_architecture(self): method expand_attention_types_params (line 92) | def expand_attention_types_params(attention_types): function custom_unfold (line 100) | def custom_unfold(input, dimension, size, step): function custom_get_block_length_and_num_blocks (line 122) | def custom_get_block_length_and_num_blocks(seq_length, window_size): FILE: src/transformers/models/gpt_neo/convert_gpt_neo_mesh_tf_to_pytorch.py function load_tf_weights_in_gpt_neo (line 31) | def load_tf_weights_in_gpt_neo(model, config, gpt_neo_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 111) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, py... FILE: src/transformers/models/gpt_neo/modeling_gpt_neo.py class GPTNeoSelfAttention (line 51) | class GPTNeoSelfAttention(nn.Module): method __init__ (line 52) | def __init__(self, config, attention_type, layer_id=None): method _split_heads (line 89) | def _split_heads(self, tensor, num_heads, attn_head_size): method _merge_heads (line 97) | def _merge_heads(self, tensor, num_heads, attn_head_size): method _attn (line 105) | def _attn(self, query, key, value, attention_mask=None): method forward (line 132) | def forward( class GPTNeoFlashAttention2 (line 161) | class GPTNeoFlashAttention2(GPTNeoSelfAttention): method __init__ (line 168) | def __init__(self, *args, **kwargs): method forward (line 176) | def forward( class GPTNeoAttention (line 260) | class GPTNeoAttention(nn.Module): method __init__ (line 261) | def __init__(self, config, layer_id=0): method forward (line 277) | def forward( class GPTNeoMLP (line 295) | class GPTNeoMLP(nn.Module): method __init__ (line 296) | def __init__(self, intermediate_size, config): # in MLP: intermediate... method forward (line 304) | def forward(self, hidden_states): class GPTNeoBlock (line 312) | class GPTNeoBlock(GradientCheckpointingLayer): method __init__ (line 313) | def __init__(self, config, layer_id=None): method forward (line 322) | def forward( class GPTNeoPreTrainedModel (line 354) | class GPTNeoPreTrainedModel(PreTrainedModel): method _init_weights (line 363) | def _init_weights(self, module): class GPTNeoModel (line 376) | class GPTNeoModel(GPTNeoPreTrainedModel): method __init__ (line 377) | def __init__(self, config): method get_input_embeddings (line 391) | def get_input_embeddings(self): method set_input_embeddings (line 394) | def set_input_embeddings(self, new_embeddings): method forward (line 398) | def forward( class GPTNeoForCausalLM (line 518) | class GPTNeoForCausalLM(GPTNeoPreTrainedModel, GenerationMixin): method __init__ (line 521) | def __init__(self, config): method forward (line 530) | def forward( class GPTNeoForSequenceClassification (line 616) | class GPTNeoForSequenceClassification(GPTNeoPreTrainedModel): method __init__ (line 617) | def __init__(self, config): method forward (line 627) | def forward( class GPTNeoForTokenClassification (line 736) | class GPTNeoForTokenClassification(GPTNeoPreTrainedModel): method __init__ (line 737) | def __init__(self, config): method forward (line 749) | def forward( class GPTNeoForQuestionAnswering (line 820) | class GPTNeoForQuestionAnswering(GPTNeoPreTrainedModel): method __init__ (line 821) | def __init__(self, config): method forward (line 831) | def forward( FILE: src/transformers/models/gpt_neox/configuration_gpt_neox.py class GPTNeoXConfig (line 25) | class GPTNeoXConfig(PreTrainedConfig): method validate_architecture (line 83) | def validate_architecture(self): method convert_rope_params_to_dict (line 90) | def convert_rope_params_to_dict(self, **kwargs): FILE: src/transformers/models/gpt_neox/modeling_gpt_neox.py class GPTNeoXMLP (line 38) | class GPTNeoXMLP(nn.Module): method __init__ (line 39) | def __init__(self, config): method forward (line 45) | def forward(self, hidden_states): class GPTNeoXRotaryEmbedding (line 52) | class GPTNeoXRotaryEmbedding(nn.Module): method __init__ (line 55) | def __init__(self, config: GPTNeoXConfig, device=None): method compute_default_rope_parameters (line 72) | def compute_default_rope_parameters( method forward (line 105) | def forward(self, x, position_ids): function rotate_half (line 119) | def rotate_half(x): function apply_rotary_pos_emb (line 126) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function eager_attention_forward (line 162) | def eager_attention_forward( class GPTNeoXAttention (line 188) | class GPTNeoXAttention(nn.Module): method __init__ (line 189) | def __init__(self, config, layer_idx=None): method forward (line 203) | def forward( class GPTNeoXLayer (line 247) | class GPTNeoXLayer(GradientCheckpointingLayer): method __init__ (line 248) | def __init__(self, config, layer_idx): method forward (line 258) | def forward( class GPTNeoXPreTrainedModel (line 293) | class GPTNeoXPreTrainedModel(PreTrainedModel): class GPTNeoXModel (line 313) | class GPTNeoXModel(GPTNeoXPreTrainedModel): method __init__ (line 314) | def __init__(self, config): method forward (line 331) | def forward( method get_input_embeddings (line 383) | def get_input_embeddings(self): method set_input_embeddings (line 386) | def set_input_embeddings(self, value): class GPTNeoXForCausalLM (line 395) | class GPTNeoXForCausalLM(GPTNeoXPreTrainedModel, GenerationMixin): method __init__ (line 400) | def __init__(self, config): method get_output_embeddings (line 409) | def get_output_embeddings(self): method set_output_embeddings (line 412) | def set_output_embeddings(self, new_embeddings): method forward (line 417) | def forward( class GPTNeoXForSequenceClassification (line 493) | class GPTNeoXForSequenceClassification(GPTNeoXPreTrainedModel): method __init__ (line 494) | def __init__(self, config): method forward (line 505) | def forward( class GPTNeoXForTokenClassification (line 567) | class GPTNeoXForTokenClassification(GPTNeoXPreTrainedModel): method __init__ (line 568) | def __init__(self, config): method forward (line 581) | def forward( class GPTNeoXForQuestionAnswering (line 627) | class GPTNeoXForQuestionAnswering(GPTNeoXPreTrainedModel): method __init__ (line 628) | def __init__(self, config): method forward (line 639) | def forward( FILE: src/transformers/models/gpt_neox/modular_gpt_neox.py class GPTNeoXMLP (line 32) | class GPTNeoXMLP(nn.Module): method __init__ (line 33) | def __init__(self, config): method forward (line 39) | def forward(self, hidden_states): class GPTNeoXRotaryEmbedding (line 46) | class GPTNeoXRotaryEmbedding(LlamaRotaryEmbedding): method compute_default_rope_parameters (line 48) | def compute_default_rope_parameters( function apply_rotary_pos_emb (line 80) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function eager_attention_forward (line 116) | def eager_attention_forward( class GPTNeoXAttention (line 142) | class GPTNeoXAttention(nn.Module): method __init__ (line 143) | def __init__(self, config, layer_idx=None): method forward (line 157) | def forward( class GPTNeoXLayer (line 201) | class GPTNeoXLayer(GradientCheckpointingLayer): method __init__ (line 202) | def __init__(self, config, layer_idx): method forward (line 212) | def forward( class GPTNeoXPreTrainedModel (line 246) | class GPTNeoXPreTrainedModel(LlamaPreTrainedModel): class GPTNeoXModel (line 260) | class GPTNeoXModel(LlamaModel): method __init__ (line 261) | def __init__(self, config): method get_input_embeddings (line 275) | def get_input_embeddings(self): method set_input_embeddings (line 278) | def set_input_embeddings(self, value): method forward (line 284) | def forward( class GPTNeoXForCausalLM (line 342) | class GPTNeoXForCausalLM(GPTNeoXPreTrainedModel, GenerationMixin): method __init__ (line 347) | def __init__(self, config): method get_output_embeddings (line 356) | def get_output_embeddings(self): method set_output_embeddings (line 359) | def set_output_embeddings(self, new_embeddings): method forward (line 364) | def forward( class GPTNeoXForSequenceClassification (line 440) | class GPTNeoXForSequenceClassification(GPTNeoXPreTrainedModel): method __init__ (line 441) | def __init__(self, config): method forward (line 452) | def forward( class GPTNeoXForTokenClassification (line 514) | class GPTNeoXForTokenClassification(GPTNeoXPreTrainedModel): method __init__ (line 515) | def __init__(self, config): method forward (line 528) | def forward( class GPTNeoXForQuestionAnswering (line 574) | class GPTNeoXForQuestionAnswering(GPTNeoXPreTrainedModel): method __init__ (line 575) | def __init__(self, config): method forward (line 586) | def forward( FILE: src/transformers/models/gpt_neox/tokenization_gpt_neox.py class GPTNeoXTokenizer (line 28) | class GPTNeoXTokenizer(TokenizersBackend): method __init__ (line 97) | def __init__( FILE: src/transformers/models/gpt_neox_japanese/configuration_gpt_neox_japanese.py class GPTNeoXJapaneseConfig (line 25) | class GPTNeoXJapaneseConfig(PreTrainedConfig): method convert_rope_params_to_dict (line 67) | def convert_rope_params_to_dict(self, **kwargs): FILE: src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py class GPTNeoXJapanesePreTrainedModel (line 40) | class GPTNeoXJapanesePreTrainedModel(PreTrainedModel): method _init_weights (line 48) | def _init_weights(self, module): class GPTNeoXJapaneseRotaryEmbedding (line 57) | class GPTNeoXJapaneseRotaryEmbedding(nn.Module): method __init__ (line 60) | def __init__(self, config: GPTNeoXJapaneseConfig, device=None): method compute_default_rope_parameters (line 77) | def compute_default_rope_parameters( method forward (line 108) | def forward(self, x, position_ids): function rotate_half (line 122) | def rotate_half(x): function apply_rotary_pos_emb (line 130) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class GPTNeoXJapaneseAttention (line 155) | class GPTNeoXJapaneseAttention(nn.Module): method __init__ (line 156) | def __init__(self, config, use_bias=False, layer_idx=None): method forward (line 180) | def forward( method _split_heads (line 231) | def _split_heads(cls, tensor, num_attention_heads, attn_head_size): method _merge_heads (line 244) | def _merge_heads(cls, tensor, num_attention_heads, attn_head_size): method _attn (line 255) | def _attn(self, query, key, value, attention_mask=None): function bias_dropout_add (line 292) | def bias_dropout_add(x: Tensor, bias: Tensor, residual: Tensor | None, p... class GPTNeoXJapaneseMLP (line 313) | class GPTNeoXJapaneseMLP(nn.Module): method __init__ (line 314) | def __init__(self, config): method forward (line 322) | def forward(self, hidden_states): class GPTNeoXJapaneseLayer (line 329) | class GPTNeoXJapaneseLayer(nn.Module): method __init__ (line 330) | def __init__(self, config, layer_number): method forward (line 342) | def forward( class GPTNeoXJapaneseModel (line 384) | class GPTNeoXJapaneseModel(GPTNeoXJapanesePreTrainedModel): method __init__ (line 385) | def __init__(self, config): method get_input_embeddings (line 399) | def get_input_embeddings(self): method set_input_embeddings (line 402) | def set_input_embeddings(self, value): method forward (line 406) | def forward( class GPTNeoXJapaneseForCausalLM (line 509) | class GPTNeoXJapaneseForCausalLM(GPTNeoXJapanesePreTrainedModel, Generat... method __init__ (line 512) | def __init__(self, config): method get_output_embeddings (line 522) | def get_output_embeddings(self): method set_output_embeddings (line 525) | def set_output_embeddings(self, new_embeddings): method forward (line 529) | def forward( FILE: src/transformers/models/gpt_neox_japanese/tokenization_gpt_neox_japanese.py function load_vocab_and_emoji (line 33) | def load_vocab_and_emoji(vocab_file, emoji_file): class GPTNeoXJapaneseTokenizer (line 53) | class GPTNeoXJapaneseTokenizer(PreTrainedTokenizer): method __init__ (line 104) | def __init__( method vocab_size (line 141) | def vocab_size(self): method get_vocab (line 145) | def get_vocab(self): method _tokenize (line 148) | def _tokenize(self, text): method _convert_token_to_id (line 151) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 155) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 159) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 164) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... class SubWordJapaneseTokenizer (line 195) | class SubWordJapaneseTokenizer: method __init__ (line 219) | def __init__(self, vocab, ids_to_tokens, emoji): method __len__ (line 254) | def __len__(self): method clean_text (line 257) | def clean_text(self, content): method tokenize (line 269) | def tokenize(self, text, clean=False): method convert_id_to_token (line 336) | def convert_id_to_token(self, index, breakline="\n"): FILE: src/transformers/models/gpt_oss/configuration_gpt_oss.py class GptOssConfig (line 24) | class GptOssConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/gpt_oss/convert_gpt_oss_weights_to_hf.py function convert_old_keys_to_new_keys (line 59) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function convert_moe_packed_tensors (line 97) | def convert_moe_packed_tensors( function write_model (line 145) | def write_model( function save_sharded_model (line 297) | def save_sharded_model(state_dict, model_path): function create_safetensors_index (line 327) | def create_safetensors_index(safetensors_index, num_shards, model_path): function bytes_to_unicode (line 335) | def bytes_to_unicode(): class GptOssConverter (line 359) | class GptOssConverter(TikTokenConverter): method extract_vocab_merges_from_model (line 360) | def extract_vocab_merges_from_model(self, tiktoken_url: str): method __init__ (line 386) | def __init__( function write_tokenizer (line 435) | def write_tokenizer(tokenizer_path: str, save_dir: str): function main (line 783) | def main(): FILE: src/transformers/models/gpt_oss/modeling_gpt_oss.py class GptOssRMSNorm (line 48) | class GptOssRMSNorm(nn.Module): method __init__ (line 49) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 57) | def forward(self, hidden_states) -> torch.Tensor: method extra_repr (line 64) | def extra_repr(self): class GptOssExperts (line 69) | class GptOssExperts(nn.Module): method __init__ (line 70) | def __init__(self, config): method _apply_gate (line 82) | def _apply_gate(self, gate_up: torch.Tensor) -> torch.Tensor: method forward (line 90) | def forward(self, hidden_states: torch.Tensor, router_indices=None, ro... class GptOssTopKRouter (line 117) | class GptOssTopKRouter(nn.Module): method __init__ (line 118) | def __init__(self, config): method forward (line 126) | def forward(self, hidden_states): class GptOssMLP (line 134) | class GptOssMLP(nn.Module): method __init__ (line 135) | def __init__(self, config): method forward (line 140) | def forward(self, hidden_states): class GptOssRotaryEmbedding (line 149) | class GptOssRotaryEmbedding(nn.Module): method __init__ (line 152) | def __init__(self, config: GptOssConfig, device=None): method compute_default_rope_parameters (line 169) | def compute_default_rope_parameters( method forward (line 200) | def forward(self, x, position_ids): function repeat_kv (line 214) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function _apply_rotary_emb (line 226) | def _apply_rotary_emb( function apply_rotary_pos_emb (line 237) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_di... function eager_attention_forward (line 245) | def eager_attention_forward( class GptOssAttention (line 277) | class GptOssAttention(nn.Module): method __init__ (line 280) | def __init__(self, config: GptOssConfig, layer_idx: int): method forward (line 305) | def forward( class GptOssDecoderLayer (line 348) | class GptOssDecoderLayer(GradientCheckpointingLayer): method __init__ (line 349) | def __init__(self, config: GptOssConfig, layer_idx: int): method forward (line 357) | def forward( class GptOssPreTrainedModel (line 390) | class GptOssPreTrainedModel(PreTrainedModel): method _init_weights (line 411) | def _init_weights(self, module): class GptOssModel (line 427) | class GptOssModel(GptOssPreTrainedModel): method __init__ (line 430) | def __init__(self, config: GptOssConfig): method forward (line 449) | def forward( function load_balancing_loss_func (line 506) | def load_balancing_loss_func( class GptOssForCausalLM (line 589) | class GptOssForCausalLM(GptOssPreTrainedModel, GenerationMixin): method __init__ (line 594) | def __init__(self, config): method forward (line 608) | def forward( class GptOssForSequenceClassification (line 691) | class GptOssForSequenceClassification(GenericForSequenceClassification, ... class GptOssForTokenClassification (line 695) | class GptOssForTokenClassification(GenericForTokenClassification, GptOss... FILE: src/transformers/models/gpt_oss/modular_gpt_oss.py class GptOssRMSNorm (line 56) | class GptOssRMSNorm(LlamaRMSNorm): method forward (line 57) | def forward(self, hidden_states): class GptOssExperts (line 66) | class GptOssExperts(nn.Module): method __init__ (line 67) | def __init__(self, config): method _apply_gate (line 79) | def _apply_gate(self, gate_up: torch.Tensor) -> torch.Tensor: method forward (line 87) | def forward(self, hidden_states: torch.Tensor, router_indices=None, ro... class GptOssTopKRouter (line 114) | class GptOssTopKRouter(nn.Module): method __init__ (line 115) | def __init__(self, config): method forward (line 123) | def forward(self, hidden_states): class GptOssMLP (line 131) | class GptOssMLP(nn.Module): method __init__ (line 132) | def __init__(self, config): method forward (line 137) | def forward(self, hidden_states): class GptOssRotaryEmbedding (line 146) | class GptOssRotaryEmbedding(Qwen2RotaryEmbedding): method forward (line 149) | def forward(self, x, position_ids): function _apply_rotary_emb (line 163) | def _apply_rotary_emb( function apply_rotary_pos_emb (line 174) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_di... function eager_attention_forward (line 182) | def eager_attention_forward( class GptOssAttention (line 213) | class GptOssAttention(Qwen2Attention): method __init__ (line 214) | def __init__(self, config: GptOssConfig, layer_idx: int): method forward (line 230) | def forward( class GptOssDecoderLayer (line 273) | class GptOssDecoderLayer(LlamaDecoderLayer): method __init__ (line 274) | def __init__(self, config: GptOssConfig, layer_idx: int): method forward (line 282) | def forward( class GptOssPreTrainedModel (line 314) | class GptOssPreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 325) | def _init_weights(self, module): class GptOssModel (line 340) | class GptOssModel(MixtralModel): method forward (line 346) | def forward( class GptOssForCausalLM (line 403) | class GptOssForCausalLM(MixtralForCausalLM): class GptOssForSequenceClassification (line 407) | class GptOssForSequenceClassification(MixtralForSequenceClassification): class GptOssForTokenClassification (line 411) | class GptOssForTokenClassification(MixtralForTokenClassification): FILE: src/transformers/models/gpt_sw3/convert_megatron_to_pytorch.py function recursive_print (line 25) | def recursive_print(name, val, spaces=0): function fix_query_key_value_ordering (line 45) | def fix_query_key_value_ordering(param, num_splits, num_heads, hidden_si... function convert_megatron_checkpoint (line 61) | def convert_megatron_checkpoint(sd_megatron, config): function copy_config (line 116) | def copy_config(config_hf, config_megatron): function main (line 147) | def main(args): FILE: src/transformers/models/gpt_sw3/tokenization_gpt_sw3.py class GPTSw3Tokenizer (line 21) | class GPTSw3Tokenizer(SentencePieceBackend): method __init__ (line 87) | def __init__( method preprocess_text (line 150) | def preprocess_text(self, text: str) -> str: method _tokenize (line 165) | def _tokenize(self, text: str, **kwargs) -> list[str]: method convert_tokens_to_string (line 169) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method encode_fast (line 191) | def encode_fast( method decode_fast (line 224) | def decode_fast(self, token_ids: int | list[int]) -> str: FILE: src/transformers/models/gptj/configuration_gptj.py class GPTJConfig (line 24) | class GPTJConfig(PreTrainedConfig): FILE: src/transformers/models/gptj/modeling_gptj.py function create_sinusoidal_positions (line 47) | def create_sinusoidal_positions(num_pos: int, dim: int) -> torch.Tensor: function get_embed_positions (line 53) | def get_embed_positions(embed_positions, position_ids): function rotate_every_two (line 57) | def rotate_every_two(x: torch.Tensor) -> torch.Tensor: function apply_rotary_pos_emb (line 64) | def apply_rotary_pos_emb(tensor: torch.Tensor, sin: torch.Tensor, cos: t... class GPTJAttention (line 70) | class GPTJAttention(nn.Module): method __init__ (line 71) | def __init__(self, config, layer_idx=None): method _split_heads (line 108) | def _split_heads(self, tensor, num_attention_heads, attn_head_size, ro... method _merge_heads (line 123) | def _merge_heads(self, tensor, num_attention_heads, attn_head_size): method _attn (line 136) | def _attn( method _get_embed_positions (line 161) | def _get_embed_positions(self, position_ids): method forward (line 168) | def forward( class GPTJFlashAttention2 (line 228) | class GPTJFlashAttention2(GPTJAttention): method __init__ (line 235) | def __init__(self, *args, **kwargs): method forward (line 243) | def forward( class GPTJMLP (line 363) | class GPTJMLP(nn.Module): method __init__ (line 364) | def __init__(self, intermediate_size, config): # in MLP: intermediate... method forward (line 374) | def forward(self, hidden_states: torch.FloatTensor | None) -> torch.Fl... class GPTJBlock (line 382) | class GPTJBlock(GradientCheckpointingLayer): method __init__ (line 383) | def __init__(self, config, layer_idx=None): method forward (line 390) | def forward( class GPTJPreTrainedModel (line 417) | class GPTJPreTrainedModel(PreTrainedModel): method _init_weights (line 426) | def _init_weights(self, module): class GPTJModel (line 433) | class GPTJModel(GPTJPreTrainedModel): method __init__ (line 434) | def __init__(self, config): method get_input_embeddings (line 449) | def get_input_embeddings(self): method set_input_embeddings (line 452) | def set_input_embeddings(self, new_embeddings): method forward (line 456) | def forward( class GPTJForCausalLM (line 567) | class GPTJForCausalLM(GPTJPreTrainedModel, GenerationMixin): method __init__ (line 570) | def __init__(self, config): method forward (line 579) | def forward( class GPTJForSequenceClassification (line 656) | class GPTJForSequenceClassification(GPTJPreTrainedModel): method __init__ (line 657) | def __init__(self, config): method forward (line 667) | def forward( class GPTJForQuestionAnswering (line 769) | class GPTJForQuestionAnswering(GPTJPreTrainedModel): method __init__ (line 770) | def __init__(self, config): method forward (line 780) | def forward( FILE: src/transformers/models/granite/configuration_granite.py class GraniteConfig (line 30) | class GraniteConfig(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): FILE: src/transformers/models/granite/modeling_granite.py function rotate_half (line 44) | def rotate_half(x): function apply_rotary_pos_emb (line 52) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 77) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 89) | def eager_attention_forward( class GraniteAttention (line 115) | class GraniteAttention(nn.Module): method __init__ (line 118) | def __init__(self, config: GraniteConfig, layer_idx: int | None = None): method forward (line 141) | def forward( class GraniteRMSNorm (line 183) | class GraniteRMSNorm(nn.Module): method __init__ (line 184) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 192) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 199) | def extra_repr(self): class GraniteMLP (line 203) | class GraniteMLP(nn.Module): method __init__ (line 204) | def __init__(self, config): method forward (line 214) | def forward(self, x): class GraniteDecoderLayer (line 219) | class GraniteDecoderLayer(GradientCheckpointingLayer): method __init__ (line 220) | def __init__(self, config: GraniteConfig, layer_idx: int): method forward (line 230) | def forward( class GranitePreTrainedModel (line 284) | class GranitePreTrainedModel(PreTrainedModel): class GraniteRotaryEmbedding (line 302) | class GraniteRotaryEmbedding(nn.Module): method __init__ (line 305) | def __init__(self, config: GraniteConfig, device=None): method compute_default_rope_parameters (line 322) | def compute_default_rope_parameters( method forward (line 353) | def forward(self, x, position_ids): class GraniteModel (line 368) | class GraniteModel(GranitePreTrainedModel): method __init__ (line 369) | def __init__(self, config: GraniteConfig): method forward (line 389) | def forward( class GraniteForCausalLM (line 446) | class GraniteForCausalLM(GranitePreTrainedModel, GenerationMixin): method __init__ (line 451) | def __init__(self, config): method forward (line 462) | def forward( FILE: src/transformers/models/granite/modular_granite.py class GraniteAttention (line 39) | class GraniteAttention(LlamaAttention): method __init__ (line 42) | def __init__(self, config: GraniteConfig, layer_idx: int | None = None): class GraniteDecoderLayer (line 47) | class GraniteDecoderLayer(LlamaDecoderLayer): method __init__ (line 48) | def __init__(self, config: GraniteConfig, layer_idx: int): method forward (line 53) | def forward( class GranitePreTrainedModel (line 106) | class GranitePreTrainedModel(LlamaPreTrainedModel): class GraniteModel (line 113) | class GraniteModel(LlamaModel): method __init__ (line 114) | def __init__(self, config: GraniteConfig): method forward (line 124) | def forward( class GraniteForCausalLM (line 180) | class GraniteForCausalLM(LlamaForCausalLM): method forward (line 183) | def forward( FILE: src/transformers/models/granite_speech/configuration_granite_speech.py class GraniteSpeechEncoderConfig (line 25) | class GraniteSpeechEncoderConfig(PreTrainedConfig): class GraniteSpeechConfig (line 73) | class GraniteSpeechConfig(PreTrainedConfig): method __post_init__ (line 119) | def __post_init__(self, **kwargs): FILE: src/transformers/models/granite_speech/feature_extraction_granite_speech.py class GraniteSpeechFeatureExtractor (line 36) | class GraniteSpeechFeatureExtractor(FeatureExtractionMixin): method __init__ (line 39) | def __init__( method __call__ (line 64) | def __call__( method _extract_mel_spectrograms (line 93) | def _extract_mel_spectrograms(self, audio: "torch.Tensor", device="cpu"): method _get_num_audio_features (line 120) | def _get_num_audio_features(self, audio_lengths: Sequence[int]) -> Seq... method _get_audios_and_audio_lengths (line 145) | def _get_audios_and_audio_lengths(self, audios: AudioInput) -> Sequenc... FILE: src/transformers/models/granite_speech/modeling_granite_speech.py class GraniteSpeechCausalLMOutputWithPast (line 51) | class GraniteSpeechCausalLMOutputWithPast(ModelOutput): class GraniteSpeechEncoderProjector (line 72) | class GraniteSpeechEncoderProjector(nn.Module): method __init__ (line 73) | def __init__(self, config: GraniteSpeechConfig): method forward (line 87) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GraniteSpeechConformerFeedForward (line 107) | class GraniteSpeechConformerFeedForward(nn.Module): method __init__ (line 110) | def __init__(self, config: GraniteSpeechEncoderConfig): method forward (line 118) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GraniteSpeechConformerAttention (line 127) | class GraniteSpeechConformerAttention(nn.Module): method __init__ (line 132) | def __init__(self, config: GraniteSpeechEncoderConfig): method forward (line 151) | def forward(self, hidden_states: torch.Tensor, attention_dists: torch.... class GraniteSpeechConformerDepthWiseConv1d (line 193) | class GraniteSpeechConformerDepthWiseConv1d(nn.Module): method __init__ (line 196) | def __init__(self, chan_in: int, chan_out: int, kernel_size: int): method forward (line 205) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GraniteSpeechConformerConvModule (line 210) | class GraniteSpeechConformerConvModule(nn.Module): method __init__ (line 213) | def __init__(self, config: GraniteSpeechEncoderConfig): method forward (line 230) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GraniteSpeechConformerBlock (line 241) | class GraniteSpeechConformerBlock(nn.Module): method __init__ (line 244) | def __init__(self, config: GraniteSpeechEncoderConfig): method forward (line 252) | def forward(self, hidden_states: torch.Tensor, attention_dists: torch.... class GraniteSpeechPreTrainedModel (line 262) | class GraniteSpeechPreTrainedModel(PreTrainedModel): method _init_weights (line 270) | def _init_weights(self, module: nn.Module): class GraniteSpeechCTCEncoder (line 283) | class GraniteSpeechCTCEncoder(GraniteSpeechPreTrainedModel): method __init__ (line 291) | def __init__(self, config: GraniteSpeechEncoderConfig): method forward (line 309) | def forward( class GraniteSpeechForConditionalGeneration (line 329) | class GraniteSpeechForConditionalGeneration(GraniteSpeechPreTrainedModel... method __init__ (line 330) | def __init__(self, config: GraniteSpeechConfig): method set_decoder (line 351) | def set_decoder(self, decoder): method get_decoder (line 354) | def get_decoder(self): method set_input_embeddings (line 357) | def set_input_embeddings(self, value): method set_output_embeddings (line 360) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 363) | def get_input_embeddings(self): method get_output_embeddings (line 366) | def get_output_embeddings(self): method get_audio_features (line 371) | def get_audio_features( method forward (line 381) | def forward( method prepare_inputs_for_generation (line 487) | def prepare_inputs_for_generation( method get_merged_audio_embeddings (line 517) | def get_merged_audio_embeddings( method generate (line 553) | def generate(self, *args, **kwargs) -> torch.LongTensor: method save_pretrained (line 567) | def save_pretrained(self, save_directory, *args, **kwargs): method _get_adapter_name (line 579) | def _get_adapter_name(self): FILE: src/transformers/models/granite_speech/processing_granite_speech.py class GraniteSpeechProcessor (line 32) | class GraniteSpeechProcessor(ProcessorMixin): method __init__ (line 33) | def __init__( method __call__ (line 50) | def __call__( method _get_validated_text (line 97) | def _get_validated_text(self, text: str | list) -> list[str]: FILE: src/transformers/models/granitemoe/configuration_granitemoe.py class GraniteMoeConfig (line 30) | class GraniteMoeConfig(PreTrainedConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): FILE: src/transformers/models/granitemoe/modeling_granitemoe.py class GraniteMoeRMSNorm (line 47) | class GraniteMoeRMSNorm(nn.Module): method __init__ (line 48) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 56) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 63) | def extra_repr(self): class GraniteMoeRotaryEmbedding (line 67) | class GraniteMoeRotaryEmbedding(nn.Module): method __init__ (line 70) | def __init__(self, config: GraniteMoeConfig, device=None): method compute_default_rope_parameters (line 87) | def compute_default_rope_parameters( method forward (line 118) | def forward(self, x, position_ids): class GraniteMoeParallelExperts (line 132) | class GraniteMoeParallelExperts(nn.Module): method __init__ (line 133) | def __init__(self, num_experts: int, input_size: int, output_size: int... method forward (line 156) | def forward(self, inputs, expert_size): class GraniteMoeTopKGating (line 177) | class GraniteMoeTopKGating(nn.Module): method __init__ (line 178) | def __init__(self, input_size: int, num_experts: int, top_k: int): method forward (line 198) | def forward(self, hidden_states): class GraniteMoeMoE (line 226) | class GraniteMoeMoE(nn.Module): method __init__ (line 235) | def __init__(self, config: GraniteMoeConfig): method forward (line 250) | def forward(self, layer_input): function rotate_half (line 269) | def rotate_half(x): function apply_rotary_pos_emb (line 277) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 302) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 314) | def eager_attention_forward( class GraniteMoeAttention (line 340) | class GraniteMoeAttention(nn.Module): method __init__ (line 343) | def __init__(self, config: GraniteMoeConfig, layer_idx: int): method forward (line 366) | def forward( class GraniteMoeDecoderLayer (line 407) | class GraniteMoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 408) | def __init__(self, config: GraniteMoeConfig, layer_idx: int): method forward (line 417) | def forward( class GraniteMoePreTrainedModel (line 443) | class GraniteMoePreTrainedModel(PreTrainedModel): method _init_weights (line 460) | def _init_weights(self, module): class GraniteMoeModel (line 467) | class GraniteMoeModel(GraniteMoePreTrainedModel): method __init__ (line 468) | def __init__(self, config: GraniteMoeConfig): method forward (line 488) | def forward( function load_balancing_loss_func (line 544) | def load_balancing_loss_func( class GraniteMoeForCausalLM (line 627) | class GraniteMoeForCausalLM(GraniteMoePreTrainedModel, GenerationMixin): method __init__ (line 632) | def __init__(self, config: GraniteMoeConfig): method forward (line 647) | def forward( FILE: src/transformers/models/granitemoe/modular_granitemoe.py class GraniteMoeRMSNorm (line 36) | class GraniteMoeRMSNorm(GraniteRMSNorm): class GraniteMoeRotaryEmbedding (line 40) | class GraniteMoeRotaryEmbedding(GraniteRotaryEmbedding): class GraniteMoeParallelExperts (line 44) | class GraniteMoeParallelExperts(JetMoeParallelExperts): class GraniteMoeTopKGating (line 48) | class GraniteMoeTopKGating(JetMoeTopKGating): class GraniteMoeMoE (line 52) | class GraniteMoeMoE(nn.Module): method __init__ (line 61) | def __init__(self, config: GraniteMoeConfig): method forward (line 76) | def forward(self, layer_input): class GraniteMoeAttention (line 95) | class GraniteMoeAttention(LlamaAttention): method __init__ (line 96) | def __init__(self, config: GraniteMoeConfig, layer_idx: int): class GraniteMoeDecoderLayer (line 101) | class GraniteMoeDecoderLayer(MixtralDecoderLayer): method __init__ (line 102) | def __init__(self, config: GraniteMoeConfig, layer_idx: int): method forward (line 112) | def forward( class GraniteMoePreTrainedModel (line 138) | class GraniteMoePreTrainedModel(LlamaPreTrainedModel, PreTrainedModel): method _init_weights (line 149) | def _init_weights(self, module): class GraniteMoeModel (line 156) | class GraniteMoeModel(MixtralModel): method __init__ (line 157) | def __init__(self, config: GraniteMoeConfig): method forward (line 168) | def forward( class GraniteMoeForCausalLM (line 224) | class GraniteMoeForCausalLM(MixtralForCausalLM): method __init__ (line 225) | def __init__(self, config: GraniteMoeConfig): method forward (line 232) | def forward( FILE: src/transformers/models/granitemoehybrid/configuration_granitemoehybrid.py class GraniteMoeHybridConfig (line 26) | class GraniteMoeHybridConfig(PreTrainedConfig): method __post_init__ (line 99) | def __post_init__(self, **kwargs): method validate_architecture (line 113) | def validate_architecture(self): FILE: src/transformers/models/granitemoehybrid/modeling_granitemoehybrid.py function rotate_half (line 50) | def rotate_half(x): function apply_rotary_pos_emb (line 58) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 83) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 95) | def eager_attention_forward( class GraniteMoeHybridAttention (line 121) | class GraniteMoeHybridAttention(nn.Module): method __init__ (line 124) | def __init__(self, config: GraniteMoeHybridConfig, layer_idx: int): method forward (line 147) | def forward( function pad_tensor_by_size (line 192) | def pad_tensor_by_size(input_tensor: torch.Tensor, pad_size: int): function reshape_into_chunks (line 203) | def reshape_into_chunks(input_tensor, pad_size, chunk_size): function segment_sum (line 223) | def segment_sum(input_tensor): function apply_mask_to_padding_states (line 243) | def apply_mask_to_padding_states(hidden_states, attention_mask): class GraniteMoeHybridMambaLayer (line 256) | class GraniteMoeHybridMambaLayer(nn.Module): method __init__ (line 270) | def __init__(self, config: GraniteMoeHybridConfig, layer_idx: int): method cuda_kernels_forward (line 362) | def cuda_kernels_forward( method torch_forward (line 524) | def torch_forward( method forward (line 713) | def forward( class GraniteMoeHybridRMSNormGated (line 735) | class GraniteMoeHybridRMSNormGated(torch.nn.Module): method __init__ (line 736) | def __init__(self, hidden_size, eps=1e-6): method forward (line 741) | def forward(self, hidden_states, gate=None): class GraniteMoeHybridMLP (line 753) | class GraniteMoeHybridMLP(nn.Module): method __init__ (line 762) | def __init__(self, config: GraniteMoeHybridConfig): method forward (line 771) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GraniteMoeHybridRotaryEmbedding (line 779) | class GraniteMoeHybridRotaryEmbedding(nn.Module): method __init__ (line 782) | def __init__(self, config: GraniteMoeHybridConfig, device=None): method compute_default_rope_parameters (line 799) | def compute_default_rope_parameters( method forward (line 830) | def forward(self, x, position_ids): class GraniteMoeHybridParallelExperts (line 844) | class GraniteMoeHybridParallelExperts(nn.Module): method __init__ (line 845) | def __init__(self, num_experts: int, input_size: int, output_size: int... method forward (line 868) | def forward(self, inputs, expert_size): class GraniteMoeHybridTopKGating (line 889) | class GraniteMoeHybridTopKGating(nn.Module): method __init__ (line 890) | def __init__(self, input_size: int, num_experts: int, top_k: int): method forward (line 910) | def forward(self, hidden_states): class GraniteMoeHybridMoE (line 938) | class GraniteMoeHybridMoE(nn.Module): method __init__ (line 947) | def __init__(self, config: GraniteMoeHybridConfig): method forward (line 966) | def forward(self, layer_input): class GraniteFlashAttentionKwargs (line 985) | class GraniteFlashAttentionKwargs(TypedDict, total=False): class GraniteMoeHybridRMSNorm (line 1010) | class GraniteMoeHybridRMSNorm(nn.Module): method __init__ (line 1011) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 1019) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 1026) | def extra_repr(self): class GraniteMoeHybridDecoderLayer (line 1030) | class GraniteMoeHybridDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1031) | def __init__(self, config: GraniteMoeHybridConfig, layer_idx: int): method forward (line 1055) | def forward( class GraniteMoeHybridPreTrainedModel (line 1099) | class GraniteMoeHybridPreTrainedModel(PreTrainedModel): method _init_weights (line 1117) | def _init_weights(self, module): class GraniteMoeHybridModel (line 1130) | class GraniteMoeHybridModel(GraniteMoeHybridPreTrainedModel): method __init__ (line 1131) | def __init__(self, config: GraniteMoeHybridConfig): method forward (line 1151) | def forward( method _update_mamba_mask (line 1210) | def _update_mamba_mask(self, attention_mask, past_key_values): function load_balancing_loss_func (line 1224) | def load_balancing_loss_func( class GraniteMoeHybridForCausalLM (line 1307) | class GraniteMoeHybridForCausalLM(GraniteMoeHybridPreTrainedModel, Gener... method __init__ (line 1312) | def __init__(self, config: GraniteMoeHybridConfig): method forward (line 1327) | def forward( FILE: src/transformers/models/granitemoehybrid/modular_granitemoehybrid.py class GraniteMoeHybridAttention (line 50) | class GraniteMoeHybridAttention(GraniteMoeSharedAttention): method __init__ (line 51) | def __init__(self, config: GraniteMoeHybridConfig, layer_idx: int): method forward (line 54) | def forward( # FIME: @ARTHUR this forward is also classic: attention ... class GraniteMoeHybridMambaLayer (line 96) | class GraniteMoeHybridMambaLayer(BambaMixer): method __init__ (line 97) | def __init__(self, config: GraniteMoeHybridConfig, layer_idx: int): class GraniteMoeHybridRMSNormGated (line 101) | class GraniteMoeHybridRMSNormGated(BambaRMSNormGated): method __init__ (line 102) | def __init__(self, hidden_size, eps=1e-6): class GraniteMoeHybridMLP (line 106) | class GraniteMoeHybridMLP(GraniteMoeSharedMLP): method __init__ (line 107) | def __init__(self, config: GraniteMoeHybridConfig): class GraniteMoeHybridRotaryEmbedding (line 111) | class GraniteMoeHybridRotaryEmbedding(Gemma2RotaryEmbedding): class GraniteMoeHybridMoE (line 115) | class GraniteMoeHybridMoE(GraniteMoeSharedMoE): class GraniteMoeHybridDecoderLayer (line 119) | class GraniteMoeHybridDecoderLayer(GraniteMoeSharedDecoderLayer): method __init__ (line 120) | def __init__(self, config: GraniteMoeHybridConfig, layer_idx: int): method forward (line 140) | def forward( class GraniteMoeHybridPreTrainedModel (line 183) | class GraniteMoeHybridPreTrainedModel(GraniteMoeSharedPreTrainedModel): method _init_weights (line 189) | def _init_weights(self, module): class GraniteMoeHybridModel (line 199) | class GraniteMoeHybridModel(GraniteMoeSharedModel): method __init__ (line 200) | def __init__(self, config: GraniteMoeHybridConfig): method forward (line 211) | def forward( method _update_mamba_mask (line 270) | def _update_mamba_mask(self, attention_mask, past_key_values): class GraniteMoeHybridForCausalLM (line 284) | class GraniteMoeHybridForCausalLM(GraniteMoeSharedForCausalLM): method __init__ (line 287) | def __init__(self, config: GraniteMoeHybridConfig): method forward (line 293) | def forward(self, **super_kwargs): FILE: src/transformers/models/granitemoeshared/configuration_granitemoeshared.py class GraniteMoeSharedConfig (line 30) | class GraniteMoeSharedConfig(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): FILE: src/transformers/models/granitemoeshared/modeling_granitemoeshared.py class GraniteFlashAttentionKwargs (line 45) | class GraniteFlashAttentionKwargs(TypedDict, total=False): class GraniteMoeSharedMLP (line 69) | class GraniteMoeSharedMLP(nn.Module): method __init__ (line 78) | def __init__(self, config: GraniteMoeSharedConfig): method forward (line 87) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GraniteMoeSharedRMSNorm (line 96) | class GraniteMoeSharedRMSNorm(nn.Module): method __init__ (line 97) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 105) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 112) | def extra_repr(self): class GraniteMoeSharedParallelExperts (line 116) | class GraniteMoeSharedParallelExperts(nn.Module): method __init__ (line 117) | def __init__(self, num_experts: int, input_size: int, output_size: int... method forward (line 140) | def forward(self, inputs, expert_size): class GraniteMoeSharedTopKGating (line 161) | class GraniteMoeSharedTopKGating(nn.Module): method __init__ (line 162) | def __init__(self, input_size: int, num_experts: int, top_k: int): method forward (line 182) | def forward(self, hidden_states): class GraniteMoeSharedMoE (line 210) | class GraniteMoeSharedMoE(nn.Module): method __init__ (line 219) | def __init__(self, config: GraniteMoeSharedConfig): method forward (line 238) | def forward(self, layer_input): function rotate_half (line 257) | def rotate_half(x): function apply_rotary_pos_emb (line 265) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 290) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 302) | def eager_attention_forward( class GraniteMoeSharedAttention (line 328) | class GraniteMoeSharedAttention(nn.Module): method __init__ (line 331) | def __init__(self, config: GraniteMoeSharedConfig, layer_idx: int): method forward (line 354) | def forward( class GraniteMoeSharedDecoderLayer (line 395) | class GraniteMoeSharedDecoderLayer(GradientCheckpointingLayer): method __init__ (line 396) | def __init__(self, config: GraniteMoeSharedConfig, layer_idx: int): method forward (line 406) | def forward( class GraniteMoeSharedPreTrainedModel (line 447) | class GraniteMoeSharedPreTrainedModel(PreTrainedModel): method _init_weights (line 464) | def _init_weights(self, module): class GraniteMoeSharedRotaryEmbedding (line 470) | class GraniteMoeSharedRotaryEmbedding(nn.Module): method __init__ (line 473) | def __init__(self, config: GraniteMoeSharedConfig, device=None): method compute_default_rope_parameters (line 490) | def compute_default_rope_parameters( method forward (line 521) | def forward(self, x, position_ids): class GraniteMoeSharedModel (line 536) | class GraniteMoeSharedModel(GraniteMoeSharedPreTrainedModel): method __init__ (line 537) | def __init__(self, config: GraniteMoeSharedConfig): method forward (line 557) | def forward( function load_balancing_loss_func (line 613) | def load_balancing_loss_func( class GraniteMoeSharedForCausalLM (line 696) | class GraniteMoeSharedForCausalLM(GraniteMoeSharedPreTrainedModel, Gener... method __init__ (line 701) | def __init__(self, config: GraniteMoeSharedConfig): method forward (line 716) | def forward( FILE: src/transformers/models/granitemoeshared/modular_granitemoeshared.py class GraniteFlashAttentionKwargs (line 36) | class GraniteFlashAttentionKwargs(TypedDict, total=False): class GraniteMoeSharedMLP (line 60) | class GraniteMoeSharedMLP(nn.Module): method __init__ (line 69) | def __init__(self, config: GraniteMoeSharedConfig): method forward (line 78) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GraniteMoeSharedDecoderLayer (line 86) | class GraniteMoeSharedDecoderLayer(GraniteMoeDecoderLayer): method __init__ (line 87) | def __init__(self, config: GraniteMoeSharedConfig, layer_idx: int): method forward (line 91) | def forward( class GraniteMoeSharedPreTrainedModel (line 131) | class GraniteMoeSharedPreTrainedModel(GraniteMoePreTrainedModel): class GraniteMoeSharedModel (line 136) | class GraniteMoeSharedModel(GraniteMoeModel): method __init__ (line 137) | def __init__(self, config: GraniteMoeSharedConfig): class GraniteMoeSharedForCausalLM (line 144) | class GraniteMoeSharedForCausalLM(GraniteMoeForCausalLM): method __init__ (line 147) | def __init__(self, config: GraniteMoeSharedConfig): FILE: src/transformers/models/grounding_dino/configuration_grounding_dino.py class GroundingDinoConfig (line 29) | class GroundingDinoConfig(PreTrainedConfig): method __post_init__ (line 131) | def __post_init__(self, **kwargs): method validate_architecture (line 148) | def validate_architecture(self): FILE: src/transformers/models/grounding_dino/convert_grounding_dino_to_hf.py function get_grounding_dino_config (line 40) | def get_grounding_dino_config(model_name): function create_rename_keys (line 70) | def create_rename_keys(state_dict, config): function rename_key (line 277) | def rename_key(dct, old, new): function read_in_q_k_v_encoder (line 283) | def read_in_q_k_v_encoder(state_dict, config): function read_in_q_k_v_text_enhancer (line 316) | def read_in_q_k_v_text_enhancer(state_dict, config): function read_in_q_k_v_decoder (line 343) | def read_in_q_k_v_decoder(state_dict, config): function prepare_img (line 381) | def prepare_img(): function preprocess_caption (line 388) | def preprocess_caption(caption: str) -> str: function convert_grounding_dino_checkpoint (line 396) | def convert_grounding_dino_checkpoint(args): FILE: src/transformers/models/grounding_dino/image_processing_grounding_dino.py class GroundingDinoImageProcessorKwargs (line 63) | class GroundingDinoImageProcessorKwargs(ImagesKwargs, total=False): function convert_coco_poly_to_mask (line 81) | def convert_coco_poly_to_mask(segmentations, height: int, width: int, de... function prepare_coco_detection_annotation (line 116) | def prepare_coco_detection_annotation( function masks_to_boxes (line 180) | def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor: function rgb_to_id (line 217) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 228) | def prepare_coco_panoptic_annotation( function _scale_boxes (line 277) | def _scale_boxes(boxes, target_sizes): class GroundingDinoImageProcessor (line 306) | class GroundingDinoImageProcessor(TorchvisionBackend): method __init__ (line 320) | def __init__(self, **kwargs: Unpack[GroundingDinoImageProcessorKwargs]... method prepare_annotation (line 337) | def prepare_annotation( method resize (line 369) | def resize( method resize_annotation (line 414) | def resize_annotation( method normalize_annotation (line 471) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 486) | def _update_annotation_for_padded_image( method pad (line 521) | def pad( method preprocess (line 552) | def preprocess( method _preprocess (line 570) | def _preprocess( method post_process_object_detection (line 686) | def post_process_object_detection( FILE: src/transformers/models/grounding_dino/image_processing_pil_grounding_dino.py class GroundingDinoImageProcessorKwargs (line 71) | class GroundingDinoImageProcessorKwargs(ImagesKwargs, total=False): function convert_coco_poly_to_mask (line 89) | def convert_coco_poly_to_mask(segmentations, height: int, width: int) ->... function prepare_coco_detection_annotation (line 124) | def prepare_coco_detection_annotation( function masks_to_boxes (line 184) | def masks_to_boxes(masks: np.ndarray) -> np.ndarray: function rgb_to_id (line 221) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 232) | def prepare_coco_panoptic_annotation( function _scale_boxes (line 273) | def _scale_boxes(boxes, target_sizes): class GroundingDinoImageProcessorPil (line 302) | class GroundingDinoImageProcessorPil(PilBackend): method __init__ (line 316) | def __init__(self, **kwargs: Unpack[GroundingDinoImageProcessorKwargs]... method prepare_annotation (line 336) | def prepare_annotation( method resize (line 368) | def resize( method resize_annotation (line 422) | def resize_annotation( method normalize_annotation (line 475) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 488) | def _update_annotation_for_padded_image( method pad (line 532) | def pad( method preprocess (line 571) | def preprocess( method _preprocess (line 589) | def _preprocess( method post_process_object_detection (line 716) | def post_process_object_detection( FILE: src/transformers/models/grounding_dino/modeling_grounding_dino.py class MultiScaleDeformableAttention (line 40) | class MultiScaleDeformableAttention(nn.Module): method forward (line 41) | def forward( class GroundingDinoDecoderOutput (line 103) | class GroundingDinoDecoderOutput(ModelOutput): class GroundingDinoEncoderOutput (line 126) | class GroundingDinoEncoderOutput(ModelOutput): class GroundingDinoModelOutput (line 155) | class GroundingDinoModelOutput(ModelOutput): class GroundingDinoObjectDetectionOutput (line 218) | class GroundingDinoObjectDetectionOutput(ModelOutput): class GroundingDinoFrozenBatchNorm2d (line 295) | class GroundingDinoFrozenBatchNorm2d(nn.Module): method __init__ (line 303) | def __init__(self, n): method _load_from_state_dict (line 310) | def _load_from_state_dict( method forward (line 321) | def forward(self, x): function replace_batch_norm (line 335) | def replace_batch_norm(model): class GroundingDinoConvEncoder (line 359) | class GroundingDinoConvEncoder(nn.Module): method __init__ (line 367) | def __init__(self, config): method forward (line 385) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class GroundingDinoConvModel (line 398) | class GroundingDinoConvModel(nn.Module): method __init__ (line 403) | def __init__(self, conv_encoder, position_embedding): method forward (line 408) | def forward(self, pixel_values, pixel_mask): class GroundingDinoSinePositionEmbedding (line 419) | class GroundingDinoSinePositionEmbedding(nn.Module): method __init__ (line 425) | def __init__(self, config): method forward (line 431) | def forward(self, pixel_values, pixel_mask): class GroundingDinoLearnedPositionEmbedding (line 449) | class GroundingDinoLearnedPositionEmbedding(nn.Module): method __init__ (line 454) | def __init__(self, config): method forward (line 461) | def forward(self, pixel_values, pixel_mask=None): function build_position_encoding (line 474) | def build_position_encoding(config): class GroundingDinoMultiscaleDeformableAttention (line 486) | class GroundingDinoMultiscaleDeformableAttention(nn.Module): method __init__ (line 491) | def __init__(self, config: GroundingDinoConfig, num_heads: int, n_poin... method forward (line 523) | def forward( class GroundingDinoTextEnhancerLayer (line 593) | class GroundingDinoTextEnhancerLayer(nn.Module): method __init__ (line 596) | def __init__(self, config): method with_pos_embed (line 613) | def with_pos_embed(self, hidden_state: Tensor, position_embeddings: Te... method forward (line 616) | def forward( class GroundingDinoBiMultiHeadAttention (line 675) | class GroundingDinoBiMultiHeadAttention(nn.Module): method __init__ (line 676) | def __init__(self, config): method _reshape (line 705) | def _reshape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): method forward (line 708) | def forward( function drop_path (line 827) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class GroundingDinoDropPath (line 843) | class GroundingDinoDropPath(nn.Module): method __init__ (line 846) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 850) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 853) | def extra_repr(self) -> str: class GroundingDinoFusionLayer (line 857) | class GroundingDinoFusionLayer(nn.Module): method __init__ (line 858) | def __init__(self, config): method forward (line 873) | def forward( class GroundingDinoDeformableLayer (line 920) | class GroundingDinoDeformableLayer(nn.Module): method __init__ (line 921) | def __init__(self, config: GroundingDinoConfig): method forward (line 935) | def forward( function get_sine_pos_embed (line 1005) | def get_sine_pos_embed( class GroundingDinoEncoderLayer (line 1041) | class GroundingDinoEncoderLayer(nn.Module): method __init__ (line 1042) | def __init__(self, config) -> None: method get_text_position_embeddings (line 1051) | def get_text_position_embeddings( method forward (line 1073) | def forward( class GroundingDinoMultiheadAttention (line 1121) | class GroundingDinoMultiheadAttention(nn.Module): method __init__ (line 1124) | def __init__(self, config, num_attention_heads=None): method forward (line 1144) | def forward( class GroundingDinoDecoderLayer (line 1193) | class GroundingDinoDecoderLayer(nn.Module): method __init__ (line 1194) | def __init__(self, config: GroundingDinoConfig): method with_pos_embed (line 1223) | def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Te... method forward (line 1226) | def forward( class GroundingDinoContrastiveEmbedding (line 1311) | class GroundingDinoContrastiveEmbedding(nn.Module): method __init__ (line 1312) | def __init__(self, config): method forward (line 1316) | def forward( class GroundingDinoPreTrainedModel (line 1333) | class GroundingDinoPreTrainedModel(PreTrainedModel): method _init_weights (line 1340) | def _init_weights(self, module): method _set_gradient_checkpointing (line 1406) | def _set_gradient_checkpointing(self, module, value=False): class GroundingDinoEncoder (line 1411) | class GroundingDinoEncoder(GroundingDinoPreTrainedModel): method __init__ (line 1422) | def __init__(self, config: GroundingDinoConfig): method get_reference_points (line 1432) | def get_reference_points(spatial_shapes_list, valid_ratios, device): method forward (line 1462) | def forward( class GroundingDinoDecoder (line 1584) | class GroundingDinoDecoder(GroundingDinoPreTrainedModel): method __init__ (line 1599) | def __init__(self, config: GroundingDinoConfig): method forward (line 1618) | def forward( function generate_masks_with_special_tokens_and_transfer_map (line 1828) | def generate_masks_with_special_tokens_and_transfer_map(input_ids: torch... class GroundingDinoModel (line 1882) | class GroundingDinoModel(GroundingDinoPreTrainedModel): method __init__ (line 1883) | def __init__(self, config: GroundingDinoConfig): method freeze_backbone (line 1954) | def freeze_backbone(self): method unfreeze_backbone (line 1958) | def unfreeze_backbone(self): method get_valid_ratio (line 1962) | def get_valid_ratio(self, mask): method generate_encoder_output_proposals (line 1973) | def generate_encoder_output_proposals(self, enc_output, padding_mask, ... method forward (line 2025) | def forward( class GroundingDinoMLPPredictionHead (line 2301) | class GroundingDinoMLPPredictionHead(nn.Module): method __init__ (line 2308) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 2314) | def forward(self, x): function build_label_maps (line 2320) | def build_label_maps(logits: torch.FloatTensor, input_ids: torch.LongTen... function build_text_mask (line 2376) | def build_text_mask(logits, attention_mask): class GroundingDinoForObjectDetection (line 2393) | class GroundingDinoForObjectDetection(GroundingDinoPreTrainedModel): method __init__ (line 2401) | def __init__(self, config: GroundingDinoConfig): method forward (line 2431) | def forward( FILE: src/transformers/models/grounding_dino/modular_grounding_dino.py function _scale_boxes (line 45) | def _scale_boxes(boxes, target_sizes): class GroundingDinoImageProcessorKwargs (line 73) | class GroundingDinoImageProcessorKwargs(ImagesKwargs, total=False): class GroundingDinoImageProcessor (line 87) | class GroundingDinoImageProcessor(DetrImageProcessor): method post_process_object_detection (line 88) | def post_process_object_detection( method post_process_instance_segmentation (line 141) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 144) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 147) | def post_process_panoptic_segmentation(self): class GroundingDinoImageProcessorPil (line 151) | class GroundingDinoImageProcessorPil(DetrImageProcessorPil): method post_process_object_detection (line 153) | def post_process_object_detection( method post_process_instance_segmentation (line 207) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 210) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 213) | def post_process_panoptic_segmentation(self): FILE: src/transformers/models/grounding_dino/processing_grounding_dino.py function get_phrases_from_posmap (line 38) | def get_phrases_from_posmap(posmaps, input_ids): function _is_list_of_candidate_labels (line 64) | def _is_list_of_candidate_labels(text) -> bool: function _merge_candidate_labels_text (line 73) | def _merge_candidate_labels_text(text: list[str]) -> str: class DictWithDeprecationWarning (line 83) | class DictWithDeprecationWarning(dict): method __getitem__ (line 89) | def __getitem__(self, key): method get (line 94) | def get(self, key, *args, **kwargs): class GroundingDinoProcessorKwargs (line 100) | class GroundingDinoProcessorKwargs(ProcessingKwargs, total=False): class GroundingDinoProcessor (line 117) | class GroundingDinoProcessor(ProcessorMixin): method __init__ (line 120) | def __init__(self, image_processor, tokenizer): method __call__ (line 124) | def __call__( method _preprocess_input_text (line 134) | def _preprocess_input_text(self, text): method post_process_grounded_object_detection (line 151) | def post_process_grounded_object_detection( FILE: src/transformers/models/groupvit/configuration_groupvit.py class GroupViTTextConfig (line 27) | class GroupViTTextConfig(PreTrainedConfig): class GroupViTVisionConfig (line 65) | class GroupViTVisionConfig(PreTrainedConfig): method validate_architecture (line 114) | def validate_architecture(self): class GroupViTConfig (line 125) | class GroupViTConfig(PreTrainedConfig): method __post_init__ (line 145) | def __post_init__(self, **kwargs): FILE: src/transformers/models/groupvit/convert_groupvit_nvlab_to_hf.py function rename_key (line 31) | def rename_key(name): function convert_state_dict (line 87) | def convert_state_dict(orig_state_dict, config): function prepare_img (line 150) | def prepare_img(): function convert_groupvit_checkpoint (line 158) | def convert_groupvit_checkpoint( FILE: src/transformers/models/groupvit/modeling_groupvit.py function contrastive_loss (line 42) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function groupvit_loss (line 47) | def groupvit_loss(similarity: torch.Tensor) -> torch.Tensor: function hard_softmax (line 53) | def hard_softmax(logits: torch.Tensor, dim: int): function gumbel_softmax (line 63) | def gumbel_softmax(logits: torch.Tensor, tau: float = 1, hard: bool = Fa... function resize_attention_map (line 85) | def resize_attention_map(attentions, height, width, align_corners=False): function get_grouping_from_attentions (line 115) | def get_grouping_from_attentions(attentions, hw_shape): class GroupViTCrossAttentionLayer (line 144) | class GroupViTCrossAttentionLayer(nn.Module): method __init__ (line 145) | def __init__(self, config: GroupViTVisionConfig): method forward (line 152) | def forward(self, query, key): class GroupViTAssignAttention (line 160) | class GroupViTAssignAttention(nn.Module): method __init__ (line 161) | def __init__(self, config: GroupViTVisionConfig): method get_attn (line 171) | def get_attn(self, attn, gumbel=True, hard=True): method forward (line 182) | def forward(self, query, key): class GroupViTTokenAssign (line 208) | class GroupViTTokenAssign(nn.Module): method __init__ (line 209) | def __init__(self, config: GroupViTVisionConfig, num_group_token, num_... method project_group_token (line 230) | def project_group_token(self, group_tokens): method forward (line 243) | def forward(self, image_tokens, group_tokens): class GroupViTModelOutput (line 265) | class GroupViTModelOutput(ModelOutput): method to_tuple (line 306) | def to_tuple(self) -> tuple[Any]: class GroupViTPatchEmbeddings (line 313) | class GroupViTPatchEmbeddings(nn.Module): method __init__ (line 318) | def __init__( method forward (line 335) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... class GroupViTVisionEmbeddings (line 347) | class GroupViTVisionEmbeddings(nn.Module): method __init__ (line 348) | def __init__(self, config: GroupViTVisionConfig): method interpolate_pos_encoding (line 364) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 402) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... class GroupViTTextEmbeddings (line 422) | class GroupViTTextEmbeddings(nn.Module): method __init__ (line 423) | def __init__(self, config: GroupViTTextConfig): method forward (line 435) | def forward( class GroupViTStage (line 462) | class GroupViTStage(nn.Module): method __init__ (line 465) | def __init__( method with_group_token (line 500) | def with_group_token(self): method split_x (line 503) | def split_x(self, x): method concat_x (line 509) | def concat_x(self, x: torch.Tensor, group_token: torch.Tensor | None =... method forward (line 514) | def forward( class GroupViTMLP (line 555) | class GroupViTMLP(nn.Module): method __init__ (line 556) | def __init__( method forward (line 572) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class GroupViTMixerMLP (line 579) | class GroupViTMixerMLP(GroupViTMLP): method forward (line 580) | def forward(self, x): class GroupViTAttention (line 585) | class GroupViTAttention(nn.Module): method __init__ (line 588) | def __init__(self, config): method _shape (line 607) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 610) | def forward( class GroupViTEncoderLayer (line 682) | class GroupViTEncoderLayer(GradientCheckpointingLayer): method __init__ (line 683) | def __init__(self, config: GroupViTConfig): method forward (line 691) | def forward( class GroupViTPreTrainedModel (line 716) | class GroupViTPreTrainedModel(PreTrainedModel): method _init_weights (line 727) | def _init_weights(self, module): class GroupViTVisionEncoder (line 764) | class GroupViTVisionEncoder(nn.Module): method __init__ (line 765) | def __init__(self, config: GroupViTVisionConfig) -> None: method forward (line 782) | def forward( class GroupViTTextEncoder (line 822) | class GroupViTTextEncoder(nn.Module): method __init__ (line 831) | def __init__(self, config: GroupViTTextConfig): method forward (line 837) | def forward( class GroupViTTextTransformer (line 870) | class GroupViTTextTransformer(GroupViTPreTrainedModel): method __init__ (line 871) | def __init__(self, config: GroupViTTextConfig): method forward (line 886) | def forward( class GroupViTTextModel (line 947) | class GroupViTTextModel(GroupViTPreTrainedModel): method __init__ (line 951) | def __init__(self, config: GroupViTTextConfig): method get_input_embeddings (line 957) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 960) | def set_input_embeddings(self, value): method forward (line 964) | def forward( class GroupViTVisionTransformer (line 994) | class GroupViTVisionTransformer(nn.Module): method __init__ (line 995) | def __init__(self, config: GroupViTVisionConfig): method forward (line 1005) | def forward( class GroupViTVisionModel (line 1047) | class GroupViTVisionModel(GroupViTPreTrainedModel): method __init__ (line 1053) | def __init__(self, config: GroupViTVisionConfig): method get_input_embeddings (line 1059) | def get_input_embeddings(self) -> GroupViTPatchEmbeddings: method forward (line 1063) | def forward( class GroupViTModel (line 1102) | class GroupViTModel(GroupViTPreTrainedModel): method __init__ (line 1105) | def __init__(self, config: GroupViTConfig): method get_text_features (line 1150) | def get_text_features( method get_image_features (line 1185) | def get_image_features( method forward (line 1216) | def forward( FILE: src/transformers/models/helium/configuration_helium.py class HeliumConfig (line 26) | class HeliumConfig(PreTrainedConfig): FILE: src/transformers/models/helium/modeling_helium.py class HeliumRMSNorm (line 48) | class HeliumRMSNorm(nn.Module): method __init__ (line 49) | def __init__(self, hidden_size, eps=1e-6): method forward (line 54) | def forward(self, hidden_states): method extra_repr (line 61) | def extra_repr(self): class HeliumRotaryEmbedding (line 65) | class HeliumRotaryEmbedding(nn.Module): method __init__ (line 68) | def __init__(self, config: HeliumConfig, device=None): method compute_default_rope_parameters (line 85) | def compute_default_rope_parameters( method forward (line 116) | def forward(self, x, position_ids): class HeliumMLP (line 130) | class HeliumMLP(nn.Module): method __init__ (line 131) | def __init__(self, config): method forward (line 141) | def forward(self, x): function repeat_kv (line 146) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 158) | def eager_attention_forward( function rotate_half (line 183) | def rotate_half(x): function apply_rotary_pos_emb (line 190) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class HeliumAttention (line 222) | class HeliumAttention(nn.Module): method __init__ (line 225) | def __init__(self, config: HeliumConfig, layer_idx: int | None = None): method forward (line 246) | def forward( class HeliumDecoderLayer (line 287) | class HeliumDecoderLayer(GradientCheckpointingLayer): method __init__ (line 288) | def __init__(self, config: HeliumConfig, layer_idx: int | None = None): method forward (line 298) | def forward( class HeliumPreTrainedModel (line 331) | class HeliumPreTrainedModel(PreTrainedModel): class HeliumModel (line 350) | class HeliumModel(HeliumPreTrainedModel): method __init__ (line 351) | def __init__(self, config: HeliumConfig): method forward (line 370) | def forward( class HeliumForCausalLM (line 424) | class HeliumForCausalLM(HeliumPreTrainedModel, GenerationMixin): method __init__ (line 429) | def __init__(self, config): method forward (line 440) | def forward( class HeliumForSequenceClassification (line 497) | class HeliumForSequenceClassification(GenericForSequenceClassification, ... class HeliumForTokenClassification (line 501) | class HeliumForTokenClassification(GenericForTokenClassification, Helium... FILE: src/transformers/models/helium/modular_helium.py class HeliumRMSNorm (line 30) | class HeliumRMSNorm(nn.Module): method __init__ (line 31) | def __init__(self, hidden_size, eps=1e-6): method forward (line 36) | def forward(self, hidden_states): method extra_repr (line 43) | def extra_repr(self): class HeliumRotaryEmbedding (line 47) | class HeliumRotaryEmbedding(LlamaRotaryEmbedding): class HeliumMLP (line 51) | class HeliumMLP(LlamaMLP): function rotate_half (line 55) | def rotate_half(x): function apply_rotary_pos_emb (line 62) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class HeliumAttention (line 93) | class HeliumAttention(GraniteAttention): method __init__ (line 94) | def __init__(self, config: HeliumConfig, layer_idx: int | None = None): class HeliumDecoderLayer (line 100) | class HeliumDecoderLayer(LlamaDecoderLayer): method __init__ (line 101) | def __init__(self, config: HeliumConfig, layer_idx: int | None = None): class HeliumPreTrainedModel (line 109) | class HeliumPreTrainedModel(LlamaPreTrainedModel): class HeliumModel (line 113) | class HeliumModel(HeliumPreTrainedModel, LlamaModel): method __init__ (line 114) | def __init__(self, config: HeliumConfig): class HeliumForCausalLM (line 126) | class HeliumForCausalLM(GemmaForCausalLM): class HeliumForSequenceClassification (line 130) | class HeliumForSequenceClassification(GemmaForSequenceClassification): class HeliumForTokenClassification (line 134) | class HeliumForTokenClassification(GemmaForTokenClassification): FILE: src/transformers/models/herbert/tokenization_herbert.py class HerbertTokenizer (line 28) | class HerbertTokenizer(TokenizersBackend): method __init__ (line 65) | def __init__( FILE: src/transformers/models/hgnet_v2/configuration_hgnet_v2.py class HGNetV2Config (line 35) | class HGNetV2Config(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 96) | def __post_init__(self, **kwargs): method validate_architecture (line 104) | def validate_architecture(self): FILE: src/transformers/models/hgnet_v2/modeling_hgnet_v2.py class HGNetV2PreTrainedModel (line 40) | class HGNetV2PreTrainedModel(PreTrainedModel): method _init_weights (line 47) | def _init_weights(self, module): class HGNetV2LearnableAffineBlock (line 57) | class HGNetV2LearnableAffineBlock(nn.Module): method __init__ (line 58) | def __init__(self, scale_value: float = 1.0, bias_value: float = 0.0): method forward (line 63) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2ConvLayer (line 68) | class HGNetV2ConvLayer(nn.Module): method __init__ (line 69) | def __init__( method forward (line 96) | def forward(self, input: Tensor) -> Tensor: class HGNetV2ConvLayerLight (line 104) | class HGNetV2ConvLayerLight(nn.Module): method __init__ (line 105) | def __init__( method forward (line 124) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2Embeddings (line 130) | class HGNetV2Embeddings(nn.Module): method __init__ (line 131) | def __init__(self, config: HGNetV2Config): method forward (line 178) | def forward(self, pixel_values: Tensor) -> Tensor: class HGNetV2BasicLayer (line 196) | class HGNetV2BasicLayer(nn.Module): method __init__ (line 197) | def __init__( method forward (line 254) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2Stage (line 267) | class HGNetV2Stage(nn.Module): method __init__ (line 268) | def __init__(self, config: HGNetV2Config, stage_index: int, drop_path:... method forward (line 305) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2Encoder (line 312) | class HGNetV2Encoder(nn.Module): method __init__ (line 313) | def __init__(self, config: HGNetV2Config): method forward (line 320) | def forward( class HGNetV2Backbone (line 343) | class HGNetV2Backbone(BackboneMixin, HGNetV2PreTrainedModel): method __init__ (line 346) | def __init__(self, config: HGNetV2Config): method forward (line 359) | def forward( class HGNetV2ForImageClassification (line 420) | class HGNetV2ForImageClassification(HGNetV2PreTrainedModel): method __init__ (line 421) | def __init__(self, config: HGNetV2Config): method forward (line 437) | def forward( FILE: src/transformers/models/hgnet_v2/modular_hgnet_v2.py class HGNetV2Config (line 43) | class HGNetV2Config(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): method validate_architecture (line 112) | def validate_architecture(self): class HGNetV2PreTrainedModel (line 131) | class HGNetV2PreTrainedModel(PreTrainedModel): method _init_weights (line 138) | def _init_weights(self, module): class HGNetV2LearnableAffineBlock (line 148) | class HGNetV2LearnableAffineBlock(nn.Module): method __init__ (line 149) | def __init__(self, scale_value: float = 1.0, bias_value: float = 0.0): method forward (line 154) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2ConvLayer (line 159) | class HGNetV2ConvLayer(RTDetrResNetConvLayer): method __init__ (line 160) | def __init__( method forward (line 185) | def forward(self, input: Tensor) -> Tensor: class HGNetV2ConvLayerLight (line 193) | class HGNetV2ConvLayerLight(nn.Module): method __init__ (line 194) | def __init__( method forward (line 213) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2Embeddings (line 219) | class HGNetV2Embeddings(nn.Module): method __init__ (line 220) | def __init__(self, config: HGNetV2Config): method forward (line 267) | def forward(self, pixel_values: Tensor) -> Tensor: class HGNetV2BasicLayer (line 285) | class HGNetV2BasicLayer(nn.Module): method __init__ (line 286) | def __init__( method forward (line 343) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2Stage (line 356) | class HGNetV2Stage(nn.Module): method __init__ (line 357) | def __init__(self, config: HGNetV2Config, stage_index: int, drop_path:... method forward (line 394) | def forward(self, hidden_state: Tensor) -> Tensor: class HGNetV2Encoder (line 401) | class HGNetV2Encoder(nn.Module): method __init__ (line 402) | def __init__(self, config: HGNetV2Config): method forward (line 409) | def forward( class HGNetV2Backbone (line 432) | class HGNetV2Backbone(BackboneMixin, HGNetV2PreTrainedModel): method __init__ (line 435) | def __init__(self, config: HGNetV2Config): method forward (line 448) | def forward( class HGNetV2ForImageClassification (line 509) | class HGNetV2ForImageClassification(HGNetV2PreTrainedModel): method __init__ (line 510) | def __init__(self, config: HGNetV2Config): method forward (line 526) | def forward( FILE: src/transformers/models/hiera/configuration_hiera.py class HieraConfig (line 25) | class HieraConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 98) | def __post_init__(self, **kwargs): method validate_architecture (line 108) | def validate_architecture(self): FILE: src/transformers/models/hiera/convert_hiera_to_hf.py function create_rename_keys (line 40) | def create_rename_keys(config: HieraConfig, base_model: bool, mae_model:... function remove_classification_head_ (line 140) | def remove_classification_head_(state_dict): function rename_key (line 146) | def rename_key(dct, old, new): function prepare_img (line 152) | def prepare_img(): function get_labels_for_classifier (line 159) | def get_labels_for_classifier(model_name: str) -> tuple[dict[int, str], ... function get_hiera_config (line 172) | def get_hiera_config(model_name: str, base_model: bool, mae_model: bool)... function convert_hiera_checkpoint (line 207) | def convert_hiera_checkpoint(args): FILE: src/transformers/models/hiera/modeling_hiera.py class HieraEncoderOutput (line 48) | class HieraEncoderOutput(ModelOutput): class HieraModelOutput (line 70) | class HieraModelOutput(ModelOutput): class HieraForImageClassificationOutput (line 101) | class HieraForImageClassificationOutput(ImageClassifierOutput): class HieraForPreTrainingOutput (line 139) | class HieraForPreTrainingOutput(ModelOutput): class HieraPatchEmbeddings (line 164) | class HieraPatchEmbeddings(nn.Module): method __init__ (line 171) | def __init__(self, config, is_mae: bool = False): method masked_conv (line 192) | def masked_conv( method random_masking (line 209) | def random_masking( method forward (line 243) | def forward( class HieraEmbeddings (line 258) | class HieraEmbeddings(nn.Module): method __init__ (line 263) | def __init__(self, config: HieraConfig, is_mae: bool = False) -> None: method interpolate_pos_encoding (line 275) | def interpolate_pos_encoding( method get_position_embedding (line 313) | def get_position_embedding( method forward (line 322) | def forward( class HieraMaskUnitAttention (line 334) | class HieraMaskUnitAttention(nn.Module): method __init__ (line 341) | def __init__( method forward (line 364) | def forward( function drop_path (line 398) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class HieraDropPath (line 414) | class HieraDropPath(nn.Module): method __init__ (line 417) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 421) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 424) | def extra_repr(self) -> str: class HieraMlp (line 428) | class HieraMlp(nn.Module): method __init__ (line 429) | def __init__(self, config, dim: int) -> None: method forward (line 435) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class HieraLayer (line 442) | class HieraLayer(nn.Module): method __init__ (line 443) | def __init__( method forward (line 477) | def forward( class HieraStage (line 503) | class HieraStage(GradientCheckpointingLayer): method __init__ (line 504) | def __init__( method forward (line 541) | def forward( function undo_windowing (line 550) | def undo_windowing(hidden_states: torch.Tensor, shape: list[int], mask_u... class HieraEncoder (line 576) | class HieraEncoder(nn.Module): method __init__ (line 577) | def __init__(self, config: HieraConfig) -> None: method reroll (line 627) | def reroll( method forward (line 673) | def forward( function unroll (line 717) | def unroll( class HieraPreTrainedModel (line 772) | class HieraPreTrainedModel(PreTrainedModel): method _init_weights (line 780) | def _init_weights(self, module) -> None: class HieraPooler (line 801) | class HieraPooler(nn.Module): method __init__ (line 802) | def __init__(self, config: HieraConfig): method forward (line 808) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class HieraModel (line 817) | class HieraModel(HieraPreTrainedModel): method __init__ (line 818) | def __init__(self, config: HieraConfig, add_pooling_layer: bool = True... method get_input_embeddings (line 838) | def get_input_embeddings(self) -> HieraPatchEmbeddings: method forward (line 842) | def forward( class HieraDecoder (line 915) | class HieraDecoder(nn.Module): method __init__ (line 916) | def __init__(self, config: HieraConfig): method forward (line 955) | def forward( class HieraMultiScaleHead (line 1017) | class HieraMultiScaleHead(nn.Module): method __init__ (line 1018) | def __init__(self, config: HieraConfig): method apply_fusion_head (line 1042) | def apply_fusion_head(self, head: nn.Module, hidden_states: torch.Tens... method forward (line 1064) | def forward(self, feature_maps: list[torch.Tensor]) -> torch.Tensor: class HieraForPreTraining (line 1085) | class HieraForPreTraining(HieraPreTrainedModel): method __init__ (line 1086) | def __init__(self, config: HieraConfig) -> None: method get_pixel_label_2d (line 1100) | def get_pixel_label_2d(self, pixel_values: torch.Tensor, bool_masked_p... method forward_loss (line 1115) | def forward_loss(self, pixel_values: torch.Tensor, logits: torch.Tenso... method forward (line 1127) | def forward( class HieraForImageClassification (line 1231) | class HieraForImageClassification(HieraPreTrainedModel): method __init__ (line 1232) | def __init__(self, config: HieraConfig) -> None: method forward (line 1247) | def forward( class HieraBackbone (line 1303) | class HieraBackbone(BackboneMixin, HieraPreTrainedModel): method __init__ (line 1304) | def __init__(self, config: HieraConfig): method get_input_embeddings (line 1322) | def get_input_embeddings(self): method forward (line 1327) | def forward( FILE: src/transformers/models/higgs_audio_v2/configuration_higgs_audio_v2.py class HiggsAudioV2Config (line 32) | class HiggsAudioV2Config(PreTrainedConfig): method __post_init__ (line 105) | def __post_init__(self, **kwargs): method validate_architecture (line 122) | def validate_architecture(self): FILE: src/transformers/models/higgs_audio_v2/convert_higgs_audio_v2_to_hf.py function convert_key (line 50) | def convert_key(key, mapping): function convert_model (line 56) | def convert_model(input_path_or_repo, revision=None): function create_processor (line 134) | def create_processor( function main (line 167) | def main(): FILE: src/transformers/models/higgs_audio_v2/generation_higgs_audio_v2.py class HiggsAudioV2DelayPatternLogitsProcessor (line 58) | class HiggsAudioV2DelayPatternLogitsProcessor(LogitsProcessor): method __init__ (line 86) | def __init__( method __call__ (line 109) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class HiggsAudioV2GenerationOutput (line 164) | class HiggsAudioV2GenerationOutput(GenerateDecoderOnlyOutput): class HiggsAudioV2GenerationMixin (line 200) | class HiggsAudioV2GenerationMixin(GenerationMixin): method _get_logits_processor (line 211) | def _get_logits_processor(self, *args, **kwargs): method _prepare_generation_config (line 244) | def _prepare_generation_config( method _sample (line 263) | def _sample( FILE: src/transformers/models/higgs_audio_v2/modeling_higgs_audio_v2.py class HiggsAudioV2MLP (line 48) | class HiggsAudioV2MLP(nn.Module): method __init__ (line 49) | def __init__(self, config): method forward (line 59) | def forward(self, x): class HiggsAudioV2RMSNorm (line 65) | class HiggsAudioV2RMSNorm(nn.Module): method __init__ (line 66) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 74) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 81) | def extra_repr(self): function rotate_half (line 85) | def rotate_half(x): function apply_rotary_pos_emb (line 93) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 118) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 130) | def eager_attention_forward( class HiggsAudioV2Attention (line 156) | class HiggsAudioV2Attention(nn.Module): method __init__ (line 159) | def __init__(self, config: HiggsAudioV2Config, layer_idx: int): method forward (line 182) | def forward( class HiggsAudioV2DecoderLayer (line 223) | class HiggsAudioV2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 224) | def __init__(self, config: HiggsAudioV2Config, layer_idx: int): method forward (line 238) | def forward( class HiggsAudioV2Embeddings (line 293) | class HiggsAudioV2Embeddings(nn.Module): method __init__ (line 294) | def __init__(self, config): method forward (line 301) | def forward(self, input_ids): class HiggsAudioV2PreTrainedModel (line 308) | class HiggsAudioV2PreTrainedModel(PreTrainedModel): method _init_weights (line 326) | def _init_weights(self, module): class HiggsAudioV2RotaryEmbedding (line 335) | class HiggsAudioV2RotaryEmbedding(nn.Module): method __init__ (line 338) | def __init__(self, config: HiggsAudioV2Config, device=None): method compute_default_rope_parameters (line 355) | def compute_default_rope_parameters( method forward (line 386) | def forward(self, x, position_ids): class HiggsAudioV2Model (line 401) | class HiggsAudioV2Model(HiggsAudioV2PreTrainedModel): method __init__ (line 402) | def __init__(self, config: HiggsAudioV2Config): method forward (line 421) | def forward( method get_placeholder_mask (line 568) | def get_placeholder_mask( class HiggsAudioV2ForConditionalGeneration (line 600) | class HiggsAudioV2ForConditionalGeneration(HiggsAudioV2PreTrainedModel, ... method __init__ (line 604) | def __init__(self, config: HiggsAudioV2Config, use_text_head: bool = F... method prepare_inputs_for_generation (line 617) | def prepare_inputs_for_generation( method forward (line 651) | def forward( FILE: src/transformers/models/higgs_audio_v2/modular_higgs_audio_v2.py class HiggsAudioV2Config (line 44) | class HiggsAudioV2Config(LlamaConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): class HiggsAudioV2MLP (line 101) | class HiggsAudioV2MLP(LlamaMLP): class HiggsAudioV2RMSNorm (line 105) | class HiggsAudioV2RMSNorm(LlamaRMSNorm): class HiggsAudioV2DecoderLayer (line 109) | class HiggsAudioV2DecoderLayer(LlamaDecoderLayer): method __init__ (line 110) | def __init__(self, config: HiggsAudioV2Config, layer_idx: int): method forward (line 117) | def forward( class HiggsAudioV2Embeddings (line 172) | class HiggsAudioV2Embeddings(CsmBackboneModelEmbeddings): method forward (line 173) | def forward(self, input_ids): class HiggsAudioV2PreTrainedModel (line 179) | class HiggsAudioV2PreTrainedModel(LlamaPreTrainedModel, PreTrainedModel): method _init_weights (line 181) | def _init_weights(self, module): class HiggsAudioV2Model (line 190) | class HiggsAudioV2Model(LlamaModel): method __init__ (line 191) | def __init__(self, config: HiggsAudioV2Config): method get_placeholder_mask (line 195) | def get_placeholder_mask( method forward (line 223) | def forward( class HiggsAudioV2ForConditionalGeneration (line 376) | class HiggsAudioV2ForConditionalGeneration(HiggsAudioV2PreTrainedModel, ... method __init__ (line 380) | def __init__(self, config: HiggsAudioV2Config, use_text_head: bool = F... method prepare_inputs_for_generation (line 393) | def prepare_inputs_for_generation( method forward (line 427) | def forward( FILE: src/transformers/models/higgs_audio_v2/processing_higgs_audio_v2.py class HiggsAudioV2ProcessorKwargs (line 38) | class HiggsAudioV2ProcessorKwargs(ProcessingKwargs, total=False): class HiggsAudioV2Processor (line 51) | class HiggsAudioV2Processor(ProcessorMixin): method __init__ (line 85) | def __init__( method get_audio_tokens (line 118) | def get_audio_tokens(self, num_audio_tokens): method __call__ (line 127) | def __call__( method batch_decode (line 237) | def batch_decode(self, audio_input_ids): method decode (line 285) | def decode(self, audio_input_ids): method build_delay_pattern (line 293) | def build_delay_pattern(self, input_ids): method revert_delay_pattern (line 312) | def revert_delay_pattern(self, input_ids): method save_audio (line 323) | def save_audio( method model_input_names (line 358) | def model_input_names(self): FILE: src/transformers/models/higgs_audio_v2_tokenizer/configuration_higgs_audio_v2_tokenizer.py class HiggsAudioV2TokenizerConfig (line 34) | class HiggsAudioV2TokenizerConfig(PreTrainedConfig): method __post_init__ (line 108) | def __post_init__(self, **kwargs): method frame_rate (line 139) | def frame_rate(self) -> int: method semantic_hidden_size (line 143) | def semantic_hidden_size(self) -> int: method hop_length (line 147) | def hop_length(self) -> int: method codebook_nbits (line 151) | def codebook_nbits(self) -> int: method hidden_size (line 155) | def hidden_size(self) -> int: method num_quantizers (line 159) | def num_quantizers(self) -> int: method semantic_downsample_factor (line 163) | def semantic_downsample_factor(self): FILE: src/transformers/models/higgs_audio_v2_tokenizer/convert_higgs_audio_v2_tokenizer_to_hf.py function convert_key (line 73) | def convert_key(key, mapping): function compute_weight_from_weight_norm (line 79) | def compute_weight_from_weight_norm(weight_v, weight_g): function convert_model (line 86) | def convert_model(input_path_or_repo, revision=None): function create_feature_extractor (line 156) | def create_feature_extractor(): function main (line 168) | def main(): FILE: src/transformers/models/higgs_audio_v2_tokenizer/modeling_higgs_audio_v2_tokenizer.py class HiggsAudioV2TokenizerPreTrainedModel (line 42) | class HiggsAudioV2TokenizerPreTrainedModel(PreTrainedAudioTokenizerBase): method _init_weights (line 56) | def _init_weights(self, module): method apply_weight_norm (line 93) | def apply_weight_norm(self): method remove_weight_norm (line 115) | def remove_weight_norm(self): method _get_conv1d_layers (line 127) | def _get_conv1d_layers(self, module): method _get_conv1d_output_lengths (line 146) | def _get_conv1d_output_lengths(self, input_length, module=None): class HiggsAudioV2TokenizerEuclideanCodebook (line 161) | class HiggsAudioV2TokenizerEuclideanCodebook(nn.Module): method __init__ (line 164) | def __init__(self, config): method quantize (line 173) | def quantize(self, hidden_states): method encode (line 180) | def encode(self, hidden_states): method decode (line 187) | def decode(self, embed_ind): class HiggsAudioV2TokenizerVectorQuantization (line 192) | class HiggsAudioV2TokenizerVectorQuantization(nn.Module): method __init__ (line 193) | def __init__(self, config: HiggsAudioV2TokenizerConfig): method encode (line 199) | def encode(self, hidden_states): method decode (line 205) | def decode(self, embed_ind): class HiggsAudioV2TokenizerOutput (line 213) | class HiggsAudioV2TokenizerOutput(ModelOutput): class HiggsAudioV2TokenizerEncoderOutput (line 227) | class HiggsAudioV2TokenizerEncoderOutput(ModelOutput): class HiggsAudioV2TokenizerDecoderOutput (line 238) | class HiggsAudioV2TokenizerDecoderOutput(ModelOutput): class HiggsAudioV2TokenizerResidualUnit (line 248) | class HiggsAudioV2TokenizerResidualUnit(nn.Module): method __init__ (line 251) | def __init__(self, config: HiggsAudioV2TokenizerConfig, in_channels: i... method forward (line 267) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class HiggsAudioV2TokenizerSemanticEncoderBlock (line 275) | class HiggsAudioV2TokenizerSemanticEncoderBlock(nn.Module): method __init__ (line 276) | def __init__(self, config: HiggsAudioV2TokenizerConfig, in_channels: i... method forward (line 290) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class SemanticEncoder (line 297) | class SemanticEncoder(nn.Module): method __init__ (line 298) | def __init__(self, config): method forward (line 320) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class SemanticDecoderBlock (line 327) | class SemanticDecoderBlock(nn.Module): method __init__ (line 328) | def __init__(self, config: HiggsAudioV2TokenizerConfig, in_channels: i... method forward (line 354) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class SemanticDecoder (line 361) | class SemanticDecoder(nn.Module): method __init__ (line 362) | def __init__(self, config): method forward (line 393) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class HiggsAudioV2TokenizerResidualVectorQuantization (line 401) | class HiggsAudioV2TokenizerResidualVectorQuantization(nn.Module): method __init__ (line 406) | def __init__(self, config: HiggsAudioV2TokenizerConfig): method get_bandwidth_per_quantizer (line 415) | def get_bandwidth_per_quantizer(self): method get_num_quantizers_for_bandwidth (line 419) | def get_num_quantizers_for_bandwidth(self, bandwidth=None) -> int: method encode (line 427) | def encode(self, embeddings: torch.Tensor, bandwidth=None) -> torch.Te... method decode (line 443) | def decode(self, codes: torch.Tensor) -> torch.Tensor: class HiggsAudioV2TokenizerModel (line 455) | class HiggsAudioV2TokenizerModel(HiggsAudioV2TokenizerPreTrainedModel): method __init__ (line 456) | def __init__(self, config): method _adjust_dac_decoder (line 476) | def _adjust_dac_decoder(decoder: nn.Module): method _extract_semantic_features (line 489) | def _extract_semantic_features(self, input_values: torch.FloatTensor) ... method encode (line 512) | def encode( method decode (line 564) | def decode( method forward (line 592) | def forward( FILE: src/transformers/models/higgs_audio_v2_tokenizer/modular_higgs_audio_v2_tokenizer.py class HiggsAudioV2TokenizerConfig (line 30) | class HiggsAudioV2TokenizerConfig(XcodecConfig): method semantic_downsample_factor (line 79) | def semantic_downsample_factor(self): class HiggsAudioV2TokenizerPreTrainedModel (line 85) | class HiggsAudioV2TokenizerPreTrainedModel(XcodecPreTrainedModel): class HiggsAudioV2TokenizerEuclideanCodebook (line 90) | class HiggsAudioV2TokenizerEuclideanCodebook(XcodecEuclideanCodebook): ... class HiggsAudioV2TokenizerVectorQuantization (line 93) | class HiggsAudioV2TokenizerVectorQuantization(nn.Module): method __init__ (line 94) | def __init__(self, config: HiggsAudioV2TokenizerConfig): method encode (line 100) | def encode(self, hidden_states): method decode (line 106) | def decode(self, embed_ind): class HiggsAudioV2TokenizerModel (line 115) | class HiggsAudioV2TokenizerModel(XcodecModel): method _extract_semantic_features (line 116) | def _extract_semantic_features(self, input_values: torch.FloatTensor) ... FILE: src/transformers/models/hubert/configuration_hubert.py class HubertConfig (line 27) | class HubertConfig(PreTrainedConfig): method __post_init__ (line 164) | def __post_init__(self, **kwargs): method validate_architecture (line 168) | def validate_architecture(self): method inputs_to_logits_ratio (line 183) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/hubert/convert_distilhubert_original_s3prl_checkpoint_to_pytorch.py function set_recursively (line 43) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 71) | def recursively_load_weights(fairseq_model, hf_model): function load_conv_layer (line 113) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_config (line 153) | def convert_config(model): function convert_hubert_checkpoint (line 187) | def convert_hubert_checkpoint(pytorch_dump_folder_path, config_path=None): FILE: src/transformers/models/hubert/convert_hubert_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 57) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 91) | def recursively_load_weights(fairseq_model, hf_model, is_finetuned): function load_conv_layer (line 141) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_hubert_checkpoint (line 182) | def convert_hubert_checkpoint( FILE: src/transformers/models/hubert/convert_hubert_original_s3prl_checkpoint_to_pytorch.py function convert_s3prl_checkpoint (line 30) | def convert_s3prl_checkpoint(base_model_name, config_path, checkpoint_pa... FILE: src/transformers/models/hubert/modeling_hubert.py class HubertPositionalConvEmbedding (line 45) | class HubertPositionalConvEmbedding(nn.Module): method __init__ (line 46) | def __init__(self, config): method forward (line 83) | def forward(self, hidden_states): class HubertSamePadLayer (line 95) | class HubertSamePadLayer(nn.Module): method __init__ (line 96) | def __init__(self, num_conv_pos_embeddings): method forward (line 100) | def forward(self, hidden_states): class HubertNoLayerNormConvLayer (line 106) | class HubertNoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 107) | def __init__(self, config, layer_id=0): method forward (line 121) | def forward(self, hidden_states): class HubertLayerNormConvLayer (line 127) | class HubertLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 128) | def __init__(self, config, layer_id=0): method forward (line 143) | def forward(self, hidden_states): class HubertGroupNormConvLayer (line 154) | class HubertGroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 155) | def __init__(self, config, layer_id=0): method forward (line 171) | def forward(self, hidden_states): class HubertFeatureEncoder (line 178) | class HubertFeatureEncoder(nn.Module): method __init__ (line 181) | def __init__(self, config): method _freeze_parameters (line 198) | def _freeze_parameters(self): method forward (line 203) | def forward(self, input_values): class HubertFeatureProjection (line 216) | class HubertFeatureProjection(nn.Module): method __init__ (line 217) | def __init__(self, config): method forward (line 225) | def forward(self, hidden_states): function eager_attention_forward (line 234) | def eager_attention_forward( class HubertAttention (line 262) | class HubertAttention(nn.Module): method __init__ (line 265) | def __init__( method forward (line 296) | def forward( class HubertFeedForward (line 348) | class HubertFeedForward(nn.Module): method __init__ (line 349) | def __init__(self, config): method forward (line 362) | def forward(self, hidden_states): class HubertEncoderLayer (line 372) | class HubertEncoderLayer(GradientCheckpointingLayer): method __init__ (line 373) | def __init__(self, config): method forward (line 388) | def forward(self, hidden_states, attention_mask=None, output_attention... class HubertEncoder (line 408) | class HubertEncoder(nn.Module): method __init__ (line 409) | def __init__(self, config): method forward (line 418) | def forward( class HubertAttnAdapterLayer (line 480) | class HubertAttnAdapterLayer(nn.Module): method __init__ (line 481) | def __init__(self, config): method forward (line 495) | def forward(self, hidden_states: torch.FloatTensor): class HubertEncoderLayerStableLayerNorm (line 505) | class HubertEncoderLayerStableLayerNorm(GradientCheckpointingLayer): method __init__ (line 506) | def __init__(self, config): method forward (line 525) | def forward( class HubertEncoderStableLayerNorm (line 551) | class HubertEncoderStableLayerNorm(nn.Module): method __init__ (line 552) | def __init__(self, config): method forward (line 563) | def forward( class HubertPreTrainedModel (line 628) | class HubertPreTrainedModel(PreTrainedModel): method _init_weights (line 640) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 675) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 690) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... function _compute_mask_indices (line 703) | def _compute_mask_indices( class HubertModel (line 823) | class HubertModel(HubertPreTrainedModel): method __init__ (line 824) | def __init__(self, config: HubertConfig): method _mask_hidden_states (line 842) | def _mask_hidden_states( method forward (line 889) | def forward( class HubertForCTC (line 969) | class HubertForCTC(HubertPreTrainedModel): method __init__ (line 970) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 999) | def tie_weights(self, **kwargs): method freeze_feature_encoder (line 1023) | def freeze_feature_encoder(self): method freeze_base_model (line 1030) | def freeze_base_model(self): method forward (line 1039) | def forward( class HubertForSequenceClassification (line 1117) | class HubertForSequenceClassification(HubertPreTrainedModel): method __init__ (line 1118) | def __init__(self, config): method freeze_feature_encoder (line 1135) | def freeze_feature_encoder(self): method freeze_base_model (line 1142) | def freeze_base_model(self): method forward (line 1151) | def forward( FILE: src/transformers/models/hubert/modular_hubert.py class HubertPositionalConvEmbedding (line 40) | class HubertPositionalConvEmbedding(nn.Module): method __init__ (line 41) | def __init__(self, config): method forward (line 78) | def forward(self, hidden_states): class HubertSamePadLayer (line 90) | class HubertSamePadLayer(Wav2Vec2SamePadLayer): class HubertFeatureEncoder (line 94) | class HubertFeatureEncoder(Wav2Vec2FeatureEncoder): class HubertFeatureProjection (line 98) | class HubertFeatureProjection(nn.Module): method __init__ (line 99) | def __init__(self, config): method forward (line 107) | def forward(self, hidden_states): class HubertEncoder (line 116) | class HubertEncoder(Wav2Vec2Encoder): class HubertEncoderStableLayerNorm (line 120) | class HubertEncoderStableLayerNorm(Wav2Vec2EncoderStableLayerNorm): class HubertPreTrainedModel (line 125) | class HubertPreTrainedModel(PreTrainedModel): method _init_weights (line 137) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 172) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 187) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... class HubertModel (line 200) | class HubertModel(Wav2Vec2Model, HubertPreTrainedModel): method __init__ (line 201) | def __init__(self, config: HubertConfig): method freeze_feature_encoder (line 220) | def freeze_feature_encoder(self): method forward (line 223) | def forward( class HubertForCTC (line 295) | class HubertForCTC(Wav2Vec2ForCTC): class HubertForSequenceClassification (line 299) | class HubertForSequenceClassification(Wav2Vec2ForSequenceClassification): FILE: src/transformers/models/hunyuan_v1_dense/configuration_hunyuan_v1_dense.py class HunYuanDenseV1Config (line 25) | class HunYuanDenseV1Config(PreTrainedConfig): method __post_init__ (line 58) | def __post_init__(self, **kwargs): FILE: src/transformers/models/hunyuan_v1_dense/modeling_hunyuan_v1_dense.py class HunYuanDenseV1RMSNorm (line 47) | class HunYuanDenseV1RMSNorm(nn.Module): method __init__ (line 48) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 56) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 63) | def extra_repr(self): class HunYuanDenseV1MLP (line 67) | class HunYuanDenseV1MLP(nn.Module): method __init__ (line 68) | def __init__(self, config: HunYuanDenseV1Config, layer_idx=None, is_sh... method forward (line 79) | def forward(self, x): function rotate_half (line 84) | def rotate_half(x): function apply_rotary_pos_emb (line 92) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 117) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 129) | def eager_attention_forward( class HunYuanDenseV1Attention (line 155) | class HunYuanDenseV1Attention(nn.Module): method __init__ (line 158) | def __init__(self, config: HunYuanDenseV1Config, layer_idx: int): method forward (line 183) | def forward( class HunYuanDenseV1DecoderLayer (line 226) | class HunYuanDenseV1DecoderLayer(GradientCheckpointingLayer): method __init__ (line 227) | def __init__(self, config: HunYuanDenseV1Config, layer_idx: int): method forward (line 238) | def forward( class HunYuanDenseV1PreTrainedModel (line 271) | class HunYuanDenseV1PreTrainedModel(PreTrainedModel): method _init_weights (line 289) | def _init_weights(self, module): class HunYuanDenseV1RotaryEmbedding (line 312) | class HunYuanDenseV1RotaryEmbedding(nn.Module): method __init__ (line 315) | def __init__(self, config: HunYuanDenseV1Config, device=None): method compute_default_rope_parameters (line 342) | def compute_default_rope_parameters( method forward (line 373) | def forward(self, x, position_ids): class HunYuanDenseV1Model (line 388) | class HunYuanDenseV1Model(HunYuanDenseV1PreTrainedModel): method __init__ (line 389) | def __init__(self, config: HunYuanDenseV1Config): method forward (line 408) | def forward( class HunYuanDenseV1ForCausalLM (line 462) | class HunYuanDenseV1ForCausalLM(HunYuanDenseV1PreTrainedModel, Generatio... method __init__ (line 467) | def __init__(self, config): method forward (line 478) | def forward( class HunYuanDenseV1ForSequenceClassification (line 535) | class HunYuanDenseV1ForSequenceClassification(GenericForSequenceClassifi... FILE: src/transformers/models/hunyuan_v1_dense/modular_hunyuan_v1_dense.py class HunYuanDenseV1RMSNorm (line 50) | class HunYuanDenseV1RMSNorm(LlamaRMSNorm): class HunYuanDenseV1MLP (line 54) | class HunYuanDenseV1MLP(LlamaMLP): method __init__ (line 55) | def __init__(self, config: HunYuanDenseV1Config, layer_idx=None, is_sh... class HunYuanDenseV1Attention (line 63) | class HunYuanDenseV1Attention(LlamaAttention): method __init__ (line 64) | def __init__(self, config: HunYuanDenseV1Config, layer_idx: int): method forward (line 69) | def forward( class HunYuanDenseV1DecoderLayer (line 112) | class HunYuanDenseV1DecoderLayer(LlamaDecoderLayer): method __init__ (line 113) | def __init__(self, config: HunYuanDenseV1Config, layer_idx: int): class HunYuanDenseV1PreTrainedModel (line 118) | class HunYuanDenseV1PreTrainedModel(LlamaPreTrainedModel, PreTrainedModel): method _init_weights (line 120) | def _init_weights(self, module): class HunYuanDenseV1RotaryEmbedding (line 143) | class HunYuanDenseV1RotaryEmbedding(LlamaRotaryEmbedding): method __init__ (line 144) | def __init__(self, config: HunYuanDenseV1Config, device=None): class HunYuanDenseV1Model (line 171) | class HunYuanDenseV1Model(LlamaModel): class HunYuanDenseV1ForCausalLM (line 175) | class HunYuanDenseV1ForCausalLM(LlamaForCausalLM): class HunYuanDenseV1ForSequenceClassification (line 179) | class HunYuanDenseV1ForSequenceClassification(LlamaForSequenceClassifica... FILE: src/transformers/models/hunyuan_v1_moe/configuration_hunyuan_v1_moe.py class HunYuanMoEV1Config (line 25) | class HunYuanMoEV1Config(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): method _rope_parameters_validation (line 71) | def _rope_parameters_validation(self): FILE: src/transformers/models/hunyuan_v1_moe/modeling_hunyuan_v1_moe.py class HunYuanMoEV1RMSNorm (line 51) | class HunYuanMoEV1RMSNorm(nn.Module): method __init__ (line 52) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 60) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 67) | def extra_repr(self): class HunYuanMoEV1MLP (line 71) | class HunYuanMoEV1MLP(nn.Module): method __init__ (line 72) | def __init__(self, config: HunYuanMoEV1Config): method forward (line 82) | def forward(self, x): function rotate_half (line 87) | def rotate_half(x): function apply_rotary_pos_emb (line 95) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 120) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 132) | def eager_attention_forward( class HunYuanMoEV1Attention (line 158) | class HunYuanMoEV1Attention(nn.Module): method __init__ (line 161) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int): method forward (line 186) | def forward( class HunYuanMoEV1Gate (line 229) | class HunYuanMoEV1Gate(nn.Module): method __init__ (line 230) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int | None =... method forward (line 237) | def forward(self, hidden_states): class HunYuanMoEV1Experts (line 247) | class HunYuanMoEV1Experts(nn.Module): method __init__ (line 250) | def __init__(self, config: HunYuanMoEV1Config): method forward (line 259) | def forward( class HunYuanMoEV1Moe (line 286) | class HunYuanMoEV1Moe(nn.Module): method __init__ (line 287) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int | None =... method route_tokens_to_experts (line 297) | def route_tokens_to_experts(self, hidden_states): method forward (line 303) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class HunYuanMoEV1DecoderLayer (line 315) | class HunYuanMoEV1DecoderLayer(GradientCheckpointingLayer): method __init__ (line 316) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int): method forward (line 325) | def forward( class HunYuanMoEV1PreTrainedModel (line 358) | class HunYuanMoEV1PreTrainedModel(PreTrainedModel): method _init_weights (line 376) | def _init_weights(self, module): class HunYuanMoEV1RotaryEmbedding (line 401) | class HunYuanMoEV1RotaryEmbedding(nn.Module): method __init__ (line 404) | def __init__(self, config: HunYuanMoEV1Config, device=None): method compute_default_rope_parameters (line 431) | def compute_default_rope_parameters( method forward (line 462) | def forward(self, x, position_ids): class HunYuanMoEV1Model (line 477) | class HunYuanMoEV1Model(HunYuanMoEV1PreTrainedModel): method __init__ (line 478) | def __init__(self, config: HunYuanMoEV1Config): method forward (line 497) | def forward( class HunYuanMoEV1ForCausalLM (line 551) | class HunYuanMoEV1ForCausalLM(HunYuanMoEV1PreTrainedModel, GenerationMix... method __init__ (line 556) | def __init__(self, config): method forward (line 567) | def forward( class HunYuanMoEV1ForSequenceClassification (line 624) | class HunYuanMoEV1ForSequenceClassification(GenericForSequenceClassifica... FILE: src/transformers/models/hunyuan_v1_moe/modular_hunyuan_v1_moe.py class HunYuanMoEV1RMSNorm (line 48) | class HunYuanMoEV1RMSNorm(LlamaRMSNorm): class HunYuanMoEV1MLP (line 52) | class HunYuanMoEV1MLP(LlamaMLP): method __init__ (line 53) | def __init__(self, config: HunYuanMoEV1Config): class HunYuanMoEV1Attention (line 60) | class HunYuanMoEV1Attention(LlamaAttention): method __init__ (line 61) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int): method forward (line 66) | def forward( class HunYuanMoEV1Gate (line 109) | class HunYuanMoEV1Gate(nn.Module): method __init__ (line 110) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int | None =... method forward (line 117) | def forward(self, hidden_states): class HunYuanMoEV1Experts (line 126) | class HunYuanMoEV1Experts(MixtralExperts): class HunYuanMoEV1Moe (line 130) | class HunYuanMoEV1Moe(nn.Module): method __init__ (line 131) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int | None =... method route_tokens_to_experts (line 141) | def route_tokens_to_experts(self, hidden_states): method forward (line 147) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class HunYuanMoEV1DecoderLayer (line 159) | class HunYuanMoEV1DecoderLayer(LlamaDecoderLayer): method __init__ (line 160) | def __init__(self, config: HunYuanMoEV1Config, layer_idx: int): class HunYuanMoEV1PreTrainedModel (line 170) | class HunYuanMoEV1PreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 172) | def _init_weights(self, module): class HunYuanMoEV1RotaryEmbedding (line 197) | class HunYuanMoEV1RotaryEmbedding(HunYuanDenseV1RotaryEmbedding): class HunYuanMoEV1Model (line 201) | class HunYuanMoEV1Model(LlamaModel): class HunYuanMoEV1ForCausalLM (line 205) | class HunYuanMoEV1ForCausalLM(LlamaForCausalLM): class HunYuanMoEV1ForSequenceClassification (line 209) | class HunYuanMoEV1ForSequenceClassification(LlamaForSequenceClassificati... FILE: src/transformers/models/ibert/configuration_ibert.py class IBertConfig (line 26) | class IBertConfig(PreTrainedConfig): FILE: src/transformers/models/ibert/modeling_ibert.py class IBertEmbeddings (line 45) | class IBertEmbeddings(nn.Module): method __init__ (line 50) | def __init__(self, config): method forward (line 99) | def forward( method create_position_ids_from_inputs_embeds (line 145) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): class IBertSelfAttention (line 163) | class IBertSelfAttention(nn.Module): method __init__ (line 164) | def __init__(self, config): method forward (line 219) | def forward( class IBertSelfOutput (line 297) | class IBertSelfOutput(nn.Module): method __init__ (line 298) | def __init__(self, config): method forward (line 327) | def forward(self, hidden_states, hidden_states_scaling_factor, input_t... class IBertAttention (line 344) | class IBertAttention(nn.Module): method __init__ (line 345) | def __init__(self, config): method forward (line 351) | def forward( class IBertIntermediate (line 372) | class IBertIntermediate(nn.Module): method __init__ (line 373) | def __init__(self, config): method forward (line 393) | def forward(self, hidden_states, hidden_states_scaling_factor): class IBertOutput (line 406) | class IBertOutput(nn.Module): method __init__ (line 407) | def __init__(self, config): method forward (line 436) | def forward(self, hidden_states, hidden_states_scaling_factor, input_t... class IBertLayer (line 453) | class IBertLayer(nn.Module): method __init__ (line 454) | def __init__(self, config): method forward (line 467) | def forward( method feed_forward_chunk (line 492) | def feed_forward_chunk(self, attention_output, attention_output_scalin... class IBertEncoder (line 509) | class IBertEncoder(nn.Module): method __init__ (line 510) | def __init__(self, config): method forward (line 516) | def forward( class IBertPooler (line 566) | class IBertPooler(nn.Module): method __init__ (line 567) | def __init__(self, config): method forward (line 573) | def forward(self, hidden_states): class IBertPreTrainedModel (line 583) | class IBertPreTrainedModel(PreTrainedModel): method _init_weights (line 588) | def _init_weights(self, module): method resize_token_embeddings (line 621) | def resize_token_embeddings(self, new_num_tokens=None): class IBertModel (line 626) | class IBertModel(IBertPreTrainedModel): method __init__ (line 636) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 653) | def get_input_embeddings(self): method set_input_embeddings (line 656) | def set_input_embeddings(self, value): method forward (line 660) | def forward( class IBertForMaskedLM (line 730) | class IBertForMaskedLM(IBertPreTrainedModel): method __init__ (line 736) | def __init__(self, config): method get_output_embeddings (line 745) | def get_output_embeddings(self): method set_output_embeddings (line 748) | def set_output_embeddings(self, new_embeddings): method forward (line 753) | def forward( class IBertLMHead (line 804) | class IBertLMHead(nn.Module): method __init__ (line 807) | def __init__(self, config): method forward (line 815) | def forward(self, features, **kwargs): class IBertForSequenceClassification (line 832) | class IBertForSequenceClassification(IBertPreTrainedModel): method __init__ (line 833) | def __init__(self, config): method forward (line 844) | def forward( class IBertForMultipleChoice (line 913) | class IBertForMultipleChoice(IBertPreTrainedModel): method __init__ (line 914) | def __init__(self, config): method forward (line 925) | def forward( class IBertForTokenClassification (line 1015) | class IBertForTokenClassification(IBertPreTrainedModel): method __init__ (line 1016) | def __init__(self, config): method forward (line 1028) | def forward( class IBertClassificationHead (line 1080) | class IBertClassificationHead(nn.Module): method __init__ (line 1083) | def __init__(self, config): method forward (line 1089) | def forward(self, features, **kwargs): class IBertForQuestionAnswering (line 1100) | class IBertForQuestionAnswering(IBertPreTrainedModel): method __init__ (line 1101) | def __init__(self, config): method forward (line 1112) | def forward( function create_position_ids_from_input_ids (line 1176) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_key_... FILE: src/transformers/models/ibert/quant_modules.py class QuantEmbedding (line 30) | class QuantEmbedding(nn.Module): method __init__ (line 43) | def __init__( method forward (line 76) | def forward(self, x, positions=None, incremental_state=None): class QuantAct (line 113) | class QuantAct(nn.Module): method __init__ (line 130) | def __init__(self, activation_bit, act_range_momentum=0.95, per_channe... method __repr__ (line 149) | def __repr__(self): method forward (line 156) | def forward( class QuantLinear (line 219) | class QuantLinear(nn.Module): method __init__ (line 234) | def __init__( method __repr__ (line 256) | def __repr__(self): method forward (line 261) | def forward(self, x, prev_act_scaling_factor=None): class IntGELU (line 299) | class IntGELU(nn.Module): method __init__ (line 310) | def __init__(self, quant_mode=True, force_dequant="none"): method int_erf (line 326) | def int_erf(self, x_int, scaling_factor): method forward (line 341) | def forward(self, x, scaling_factor=None): class IntSoftmax (line 356) | class IntSoftmax(nn.Module): method __init__ (line 369) | def __init__(self, output_bit, quant_mode=False, force_dequant="none"): method int_polynomial (line 386) | def int_polynomial(self, x_int, scaling_factor): method int_exp (line 394) | def int_exp(self, x_int, scaling_factor): method forward (line 406) | def forward(self, x, scaling_factor): class IntLayerNorm (line 427) | class IntLayerNorm(nn.Module): method __init__ (line 440) | def __init__(self, normalized_shape, eps, output_bit=8, quant_mode=Fal... method set_shift (line 459) | def set_shift(self, y_int): method overflow_fallback (line 468) | def overflow_fallback(self, y_int): method forward (line 479) | def forward(self, x, scaling_factor=None): function get_percentile_min_max (line 528) | def get_percentile_min_max(input, lower_percentile, upper_percentile, ou... function linear_quantize (line 564) | def linear_quantize(input, scale, zero_point, inplace=False): function symmetric_linear_quantization_params (line 599) | def symmetric_linear_quantization_params(num_bits, saturation_min, satur... class SymmetricQuantFunction (line 631) | class SymmetricQuantFunction(Function): method forward (line 637) | def forward(ctx, x, k, percentile_mode, scale): method backward (line 663) | def backward(ctx, grad_output): class floor_ste (line 676) | class floor_ste(Function): method forward (line 682) | def forward(ctx, x): method backward (line 686) | def backward(ctx, grad_output): class round_ste (line 690) | class round_ste(Function): method forward (line 696) | def forward(ctx, x): method backward (line 700) | def backward(ctx, grad_output): function batch_frexp (line 704) | def batch_frexp(inputs, max_bit=31): class FixedPointMul (line 738) | class FixedPointMul(Function): method forward (line 762) | def forward( method backward (line 815) | def backward(ctx, grad_output): FILE: src/transformers/models/idefics/configuration_idefics.py class IdeficsVisionConfig (line 29) | class IdeficsVisionConfig(PreTrainedConfig): class IdeficsPerceiverConfig (line 49) | class IdeficsPerceiverConfig(PreTrainedConfig): class IdeficsConfig (line 77) | class IdeficsConfig(PreTrainedConfig): method __post_init__ (line 155) | def __post_init__(self, **kwargs): FILE: src/transformers/models/idefics/image_processing_idefics.py class IdeficsImageProcessorKwargs (line 33) | class IdeficsImageProcessorKwargs(ImagesKwargs, total=False): class IdeficsImageProcessor (line 52) | class IdeficsImageProcessor(TorchvisionBackend): method __init__ (line 64) | def __init__(self, **kwargs: Unpack[IdeficsImageProcessorKwargs]): method preprocess (line 72) | def preprocess( FILE: src/transformers/models/idefics/image_processing_pil_idefics.py class IdeficsImageProcessorKwargs (line 32) | class IdeficsImageProcessorKwargs(ImagesKwargs, total=False): class IdeficsImageProcessorPil (line 51) | class IdeficsImageProcessorPil(PilBackend): method __init__ (line 63) | def __init__(self, **kwargs: Unpack[IdeficsImageProcessorKwargs]): method preprocess (line 71) | def preprocess( FILE: src/transformers/models/idefics/modeling_idefics.py class IdeficsBaseModelOutputWithPast (line 55) | class IdeficsBaseModelOutputWithPast(ModelOutput): class IdeficsCausalLMOutputWithPast (line 88) | class IdeficsCausalLMOutputWithPast(ModelOutput): function expand_inputs_for_generation (line 114) | def expand_inputs_for_generation( function freeze_model (line 159) | def freeze_model(model, module_exceptions=()): class IdeficsDecoupledEmbedding (line 174) | class IdeficsDecoupledEmbedding(nn.Embedding): method __init__ (line 183) | def __init__( method forward (line 236) | def forward(self, input_ids): method extra_repr (line 275) | def extra_repr(self) -> str: class IdeficsDecoupledLinear (line 279) | class IdeficsDecoupledLinear(nn.Linear): method __init__ (line 288) | def __init__( method forward (line 324) | def forward(self, input: torch.Tensor) -> torch.Tensor: method extra_repr (line 333) | def extra_repr(self) -> str: class IdeficsRMSNorm (line 339) | class IdeficsRMSNorm(nn.Module): method __init__ (line 340) | def __init__(self, hidden_size, eps=1e-6): method forward (line 348) | def forward(self, hidden_states): method extra_repr (line 358) | def extra_repr(self): class IdeficsEmbedding (line 363) | class IdeficsEmbedding(torch.nn.Module): method __init__ (line 364) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 381) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 391) | def forward(self, x, seq_len=None): function rotate_half (line 402) | def rotate_half(x): function apply_rotary_pos_emb (line 409) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1): class IdeficsMLP (line 438) | class IdeficsMLP(nn.Module): method __init__ (line 439) | def __init__( method forward (line 451) | def forward(self, x): function eager_attention_forward (line 456) | def eager_attention_forward( class IdeficsAttention (line 480) | class IdeficsAttention(nn.Module): method __init__ (line 483) | def __init__( method _shape (line 564) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 567) | def forward( class IdeficsDecoderLayer (line 630) | class IdeficsDecoderLayer(GradientCheckpointingLayer): method __init__ (line 631) | def __init__(self, config: IdeficsConfig, layer_idx: int | None = None): method forward (line 651) | def forward( class IdeficsGatedCrossAttentionLayer (line 684) | class IdeficsGatedCrossAttentionLayer(GradientCheckpointingLayer): method __init__ (line 685) | def __init__(self, config: IdeficsConfig, layer_idx: int | None = None): method forward (line 752) | def forward( class IdeficsPreTrainedModel (line 812) | class IdeficsPreTrainedModel(PreTrainedModel): method _init_weights (line 830) | def _init_weights(self, module): class IdeficsModel (line 862) | class IdeficsModel(IdeficsPreTrainedModel): method __init__ (line 870) | def __init__(self, config: IdeficsConfig): method freeze_relevant_params (line 920) | def freeze_relevant_params(self, config=None): method freeze_text_layers (line 930) | def freeze_text_layers(self, module_exceptions=()): method freeze_vision_layers (line 934) | def freeze_vision_layers(self, module_exceptions=()): method forward (line 940) | def forward( class IdeficsForVisionText2Text (line 1094) | class IdeficsForVisionText2Text(IdeficsPreTrainedModel, GenerationMixin): method __init__ (line 1097) | def __init__(self, config, vision_model=None): method forward (line 1119) | def forward( method prepare_inputs_for_generation (line 1207) | def prepare_inputs_for_generation( method _update_model_kwargs_for_generation (line 1250) | def _update_model_kwargs_for_generation( FILE: src/transformers/models/idefics/perceiver.py class IdeficsPerceiverResampler (line 46) | class IdeficsPerceiverResampler(nn.Module): method __init__ (line 47) | def __init__( method forward (line 93) | def forward(self, context: torch.Tensor) -> torch.Tensor: class IdeficsPerceiverAttention (line 106) | class IdeficsPerceiverAttention(nn.Module): method __init__ (line 107) | def __init__(self, embed_dim: int, n_heads: int, head_dim: int, qk_lay... method forward (line 128) | def forward(self, context: torch.Tensor, latents: torch.Tensor) -> tor... class IdeficsMLP (line 171) | class IdeficsMLP(nn.Module): method __init__ (line 172) | def __init__(self, intermediate_size, config: IdeficsConfig): method forward (line 181) | def forward(self, hidden_states: tuple[torch.FloatTensor] | None) -> t... FILE: src/transformers/models/idefics/processing_idefics.py class IdeficsTextKwargs (line 39) | class IdeficsTextKwargs(TextKwargs, total=False): class IdeficsProcessorKwargs (line 54) | class IdeficsProcessorKwargs(ProcessingKwargs, total=False): function incremental_to_binary_attention_mask (line 67) | def incremental_to_binary_attention_mask(incremental_mask, return_tensor... function image_attention_mask_for_packed_input_ids (line 84) | def image_attention_mask_for_packed_input_ids(input_ids, tokenizer, retu... function image_attention_mask_for_packed_input_ids_pt (line 89) | def image_attention_mask_for_packed_input_ids_pt(input_ids, tokenizer): function is_url (line 136) | def is_url(string): class IdeficsProcessor (line 146) | class IdeficsProcessor(ProcessorMixin): method __init__ (line 147) | def __init__(self, image_processor, tokenizer=None, image_size=224, ad... method __call__ (line 172) | def __call__( method model_input_names (line 410) | def model_input_names(self): FILE: src/transformers/models/idefics/vision.py class IdeficsVisionModelOutput (line 40) | class IdeficsVisionModelOutput(ModelOutput): class IdeficsVisionEmbeddings (line 69) | class IdeficsVisionEmbeddings(nn.Module): method __init__ (line 70) | def __init__(self, config: IdeficsVisionConfig): method interpolate_pos_encoding (line 93) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 142) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... function eager_attention_forward (line 169) | def eager_attention_forward( class IdeficsVisionAttention (line 192) | class IdeficsVisionAttention(nn.Module): method __init__ (line 195) | def __init__(self, config: IdeficsVisionConfig): method forward (line 215) | def forward( class IdeficsVisionMLP (line 255) | class IdeficsVisionMLP(nn.Module): method __init__ (line 256) | def __init__(self, config): method forward (line 263) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class IdeficsVisionEncoderLayer (line 271) | class IdeficsVisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 272) | def __init__(self, config: IdeficsVisionConfig): method forward (line 280) | def forward( class IdeficsVisionEncoder (line 305) | class IdeficsVisionEncoder(nn.Module): method __init__ (line 314) | def __init__(self, config: IdeficsVisionConfig): method forward (line 320) | def forward( class IdeficsVisionTransformer (line 355) | class IdeficsVisionTransformer(nn.Module): method __init__ (line 356) | def __init__(self, config: IdeficsVisionConfig): method forward (line 367) | def forward( FILE: src/transformers/models/idefics2/configuration_idefics2.py class Idefics2VisionConfig (line 27) | class Idefics2VisionConfig(PreTrainedConfig): class Idefics2PerceiverConfig (line 63) | class Idefics2PerceiverConfig(PreTrainedConfig): method validate_architecture (line 88) | def validate_architecture(self): class Idefics2Config (line 99) | class Idefics2Config(PreTrainedConfig): method __post_init__ (line 129) | def __post_init__(self, **kwargs): FILE: src/transformers/models/idefics2/convert_idefics2_weights_to_hf.py function convert_state_dict_to_hf (line 56) | def convert_state_dict_to_hf(state_dict): function merge_weights (line 69) | def merge_weights(state_dict): function get_config (line 91) | def get_config(checkpoint): function convert_idefics2_hub_to_hf (line 128) | def convert_idefics2_hub_to_hf(original_model_id, output_hub_path, push_... function main (line 161) | def main(): FILE: src/transformers/models/idefics2/image_processing_idefics2.py function get_resize_output_image_size (line 40) | def get_resize_output_image_size(image, size: SizeDict) -> tuple[int, int]: function convert_to_rgb (line 62) | def convert_to_rgb(image: ImageInput) -> ImageInput: class Idefics2ImageProcessorKwargs (line 80) | class Idefics2ImageProcessorKwargs(ImagesKwargs, total=False): function get_max_height_width (line 89) | def get_max_height_width(images_list: list[list["torch.Tensor|np.ndarray... function make_pixel_mask (line 103) | def make_pixel_mask(image: "torch.Tensor", output_size: tuple[int, int])... class Idefics2ImageProcessor (line 114) | class Idefics2ImageProcessor(TorchvisionBackend): method __init__ (line 129) | def __init__(self, **kwargs: Unpack[Idefics2ImageProcessorKwargs]): method preprocess (line 133) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Idefics2Imag... method convert_to_rgb (line 136) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: method resize (line 140) | def resize( method _prepare_images_structure (line 157) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method split_images (line 162) | def split_images(self, images: "torch.Tensor") -> list[list["torch.Ten... method pad (line 182) | def pad( method _preprocess (line 207) | def _preprocess( FILE: src/transformers/models/idefics2/image_processing_pil_idefics2.py function _make_pixel_mask (line 40) | def _make_pixel_mask(image: np.ndarray, output_size: tuple[int, int]) ->... class Idefics2ImageProcessorKwargs (line 49) | class Idefics2ImageProcessorKwargs(ImagesKwargs, total=False): function convert_to_rgb (line 59) | def convert_to_rgb(image: ImageInput) -> ImageInput: function get_max_height_width (line 78) | def get_max_height_width(images_list: list[list["torch.Tensor|np.ndarray... function get_resize_output_image_size (line 93) | def get_resize_output_image_size(image, size: SizeDict) -> tuple[int, int]: class Idefics2ImageProcessorPil (line 116) | class Idefics2ImageProcessorPil(PilBackend): method __init__ (line 131) | def __init__(self, **kwargs: Unpack[Idefics2ImageProcessorKwargs]): method preprocess (line 135) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Idefics2Imag... method convert_to_rgb (line 138) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: method _prepare_images_structure (line 142) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method resize (line 146) | def resize( method split_images (line 162) | def split_images(self, image: np.ndarray) -> list[np.ndarray]: method pad (line 176) | def pad( method _preprocess (line 209) | def _preprocess( FILE: src/transformers/models/idefics2/modeling_idefics2.py class Idefics2BaseModelOutputWithPast (line 48) | class Idefics2BaseModelOutputWithPast(ModelOutput): class Idefics2CausalLMOutputWithPast (line 80) | class Idefics2CausalLMOutputWithPast(ModelOutput): class Idefics2VisionEmbeddings (line 106) | class Idefics2VisionEmbeddings(nn.Module): method __init__ (line 117) | def __init__(self, config: Idefics2VisionConfig): method forward (line 136) | def forward(self, pixel_values: torch.FloatTensor, patch_attention_mas... function eager_attention_forward (line 182) | def eager_attention_forward( class Idefics2VisionAttention (line 209) | class Idefics2VisionAttention(nn.Module): method __init__ (line 213) | def __init__(self, config): method forward (line 235) | def forward( class Idefics2VisionMLP (line 275) | class Idefics2VisionMLP(nn.Module): method __init__ (line 276) | def __init__(self, config): method forward (line 283) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Idefics2MLP (line 290) | class Idefics2MLP(nn.Module): method __init__ (line 291) | def __init__( method forward (line 304) | def forward(self, x): class Idefics2MultiheadAttentionPoolingHead (line 309) | class Idefics2MultiheadAttentionPoolingHead(nn.Module): method __init__ (line 312) | def __init__(self, config: Idefics2VisionConfig): method forward (line 326) | def forward(self, hidden_state): class Idefics2EncoderLayer (line 339) | class Idefics2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 340) | def __init__(self, config: Idefics2VisionConfig): method forward (line 350) | def forward( class Idefics2Encoder (line 375) | class Idefics2Encoder(nn.Module): method __init__ (line 384) | def __init__(self, config: Idefics2Config): method forward (line 392) | def forward( class Idefics2PreTrainedModel (line 410) | class Idefics2PreTrainedModel(PreTrainedModel): method _init_weights (line 424) | def _init_weights(self, module): class Idefics2VisionTransformer (line 437) | class Idefics2VisionTransformer(Idefics2PreTrainedModel): method __init__ (line 445) | def __init__(self, config: Idefics2VisionConfig): method get_input_embeddings (line 456) | def get_input_embeddings(self): method set_input_embeddings (line 459) | def set_input_embeddings(self, value): method forward (line 465) | def forward( function repeat_kv (line 509) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class Idefics2RMSNorm (line 522) | class Idefics2RMSNorm(nn.Module): method __init__ (line 523) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 531) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 538) | def extra_repr(self): class Idefics2PerceiverAttention (line 542) | class Idefics2PerceiverAttention(nn.Module): method __init__ (line 543) | def __init__(self, config, layer_idx: int | None = None) -> None: method forward (line 563) | def forward( class Idefics2PerceiverLayer (line 624) | class Idefics2PerceiverLayer(nn.Module): method __init__ (line 625) | def __init__(self, config, layer_idx: int): method forward (line 643) | def forward( class Idefics2PerceiverResampler (line 692) | class Idefics2PerceiverResampler(Idefics2PreTrainedModel): method __init__ (line 699) | def __init__(self, config) -> None: method forward (line 717) | def forward( class Idefics2Connector (line 755) | class Idefics2Connector(nn.Module): method __init__ (line 756) | def __init__(self, config): method forward (line 766) | def forward(self, image_hidden_states, attention_mask): class Idefics2Model (line 777) | class Idefics2Model(Idefics2PreTrainedModel): method __init__ (line 778) | def __init__(self, config: Idefics2Config): method get_input_embeddings (line 792) | def get_input_embeddings(self): method set_input_embeddings (line 795) | def set_input_embeddings(self, value): method inputs_merger (line 798) | def inputs_merger( method get_image_features (line 828) | def get_image_features( method forward (line 892) | def forward( class Idefics2ForConditionalGeneration (line 973) | class Idefics2ForConditionalGeneration(Idefics2PreTrainedModel, Generati... method __init__ (line 976) | def __init__(self, config): method get_input_embeddings (line 987) | def get_input_embeddings(self): method set_input_embeddings (line 990) | def set_input_embeddings(self, value): method get_image_features (line 994) | def get_image_features( method forward (line 1012) | def forward( method prepare_inputs_for_generation (line 1109) | def prepare_inputs_for_generation( FILE: src/transformers/models/idefics2/processing_idefics2.py function is_url (line 40) | def is_url(val) -> bool: function is_image_or_image_url (line 44) | def is_image_or_image_url(elem): class Idefics2ProcessorKwargs (line 48) | class Idefics2ProcessorKwargs(ProcessingKwargs, total=False): class Idefics2Processor (line 59) | class Idefics2Processor(ProcessorMixin): method __init__ (line 60) | def __init__( method _extract_images_from_prompts (line 86) | def _extract_images_from_prompts(self, prompts): method __call__ (line 99) | def __call__( FILE: src/transformers/models/idefics3/configuration_idefics3.py class Idefics3VisionConfig (line 27) | class Idefics3VisionConfig(PreTrainedConfig): class Idefics3Config (line 63) | class Idefics3Config(PreTrainedConfig): method __post_init__ (line 90) | def __post_init__(self, **kwargs): FILE: src/transformers/models/idefics3/convert_idefics3_weights_to_hf.py function convert_state_dict_to_hf (line 60) | def convert_state_dict_to_hf(state_dict): function merge_weights (line 89) | def merge_weights(state_dict, new_state_dict): function get_config (line 117) | def get_config(checkpoint): function convert_idefics3_hub_to_hf (line 155) | def convert_idefics3_hub_to_hf(original_model_id, output_hub_path, push_... function main (line 190) | def main(): FILE: src/transformers/models/idefics3/image_processing_idefics3.py class Idefics3ImageProcessorKwargs (line 42) | class Idefics3ImageProcessorKwargs(ImagesKwargs, total=False): function _resize_output_size_rescale_to_max_len (line 58) | def _resize_output_size_rescale_to_max_len( function _resize_output_size_scale_below_upper_bound (line 95) | def _resize_output_size_scale_below_upper_bound( function get_resize_output_image_size (line 126) | def get_resize_output_image_size( function get_max_height_width (line 150) | def get_max_height_width(images_list: list[list["torch.Tensor|np.ndarray... function get_num_channels (line 164) | def get_num_channels(images_list: list[list["torch.Tensor|np.ndarray"]])... function get_device_from_images (line 175) | def get_device_from_images(images_list: list[list["torch.Tensor"]]) -> "... function make_pixel_mask (line 185) | def make_pixel_mask(image: "torch.Tensor", output_size: tuple[int, int])... class Idefics3ImageProcessor (line 202) | class Idefics3ImageProcessor(TorchvisionBackend): method __init__ (line 218) | def __init__(self, **kwargs: Unpack[Idefics3ImageProcessorKwargs]): method preprocess (line 222) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Idefics3Imag... method _prepare_images_structure (line 225) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method resize (line 233) | def resize( method split_images (line 260) | def split_images( method resize_for_vision_encoder (line 319) | def resize_for_vision_encoder( method pad (line 350) | def pad( method _preprocess (line 380) | def _preprocess( method to_dict (line 502) | def to_dict(self): method get_number_of_image_patches (line 508) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/idefics3/image_processing_pil_idefics3.py function _make_pixel_mask (line 40) | def _make_pixel_mask(image: np.ndarray, output_size: tuple[int, int]) ->... class Idefics3ImageProcessorKwargs (line 53) | class Idefics3ImageProcessorKwargs(ImagesKwargs, total=False): function _resize_output_size_rescale_to_max_len (line 70) | def _resize_output_size_rescale_to_max_len( function _resize_output_size_scale_below_upper_bound (line 108) | def _resize_output_size_scale_below_upper_bound( function get_max_height_width (line 139) | def get_max_height_width(images_list: list[list[np.ndarray]]) -> tuple[i... function get_num_channels (line 153) | def get_num_channels(images_list: list[list[np.ndarray]]) -> int: function get_resize_output_image_size (line 164) | def get_resize_output_image_size( class Idefics3ImageProcessorPil (line 189) | class Idefics3ImageProcessorPil(PilBackend): method __init__ (line 205) | def __init__(self, **kwargs: Unpack[Idefics3ImageProcessorKwargs]): method preprocess (line 209) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Idefics3Imag... method _prepare_images_structure (line 212) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method resize (line 216) | def resize( method split_images (line 231) | def split_images( method resize_for_vision_encoder (line 266) | def resize_for_vision_encoder( method pad (line 286) | def pad( method _preprocess (line 319) | def _preprocess( method to_dict (line 432) | def to_dict(self): method get_number_of_image_patches (line 438) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/idefics3/modeling_idefics3.py class Idefics3BaseModelOutputWithPast (line 47) | class Idefics3BaseModelOutputWithPast(ModelOutput): class Idefics3CausalLMOutputWithPast (line 78) | class Idefics3CausalLMOutputWithPast(ModelOutput): class Idefics3VisionEmbeddings (line 104) | class Idefics3VisionEmbeddings(nn.Module): method __init__ (line 115) | def __init__(self, config: Idefics3VisionConfig): method forward (line 134) | def forward(self, pixel_values: torch.FloatTensor, patch_attention_mas... function eager_attention_forward (line 181) | def eager_attention_forward( class Idefics3VisionAttention (line 205) | class Idefics3VisionAttention(nn.Module): method __init__ (line 209) | def __init__(self, config): method forward (line 231) | def forward( class Idefics3VisionMLP (line 271) | class Idefics3VisionMLP(nn.Module): method __init__ (line 272) | def __init__(self, config): method forward (line 279) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Idefics3SimpleMLP (line 286) | class Idefics3SimpleMLP(nn.Module): method __init__ (line 287) | def __init__(self, config): method forward (line 293) | def forward(self, x): class Idefics3EncoderLayer (line 298) | class Idefics3EncoderLayer(GradientCheckpointingLayer): method __init__ (line 299) | def __init__(self, config: Idefics3VisionConfig): method forward (line 309) | def forward( class Idefics3Encoder (line 334) | class Idefics3Encoder(nn.Module): method __init__ (line 343) | def __init__(self, config: Idefics3Config): method forward (line 351) | def forward( function repeat_kv (line 369) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class Idefics3RMSNorm (line 382) | class Idefics3RMSNorm(nn.Module): method __init__ (line 383) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 391) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 398) | def extra_repr(self): class Idefics3Connector (line 402) | class Idefics3Connector(nn.Module): method __init__ (line 403) | def __init__(self, config): method pixel_shuffle (line 408) | def pixel_shuffle(self, x, scale_factor=2): method forward (line 419) | def forward(self, image_hidden_states): class Idefics3PreTrainedModel (line 426) | class Idefics3PreTrainedModel(PreTrainedModel): class Idefics3VisionTransformer (line 444) | class Idefics3VisionTransformer(Idefics3PreTrainedModel): method __init__ (line 452) | def __init__(self, config: Idefics3VisionConfig): method get_input_embeddings (line 464) | def get_input_embeddings(self): method set_input_embeddings (line 468) | def set_input_embeddings(self, value): method forward (line 473) | def forward( class Idefics3Model (line 519) | class Idefics3Model(Idefics3PreTrainedModel): method __init__ (line 520) | def __init__(self, config: Idefics3Config): method get_input_embeddings (line 537) | def get_input_embeddings(self): method set_input_embeddings (line 541) | def set_input_embeddings(self, value): method inputs_merger (line 544) | def inputs_merger( method get_image_features (line 574) | def get_image_features( method forward (line 636) | def forward( class Idefics3ForConditionalGeneration (line 718) | class Idefics3ForConditionalGeneration(Idefics3PreTrainedModel, Generati... method __init__ (line 722) | def __init__(self, config): method get_input_embeddings (line 734) | def get_input_embeddings(self): method set_input_embeddings (line 738) | def set_input_embeddings(self, value): method get_image_features (line 742) | def get_image_features( method forward (line 760) | def forward( method prepare_inputs_for_generation (line 874) | def prepare_inputs_for_generation( FILE: src/transformers/models/idefics3/processing_idefics3.py function is_url (line 37) | def is_url(val) -> bool: function is_image_or_image_url (line 41) | def is_image_or_image_url(elem): function _prompt_split_image (line 45) | def _prompt_split_image(image_seq_len, image_rows, image_cols, fake_toke... function _prompt_single_image (line 64) | def _prompt_single_image(image_seq_len, fake_token_around_image, image_t... function get_image_prompt_string (line 74) | def get_image_prompt_string( class Idefics3ProcessorKwargs (line 89) | class Idefics3ProcessorKwargs(ProcessingKwargs, total=False): class Idefics3Processor (line 104) | class Idefics3Processor(ProcessorMixin): method __init__ (line 105) | def __init__( method _extract_images_from_prompts (line 142) | def _extract_images_from_prompts(self, prompts): method __call__ (line 155) | def __call__( method create_mm_token_type_ids (line 285) | def create_mm_token_type_ids(self, input_ids: list, batch_image_seq_le... method _get_num_multimodal_tokens (line 306) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/ijepa/configuration_ijepa.py class IJepaConfig (line 24) | class IJepaConfig(PreTrainedConfig): method __post_init__ (line 64) | def __post_init__(self, **kwargs): FILE: src/transformers/models/ijepa/convert_ijepa_to_hf.py function convert_old_keys_to_new_keys (line 66) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function read_in_q_k_v (line 94) | def read_in_q_k_v(state_dict, config): function rename_key (line 112) | def rename_key(dct, old, new): function prepare_img (line 118) | def prepare_img(): function get_ijepa_config (line 125) | def get_ijepa_config(model_name): function write_model (line 150) | def write_model(model_name, output_dir, push_to_hub, verify_logits): function main (line 229) | def main(): FILE: src/transformers/models/ijepa/modeling_ijepa.py class IJepaPatchEmbeddings (line 25) | class IJepaPatchEmbeddings(nn.Module): method __init__ (line 32) | def __init__(self, config: IJepaConfig): method forward (line 47) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... class IJepaEmbeddings (line 64) | class IJepaEmbeddings(nn.Module): method __init__ (line 69) | def __init__(self, config: IJepaConfig, use_mask_token: bool = False) ... method interpolate_pos_encoding (line 79) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 118) | def forward( function eager_attention_forward (line 145) | def eager_attention_forward( class IJepaSelfAttention (line 173) | class IJepaSelfAttention(nn.Module): method __init__ (line 174) | def __init__(self, config: IJepaConfig): method forward (line 194) | def forward( class IJepaSelfOutput (line 228) | class IJepaSelfOutput(nn.Module): method __init__ (line 234) | def __init__(self, config: IJepaConfig): method forward (line 239) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class IJepaAttention (line 245) | class IJepaAttention(nn.Module): method __init__ (line 246) | def __init__(self, config: IJepaConfig): method forward (line 251) | def forward( class IJepaIntermediate (line 261) | class IJepaIntermediate(nn.Module): method __init__ (line 262) | def __init__(self, config: IJepaConfig): method forward (line 270) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class IJepaOutput (line 276) | class IJepaOutput(nn.Module): method __init__ (line 277) | def __init__(self, config: IJepaConfig): method forward (line 282) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class IJepaLayer (line 289) | class IJepaLayer(GradientCheckpointingLayer): method __init__ (line 292) | def __init__(self, config: IJepaConfig): method forward (line 302) | def forward( class IJepaPreTrainedModel (line 324) | class IJepaPreTrainedModel(PreTrainedModel): method _init_weights (line 341) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class IJepaEncoder (line 356) | class IJepaEncoder(nn.Module): method __init__ (line 357) | def __init__(self, config: IJepaConfig): method forward (line 363) | def forward( class IJepaPooler (line 374) | class IJepaPooler(nn.Module): method __init__ (line 375) | def __init__(self, config: IJepaConfig): method forward (line 380) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class IJepaModel (line 390) | class IJepaModel(IJepaPreTrainedModel): method __init__ (line 391) | def __init__(self, config: IJepaConfig, add_pooling_layer: bool = Fals... method get_input_embeddings (line 409) | def get_input_embeddings(self) -> IJepaPatchEmbeddings: method forward (line 415) | def forward( class IJepaForImageClassification (line 462) | class IJepaForImageClassification(IJepaPreTrainedModel): method __init__ (line 463) | def __init__(self, config: IJepaConfig): method forward (line 477) | def forward( FILE: src/transformers/models/ijepa/modular_ijepa.py class IJepaEmbeddings (line 13) | class IJepaEmbeddings(ViTEmbeddings): method __init__ (line 14) | def __init__(self, config: IJepaConfig, use_mask_token: bool = False) ... method interpolate_pos_encoding (line 21) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 60) | def forward( class IJepaPreTrainedModel (line 88) | class IJepaPreTrainedModel(ViTPreTrainedModel): method _init_weights (line 90) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class IJepaModel (line 105) | class IJepaModel(IJepaPreTrainedModel, ViTModel): method __init__ (line 106) | def __init__(self, config: IJepaConfig, add_pooling_layer: bool = Fals... class IJepaForImageClassification (line 132) | class IJepaForImageClassification(IJepaPreTrainedModel, ViTForImageClass... method __init__ (line 133) | def __init__(self, config: IJepaConfig): method forward (line 138) | def forward( FILE: src/transformers/models/imagegpt/configuration_imagegpt.py class ImageGPTConfig (line 24) | class ImageGPTConfig(PreTrainedConfig): FILE: src/transformers/models/imagegpt/convert_imagegpt_original_tf2_to_pytorch.py function load_tf_weights_in_imagegpt (line 29) | def load_tf_weights_in_imagegpt(model, config, imagegpt_checkpoint_path): function convert_imagegpt_checkpoint_to_pytorch (line 140) | def convert_imagegpt_checkpoint_to_pytorch(imagegpt_checkpoint_path, mod... FILE: src/transformers/models/imagegpt/image_processing_imagegpt.py class ImageGPTImageProcessorKwargs (line 33) | class ImageGPTImageProcessorKwargs(ImagesKwargs, total=False): function squared_euclidean_distance_torch (line 47) | def squared_euclidean_distance_torch(a: torch.Tensor, b: torch.Tensor) -... function color_quantize_torch (line 66) | def color_quantize_torch(x: torch.Tensor, clusters: torch.Tensor) -> tor... class ImageGPTImageProcessor (line 82) | class ImageGPTImageProcessor(TorchvisionBackend): method __init__ (line 95) | def __init__( method _preprocess (line 108) | def _preprocess( method to_dict (line 183) | def to_dict(self): FILE: src/transformers/models/imagegpt/image_processing_pil_imagegpt.py function squared_euclidean_distance (line 38) | def squared_euclidean_distance(a, b): function color_quantize (line 47) | def color_quantize(x, clusters): class ImageGPTImageProcessorKwargs (line 54) | class ImageGPTImageProcessorKwargs(ImagesKwargs, total=False): class ImageGPTImageProcessorPil (line 69) | class ImageGPTImageProcessorPil(PilBackend): method __init__ (line 82) | def __init__( method _preprocess (line 96) | def _preprocess( method to_dict (line 147) | def to_dict(self): FILE: src/transformers/models/imagegpt/modeling_imagegpt.py class ImageGPTLayerNorm (line 47) | class ImageGPTLayerNorm(nn.Module): method __init__ (line 48) | def __init__(self, hidden_size: tuple[int], eps: float = 1e-5): method forward (line 53) | def forward(self, tensor: torch.Tensor) -> torch.Tensor: class ImageGPTAttention (line 60) | class ImageGPTAttention(nn.Module): method __init__ (line 61) | def __init__(self, config, is_cross_attention: bool | None = False, la... method _attn (line 101) | def _attn(self, query, key, value, attention_mask=None): method _upcast_and_reordered_attn (line 135) | def _upcast_and_reordered_attn(self, query, key, value, attention_mask... method _split_heads (line 183) | def _split_heads(self, tensor, num_heads, attn_head_size): method _merge_heads (line 191) | def _merge_heads(self, tensor, num_heads, attn_head_size): method forward (line 199) | def forward( class ImageGPTMLP (line 268) | class ImageGPTMLP(nn.Module): method __init__ (line 269) | def __init__(self, intermediate_size, config): method forward (line 277) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ImageGPTBlock (line 285) | class ImageGPTBlock(GradientCheckpointingLayer): method __init__ (line 286) | def __init__(self, config, layer_idx=None): method forward (line 301) | def forward( class ImageGPTPreTrainedModel (line 358) | class ImageGPTPreTrainedModel(PreTrainedModel): method _init_weights (line 367) | def _init_weights(self, module): class ImageGPTModel (line 393) | class ImageGPTModel(ImageGPTPreTrainedModel): method __init__ (line 394) | def __init__(self, config: ImageGPTConfig): method get_input_embeddings (line 410) | def get_input_embeddings(self): method set_input_embeddings (line 413) | def set_input_embeddings(self, new_embeddings): method forward (line 417) | def forward( class ImageGPTForCausalImageModeling (line 599) | class ImageGPTForCausalImageModeling(ImageGPTPreTrainedModel, Generation... method __init__ (line 602) | def __init__(self, config: ImageGPTConfig): method forward (line 611) | def forward( class ImageGPTForImageClassification (line 728) | class ImageGPTForImageClassification(ImageGPTPreTrainedModel): method __init__ (line 729) | def __init__(self, config: ImageGPTConfig): method forward (line 739) | def forward( FILE: src/transformers/models/informer/configuration_informer.py class InformerConfig (line 24) | class InformerConfig(PreTrainedConfig): method __post_init__ (line 132) | def __post_init__(self, **kwargs): method validate_architecture (line 145) | def validate_architecture(self): method _number_of_features (line 166) | def _number_of_features(self) -> int: FILE: src/transformers/models/informer/modeling_informer.py class InformerFeatureEmbedder (line 52) | class InformerFeatureEmbedder(nn.Module): method __init__ (line 63) | def __init__(self, cardinalities: list[int], embedding_dims: list[int]... method forward (line 69) | def forward(self, features: torch.Tensor) -> torch.Tensor: class InformerStdScaler (line 86) | class InformerStdScaler(nn.Module): method __init__ (line 92) | def __init__(self, config: InformerConfig): method forward (line 98) | def forward( class InformerMeanScaler (line 121) | class InformerMeanScaler(nn.Module): method __init__ (line 127) | def __init__(self, config: InformerConfig): method forward (line 134) | def forward( class InformerNOPScaler (line 175) | class InformerNOPScaler(nn.Module): method __init__ (line 180) | def __init__(self, config: InformerConfig): method forward (line 185) | def forward( class InformerSinusoidalPositionalEmbedding (line 202) | class InformerSinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 205) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method create_weight (line 208) | def create_weight(self): method forward (line 224) | def forward( class InformerValueEmbedding (line 236) | class InformerValueEmbedding(nn.Module): method __init__ (line 237) | def __init__(self, feature_size, d_model): method forward (line 241) | def forward(self, x): class InformerPreTrainedModel (line 246) | class InformerPreTrainedModel(PreTrainedModel): method _init_weights (line 254) | def _init_weights(self, module: nn.Module): function eager_attention_forward (line 260) | def eager_attention_forward( class InformerAttention (line 288) | class InformerAttention(nn.Module): method __init__ (line 291) | def __init__( method forward (line 330) | def forward( class InformerProbSparseAttention (line 406) | class InformerProbSparseAttention(nn.Module): method __init__ (line 411) | def __init__( method _shape (line 442) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 445) | def forward( class InformerConvLayer (line 609) | class InformerConvLayer(GradientCheckpointingLayer): method __init__ (line 610) | def __init__(self, c_in): method forward (line 623) | def forward(self, x): class InformerEncoderLayer (line 632) | class InformerEncoderLayer(GradientCheckpointingLayer): method __init__ (line 633) | def __init__(self, config: InformerConfig): method forward (line 659) | def forward( class InformerDecoderLayer (line 690) | class InformerDecoderLayer(GradientCheckpointingLayer): method __init__ (line 691) | def __init__(self, config: InformerConfig, layer_idx: int | None = None): method forward (line 731) | def forward( class InformerEncoder (line 781) | class InformerEncoder(InformerPreTrainedModel): method __init__ (line 795) | def __init__(self, config: InformerConfig): method forward (line 823) | def forward( class InformerDecoder (line 863) | class InformerDecoder(InformerPreTrainedModel): method __init__ (line 878) | def __init__(self, config: InformerConfig): method forward (line 898) | def forward( class InformerModel (line 994) | class InformerModel(InformerPreTrainedModel): method __init__ (line 995) | def __init__(self, config: InformerConfig): method _past_length (line 1019) | def _past_length(self) -> int: method get_lagged_subsequences (line 1022) | def get_lagged_subsequences( method create_network_inputs (line 1054) | def create_network_inputs( method forward (line 1135) | def forward( function weighted_average (line 1325) | def weighted_average(input_tensor: torch.Tensor, weights: torch.Tensor |... function nll (line 1349) | def nll(input: torch.distributions.Distribution, target: torch.Tensor) -... class InformerForPrediction (line 1357) | class InformerForPrediction(InformerPreTrainedModel): method __init__ (line 1358) | def __init__(self, config: InformerConfig): method output_params (line 1382) | def output_params(self, dec_output): method output_distribution (line 1386) | def output_distribution(self, params, loc=None, scale=None, trailing_n... method forward (line 1395) | def forward( method generate (line 1605) | def generate( FILE: src/transformers/models/informer/modular_informer.py function nll (line 51) | def nll(input: torch.distributions.Distribution, target: torch.Tensor) -... class InformerFeatureEmbedder (line 58) | class InformerFeatureEmbedder(TimeSeriesFeatureEmbedder): class InformerStdScaler (line 62) | class InformerStdScaler(TimeSeriesStdScaler): class InformerMeanScaler (line 66) | class InformerMeanScaler(TimeSeriesMeanScaler): class InformerNOPScaler (line 70) | class InformerNOPScaler(TimeSeriesNOPScaler): class InformerSinusoidalPositionalEmbedding (line 74) | class InformerSinusoidalPositionalEmbedding(TimeSeriesSinusoidalPosition... class InformerValueEmbedding (line 78) | class InformerValueEmbedding(TimeSeriesValueEmbedding): class InformerPreTrainedModel (line 83) | class InformerPreTrainedModel(PreTrainedModel): method _init_weights (line 91) | def _init_weights(self, module: nn.Module): class InformerAttention (line 97) | class InformerAttention(BartAttention): class InformerProbSparseAttention (line 101) | class InformerProbSparseAttention(nn.Module): method __init__ (line 106) | def __init__( method _shape (line 137) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 140) | def forward( class InformerConvLayer (line 304) | class InformerConvLayer(GradientCheckpointingLayer): method __init__ (line 305) | def __init__(self, c_in): method forward (line 318) | def forward(self, x): class InformerEncoderLayer (line 327) | class InformerEncoderLayer(TimeSeriesTransformerEncoderLayer): method __init__ (line 328) | def __init__(self, config: InformerConfig): class InformerDecoderLayer (line 349) | class InformerDecoderLayer(TimeSeriesTransformerDecoderLayer): method __init__ (line 350) | def __init__(self, config: InformerConfig, layer_idx: int | None = None): class InformerEncoder (line 375) | class InformerEncoder(TimeSeriesTransformerEncoder): method __init__ (line 381) | def __init__(self, config: InformerConfig): method forward (line 410) | def forward( class InformerDecoder (line 450) | class InformerDecoder(TimeSeriesTransformerDecoder): method __init__ (line 457) | def __init__(self, config: InformerConfig): class InformerModel (line 476) | class InformerModel(TimeSeriesTransformerModel): method __init__ (line 477) | def __init__(self, config: InformerConfig): method forward (line 500) | def forward(self, **super_kwargs): class InformerForPrediction (line 621) | class InformerForPrediction(TimeSeriesTransformerForPrediction): method __init__ (line 622) | def __init__(self, config: InformerConfig): method forward (line 649) | def forward(self, **super_kwargs): FILE: src/transformers/models/instructblip/configuration_instructblip.py class InstructBlipVisionConfig (line 29) | class InstructBlipVisionConfig(PreTrainedConfig): class InstructBlipQFormerConfig (line 64) | class InstructBlipQFormerConfig(PreTrainedConfig): class InstructBlipConfig (line 106) | class InstructBlipConfig(PreTrainedConfig): method __post_init__ (line 161) | def __post_init__(self, **kwargs): FILE: src/transformers/models/instructblip/convert_instructblip_original_to_pytorch.py function load_demo_image (line 49) | def load_demo_image(): function create_rename_keys (line 58) | def create_rename_keys(config): function rename_key (line 91) | def rename_key(dct, old, new): function read_in_q_v_bias (line 96) | def read_in_q_v_bias(state_dict, config): function get_blip2_config (line 107) | def get_blip2_config(model_name): function convert_blip2_checkpoint (line 132) | def convert_blip2_checkpoint(model_name, pytorch_dump_folder_path=None, ... FILE: src/transformers/models/instructblip/modeling_instructblip.py class BaseModelOutputWithVisionQformerOutputs (line 52) | class BaseModelOutputWithVisionQformerOutputs(BaseModelOutputWithPooling): class InstructBlipForConditionalGenerationModelOutput (line 71) | class InstructBlipForConditionalGenerationModelOutput(ModelOutput): method to_tuple (line 91) | def to_tuple(self) -> tuple[Any]: class InstructBlipVisionEmbeddings (line 101) | class InstructBlipVisionEmbeddings(nn.Module): method __init__ (line 102) | def __init__(self, config: InstructBlipVisionConfig): method interpolate_pos_encoding (line 120) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 160) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... function eager_attention_forward (line 176) | def eager_attention_forward( class InstructBlipAttention (line 200) | class InstructBlipAttention(nn.Module): method __init__ (line 203) | def __init__(self, config): method _shape (line 234) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 237) | def forward( class InstructBlipMLP (line 275) | class InstructBlipMLP(nn.Module): method __init__ (line 276) | def __init__(self, config): method forward (line 283) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InstructBlipEncoderLayer (line 291) | class InstructBlipEncoderLayer(GradientCheckpointingLayer): method __init__ (line 292) | def __init__(self, config: InstructBlipConfig): method forward (line 301) | def forward( class InstructBlipPreTrainedModel (line 324) | class InstructBlipPreTrainedModel(PreTrainedModel): method _init_weights (line 344) | def _init_weights(self, module): class InstructBlipEncoder (line 358) | class InstructBlipEncoder(nn.Module): method __init__ (line 368) | def __init__(self, config: InstructBlipConfig): method forward (line 375) | def forward( class InstructBlipVisionModel (line 390) | class InstructBlipVisionModel(InstructBlipPreTrainedModel): method __init__ (line 399) | def __init__(self, config: InstructBlipVisionConfig): method forward (line 413) | def forward( method get_input_embeddings (line 440) | def get_input_embeddings(self): class InstructBlipQFormerMultiHeadAttention (line 444) | class InstructBlipQFormerMultiHeadAttention(nn.Module): method __init__ (line 445) | def __init__(self, config, is_cross_attention=False): method save_attn_gradients (line 469) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 472) | def get_attn_gradients(self): method save_attention_map (line 475) | def save_attention_map(self, attention_map): method get_attention_map (line 478) | def get_attention_map(self): method transpose_for_scores (line 481) | def transpose_for_scores(self, x): method forward (line 486) | def forward( class InstructBlipQFormerSelfOutput (line 542) | class InstructBlipQFormerSelfOutput(nn.Module): method __init__ (line 543) | def __init__(self, config): method forward (line 549) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class InstructBlipQFormerAttention (line 557) | class InstructBlipQFormerAttention(nn.Module): method __init__ (line 558) | def __init__(self, config, is_cross_attention=False): method forward (line 563) | def forward( class InstructBlipQFormerIntermediate (line 583) | class InstructBlipQFormerIntermediate(nn.Module): method __init__ (line 584) | def __init__(self, config): method forward (line 592) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InstructBlipQFormerOutput (line 599) | class InstructBlipQFormerOutput(nn.Module): method __init__ (line 600) | def __init__(self, config): method forward (line 606) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class InstructBlipQFormerLayer (line 613) | class InstructBlipQFormerLayer(GradientCheckpointingLayer): method __init__ (line 614) | def __init__(self, config, layer_idx): method forward (line 634) | def forward( method feed_forward_chunk (line 687) | def feed_forward_chunk(self, attention_output): method feed_forward_chunk_query (line 692) | def feed_forward_chunk_query(self, attention_output): class InstructBlipQFormerEncoder (line 699) | class InstructBlipQFormerEncoder(nn.Module): method __init__ (line 700) | def __init__(self, config): method forward (line 709) | def forward( class InstructBlipQFormerEmbeddings (line 735) | class InstructBlipQFormerEmbeddings(nn.Module): method __init__ (line 738) | def __init__(self, config): method forward (line 753) | def forward( class InstructBlipQFormerModel (line 785) | class InstructBlipQFormerModel(InstructBlipPreTrainedModel): method __init__ (line 806) | def __init__(self, config: InstructBlipQFormerConfig): method get_input_embeddings (line 816) | def get_input_embeddings(self): method set_input_embeddings (line 819) | def set_input_embeddings(self, value): method get_extended_attention_mask (line 822) | def get_extended_attention_mask( method forward (line 868) | def forward( class InstructBlipModel (line 946) | class InstructBlipModel(InstructBlipPreTrainedModel): method __init__ (line 950) | def __init__(self, config: InstructBlipConfig): method get_input_embeddings (line 963) | def get_input_embeddings(self): method set_input_embeddings (line 966) | def set_input_embeddings(self, value): method _preprocess_accelerate (line 969) | def _preprocess_accelerate(self): method get_placeholder_mask (line 989) | def get_placeholder_mask(self, input_ids: torch.LongTensor, inputs_emb... method forward (line 1006) | def forward( class InstructBlipForConditionalGeneration (line 1112) | class InstructBlipForConditionalGeneration(InstructBlipPreTrainedModel, ... method __init__ (line 1119) | def __init__(self, config: InstructBlipConfig): method get_input_embeddings (line 1139) | def get_input_embeddings(self): method set_input_embeddings (line 1142) | def set_input_embeddings(self, value): method set_output_embeddings (line 1145) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 1148) | def get_output_embeddings(self) -> nn.Module: method get_encoder (line 1151) | def get_encoder(self, modality=None): method get_decoder (line 1157) | def get_decoder(self): method _preprocess_accelerate (line 1161) | def _preprocess_accelerate(self): method get_image_features (line 1183) | def get_image_features( method get_placeholder_mask (line 1248) | def get_placeholder_mask(self, input_ids: torch.LongTensor, inputs_emb... method forward (line 1265) | def forward( method generate (line 1398) | def generate( FILE: src/transformers/models/instructblip/processing_instructblip.py class InstructBlipProcessorKwargs (line 28) | class InstructBlipProcessorKwargs(ProcessingKwargs, total=False): class InstructBlipProcessor (line 45) | class InstructBlipProcessor(ProcessorMixin): method __init__ (line 46) | def __init__(self, image_processor, tokenizer, qformer_tokenizer, num_... method __call__ (line 64) | def __call__( method model_input_names (line 116) | def model_input_names(self): FILE: src/transformers/models/instructblipvideo/configuration_instructblipvideo.py class InstructBlipVideoVisionConfig (line 35) | class InstructBlipVideoVisionConfig(PreTrainedConfig): class InstructBlipVideoQFormerConfig (line 70) | class InstructBlipVideoQFormerConfig(PreTrainedConfig): class InstructBlipVideoConfig (line 112) | class InstructBlipVideoConfig(PreTrainedConfig): method __post_init__ (line 166) | def __post_init__(self, **kwargs): FILE: src/transformers/models/instructblipvideo/convert_instructblipvideo_original_to_pytorch.py function load_demo_image (line 49) | def load_demo_image(): function create_rename_keys (line 58) | def create_rename_keys(config): function rename_key (line 91) | def rename_key(dct, old, new): function read_in_q_v_bias (line 96) | def read_in_q_v_bias(state_dict, config): function get_blip2_config (line 107) | def get_blip2_config(model_name): function convert_blip2_checkpoint (line 134) | def convert_blip2_checkpoint(model_name, pytorch_dump_folder_path=None, ... FILE: src/transformers/models/instructblipvideo/modeling_instructblipvideo.py class InstructBlipVideoVisionEmbeddings (line 59) | class InstructBlipVideoVisionEmbeddings(nn.Module): method __init__ (line 60) | def __init__(self, config: InstructBlipVideoVisionConfig): method interpolate_pos_encoding (line 78) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 118) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class InstructBlipVideoQFormerEmbeddings (line 133) | class InstructBlipVideoQFormerEmbeddings(nn.Module): method __init__ (line 136) | def __init__(self, config): method forward (line 151) | def forward( class InstructBlipVideoPreTrainedModel (line 184) | class InstructBlipVideoPreTrainedModel(PreTrainedModel): method _init_weights (line 204) | def _init_weights(self, module): function eager_attention_forward (line 218) | def eager_attention_forward( class InstructBlipVideoAttention (line 241) | class InstructBlipVideoAttention(nn.Module): method __init__ (line 244) | def __init__(self, config): method _shape (line 275) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 278) | def forward( class InstructBlipVideoMLP (line 315) | class InstructBlipVideoMLP(nn.Module): method __init__ (line 316) | def __init__(self, config): method forward (line 323) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InstructBlipVideoEncoderLayer (line 330) | class InstructBlipVideoEncoderLayer(GradientCheckpointingLayer): method __init__ (line 331) | def __init__(self, config: InstructBlipVideoConfig): method forward (line 340) | def forward( class InstructBlipVideoEncoder (line 362) | class InstructBlipVideoEncoder(nn.Module): method __init__ (line 372) | def __init__(self, config: InstructBlipVideoConfig): method forward (line 379) | def forward( class InstructBlipVideoVisionModel (line 394) | class InstructBlipVideoVisionModel(InstructBlipVideoPreTrainedModel): method __init__ (line 403) | def __init__(self, config: InstructBlipVideoVisionConfig): method forward (line 417) | def forward( method get_input_embeddings (line 444) | def get_input_embeddings(self): class InstructBlipVideoQFormerMultiHeadAttention (line 448) | class InstructBlipVideoQFormerMultiHeadAttention(nn.Module): method __init__ (line 449) | def __init__(self, config, is_cross_attention=False): method save_attn_gradients (line 473) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 476) | def get_attn_gradients(self): method save_attention_map (line 479) | def save_attention_map(self, attention_map): method get_attention_map (line 482) | def get_attention_map(self): method transpose_for_scores (line 485) | def transpose_for_scores(self, x): method forward (line 490) | def forward( class InstructBlipVideoQFormerSelfOutput (line 545) | class InstructBlipVideoQFormerSelfOutput(nn.Module): method __init__ (line 546) | def __init__(self, config): method forward (line 552) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class InstructBlipVideoQFormerAttention (line 559) | class InstructBlipVideoQFormerAttention(nn.Module): method __init__ (line 560) | def __init__(self, config, is_cross_attention=False): method forward (line 565) | def forward( class InstructBlipVideoQFormerIntermediate (line 584) | class InstructBlipVideoQFormerIntermediate(nn.Module): method __init__ (line 585) | def __init__(self, config): method forward (line 593) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InstructBlipVideoQFormerOutput (line 599) | class InstructBlipVideoQFormerOutput(nn.Module): method __init__ (line 600) | def __init__(self, config): method forward (line 606) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class InstructBlipVideoQFormerLayer (line 613) | class InstructBlipVideoQFormerLayer(GradientCheckpointingLayer): method __init__ (line 614) | def __init__(self, config, layer_idx): method forward (line 634) | def forward( method feed_forward_chunk (line 687) | def feed_forward_chunk(self, attention_output): method feed_forward_chunk_query (line 692) | def feed_forward_chunk_query(self, attention_output): class InstructBlipVideoQFormerEncoder (line 698) | class InstructBlipVideoQFormerEncoder(nn.Module): method __init__ (line 699) | def __init__(self, config): method forward (line 708) | def forward( class InstructBlipVideoQFormerModel (line 734) | class InstructBlipVideoQFormerModel(InstructBlipVideoPreTrainedModel): method __init__ (line 755) | def __init__(self, config: InstructBlipVideoQFormerConfig): method get_input_embeddings (line 765) | def get_input_embeddings(self): method set_input_embeddings (line 768) | def set_input_embeddings(self, value): method get_extended_attention_mask (line 771) | def get_extended_attention_mask( method forward (line 817) | def forward( class InstructBlipVideoForConditionalGenerationModelOutput (line 896) | class InstructBlipVideoForConditionalGenerationModelOutput(ModelOutput): method to_tuple (line 916) | def to_tuple(self) -> tuple[Any]: class InstructBlipVideoModel (line 930) | class InstructBlipVideoModel(InstructBlipVideoPreTrainedModel): method __init__ (line 934) | def __init__(self, config: InstructBlipVideoConfig): method get_input_embeddings (line 947) | def get_input_embeddings(self): method set_input_embeddings (line 950) | def set_input_embeddings(self, value): method _preprocess_accelerate (line 953) | def _preprocess_accelerate(self): method get_placeholder_mask (line 973) | def get_placeholder_mask(self, input_ids: torch.LongTensor, inputs_emb... method forward (line 990) | def forward( class BaseModelOutputWithVisionQformerOutputs (line 1107) | class BaseModelOutputWithVisionQformerOutputs(BaseModelOutputWithPooling): class InstructBlipVideoForConditionalGeneration (line 1128) | class InstructBlipVideoForConditionalGeneration(InstructBlipVideoPreTrai... method __init__ (line 1135) | def __init__(self, config: InstructBlipVideoConfig): method get_input_embeddings (line 1155) | def get_input_embeddings(self): method set_input_embeddings (line 1158) | def set_input_embeddings(self, value): method set_output_embeddings (line 1161) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 1164) | def get_output_embeddings(self) -> nn.Module: method get_encoder (line 1167) | def get_encoder(self, modality=None): method get_decoder (line 1173) | def get_decoder(self): method _preprocess_accelerate (line 1176) | def _preprocess_accelerate(self): method get_placeholder_mask (line 1196) | def get_placeholder_mask(self, input_ids: torch.LongTensor, inputs_emb... method forward (line 1213) | def forward( method generate (line 1348) | def generate( method get_video_features (line 1419) | def get_video_features( FILE: src/transformers/models/instructblipvideo/modular_instructblipvideo.py class InstructBlipVideoVisionConfig (line 42) | class InstructBlipVideoVisionConfig(InstructBlipVisionConfig): class InstructBlipVideoQFormerConfig (line 62) | class InstructBlipVideoQFormerConfig(InstructBlipQFormerConfig): class InstructBlipVideoConfig (line 86) | class InstructBlipVideoConfig(InstructBlipConfig): class InstructBlipVideoPreTrainedModel (line 128) | class InstructBlipVideoPreTrainedModel(InstructBlipPreTrainedModel): class InstructBlipVideoVisionModel (line 132) | class InstructBlipVideoVisionModel(InstructBlipVisionModel): class InstructBlipVideoQFormerModel (line 136) | class InstructBlipVideoQFormerModel(InstructBlipQFormerModel): class InstructBlipVideoForConditionalGenerationModelOutput (line 140) | class InstructBlipVideoForConditionalGenerationModelOutput(InstructBlipF... class InstructBlipVideoModel (line 144) | class InstructBlipVideoModel(InstructBlipModel): method forward (line 147) | def forward( class InstructBlipVideoForConditionalGeneration (line 240) | class InstructBlipVideoForConditionalGeneration(InstructBlipForCondition... method get_video_features (line 243) | def get_video_features( method get_image_features (line 312) | def get_image_features(**super_kwargs): method get_placeholder_mask (line 315) | def get_placeholder_mask(self, input_ids: torch.LongTensor, inputs_emb... method forward (line 332) | def forward( method generate (line 467) | def generate( FILE: src/transformers/models/instructblipvideo/processing_instructblipvideo.py class InstructBlipVideoProcessor (line 35) | class InstructBlipVideoProcessor(ProcessorMixin): method __init__ (line 36) | def __init__(self, video_processor, tokenizer, qformer_tokenizer, num_... method __call__ (line 52) | def __call__( method model_input_names (line 151) | def model_input_names(self): FILE: src/transformers/models/instructblipvideo/video_processing_instructblipvideo.py class InstructBlipVideoVideoProcessor (line 29) | class InstructBlipVideoVideoProcessor(BaseVideoProcessor): method _preprocess (line 42) | def _preprocess( FILE: src/transformers/models/internvl/configuration_internvl.py class InternVLVisionConfig (line 25) | class InternVLVisionConfig(PreTrainedConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): class InternVLConfig (line 88) | class InternVLConfig(PreTrainedConfig): method __post_init__ (line 121) | def __post_init__(self, **kwargs): FILE: src/transformers/models/internvl/convert_internvl_weights_to_hf.py function get_lm_type (line 126) | def get_lm_type(path: str) -> Literal["qwen2", "llama"]: function convert_old_keys_to_new_keys (line 149) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None, pa... function load_original_state_dict (line 185) | def load_original_state_dict(input_base_path): function get_internvl_config (line 196) | def get_internvl_config(input_base_path): function write_model (line 234) | def write_model( function write_tokenizer (line 346) | def write_tokenizer(save_dir: str, push_to_hub: bool = False, path: str ... function write_image_processor (line 400) | def write_image_processor(save_dir: str, push_to_hub: bool = False, hub_... function main (line 418) | def main(): FILE: src/transformers/models/internvl/modeling_internvl.py class InternVLVisionRMSNorm (line 46) | class InternVLVisionRMSNorm(nn.Module): method __init__ (line 47) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 55) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 62) | def extra_repr(self): function eager_attention_forward (line 66) | def eager_attention_forward( class InternVLVisionAttention (line 92) | class InternVLVisionAttention(nn.Module): method __init__ (line 95) | def __init__(self, config: InternVLVisionConfig): method forward (line 123) | def forward( class InternVLVisionModelOutputWithPooling (line 171) | class InternVLVisionModelOutputWithPooling(BaseModelOutputWithPooling): class InternVLVisionPatchEmbeddings (line 180) | class InternVLVisionPatchEmbeddings(nn.Module): method __init__ (line 187) | def __init__(self, config): method forward (line 202) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class InternVLVisionEmbeddings (line 217) | class InternVLVisionEmbeddings(nn.Module): method __init__ (line 223) | def __init__(self, config: InternVLVisionConfig) -> None: method interpolate_pos_encoding (line 245) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 285) | def forward( class InternVLVisionMLP (line 311) | class InternVLVisionMLP(nn.Module): method __init__ (line 312) | def __init__(self, config): method forward (line 319) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVLVisionLayer (line 329) | class InternVLVisionLayer(GradientCheckpointingLayer): method __init__ (line 332) | def __init__(self, config: InternVLVisionConfig) -> None: method forward (line 347) | def forward( class InternVLVisionEncoder (line 375) | class InternVLVisionEncoder(nn.Module): method __init__ (line 376) | def __init__(self, config: InternVLVisionConfig) -> None: method forward (line 382) | def forward( class InternVLVisionPreTrainedModel (line 395) | class InternVLVisionPreTrainedModel(PreTrainedModel): method _init_weights (line 413) | def _init_weights(self, module): class InternVLVisionModel (line 428) | class InternVLVisionModel(InternVLVisionPreTrainedModel): method __init__ (line 429) | def __init__(self, config: InternVLVisionConfig) -> None: method get_input_embeddings (line 443) | def get_input_embeddings(self): method forward (line 449) | def forward( class InternVLPreTrainedModel (line 470) | class InternVLPreTrainedModel(PreTrainedModel): class InternVLMultiModalProjector (line 485) | class InternVLMultiModalProjector(nn.Module): method __init__ (line 486) | def __init__(self, config: InternVLConfig): method forward (line 495) | def forward(self, image_features): class InternVLModelOutputWithPast (line 509) | class InternVLModelOutputWithPast(BaseModelOutputWithPast): class InternVLModel (line 529) | class InternVLModel(InternVLPreTrainedModel): method __init__ (line 530) | def __init__(self, config: InternVLConfig): method get_input_embeddings (line 538) | def get_input_embeddings(self): method set_input_embeddings (line 541) | def set_input_embeddings(self, value): method get_image_features (line 549) | def get_image_features( method get_placeholder_mask (line 595) | def get_placeholder_mask( method forward (line 621) | def forward( method pixel_shuffle (line 668) | def pixel_shuffle(self, vision_features: torch.Tensor, scale_factor: f... class InternVLCausalLMOutputWithPast (line 710) | class InternVLCausalLMOutputWithPast(ModelOutput): class InternVLForConditionalGeneration (line 739) | class InternVLForConditionalGeneration(InternVLPreTrainedModel, Generati... method __init__ (line 742) | def __init__(self, config: InternVLConfig): method get_input_embeddings (line 748) | def get_input_embeddings(self): method set_input_embeddings (line 751) | def set_input_embeddings(self, value): method get_output_embeddings (line 754) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 758) | def get_image_features( method forward (line 774) | def forward( method prepare_inputs_for_generation (line 857) | def prepare_inputs_for_generation( FILE: src/transformers/models/internvl/modular_internvl.py function eager_attention_forward (line 46) | def eager_attention_forward( class InternVLVisionRMSNorm (line 72) | class InternVLVisionRMSNorm(LlamaRMSNorm): class InternVLVisionAttention (line 76) | class InternVLVisionAttention(JanusVisionAttention): method __init__ (line 77) | def __init__(self, config: InternVLVisionConfig): method forward (line 88) | def forward( class InternVLVisionModelOutputWithPooling (line 136) | class InternVLVisionModelOutputWithPooling(BaseModelOutputWithPooling): class InternVLVisionPatchEmbeddings (line 145) | class InternVLVisionPatchEmbeddings(nn.Module): method __init__ (line 152) | def __init__(self, config): method forward (line 167) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class InternVLVisionEmbeddings (line 182) | class InternVLVisionEmbeddings(nn.Module): method __init__ (line 188) | def __init__(self, config: InternVLVisionConfig) -> None: method interpolate_pos_encoding (line 210) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 250) | def forward( class InternVLVisionMLP (line 276) | class InternVLVisionMLP(CLIPMLP): class InternVLVisionLayer (line 283) | class InternVLVisionLayer(GradientCheckpointingLayer): method __init__ (line 286) | def __init__(self, config: InternVLVisionConfig) -> None: method forward (line 301) | def forward( class InternVLVisionEncoder (line 329) | class InternVLVisionEncoder(nn.Module): method __init__ (line 330) | def __init__(self, config: InternVLVisionConfig) -> None: method forward (line 336) | def forward( class InternVLVisionPreTrainedModel (line 349) | class InternVLVisionPreTrainedModel(PreTrainedModel): method _init_weights (line 367) | def _init_weights(self, module): class InternVLVisionModel (line 382) | class InternVLVisionModel(InternVLVisionPreTrainedModel): method __init__ (line 383) | def __init__(self, config: InternVLVisionConfig) -> None: method get_input_embeddings (line 397) | def get_input_embeddings(self): method forward (line 403) | def forward( class InternVLPreTrainedModel (line 423) | class InternVLPreTrainedModel(LlavaPreTrainedModel): class InternVLMultiModalProjector (line 430) | class InternVLMultiModalProjector(nn.Module): method __init__ (line 431) | def __init__(self, config: InternVLConfig): method forward (line 440) | def forward(self, image_features): class InternVLModelOutputWithPast (line 448) | class InternVLModelOutputWithPast(LlavaModelOutputWithPast): class InternVLModel (line 452) | class InternVLModel(LlavaModel): method pixel_shuffle (line 453) | def pixel_shuffle(self, vision_features: torch.Tensor, scale_factor: f... method get_image_features (line 493) | def get_image_features( method forward (line 541) | def forward( class InternVLCausalLMOutputWithPast (line 589) | class InternVLCausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class InternVLForConditionalGeneration (line 593) | class InternVLForConditionalGeneration(LlavaForConditionalGeneration): method forward (line 594) | def forward(**super_kwargs): FILE: src/transformers/models/internvl/processing_internvl.py class InternVLProcessorKwargs (line 26) | class InternVLProcessorKwargs(ProcessingKwargs, total=False): class InternVLProcessor (line 42) | class InternVLProcessor(ProcessorMixin): method __init__ (line 43) | def __init__( method _insert_media_placeholders (line 69) | def _insert_media_placeholders( method __call__ (line 134) | def __call__( method _get_num_multimodal_tokens (line 225) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 254) | def model_input_names(self): FILE: src/transformers/models/internvl/video_processing_internvl.py class InternVLVideoProcessorInitKwargs (line 27) | class InternVLVideoProcessorInitKwargs(VideosKwargs, total=False): class InternVLVideoProcessor (line 31) | class InternVLVideoProcessor(BaseVideoProcessor): method __init__ (line 44) | def __init__(self, **kwargs: Unpack[InternVLVideoProcessorInitKwargs]): method sample_frames (line 47) | def sample_frames( method _preprocess (line 98) | def _preprocess( FILE: src/transformers/models/jais2/configuration_jais2.py class Jais2Config (line 32) | class Jais2Config(PreTrainedConfig): method __post_init__ (line 84) | def __post_init__(self, **kwargs): method validate_architecture (line 92) | def validate_architecture(self): FILE: src/transformers/models/jais2/modeling_jais2.py class Jais2MLP (line 44) | class Jais2MLP(nn.Module): method __init__ (line 45) | def __init__(self, config): method forward (line 54) | def forward(self, x): function rotate_half (line 58) | def rotate_half(x): function apply_rotary_pos_emb (line 66) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 91) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 103) | def eager_attention_forward( class Jais2Attention (line 129) | class Jais2Attention(nn.Module): method __init__ (line 132) | def __init__(self, config: Jais2Config, layer_idx: int): method forward (line 155) | def forward( class Jais2DecoderLayer (line 196) | class Jais2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 197) | def __init__(self, config: Jais2Config, layer_idx: int): method forward (line 207) | def forward( class Jais2PreTrainedModel (line 240) | class Jais2PreTrainedModel(PreTrainedModel): class Jais2RotaryEmbedding (line 258) | class Jais2RotaryEmbedding(nn.Module): method __init__ (line 261) | def __init__(self, config: Jais2Config, device=None): method compute_default_rope_parameters (line 278) | def compute_default_rope_parameters( method forward (line 309) | def forward(self, x, position_ids): class Jais2Model (line 324) | class Jais2Model(Jais2PreTrainedModel): method __init__ (line 325) | def __init__(self, config: Jais2Config): method forward (line 344) | def forward( class Jais2ForCausalLM (line 398) | class Jais2ForCausalLM(Jais2PreTrainedModel, GenerationMixin): method __init__ (line 403) | def __init__(self, config): method forward (line 414) | def forward( FILE: src/transformers/models/jais2/modular_jais2.py class Jais2Config (line 32) | class Jais2Config(LlamaConfig): class Jais2MLP (line 57) | class Jais2MLP(NemotronMLP): class Jais2DecoderLayer (line 61) | class Jais2DecoderLayer(LlamaDecoderLayer): method __init__ (line 62) | def __init__(self, config: Jais2Config, layer_idx: int): class Jais2PreTrainedModel (line 68) | class Jais2PreTrainedModel(LlamaPreTrainedModel): class Jais2Model (line 72) | class Jais2Model(LlamaModel): method __init__ (line 73) | def __init__(self, config: Jais2Config): class Jais2ForCausalLM (line 78) | class Jais2ForCausalLM(LlamaForCausalLM): method forward (line 81) | def forward(self, **super_kwargs): FILE: src/transformers/models/jamba/configuration_jamba.py class JambaConfig (line 26) | class JambaConfig(PreTrainedConfig): method __post_init__ (line 82) | def __post_init__(self, **kwargs): method layers_block_type (line 90) | def layers_block_type(self): method layer_types (line 97) | def layer_types(self): method layers_num_experts (line 103) | def layers_num_experts(self): method validate_architecture (line 109) | def validate_architecture(self): FILE: src/transformers/models/jamba/modeling_jamba.py class JambaRMSNorm (line 57) | class JambaRMSNorm(nn.Module): method __init__ (line 58) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 66) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 73) | def extra_repr(self): function rotate_half (line 77) | def rotate_half(x): function apply_rotary_pos_emb (line 85) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 110) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 122) | def eager_attention_forward( class JambaAttention (line 148) | class JambaAttention(nn.Module): method __init__ (line 151) | def __init__(self, config: JambaConfig, layer_idx: int): method forward (line 165) | def forward( class JambaMambaMixer (line 202) | class JambaMambaMixer(nn.Module): method __init__ (line 210) | def __init__(self, config: JambaConfig, layer_idx): method cuda_kernels_forward (line 277) | def cuda_kernels_forward( method slow_forward (line 379) | def slow_forward(self, input_states, cache_params: Cache | None = None... method forward (line 456) | def forward( class JambaMLP (line 477) | class JambaMLP(nn.Module): method __init__ (line 478) | def __init__(self, config): method forward (line 488) | def forward(self, x): class JambaExperts (line 494) | class JambaExperts(nn.Module): method __init__ (line 497) | def __init__(self, config: JambaConfig): method forward (line 506) | def forward( class JambaSparseMoeBlock (line 533) | class JambaSparseMoeBlock(nn.Module): method __init__ (line 545) | def __init__(self, config: JambaConfig): method route_tokens_to_experts (line 555) | def route_tokens_to_experts(self, hidden_states, router_logits): method forward (line 560) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JambaAttentionDecoderLayer (line 570) | class JambaAttentionDecoderLayer(GradientCheckpointingLayer): method __init__ (line 571) | def __init__(self, config: JambaConfig, layer_idx: int): method forward (line 581) | def forward( class JambaMambaDecoderLayer (line 608) | class JambaMambaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 609) | def __init__(self, config: JambaConfig, layer_idx: int): method forward (line 618) | def forward( class JambaPreTrainedModel (line 641) | class JambaPreTrainedModel(PreTrainedModel): method _init_weights (line 657) | def _init_weights(self, module): class JambaModel (line 673) | class JambaModel(JambaPreTrainedModel): method __init__ (line 674) | def __init__(self, config: JambaConfig): method forward (line 695) | def forward( method _update_mamba_mask (line 747) | def _update_mamba_mask(self, attention_mask, past_key_values): function load_balancing_loss_func (line 761) | def load_balancing_loss_func( class JambaForCausalLM (line 844) | class JambaForCausalLM(JambaPreTrainedModel, GenerationMixin): method __init__ (line 849) | def __init__(self, config: JambaConfig): method forward (line 863) | def forward( class JambaForSequenceClassification (line 946) | class JambaForSequenceClassification(GenericForSequenceClassification, J... FILE: src/transformers/models/jamba/modular_jamba.py class JambaRMSNorm (line 46) | class JambaRMSNorm(LlamaRMSNorm): class JambaAttention (line 50) | class JambaAttention(LlamaAttention): method __init__ (line 51) | def __init__(self, config: JambaConfig, layer_idx: int): method forward (line 58) | def forward( class JambaMambaMixer (line 95) | class JambaMambaMixer(nn.Module): method __init__ (line 103) | def __init__(self, config: JambaConfig, layer_idx): method cuda_kernels_forward (line 170) | def cuda_kernels_forward( method slow_forward (line 272) | def slow_forward(self, input_states, cache_params: Cache | None = None... method forward (line 349) | def forward( class JambaMLP (line 370) | class JambaMLP(MistralMLP): class JambaExperts (line 374) | class JambaExperts(MixtralExperts): class JambaSparseMoeBlock (line 378) | class JambaSparseMoeBlock(nn.Module): method __init__ (line 390) | def __init__(self, config: JambaConfig): method route_tokens_to_experts (line 400) | def route_tokens_to_experts(self, hidden_states, router_logits): method forward (line 405) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JambaAttentionDecoderLayer (line 415) | class JambaAttentionDecoderLayer(GradientCheckpointingLayer): method __init__ (line 416) | def __init__(self, config: JambaConfig, layer_idx: int): method forward (line 426) | def forward( class JambaMambaDecoderLayer (line 453) | class JambaMambaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 454) | def __init__(self, config: JambaConfig, layer_idx: int): method forward (line 463) | def forward( class JambaPreTrainedModel (line 489) | class JambaPreTrainedModel(PreTrainedModel): method _init_weights (line 505) | def _init_weights(self, module): class JambaModel (line 518) | class JambaModel(JambaPreTrainedModel): method __init__ (line 519) | def __init__(self, config: JambaConfig): method forward (line 540) | def forward( method _update_mamba_mask (line 592) | def _update_mamba_mask(self, attention_mask, past_key_values): class JambaForCausalLM (line 606) | class JambaForCausalLM(MixtralForCausalLM): method __init__ (line 607) | def __init__(self, config: JambaConfig): method forward (line 611) | def forward( class JambaForSequenceClassification (line 659) | class JambaForSequenceClassification(GenericForSequenceClassification, J... FILE: src/transformers/models/janus/configuration_janus.py class JanusVisionConfig (line 33) | class JanusVisionConfig(PreTrainedConfig): class JanusVQVAEConfig (line 66) | class JanusVQVAEConfig(PreTrainedConfig): class JanusConfig (line 105) | class JanusConfig(PreTrainedConfig): method __post_init__ (line 143) | def __post_init__(self, **kwargs): FILE: src/transformers/models/janus/convert_janus_weights_to_hf.py function convert_old_keys_to_new_keys (line 117) | def convert_old_keys_to_new_keys(state_dict): function split_tensor (line 129) | def split_tensor(tensor, key): function convert_state_dict_to_hf (line 148) | def convert_state_dict_to_hf(state_dict): function ensure_model_downloaded (line 168) | def ensure_model_downloaded( function load_model_state_dict (line 206) | def load_model_state_dict(input_path: str) -> dict: function convert_model (line 239) | def convert_model( function main (line 446) | def main(): FILE: src/transformers/models/janus/image_processing_janus.py class JanusImageProcessorKwargs (line 36) | class JanusImageProcessorKwargs(ImagesKwargs, total=False): class JanusImageProcessor (line 47) | class JanusImageProcessor(TorchvisionBackend): method __init__ (line 59) | def __init__(self, **kwargs: Unpack[JanusImageProcessorKwargs]): method resize (line 67) | def resize( method pad_to_square (line 94) | def pad_to_square( method _preprocess (line 144) | def _preprocess( method postprocess (line 187) | def postprocess( FILE: src/transformers/models/janus/image_processing_pil_janus.py class JanusImageProcessorKwargs (line 44) | class JanusImageProcessorKwargs(ImagesKwargs, total=False): class JanusImageProcessorPil (line 55) | class JanusImageProcessorPil(PilBackend): method __init__ (line 67) | def __init__(self, **kwargs: Unpack[JanusImageProcessorKwargs]): method preprocess (line 77) | def preprocess(self, images: ImageInput, **kwargs: Unpack[JanusImagePr... method resize (line 80) | def resize( method pad_to_square (line 110) | def pad_to_square( method _preprocess (line 144) | def _preprocess( method postprocess (line 174) | def postprocess( method unnormalize (line 225) | def unnormalize( FILE: src/transformers/models/janus/modeling_janus.py class JanusPreTrainedModel (line 48) | class JanusPreTrainedModel(PreTrainedModel): method _init_weights (line 60) | def _init_weights(self, module): class JanusVQVAEOutput (line 72) | class JanusVQVAEOutput(ModelOutput): class JanusBaseModelOutputWithPast (line 90) | class JanusBaseModelOutputWithPast(ModelOutput): class JanusCausalLMOutputWithPast (line 123) | class JanusCausalLMOutputWithPast(ModelOutput): class JanusVisionEmbeddings (line 149) | class JanusVisionEmbeddings(nn.Module): method __init__ (line 150) | def __init__(self, config: JanusVisionConfig): method interpolate_pos_encoding (line 170) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 208) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... function repeat_kv (line 224) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 236) | def eager_attention_forward( class JanusVisionAttention (line 261) | class JanusVisionAttention(nn.Module): method __init__ (line 264) | def __init__(self, config: JanusVisionConfig): method forward (line 293) | def forward( class JanusVisionMLP (line 337) | class JanusVisionMLP(nn.Module): method __init__ (line 338) | def __init__(self, config: JanusVisionConfig): method forward (line 348) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JanusVisionEncoderLayer (line 357) | class JanusVisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 358) | def __init__(self, config: JanusVisionConfig): method forward (line 368) | def forward( class JanusVisionEncoder (line 392) | class JanusVisionEncoder(nn.Module): method __init__ (line 401) | def __init__(self, config: JanusVisionConfig): method forward (line 409) | def forward( class JanusVisionModel (line 427) | class JanusVisionModel(JanusPreTrainedModel): method __init__ (line 436) | def __init__(self, config: JanusVisionConfig): method forward (line 450) | def forward( method get_input_embeddings (line 477) | def get_input_embeddings(self): class JanusVisionAlignerMLP (line 481) | class JanusVisionAlignerMLP(nn.Module): method __init__ (line 482) | def __init__(self, config: JanusVisionConfig): method forward (line 491) | def forward(self, hidden_states): class JanusVQVAEVectorQuantizer (line 499) | class JanusVQVAEVectorQuantizer(nn.Module): method __init__ (line 510) | def __init__(self, config: JanusVQVAEConfig): method forward (line 519) | def forward(self, hidden_state: torch.Tensor): method get_codebook_entry (line 546) | def get_codebook_entry(self, image_tokens: torch.LongTensor) -> torch.... class JanusVQVAEResnetBlock (line 562) | class JanusVQVAEResnetBlock(nn.Module): method __init__ (line 563) | def __init__( method forward (line 586) | def forward(self, hidden_states): class JanusVQVAEAttnBlock (line 606) | class JanusVQVAEAttnBlock(nn.Module): method __init__ (line 607) | def __init__(self, in_channels): method forward (line 617) | def forward(self, hidden_states): class JanusVQVAEConvDownsample (line 641) | class JanusVQVAEConvDownsample(nn.Module): method __init__ (line 642) | def __init__(self, in_channels): method forward (line 646) | def forward(self, hidden_states): class JanusVQVAEConvUpsample (line 653) | class JanusVQVAEConvUpsample(nn.Module): method __init__ (line 654) | def __init__(self, in_channels): method forward (line 658) | def forward(self, hidden_states): class JanusVQVAEMidBlock (line 664) | class JanusVQVAEMidBlock(nn.Module): method __init__ (line 665) | def __init__(self, config: JanusVQVAEConfig, channels: int): method forward (line 679) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JanusVQVAEEncoder (line 686) | class JanusVQVAEEncoder(nn.Module): method __init__ (line 687) | def __init__(self, config): method forward (line 738) | def forward(self, pixel_values: torch.LongTensor): class JanusVQVAEDecoder (line 763) | class JanusVQVAEDecoder(nn.Module): method __init__ (line 764) | def __init__(self, config): method forward (line 810) | def forward(self, hidden_state: torch.FloatTensor) -> torch.FloatTensor: class JanusVQVAEModelOutput (line 833) | class JanusVQVAEModelOutput(BaseModelOutputWithPooling): class JanusVQVAE (line 856) | class JanusVQVAE(JanusPreTrainedModel): method __init__ (line 869) | def __init__(self, config: JanusVQVAEConfig): method encode (line 883) | def encode(self, pixel_values: torch.LongTensor, **kwargs: Unpack[Tran... method decode (line 894) | def decode(self, image_tokens: torch.LongTensor) -> torch.FloatTensor: method forward (line 915) | def forward( class JanusVQVAEAlignerMLP (line 927) | class JanusVQVAEAlignerMLP(nn.Module): method __init__ (line 928) | def __init__(self, config: JanusVQVAEConfig): method forward (line 937) | def forward(self, hidden_states): class JanusVQVAEHead (line 945) | class JanusVQVAEHead(nn.Module): method __init__ (line 948) | def __init__(self, config: JanusVQVAEConfig): method forward (line 954) | def forward(self, hidden_states: torch.Tensor) -> torch.tensor: class JanusModel (line 966) | class JanusModel(JanusPreTrainedModel): method __init__ (line 967) | def __init__(self, config: JanusConfig): method get_input_embeddings (line 988) | def get_input_embeddings(self): method set_input_embeddings (line 991) | def set_input_embeddings(self, value): method get_image_features (line 996) | def get_image_features( method get_placeholder_mask (line 1004) | def get_placeholder_mask( method forward (line 1030) | def forward( class JanusForConditionalGeneration (line 1077) | class JanusForConditionalGeneration(JanusPreTrainedModel, GenerationMixin): method __init__ (line 1082) | def __init__(self, config: JanusConfig): method get_input_embeddings (line 1091) | def get_input_embeddings(self): method set_input_embeddings (line 1094) | def set_input_embeddings(self, value): method prepare_embeddings_for_image_generation (line 1097) | def prepare_embeddings_for_image_generation(self, inputs: torch.Tensor... method forward (line 1104) | def forward( method prepare_inputs_for_generation (line 1153) | def prepare_inputs_for_generation( method decode_image_tokens (line 1185) | def decode_image_tokens(self, image_tokens: torch.Tensor): method generate (line 1198) | def generate( FILE: src/transformers/models/janus/modular_janus.py class JanusVisionConfig (line 66) | class JanusVisionConfig(SiglipVisionConfig): class JanusVQVAEConfig (line 93) | class JanusVQVAEConfig(ChameleonVQVAEConfig): class JanusConfig (line 133) | class JanusConfig(PreTrainedConfig): method __post_init__ (line 171) | def __post_init__(self, **kwargs): class JanusPreTrainedModel (line 197) | class JanusPreTrainedModel(PreTrainedModel): method _init_weights (line 209) | def _init_weights(self, module): class JanusVQVAEOutput (line 221) | class JanusVQVAEOutput(ModelOutput): class JanusBaseModelOutputWithPast (line 233) | class JanusBaseModelOutputWithPast(IdeficsBaseModelOutputWithPast): class JanusCausalLMOutputWithPast (line 237) | class JanusCausalLMOutputWithPast(IdeficsCausalLMOutputWithPast): class JanusVisionEmbeddings (line 241) | class JanusVisionEmbeddings(SiglipVisionEmbeddings): method forward (line 242) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... class JanusVisionAttention (line 258) | class JanusVisionAttention(nn.Module): method __init__ (line 261) | def __init__(self, config: JanusVisionConfig): method forward (line 290) | def forward( class JanusVisionMLP (line 334) | class JanusVisionMLP(nn.Module): method __init__ (line 335) | def __init__(self, config: JanusVisionConfig): method forward (line 345) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JanusVisionEncoderLayer (line 354) | class JanusVisionEncoderLayer(SiglipEncoderLayer): method __init__ (line 355) | def __init__(self, config: JanusVisionConfig): class JanusVisionEncoder (line 365) | class JanusVisionEncoder(SiglipEncoder): method __init__ (line 366) | def __init__(self, config: JanusVisionConfig): class JanusVisionModel (line 371) | class JanusVisionModel(Blip2VisionModel): method __init__ (line 377) | def __init__(self, config: JanusVisionConfig): method forward (line 381) | def forward( class JanusVisionAlignerMLP (line 409) | class JanusVisionAlignerMLP(nn.Module): method __init__ (line 410) | def __init__(self, config: JanusVisionConfig): method forward (line 419) | def forward(self, hidden_states): class JanusVQVAEVectorQuantizer (line 427) | class JanusVQVAEVectorQuantizer(ChameleonVQVAEVectorQuantizer): method __init__ (line 428) | def __init__(self, config: JanusVQVAEConfig): method get_codebook_entry (line 432) | def get_codebook_entry(self, image_tokens: torch.LongTensor) -> torch.... class JanusVQVAEResnetBlock (line 448) | class JanusVQVAEResnetBlock(ChameleonVQVAEEncoderResnetBlock): class JanusVQVAEAttnBlock (line 452) | class JanusVQVAEAttnBlock(ChameleonVQVAEEncoderAttnBlock): class JanusVQVAEConvDownsample (line 456) | class JanusVQVAEConvDownsample(ChameleonVQVAEEncoderConvDownsample): class JanusVQVAEConvUpsample (line 460) | class JanusVQVAEConvUpsample(nn.Module): method __init__ (line 461) | def __init__(self, in_channels): method forward (line 465) | def forward(self, hidden_states): class JanusVQVAEMidBlock (line 471) | class JanusVQVAEMidBlock(nn.Module): method __init__ (line 472) | def __init__(self, config: JanusVQVAEConfig, channels: int): method forward (line 486) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JanusVQVAEEncoder (line 493) | class JanusVQVAEEncoder(nn.Module): method __init__ (line 494) | def __init__(self, config): method forward (line 545) | def forward(self, pixel_values: torch.LongTensor): class JanusVQVAEDecoder (line 570) | class JanusVQVAEDecoder(nn.Module): method __init__ (line 571) | def __init__(self, config): method forward (line 617) | def forward(self, hidden_state: torch.FloatTensor) -> torch.FloatTensor: class JanusVQVAE (line 638) | class JanusVQVAE(ChameleonVQVAE): method __init__ (line 650) | def __init__(self, config: JanusVQVAEConfig): method decode (line 658) | def decode(self, image_tokens: torch.LongTensor) -> torch.FloatTensor: method forward (line 679) | def forward( class JanusVQVAEAlignerMLP (line 691) | class JanusVQVAEAlignerMLP(nn.Module): method __init__ (line 692) | def __init__(self, config: JanusVQVAEConfig): method forward (line 701) | def forward(self, hidden_states): class JanusVQVAEHead (line 709) | class JanusVQVAEHead(nn.Module): method __init__ (line 712) | def __init__(self, config: JanusVQVAEConfig): method forward (line 718) | def forward(self, hidden_states: torch.Tensor) -> torch.tensor: class JanusModel (line 730) | class JanusModel(JanusPreTrainedModel): method __init__ (line 731) | def __init__(self, config: JanusConfig): method get_input_embeddings (line 752) | def get_input_embeddings(self): method set_input_embeddings (line 755) | def set_input_embeddings(self, value): method get_image_features (line 760) | def get_image_features( method get_placeholder_mask (line 768) | def get_placeholder_mask( method forward (line 794) | def forward( class JanusForConditionalGeneration (line 841) | class JanusForConditionalGeneration(JanusPreTrainedModel, GenerationMixin): method __init__ (line 846) | def __init__(self, config: JanusConfig): method get_input_embeddings (line 855) | def get_input_embeddings(self): method set_input_embeddings (line 858) | def set_input_embeddings(self, value): method prepare_embeddings_for_image_generation (line 861) | def prepare_embeddings_for_image_generation(self, inputs: torch.Tensor... method forward (line 868) | def forward( method prepare_inputs_for_generation (line 917) | def prepare_inputs_for_generation( method decode_image_tokens (line 949) | def decode_image_tokens(self, image_tokens: torch.Tensor): method generate (line 962) | def generate( FILE: src/transformers/models/janus/processing_janus.py class JanusTextKwargs (line 34) | class JanusTextKwargs(TextKwargs, total=False): class JanusProcessorKwargs (line 45) | class JanusProcessorKwargs(ProcessingKwargs, total=False): class JanusProcessor (line 54) | class JanusProcessor(ProcessorMixin): method __init__ (line 55) | def __init__(self, image_processor, tokenizer, chat_template=None, use... method __call__ (line 69) | def __call__( method postprocess (line 122) | def postprocess(self, images: ImageInput, **kwargs): method post_process_multimodal_output (line 129) | def post_process_multimodal_output( FILE: src/transformers/models/jetmoe/configuration_jetmoe.py class JetMoeConfig (line 25) | class JetMoeConfig(PreTrainedConfig): method __post_init__ (line 72) | def __post_init__(self, **kwargs): method validate_architecture (line 76) | def validate_architecture(self): FILE: src/transformers/models/jetmoe/modeling_jetmoe.py class JetMoeRMSNorm (line 49) | class JetMoeRMSNorm(nn.Module): method __init__ (line 50) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 58) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 65) | def extra_repr(self): class JetMoeRotaryEmbedding (line 69) | class JetMoeRotaryEmbedding(nn.Module): method __init__ (line 72) | def __init__(self, config: JetMoeConfig, device=None): method compute_default_rope_parameters (line 89) | def compute_default_rope_parameters( method forward (line 120) | def forward(self, x, position_ids): class JetMoeParallelExperts (line 134) | class JetMoeParallelExperts(nn.Module): method __init__ (line 135) | def __init__(self, num_experts: int, input_size: int, output_size: int... method forward (line 158) | def forward(self, inputs, expert_size): class JetMoeTopKGating (line 179) | class JetMoeTopKGating(nn.Module): method __init__ (line 180) | def __init__(self, input_size: int, num_experts: int, top_k: int): method forward (line 200) | def forward(self, hidden_states): class JetMoeMoE (line 228) | class JetMoeMoE(nn.Module): method __init__ (line 237) | def __init__(self, config: JetMoeConfig): method forward (line 253) | def forward(self, layer_input): class JetMoeMoA (line 286) | class JetMoeMoA(nn.Module): method __init__ (line 295) | def __init__(self, config: JetMoeConfig): method map (line 313) | def map(self, layer_input): method reduce (line 336) | def reduce(self, layer_input, topo_info): method forward (line 358) | def forward(self, layer_input): function rotate_half (line 362) | def rotate_half(x): function apply_rotary_pos_emb (line 370) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 395) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 407) | def eager_attention_forward( class JetMoeAttention (line 432) | class JetMoeAttention(nn.Module): method __init__ (line 437) | def __init__(self, config: JetMoeConfig, layer_idx: int | None = None): method forward (line 470) | def forward( class JetMoeDecoderLayer (line 520) | class JetMoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 521) | def __init__(self, config: JetMoeConfig, layer_idx: int | None = None): method forward (line 529) | def forward( class JetMoePreTrainedModel (line 562) | class JetMoePreTrainedModel(PreTrainedModel): method _init_weights (line 580) | def _init_weights(self, module): class JetMoeModel (line 590) | class JetMoeModel(JetMoePreTrainedModel): method __init__ (line 591) | def __init__(self, config: JetMoeConfig): method forward (line 611) | def forward( function load_balancing_loss_func (line 667) | def load_balancing_loss_func( class JetMoeForCausalLM (line 749) | class JetMoeForCausalLM(JetMoePreTrainedModel, GenerationMixin): method __init__ (line 752) | def __init__(self, config): method forward (line 767) | def forward( class JetMoeForSequenceClassification (line 827) | class JetMoeForSequenceClassification(GenericForSequenceClassification, ... FILE: src/transformers/models/jetmoe/modular_jetmoe.py class JetMoeRMSNorm (line 52) | class JetMoeRMSNorm(MixtralRMSNorm): class JetMoeRotaryEmbedding (line 56) | class JetMoeRotaryEmbedding(MixtralRotaryEmbedding): class JetMoeParallelExperts (line 60) | class JetMoeParallelExperts(nn.Module): method __init__ (line 61) | def __init__(self, num_experts: int, input_size: int, output_size: int... method forward (line 84) | def forward(self, inputs, expert_size): class JetMoeTopKGating (line 105) | class JetMoeTopKGating(nn.Module): method __init__ (line 106) | def __init__(self, input_size: int, num_experts: int, top_k: int): method forward (line 126) | def forward(self, hidden_states): class JetMoeMoE (line 154) | class JetMoeMoE(nn.Module): method __init__ (line 163) | def __init__(self, config: JetMoeConfig): method forward (line 179) | def forward(self, layer_input): class JetMoeMoA (line 212) | class JetMoeMoA(nn.Module): method __init__ (line 221) | def __init__(self, config: JetMoeConfig): method map (line 239) | def map(self, layer_input): method reduce (line 262) | def reduce(self, layer_input, topo_info): method forward (line 284) | def forward(self, layer_input): class JetMoeAttention (line 288) | class JetMoeAttention(nn.Module): method __init__ (line 293) | def __init__(self, config: JetMoeConfig, layer_idx: int | None = None): method forward (line 326) | def forward( class JetMoeDecoderLayer (line 376) | class JetMoeDecoderLayer(LlamaDecoderLayer): method __init__ (line 377) | def __init__(self, config: JetMoeConfig, layer_idx: int | None = None): method forward (line 385) | def forward( class JetMoePreTrainedModel (line 418) | class JetMoePreTrainedModel(MixtralPreTrainedModel): method _init_weights (line 434) | def _init_weights(self, module): class JetMoeModel (line 444) | class JetMoeModel(MixtralModel): method __init__ (line 445) | def __init__(self, config: JetMoeConfig): method forward (line 460) | def forward( class JetMoeForCausalLM (line 516) | class JetMoeForCausalLM(JetMoePreTrainedModel, GenerationMixin): method __init__ (line 519) | def __init__(self, config): method forward (line 534) | def forward( class JetMoeForSequenceClassification (line 594) | class JetMoeForSequenceClassification(GenericForSequenceClassification, ... FILE: src/transformers/models/jina_embeddings_v3/configuration_jina_embeddings_v3.py class JinaEmbeddingsV3Config (line 31) | class JinaEmbeddingsV3Config(PreTrainedConfig): FILE: src/transformers/models/jina_embeddings_v3/modeling_jina_embeddings_v3.py class JinaEmbeddingsV3Embeddings (line 50) | class JinaEmbeddingsV3Embeddings(nn.Module): method __init__ (line 53) | def __init__(self, config: JinaEmbeddingsV3Config): method forward (line 68) | def forward( class JinaEmbeddingsV3RotaryEmbedding (line 103) | class JinaEmbeddingsV3RotaryEmbedding(nn.Module): method __init__ (line 106) | def __init__(self, config: JinaEmbeddingsV3Config, device=None): method compute_default_rope_parameters (line 123) | def compute_default_rope_parameters( method forward (line 154) | def forward(self, x, position_ids): function rotate_half (line 168) | def rotate_half(x): function apply_rotary_pos_emb (line 176) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function eager_attention_forward (line 201) | def eager_attention_forward( class JinaEmbeddingsV3Attention (line 230) | class JinaEmbeddingsV3Attention(nn.Module): method __init__ (line 233) | def __init__(self, config: JinaEmbeddingsV3Config): method forward (line 246) | def forward( class JinaEmbeddingsV3MLP (line 282) | class JinaEmbeddingsV3MLP(nn.Module): method __init__ (line 283) | def __init__(self, config): method forward (line 290) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JinaEmbeddingsV3Layer (line 297) | class JinaEmbeddingsV3Layer(GradientCheckpointingLayer): method __init__ (line 298) | def __init__(self, config: JinaEmbeddingsV3Config): method forward (line 308) | def forward( class JinaEmbeddingsV3Pooler (line 332) | class JinaEmbeddingsV3Pooler(nn.Module): method __init__ (line 333) | def __init__(self, config): method forward (line 338) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class JinaEmbeddingsV3PreTrainedModel (line 348) | class JinaEmbeddingsV3PreTrainedModel(PreTrainedModel): method _init_weights (line 362) | def _init_weights(self, module): class JinaEmbeddingsV3Model (line 373) | class JinaEmbeddingsV3Model(JinaEmbeddingsV3PreTrainedModel): method __init__ (line 376) | def __init__(self, config: JinaEmbeddingsV3Config, add_pooling_layer=T... method get_input_embeddings (line 394) | def get_input_embeddings(self): method set_input_embeddings (line 397) | def set_input_embeddings(self, value): method forward (line 403) | def forward( class JinaEmbeddingsV3LMHead (line 453) | class JinaEmbeddingsV3LMHead(nn.Module): method __init__ (line 456) | def __init__(self, config): method forward (line 464) | def forward(self, features, **kwargs): class JinaEmbeddingsV3ForMaskedLM (line 476) | class JinaEmbeddingsV3ForMaskedLM(JinaEmbeddingsV3PreTrainedModel): method __init__ (line 482) | def __init__(self, config): method get_output_embeddings (line 491) | def get_output_embeddings(self): method set_output_embeddings (line 494) | def set_output_embeddings(self, new_embeddings): method forward (line 499) | def forward( class JinaEmbeddingsV3ClassificationHead (line 552) | class JinaEmbeddingsV3ClassificationHead(nn.Module): method __init__ (line 555) | def __init__(self, config): method forward (line 564) | def forward(self, features, **kwargs): class JinaEmbeddingsV3ForSequenceClassification (line 580) | class JinaEmbeddingsV3ForSequenceClassification(JinaEmbeddingsV3PreTrain... method __init__ (line 581) | def __init__(self, config): method forward (line 594) | def forward( class JinaEmbeddingsV3ForTokenClassification (line 665) | class JinaEmbeddingsV3ForTokenClassification(JinaEmbeddingsV3PreTrainedM... method __init__ (line 666) | def __init__(self, config): method forward (line 682) | def forward( class JinaEmbeddingsV3ForQuestionAnswering (line 736) | class JinaEmbeddingsV3ForQuestionAnswering(JinaEmbeddingsV3PreTrainedMod... method __init__ (line 737) | def __init__(self, config): method forward (line 749) | def forward( FILE: src/transformers/models/jina_embeddings_v3/modular_jina_embeddings_v3.py class JinaEmbeddingsV3Config (line 58) | class JinaEmbeddingsV3Config(XLMRobertaConfig): class JinaEmbeddingsV3Embeddings (line 92) | class JinaEmbeddingsV3Embeddings(XLMRobertaEmbeddings): method __init__ (line 93) | def __init__(self, config: JinaEmbeddingsV3Config): method create_position_ids_from_inputs_embeds (line 99) | def create_position_ids_from_inputs_embeds(): method create_position_ids_from_input_ids (line 102) | def create_position_ids_from_input_ids(): method forward (line 105) | def forward( class JinaEmbeddingsV3RotaryEmbedding (line 140) | class JinaEmbeddingsV3RotaryEmbedding(LlamaRotaryEmbedding): class JinaEmbeddingsV3Attention (line 145) | class JinaEmbeddingsV3Attention(LlamaAttention): method __init__ (line 146) | def __init__(self, config: JinaEmbeddingsV3Config): method forward (line 159) | def forward( class JinaEmbeddingsV3MLP (line 195) | class JinaEmbeddingsV3MLP(CLIPMLP): class JinaEmbeddingsV3Layer (line 199) | class JinaEmbeddingsV3Layer(GPTNeoXLayer): method __init__ (line 200) | def __init__(self, config: JinaEmbeddingsV3Config): method forward (line 212) | def forward( class JinaEmbeddingsV3Pooler (line 236) | class JinaEmbeddingsV3Pooler(XLMRobertaPooler): class JinaEmbeddingsV3PreTrainedModel (line 240) | class JinaEmbeddingsV3PreTrainedModel(XLMRobertaPreTrainedModel): class JinaEmbeddingsV3Model (line 248) | class JinaEmbeddingsV3Model(XLMRobertaModel): method __init__ (line 249) | def __init__(self, config: JinaEmbeddingsV3Config, add_pooling_layer=T... method forward (line 261) | def forward( method _create_attention_masks (line 310) | def _create_attention_masks(self): class JinaEmbeddingsV3LMHead (line 314) | class JinaEmbeddingsV3LMHead(XLMRobertaLMHead): class JinaEmbeddingsV3ForMaskedLM (line 318) | class JinaEmbeddingsV3ForMaskedLM(XLMRobertaForMaskedLM): method __init__ (line 319) | def __init__(self, config): method forward (line 330) | def forward( class JinaEmbeddingsV3ForSequenceClassification (line 383) | class JinaEmbeddingsV3ForSequenceClassification(XLMRobertaForSequenceCla... class JinaEmbeddingsV3ForTokenClassification (line 387) | class JinaEmbeddingsV3ForTokenClassification(XLMRobertaForTokenClassific... class JinaEmbeddingsV3ForQuestionAnswering (line 391) | class JinaEmbeddingsV3ForQuestionAnswering(XLMRobertaForQuestionAnswering): FILE: src/transformers/models/kosmos2/configuration_kosmos2.py class Kosmos2TextConfig (line 27) | class Kosmos2TextConfig(PreTrainedConfig): class Kosmos2VisionConfig (line 60) | class Kosmos2VisionConfig(PreTrainedConfig): class Kosmos2Config (line 80) | class Kosmos2Config(PreTrainedConfig): method __post_init__ (line 108) | def __post_init__(self, **kwargs): FILE: src/transformers/models/kosmos2/convert_kosmos2_original_pytorch_checkpoint_to_pytorch.py function rename_key (line 35) | def rename_key(key): function convert_kosmos2_checkpoint_to_pytorch (line 43) | def convert_kosmos2_checkpoint_to_pytorch(checkpoint_path, pytorch_dump_... FILE: src/transformers/models/kosmos2/modeling_kosmos2.py class Kosmos2PreTrainedModel (line 49) | class Kosmos2PreTrainedModel(PreTrainedModel): method _init_weights (line 59) | def _init_weights(self, module: nn.Module): function _expand_mask (line 118) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: int | ... function _make_causal_mask (line 132) | def _make_causal_mask( class BaseModelOutputWithProjectionAttentions (line 151) | class BaseModelOutputWithProjectionAttentions(BaseModelOutputWithPooling): class Kosmos2ModelOutput (line 170) | class Kosmos2ModelOutput(ModelOutput): method to_tuple (line 198) | def to_tuple(self) -> tuple[Any]: class Kosmos2ForConditionalGenerationModelOutput (line 211) | class Kosmos2ForConditionalGenerationModelOutput(ModelOutput): method to_tuple (line 244) | def to_tuple(self) -> tuple[Any]: class Kosmos2VisionEmbeddings (line 252) | class Kosmos2VisionEmbeddings(nn.Module): method __init__ (line 253) | def __init__(self, config: Kosmos2VisionConfig): method interpolate_pos_encoding (line 275) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 316) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... function eager_attention_forward (line 336) | def eager_attention_forward( class Kosmos2VisionAttention (line 358) | class Kosmos2VisionAttention(nn.Module): method __init__ (line 361) | def __init__(self, config): method forward (line 381) | def forward( class Kosmos2VisionMLP (line 421) | class Kosmos2VisionMLP(nn.Module): method __init__ (line 422) | def __init__(self, config): method forward (line 429) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Kosmos2VisionEncoderLayer (line 437) | class Kosmos2VisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 438) | def __init__(self, config: Kosmos2VisionConfig): method forward (line 446) | def forward( class Kosmos2VisionEncoder (line 470) | class Kosmos2VisionEncoder(nn.Module): method __init__ (line 479) | def __init__(self, config: Kosmos2VisionConfig): method forward (line 485) | def forward( class Kosmos2VisionTransformer (line 519) | class Kosmos2VisionTransformer(Kosmos2PreTrainedModel): method __init__ (line 525) | def __init__(self, config: Kosmos2VisionConfig): method forward (line 539) | def forward( class Kosmos2TextSinusoidalPositionalEmbedding (line 567) | class Kosmos2TextSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 571) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 580) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 590) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 611) | def forward( method create_position_ids_from_inputs_embeds (line 641) | def create_position_ids_from_inputs_embeds(inputs_embeds, past_key_val... method create_position_ids_from_input_ids (line 660) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class KosmosTextAttention (line 676) | class KosmosTextAttention(nn.Module): method __init__ (line 680) | def __init__( method forward (line 718) | def forward( class Kosmos2TextFFN (line 790) | class Kosmos2TextFFN(nn.Module): method __init__ (line 791) | def __init__(self, config: Kosmos2TextConfig): method forward (line 803) | def forward(self, hidden_states): class Kosmos2TextBlock (line 813) | class Kosmos2TextBlock(GradientCheckpointingLayer): method __init__ (line 814) | def __init__(self, config: Kosmos2TextConfig, layer_idx=None): method forward (line 845) | def forward( class Kosmos2TextTransformer (line 902) | class Kosmos2TextTransformer(Kosmos2PreTrainedModel): method __init__ (line 911) | def __init__(self, config: Kosmos2TextConfig): method _prepare_decoder_attention_mask (line 932) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward_embedding (line 955) | def forward_embedding( method forward (line 993) | def forward( class Kosmos2VisionModel (line 1091) | class Kosmos2VisionModel(Kosmos2PreTrainedModel): method __init__ (line 1097) | def __init__(self, config: Kosmos2VisionConfig): method get_input_embeddings (line 1104) | def get_input_embeddings(self) -> nn.Module: method forward (line 1109) | def forward( class Kosmos2TextModel (line 1122) | class Kosmos2TextModel(Kosmos2PreTrainedModel): method __init__ (line 1126) | def __init__(self, config: Kosmos2TextConfig): method get_input_embeddings (line 1132) | def get_input_embeddings(self) -> nn.Module: method forward (line 1137) | def forward( class Kosmos2TextForCausalLM (line 1182) | class Kosmos2TextForCausalLM(Kosmos2PreTrainedModel, GenerationMixin): method __init__ (line 1186) | def __init__(self, config: Kosmos2TextConfig): method get_input_embeddings (line 1195) | def get_input_embeddings(self) -> nn.Module: method get_output_embeddings (line 1198) | def get_output_embeddings(self) -> nn.Module: method forward (line 1203) | def forward( method prepare_inputs_for_generation (line 1270) | def prepare_inputs_for_generation( class Kosmos2ImageToTextProjection (line 1321) | class Kosmos2ImageToTextProjection(nn.Module): method __init__ (line 1324) | def __init__(self, config: Kosmos2Config): method forward (line 1338) | def forward(self, features): class Kosmos2Model (line 1361) | class Kosmos2Model(Kosmos2PreTrainedModel): method __init__ (line 1365) | def __init__(self, config: Kosmos2Config): method get_input_embeddings (line 1375) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1378) | def set_input_embeddings(self, value): method get_image_features (line 1383) | def get_image_features( method forward (line 1415) | def forward( class Kosmos2ForConditionalGeneration (line 1512) | class Kosmos2ForConditionalGeneration(Kosmos2PreTrainedModel, Generation... method __init__ (line 1517) | def __init__(self, config: Kosmos2Config): method get_input_embeddings (line 1528) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1531) | def set_input_embeddings(self, value): method get_output_embeddings (line 1534) | def get_output_embeddings(self) -> nn.Module: method set_output_embeddings (line 1537) | def set_output_embeddings(self, new_embeddings): method forward (line 1542) | def forward( method generate (line 1652) | def generate( FILE: src/transformers/models/kosmos2/processing_kosmos2.py class Kosmos2ImagesKwargs (line 39) | class Kosmos2ImagesKwargs(ImagesKwargs, total=False): class Kosmos2TextKwargs (line 56) | class Kosmos2TextKwargs(TextKwargs, total=False): class Kosmos2ProcessorKwargs (line 65) | class Kosmos2ProcessorKwargs(ProcessingKwargs, total=False): class Kosmos2Processor (line 87) | class Kosmos2Processor(ProcessorMixin): method __init__ (line 88) | def __init__(self, image_processor, tokenizer, num_patch_index_tokens=... method __call__ (line 138) | def __call__( method _check_bboxes_for_single_text (line 278) | def _check_bboxes_for_single_text(self, bboxes): method _preprocess_single_example (line 313) | def _preprocess_single_example(self, text, image, bboxes, img_info_tok... method preprocess_examples (line 323) | def preprocess_examples( method post_process_generation (line 389) | def post_process_generation(self, text, cleanup_and_extract=True): method post_process_image_text_to_text (line 395) | def post_process_image_text_to_text(self, generated_outputs, skip_spec... method model_input_names (line 415) | def model_input_names(self): method _insert_patch_index_tokens (line 420) | def _insert_patch_index_tokens(self, text: str, bboxes: list[tuple[int... method _convert_bbox_to_patch_index_tokens (line 465) | def _convert_bbox_to_patch_index_tokens( function coordinate_to_patch_index (line 483) | def coordinate_to_patch_index(bbox: tuple[float, float, float, float], n... function patch_index_to_coordinate (line 514) | def patch_index_to_coordinate(ul_idx: int, lr_idx: int, num_patches_per_... function extract_entities_with_patch_indices (line 559) | def extract_entities_with_patch_indices(text): function adjust_entity_positions (line 617) | def adjust_entity_positions(entity, text): function _cleanup_spaces (line 627) | def _cleanup_spaces(text, entities): function clean_text_and_extract_entities_with_bboxes (line 648) | def clean_text_and_extract_entities_with_bboxes(text, num_patches_per_si... FILE: src/transformers/models/kosmos2_5/configuration_kosmos2_5.py class Kosmos2_5TextConfig (line 27) | class Kosmos2_5TextConfig(PreTrainedConfig): class Kosmos2_5VisionConfig (line 59) | class Kosmos2_5VisionConfig(PreTrainedConfig): class Kosmos2_5Config (line 104) | class Kosmos2_5Config(PreTrainedConfig): method __post_init__ (line 118) | def __post_init__(self, **kwargs): FILE: src/transformers/models/kosmos2_5/convert_kosmos2_5.py function rename_key (line 48) | def rename_key(key): function convert_kosmos2_5_checkpoint_to_pytorch (line 56) | def convert_kosmos2_5_checkpoint_to_pytorch(checkpoint_path, pytorch_dum... FILE: src/transformers/models/kosmos2_5/image_processing_kosmos2_5.py class Kosmos2_5ImageProcessorKwargs (line 28) | class Kosmos2_5ImageProcessorKwargs(ImagesKwargs, total=False): function torch_extract_patches (line 42) | def torch_extract_patches(image_tensor, patch_height, patch_width): class Kosmos2_5ImageProcessor (line 67) | class Kosmos2_5ImageProcessor(TorchvisionBackend): method __init__ (line 75) | def __init__(self, **kwargs: Unpack[Kosmos2_5ImageProcessorKwargs]): method preprocess (line 79) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Kosmos2_5Ima... method normalize (line 82) | def normalize( method extract_flattened_patches (line 121) | def extract_flattened_patches( method _preprocess (line 207) | def _preprocess( method _validate_preprocess_kwargs (line 270) | def _validate_preprocess_kwargs(self, **kwargs): method _standardize_kwargs (line 276) | def _standardize_kwargs( FILE: src/transformers/models/kosmos2_5/image_processing_pil_kosmos2_5.py class Kosmos2_5ImageProcessorKwargs (line 33) | class Kosmos2_5ImageProcessorKwargs(ImagesKwargs, total=False): function torch_extract_patches (line 48) | def torch_extract_patches(image_tensor, patch_height, patch_width): class Kosmos2_5ImageProcessorPil (line 74) | class Kosmos2_5ImageProcessorPil(PilBackend): method __init__ (line 82) | def __init__(self, **kwargs: Unpack[Kosmos2_5ImageProcessorKwargs]): method preprocess (line 86) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Kosmos2_5Ima... method normalize (line 89) | def normalize(self, image: np.ndarray, **kwargs) -> np.ndarray: method extract_flattened_patches (line 110) | def extract_flattened_patches( method _preprocess (line 195) | def _preprocess( method _validate_preprocess_kwargs (line 239) | def _validate_preprocess_kwargs(self, **kwargs): method _standardize_kwargs (line 245) | def _standardize_kwargs(self, patch_size: dict[str, int] | SizeDict | ... FILE: src/transformers/models/kosmos2_5/modeling_kosmos2_5.py class Kosmos2_5PreTrainedModel (line 62) | class Kosmos2_5PreTrainedModel(PreTrainedModel): method _init_weights (line 78) | def _init_weights(self, module): function _expand_mask (line 117) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: int | ... class Kosmos2_5ModelOutput (line 275) | class Kosmos2_5ModelOutput(ModelOutput): method to_tuple (line 325) | def to_tuple(self) -> tuple[Any]: class Kosmos2_5ForConditionalGenerationModelOutput (line 330) | class Kosmos2_5ForConditionalGenerationModelOutput(ModelOutput): method to_tuple (line 383) | def to_tuple(self) -> tuple[Any]: class Kosmos2_5LayerNorm (line 388) | class Kosmos2_5LayerNorm(nn.Module): method __init__ (line 389) | def __init__(self, hidden_size, eps=1e-6): method forward (line 397) | def forward(self, hidden_states): class Kosmos2_5VisionEmbeddings (line 415) | class Kosmos2_5VisionEmbeddings(nn.Module): method __init__ (line 416) | def __init__(self, config: Kosmos2_5VisionConfig) -> None: method forward (line 426) | def forward(self, flattened_patches: torch.Tensor) -> torch.Tensor: class Kosmos2_5VisionMlp (line 447) | class Kosmos2_5VisionMlp(nn.Module): method __init__ (line 448) | def __init__(self, config: Kosmos2_5VisionConfig): method forward (line 459) | def forward(self, hidden_states): function eager_attention_forward (line 479) | def eager_attention_forward( class Kosmos2_5VisionAttention (line 503) | class Kosmos2_5VisionAttention(nn.Module): method __init__ (line 504) | def __init__(self, config): method forward (line 522) | def forward( class Kosmos2_5VisionLayer (line 559) | class Kosmos2_5VisionLayer(GradientCheckpointingLayer): method __init__ (line 560) | def __init__(self, config: Kosmos2_5VisionConfig) -> None: method forward (line 569) | def forward( class Kosmos2_5VisionEncoder (line 597) | class Kosmos2_5VisionEncoder(Kosmos2_5PreTrainedModel): method __init__ (line 605) | def __init__(self, config: Kosmos2_5VisionConfig) -> None: method _prepare_attention_mask (line 611) | def _prepare_attention_mask(self, attention_mask, input_shape, inputs_... method forward (line 625) | def forward( class Kosmos2_5TextSinusoidalPositionalEmbedding (line 640) | class Kosmos2_5TextSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 644) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 653) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 663) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 684) | def forward( method create_position_ids_from_inputs_embeds (line 714) | def create_position_ids_from_inputs_embeds(inputs_embeds, past_key_val... method create_position_ids_from_input_ids (line 733) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class Kosmos2_5TextFFN (line 750) | class Kosmos2_5TextFFN(nn.Module): method __init__ (line 751) | def __init__(self, config: Kosmos2_5TextConfig): method forward (line 763) | def forward(self, hidden_states): class Kosmos2_5TextAttention (line 773) | class Kosmos2_5TextAttention(nn.Module): method __init__ (line 776) | def __init__( method forward (line 809) | def forward( class Kosmos2_5TextBlock (line 857) | class Kosmos2_5TextBlock(GradientCheckpointingLayer): method __init__ (line 858) | def __init__(self, config: Kosmos2_5TextConfig, layer_idx: int): method forward (line 877) | def forward( class Kosmos2_5TextTransformer (line 910) | class Kosmos2_5TextTransformer(Kosmos2_5PreTrainedModel): method __init__ (line 918) | def __init__(self, config: Kosmos2_5TextConfig): method forward (line 942) | def forward( class Kosmos2_5ImageToTextProjection (line 1029) | class Kosmos2_5ImageToTextProjection(nn.Module): method __init__ (line 1032) | def __init__(self, config: Kosmos2_5Config): method forward (line 1047) | def forward(self, features): class Kosmos2_5VisionModel (line 1065) | class Kosmos2_5VisionModel(Kosmos2_5PreTrainedModel): method __init__ (line 1070) | def __init__(self, config: Kosmos2_5VisionConfig): method get_input_embeddings (line 1083) | def get_input_embeddings(self): method forward (line 1088) | def forward( class Kosmos2_5TextModel (line 1115) | class Kosmos2_5TextModel(Kosmos2_5PreTrainedModel): method __init__ (line 1119) | def __init__(self, config: Kosmos2_5TextConfig): method get_input_embeddings (line 1125) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1128) | def set_input_embeddings(self, value): method forward (line 1134) | def forward( class Kosmos2_5Model (line 1169) | class Kosmos2_5Model(Kosmos2_5PreTrainedModel): method __init__ (line 1172) | def __init__(self, config: Kosmos2_5Config): method get_input_embeddings (line 1181) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1184) | def set_input_embeddings(self, value): method forward (line 1190) | def forward( class Kosmos2_5TextForCausalLM (line 1284) | class Kosmos2_5TextForCausalLM(Kosmos2_5PreTrainedModel, GenerationMixin): method __init__ (line 1289) | def __init__(self, config: Kosmos2_5TextConfig): method get_input_embeddings (line 1298) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1301) | def set_input_embeddings(self, value): method get_output_embeddings (line 1304) | def get_output_embeddings(self) -> nn.Module: method set_output_embeddings (line 1307) | def set_output_embeddings(self, new_embeddings): method forward (line 1313) | def forward( method prepare_inputs_for_generation (line 1370) | def prepare_inputs_for_generation( class Kosmos2_5ForConditionalGeneration (line 1433) | class Kosmos2_5ForConditionalGeneration(Kosmos2_5PreTrainedModel, Genera... method __init__ (line 1436) | def __init__(self, config: Kosmos2_5Config): method get_input_embeddings (line 1444) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1447) | def set_input_embeddings(self, value): method get_output_embeddings (line 1450) | def get_output_embeddings(self) -> nn.Module: method set_output_embeddings (line 1453) | def set_output_embeddings(self, new_embeddings): method forward (line 1462) | def forward( method prepare_inputs_for_generation (line 1558) | def prepare_inputs_for_generation( FILE: src/transformers/models/kosmos2_5/processing_kosmos2_5.py class Kosmos2_5ProcessorKwargs (line 29) | class Kosmos2_5ProcessorKwargs(ProcessingKwargs, total=False): class Kosmos2_5Processor (line 45) | class Kosmos2_5Processor(ProcessorMixin): method __init__ (line 46) | def __init__(self, image_processor, tokenizer, num_image_tokens: int =... method __call__ (line 58) | def __call__( method batch_decode (line 109) | def batch_decode(self, *args, **kwargs): method decode (line 116) | def decode(self, *args, **kwargs): method model_input_names (line 124) | def model_input_names(self): FILE: src/transformers/models/kyutai_speech_to_text/configuration_kyutai_speech_to_text.py class KyutaiSpeechToTextConfig (line 29) | class KyutaiSpeechToTextConfig(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): method validate_architecture (line 97) | def validate_architecture(self): FILE: src/transformers/models/kyutai_speech_to_text/convert_kyutai_speech_to_text_to_hf.py function permute_for_rope (line 78) | def permute_for_rope(input_tensor, n_heads, dim1, dim2): function convert_key (line 86) | def convert_key(key, mapping): function convert_kyutai_speech_to_text_state_dict (line 92) | def convert_kyutai_speech_to_text_state_dict(state_dict, config, unwante... function convert_mimi_state_dict (line 143) | def convert_mimi_state_dict(state_dict, config, unwanted_prefix=None): function write_model (line 180) | def write_model( function write_processor (line 264) | def write_processor( function main (line 301) | def main(): FILE: src/transformers/models/kyutai_speech_to_text/feature_extraction_kyutai_speech_to_text.py class KyutaiSpeechToTextFeatureExtractor (line 32) | class KyutaiSpeechToTextFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 59) | def __init__( method chunk_length (line 78) | def chunk_length(self) -> int | None: method chunk_stride (line 86) | def chunk_stride(self) -> int | None: method __call__ (line 92) | def __call__( FILE: src/transformers/models/kyutai_speech_to_text/modeling_kyutai_speech_to_text.py class KyutaiSpeechToTextFlexibleLinear (line 53) | class KyutaiSpeechToTextFlexibleLinear(nn.Module): method __init__ (line 54) | def __init__(self, input_size, output_size, num_layers): method forward (line 59) | def forward(self, x, layer_idx=None): class KyutaiSpeechToTextPreTrainedModel (line 93) | class KyutaiSpeechToTextPreTrainedModel(PreTrainedModel): method _init_weights (line 105) | def _init_weights(self, module): class KyutaiSpeechToTextConv1dPaddingCache (line 116) | class KyutaiSpeechToTextConv1dPaddingCache: method __init__ (line 125) | def __init__( method _cache_init (line 146) | def _cache_init(self, hidden_states: torch.Tensor, layer_idx: int): method update (line 176) | def update(self, hidden_states: torch.Tensor, layer_idx: int): class KyutaiSpeechToTextEmbeddings (line 210) | class KyutaiSpeechToTextEmbeddings(nn.Module): method __init__ (line 211) | def __init__(self, config): method forward (line 226) | def forward(self, input_ids): class KyutaiSpeechToTextRMSNorm (line 235) | class KyutaiSpeechToTextRMSNorm(nn.Module): method __init__ (line 236) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 241) | def _norm(self, x): method forward (line 245) | def forward(self, x): method extra_repr (line 250) | def extra_repr(self): class KyutaiSpeechToTextLinear (line 254) | class KyutaiSpeechToTextLinear(nn.Module): method __init__ (line 255) | def __init__(self, input_dim, output_dim, num_codebooks, use_flexible_... method forward (line 265) | def forward(self, x, layer_idx=None): class KyutaiSpeechToTextRotaryEmbedding (line 272) | class KyutaiSpeechToTextRotaryEmbedding(nn.Module): method __init__ (line 275) | def __init__(self, config: KyutaiSpeechToTextConfig, device=None): method compute_default_rope_parameters (line 292) | def compute_default_rope_parameters( method forward (line 323) | def forward(self, x, position_ids): class KyutaiSpeechToTextGatingMLP (line 337) | class KyutaiSpeechToTextGatingMLP(nn.Module): method __init__ (line 338) | def __init__(self, config, use_flexible_linear=False): method forward (line 352) | def forward(self, hidden_states: torch.Tensor, layer_idx: int | None =... function rotate_half (line 362) | def rotate_half(x): function apply_rotary_pos_emb (line 369) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 394) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class KyutaiSpeechToTextAttention (line 406) | class KyutaiSpeechToTextAttention(nn.Module): method __init__ (line 409) | def __init__( method forward (line 456) | def forward( class KyutaiSpeechToTextFlashAttention2 (line 516) | class KyutaiSpeechToTextFlashAttention2(KyutaiSpeechToTextAttention): method __init__ (line 523) | def __init__(self, *args, **kwargs): method forward (line 531) | def forward( class KyutaiSpeechToTextSdpaAttention (line 627) | class KyutaiSpeechToTextSdpaAttention(KyutaiSpeechToTextAttention): method forward (line 635) | def forward( class KyutaiSpeechToTextDecoderLayer (line 703) | class KyutaiSpeechToTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 704) | def __init__(self, config: KyutaiSpeechToTextConfig, layer_idx: int, u... method forward (line 720) | def forward( class KyutaiSpeechToTextModel (line 765) | class KyutaiSpeechToTextModel(KyutaiSpeechToTextPreTrainedModel): method __init__ (line 766) | def __init__(self, config): method forward (line 784) | def forward( class KyutaiSpeechToTextForConditionalGeneration (line 875) | class KyutaiSpeechToTextForConditionalGeneration(KyutaiSpeechToTextPreTr... method __init__ (line 882) | def __init__(self, config): method forward (line 899) | def forward( method _prepare_generation_config (line 970) | def _prepare_generation_config(self, *args, **kwargs): method _prepare_model_inputs (line 978) | def _prepare_model_inputs( method prepare_inputs_for_generation (line 1057) | def prepare_inputs_for_generation( method from_pretrained (line 1117) | def from_pretrained(cls, *args, **kwargs): method save_pretrained (line 1144) | def save_pretrained(self, *args, **kwargs): method generate (line 1153) | def generate(self, *args, **kwargs): FILE: src/transformers/models/kyutai_speech_to_text/modular_kyutai_speech_to_text.py class KyutaiSpeechToTextFeatureExtractor (line 37) | class KyutaiSpeechToTextFeatureExtractor(EncodecFeatureExtractor): method __init__ (line 62) | def __init__( method __call__ (line 72) | def __call__( class KyutaiSpeechToTextPreTrainedModel (line 214) | class KyutaiSpeechToTextPreTrainedModel(MoshiPreTrainedModel): method _init_weights (line 215) | def _init_weights(self, module): class KyutaiSpeechToTextConv1dPaddingCache (line 224) | class KyutaiSpeechToTextConv1dPaddingCache(MimiConv1dPaddingCache): class KyutaiSpeechToTextEmbeddings (line 228) | class KyutaiSpeechToTextEmbeddings(nn.Module): method __init__ (line 229) | def __init__(self, config): method forward (line 244) | def forward(self, input_ids): class KyutaiSpeechToTextModel (line 253) | class KyutaiSpeechToTextModel(MoshiModel): method __init__ (line 254) | def __init__(self, config): class KyutaiSpeechToTextForConditionalGeneration (line 259) | class KyutaiSpeechToTextForConditionalGeneration(LlamaForCausalLM, Gener... method __init__ (line 264) | def __init__(self, config): method forward (line 273) | def forward(self, **super_kwargs): method _prepare_generation_config (line 308) | def _prepare_generation_config(self, *args, **kwargs): method _prepare_model_inputs (line 316) | def _prepare_model_inputs( method prepare_inputs_for_generation (line 396) | def prepare_inputs_for_generation( method from_pretrained (line 456) | def from_pretrained(cls, *args, **kwargs): method save_pretrained (line 483) | def save_pretrained(self, *args, **kwargs): method generate (line 492) | def generate(self, *args, **kwargs): FILE: src/transformers/models/kyutai_speech_to_text/processing_kyutai_speech_to_text.py class KyutaiSpeechToTextProcessorKwargs (line 20) | class KyutaiSpeechToTextProcessorKwargs(ProcessingKwargs, total=False): class KyutaiSpeechToTextProcessor (line 30) | class KyutaiSpeechToTextProcessor(ProcessorMixin): method __init__ (line 33) | def __init__(self, feature_extractor, tokenizer): FILE: src/transformers/models/lasr/configuration_lasr.py class LasrEncoderConfig (line 29) | class LasrEncoderConfig(PreTrainedConfig): method __post_init__ (line 96) | def __post_init__(self, **kwargs): class LasrCTCConfig (line 103) | class LasrCTCConfig(PreTrainedConfig): method __post_init__ (line 136) | def __post_init__(self, **kwargs): method inputs_to_logits_ratio (line 145) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/lasr/feature_extraction_lasr.py function linear_to_mel_weight_matrix (line 29) | def linear_to_mel_weight_matrix( class LasrFeatureExtractor (line 67) | class LasrFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 94) | def __init__( method _torch_extract_fbank_features (line 120) | def _torch_extract_fbank_features(self, waveform, device="cpu"): method __call__ (line 139) | def __call__( FILE: src/transformers/models/lasr/modeling_lasr.py class LasrEncoderSubsampling (line 42) | class LasrEncoderSubsampling(nn.Module): method __init__ (line 43) | def __init__(self, config: LasrEncoderConfig): method forward (line 61) | def forward(self, input_features: torch.Tensor) -> torch.Tensor: class LasrEncoderRotaryEmbedding (line 70) | class LasrEncoderRotaryEmbedding(nn.Module): method __init__ (line 73) | def __init__(self, config: LasrEncoderConfig, device=None): method compute_default_rope_parameters (line 90) | def compute_default_rope_parameters( method forward (line 121) | def forward(self, x, position_ids): function rotate_half (line 135) | def rotate_half(x): function apply_rotary_pos_emb (line 143) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 168) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 180) | def eager_attention_forward( class LasrEncoderAttention (line 206) | class LasrEncoderAttention(nn.Module): method __init__ (line 209) | def __init__(self, config: LasrEncoderConfig, layer_idx: int): method forward (line 232) | def forward( class LasrEncoderConvolutionModule (line 269) | class LasrEncoderConvolutionModule(nn.Module): method __init__ (line 270) | def __init__(self, config: LasrEncoderConfig, module_config=None): method forward (line 304) | def forward(self, hidden_states, attention_mask=None): class LasrEncoderFeedForward (line 341) | class LasrEncoderFeedForward(nn.Module): method __init__ (line 342) | def __init__(self, config: LasrEncoderConfig): method forward (line 349) | def forward(self, hidden_states): class LasrEncoderBlock (line 356) | class LasrEncoderBlock(GradientCheckpointingLayer): method __init__ (line 357) | def __init__(self, config: LasrEncoderConfig, layer_idx: int): method forward (line 375) | def forward( class LasrPreTrainedModel (line 412) | class LasrPreTrainedModel(PreTrainedModel): method _init_weights (line 435) | def _init_weights(self, module): method _get_subsampling_output_length (line 438) | def _get_subsampling_output_length(self, input_lengths: torch.Tensor): method _get_output_attention_mask (line 449) | def _get_output_attention_mask(self, attention_mask: torch.Tensor, tar... class LasrEncoder (line 466) | class LasrEncoder(LasrPreTrainedModel): method __init__ (line 470) | def __init__(self, config: LasrEncoderConfig): method forward (line 491) | def forward( class LasrGenerateOutput (line 558) | class LasrGenerateOutput(ModelOutput): class LasrForCTC (line 589) | class LasrForCTC(LasrPreTrainedModel): method __init__ (line 592) | def __init__(self, config: LasrCTCConfig): method forward (line 602) | def forward( method generate (line 674) | def generate( FILE: src/transformers/models/lasr/modular_lasr.py class LasrTokenizer (line 44) | class LasrTokenizer(T5Tokenizer, TokenizersBackend): method __init__ (line 45) | def __init__( method _decode (line 122) | def _decode( class LasrProcessor (line 147) | class LasrProcessor(ParakeetProcessor): class LasrEncoderConfig (line 153) | class LasrEncoderConfig(ParakeetEncoderConfig): class LasrCTCConfig (line 213) | class LasrCTCConfig(ParakeetCTCConfig): method inputs_to_logits_ratio (line 241) | def inputs_to_logits_ratio(self): class LasrEncoderSubsampling (line 245) | class LasrEncoderSubsampling(nn.Module): method __init__ (line 246) | def __init__(self, config: LasrEncoderConfig): method forward (line 264) | def forward(self, input_features: torch.Tensor) -> torch.Tensor: class LasrEncoderRotaryEmbedding (line 273) | class LasrEncoderRotaryEmbedding(LlamaRotaryEmbedding): ... class LasrEncoderAttention (line 276) | class LasrEncoderAttention(LlamaAttention): method __init__ (line 277) | def __init__(self, config: LasrEncoderConfig, layer_idx: int): method forward (line 281) | def forward( class LasrEncoderConvolutionModule (line 318) | class LasrEncoderConvolutionModule(ParakeetEncoderConvolutionModule): method __init__ (line 319) | def __init__(self, config: LasrEncoderConfig, module_config=None): class LasrEncoderBlock (line 325) | class LasrEncoderBlock(ParakeetEncoderBlock): method __init__ (line 326) | def __init__(self, config: LasrEncoderConfig, layer_idx: int): method forward (line 338) | def forward( class LasrPreTrainedModel (line 374) | class LasrPreTrainedModel(ParakeetPreTrainedModel): method _init_weights (line 378) | def _init_weights(self, module): method _get_subsampling_output_length (line 381) | def _get_subsampling_output_length(self, input_lengths: torch.Tensor): class LasrEncoder (line 398) | class LasrEncoder(LasrPreTrainedModel): method __init__ (line 402) | def __init__(self, config: LasrEncoderConfig): method forward (line 423) | def forward( class LasrForCTC (line 489) | class LasrForCTC(ParakeetForCTC): method generate (line 490) | def generate(**super_kwargs): FILE: src/transformers/models/lasr/processing_lasr.py class LasrProcessorKwargs (line 30) | class LasrProcessorKwargs(ProcessingKwargs, total=False): class LasrProcessor (line 47) | class LasrProcessor(ProcessorMixin): method __init__ (line 48) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 52) | def __call__( method model_input_names (line 95) | def model_input_names(self): FILE: src/transformers/models/lasr/tokenization_lasr.py class LasrTokenizer (line 33) | class LasrTokenizer(TokenizersBackend): method __init__ (line 74) | def __init__( method get_sentinel_tokens (line 151) | def get_sentinel_tokens(self): method get_sentinel_token_ids (line 157) | def get_sentinel_token_ids(self): method _decode (line 161) | def _decode( FILE: src/transformers/models/layoutlm/configuration_layoutlm.py class LayoutLMConfig (line 24) | class LayoutLMConfig(PreTrainedConfig): FILE: src/transformers/models/layoutlm/modeling_layoutlm.py class LayoutLMEmbeddings (line 48) | class LayoutLMEmbeddings(nn.Module): method __init__ (line 51) | def __init__(self, config): method forward (line 68) | def forward( function eager_attention_forward (line 125) | def eager_attention_forward( class LayoutLMSelfAttention (line 148) | class LayoutLMSelfAttention(nn.Module): method __init__ (line 149) | def __init__(self, config): method forward (line 170) | def forward( class LayoutLMSelfOutput (line 203) | class LayoutLMSelfOutput(nn.Module): method __init__ (line 204) | def __init__(self, config): method forward (line 210) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LayoutLMAttention (line 218) | class LayoutLMAttention(nn.Module): method __init__ (line 219) | def __init__(self, config): method forward (line 224) | def forward( class LayoutLMIntermediate (line 241) | class LayoutLMIntermediate(nn.Module): method __init__ (line 242) | def __init__(self, config): method forward (line 250) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LayoutLMOutput (line 257) | class LayoutLMOutput(nn.Module): method __init__ (line 258) | def __init__(self, config): method forward (line 264) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LayoutLMLayer (line 272) | class LayoutLMLayer(GradientCheckpointingLayer): method __init__ (line 273) | def __init__(self, config): method forward (line 281) | def forward( method feed_forward_chunk (line 299) | def feed_forward_chunk(self, attention_output): class LayoutLMEncoder (line 306) | class LayoutLMEncoder(nn.Module): method __init__ (line 307) | def __init__(self, config): method forward (line 313) | def forward( class LayoutLMPooler (line 332) | class LayoutLMPooler(nn.Module): method __init__ (line 333) | def __init__(self, config): method forward (line 338) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LayoutLMPredictionHeadTransform (line 348) | class LayoutLMPredictionHeadTransform(nn.Module): method __init__ (line 349) | def __init__(self, config): method forward (line 358) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LayoutLMLMPredictionHead (line 366) | class LayoutLMLMPredictionHead(nn.Module): method __init__ (line 367) | def __init__(self, config): method forward (line 376) | def forward(self, hidden_states): class LayoutLMOnlyMLMHead (line 383) | class LayoutLMOnlyMLMHead(nn.Module): method __init__ (line 384) | def __init__(self, config): method forward (line 388) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class LayoutLMPreTrainedModel (line 394) | class LayoutLMPreTrainedModel(PreTrainedModel): method _init_weights (line 404) | def _init_weights(self, module): class LayoutLMModel (line 414) | class LayoutLMModel(LayoutLMPreTrainedModel): method __init__ (line 415) | def __init__(self, config): method get_input_embeddings (line 426) | def get_input_embeddings(self): method set_input_embeddings (line 429) | def set_input_embeddings(self, value): method forward (line 435) | def forward( class LayoutLMForMaskedLM (line 530) | class LayoutLMForMaskedLM(LayoutLMPreTrainedModel): method __init__ (line 536) | def __init__(self, config): method get_input_embeddings (line 545) | def get_input_embeddings(self): method get_output_embeddings (line 548) | def get_output_embeddings(self): method set_output_embeddings (line 551) | def set_output_embeddings(self, new_embeddings): method forward (line 557) | def forward( class LayoutLMForSequenceClassification (line 651) | class LayoutLMForSequenceClassification(LayoutLMPreTrainedModel): method __init__ (line 652) | def __init__(self, config): method get_input_embeddings (line 662) | def get_input_embeddings(self): method forward (line 667) | def forward( class LayoutLMForTokenClassification (line 779) | class LayoutLMForTokenClassification(LayoutLMPreTrainedModel): method __init__ (line 780) | def __init__(self, config): method get_input_embeddings (line 790) | def get_input_embeddings(self): method forward (line 795) | def forward( class LayoutLMForQuestionAnswering (line 881) | class LayoutLMForQuestionAnswering(LayoutLMPreTrainedModel): method __init__ (line 882) | def __init__(self, config, has_visual_segment_embedding=True): method get_input_embeddings (line 896) | def get_input_embeddings(self): method forward (line 901) | def forward( FILE: src/transformers/models/layoutlmv2/configuration_layoutlmv2.py class LayoutLMv2Config (line 29) | class LayoutLMv2Config(PreTrainedConfig): method __post_init__ (line 108) | def __post_init__(self, **kwargs): method get_default_detectron2_config (line 117) | def get_default_detectron2_config(cls): method get_detectron2_config (line 147) | def get_detectron2_config(self): FILE: src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py function normalize_box (line 42) | def normalize_box(box, width, height): function apply_tesseract (line 51) | def apply_tesseract( class LayoutLMv2ImageProcessorKwargs (line 98) | class LayoutLMv2ImageProcessorKwargs(ImagesKwargs, total=False): class LayoutLMv2ImageProcessor (line 118) | class LayoutLMv2ImageProcessor(TorchvisionBackend): method __init__ (line 128) | def __init__(self, **kwargs: Unpack[LayoutLMv2ImageProcessorKwargs]): method preprocess (line 132) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LayoutLMv2Im... method _preprocess (line 135) | def _preprocess( FILE: src/transformers/models/layoutlmv2/image_processing_pil_layoutlmv2.py class LayoutLMv2ImageProcessorKwargs (line 43) | class LayoutLMv2ImageProcessorKwargs(ImagesKwargs, total=False): function normalize_box (line 63) | def normalize_box(box, width, height): function apply_tesseract (line 73) | def apply_tesseract( class LayoutLMv2ImageProcessorPil (line 121) | class LayoutLMv2ImageProcessorPil(PilBackend): method __init__ (line 131) | def __init__(self, **kwargs: Unpack[LayoutLMv2ImageProcessorKwargs]): method preprocess (line 135) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LayoutLMv2Im... method _preprocess (line 138) | def _preprocess( FILE: src/transformers/models/layoutlmv2/modeling_layoutlmv2.py class LayoutLMv2Embeddings (line 53) | class LayoutLMv2Embeddings(nn.Module): method __init__ (line 56) | def __init__(self, config): method _calc_spatial_position_embeddings (line 74) | def _calc_spatial_position_embeddings(self, bbox): class LayoutLMv2SelfAttention (line 100) | class LayoutLMv2SelfAttention(nn.Module): method __init__ (line 101) | def __init__(self, config): method compute_qkv (line 127) | def compute_qkv(self, hidden_states): method forward (line 144) | def forward( class LayoutLMv2Attention (line 183) | class LayoutLMv2Attention(nn.Module): method __init__ (line 184) | def __init__(self, config): method forward (line 189) | def forward( class LayoutLMv2SelfOutput (line 209) | class LayoutLMv2SelfOutput(nn.Module): method __init__ (line 210) | def __init__(self, config): method forward (line 216) | def forward(self, hidden_states, input_tensor): class LayoutLMv2Intermediate (line 224) | class LayoutLMv2Intermediate(nn.Module): method __init__ (line 225) | def __init__(self, config): method forward (line 233) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LayoutLMv2Output (line 240) | class LayoutLMv2Output(nn.Module): method __init__ (line 241) | def __init__(self, config): method forward (line 247) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LayoutLMv2Layer (line 254) | class LayoutLMv2Layer(GradientCheckpointingLayer): method __init__ (line 255) | def __init__(self, config): method forward (line 263) | def forward( method feed_forward_chunk (line 285) | def feed_forward_chunk(self, attention_output): function relative_position_bucket (line 291) | def relative_position_bucket(relative_position, bidirectional=True, num_... class LayoutLMv2Encoder (line 335) | class LayoutLMv2Encoder(nn.Module): method __init__ (line 336) | def __init__(self, config): method _calculate_1d_position_embeddings (line 357) | def _calculate_1d_position_embeddings(self, position_ids): method _calculate_2d_position_embeddings (line 373) | def _calculate_2d_position_embeddings(self, bbox): method forward (line 400) | def forward( class LayoutLMv2PreTrainedModel (line 423) | class LayoutLMv2PreTrainedModel(PreTrainedModel): method _init_weights (line 429) | def _init_weights(self, module): function my_convert_sync_batchnorm (line 453) | def my_convert_sync_batchnorm(module, process_group=None): class LayoutLMv2VisualBackbone (line 477) | class LayoutLMv2VisualBackbone(nn.Module): method __init__ (line 478) | def __init__(self, config): method forward (line 513) | def forward(self, images): method synchronize_batch_norm (line 520) | def synchronize_batch_norm(self): class LayoutLMv2Pooler (line 543) | class LayoutLMv2Pooler(nn.Module): method __init__ (line 544) | def __init__(self, config): method forward (line 549) | def forward(self, hidden_states): class LayoutLMv2Model (line 559) | class LayoutLMv2Model(LayoutLMv2PreTrainedModel): method __init__ (line 562) | def __init__(self, config): method get_input_embeddings (line 582) | def get_input_embeddings(self): method set_input_embeddings (line 585) | def set_input_embeddings(self, value): method _calc_text_embeddings (line 588) | def _calc_text_embeddings(self, input_ids, bbox, position_ids, token_t... method _calc_img_embeddings (line 613) | def _calc_img_embeddings(self, image, bbox, position_ids): method _calc_visual_bbox (line 624) | def _calc_visual_bbox(self, image_feature_pool_shape, bbox, device, fi... method _get_input_shape (line 661) | def _get_input_shape(self, input_ids=None, inputs_embeds=None): method forward (line 674) | def forward( class LayoutLMv2ForSequenceClassification (line 800) | class LayoutLMv2ForSequenceClassification(LayoutLMv2PreTrainedModel): method __init__ (line 801) | def __init__(self, config): method get_input_embeddings (line 811) | def get_input_embeddings(self): method forward (line 816) | def forward( class LayoutLMv2ForTokenClassification (line 998) | class LayoutLMv2ForTokenClassification(LayoutLMv2PreTrainedModel): method __init__ (line 999) | def __init__(self, config): method get_input_embeddings (line 1009) | def get_input_embeddings(self): method forward (line 1014) | def forward( class LayoutLMv2ForQuestionAnswering (line 1135) | class LayoutLMv2ForQuestionAnswering(LayoutLMv2PreTrainedModel): method __init__ (line 1136) | def __init__(self, config, has_visual_segment_embedding=True): method get_input_embeddings (line 1150) | def get_input_embeddings(self): method forward (line 1155) | def forward( FILE: src/transformers/models/layoutlmv2/processing_layoutlmv2.py class LayoutLMv2Processor (line 24) | class LayoutLMv2Processor(ProcessorMixin): method __init__ (line 25) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 29) | def __call__( method get_overflowing_images (line 105) | def get_overflowing_images(self, images, overflow_to_sample_mapping): method model_input_names (line 120) | def model_input_names(self): FILE: src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py class LayoutLMv2Tokenizer (line 112) | class LayoutLMv2Tokenizer(TokenizersBackend): method __init__ (line 162) | def __init__( method __call__ (line 244) | def __call__( method batch_encode_plus (line 396) | def batch_encode_plus( method tokenize (line 452) | def tokenize(self, text: str, pair: str | None = None, add_special_tok... method encode_plus (line 461) | def encode_plus( method _batch_encode_plus (line 529) | def _batch_encode_plus( method _encode_plus (line 683) | def _encode_plus( method _pad (line 751) | def _pad( method build_inputs_with_special_tokens (line 840) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... FILE: src/transformers/models/layoutlmv3/configuration_layoutlmv3.py class LayoutLMv3Config (line 24) | class LayoutLMv3Config(PreTrainedConfig): FILE: src/transformers/models/layoutlmv3/image_processing_layoutlmv3.py function normalize_box (line 48) | def normalize_box(box, width, height): function apply_tesseract (line 57) | def apply_tesseract( class LayoutLMv3ImageProcessorKwargs (line 104) | class LayoutLMv3ImageProcessorKwargs(ImagesKwargs, total=False): class LayoutLMv3ImageProcessor (line 124) | class LayoutLMv3ImageProcessor(TorchvisionBackend): method __init__ (line 137) | def __init__(self, **kwargs: Unpack[LayoutLMv3ImageProcessorKwargs]): method preprocess (line 141) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LayoutLMv3Im... method _preprocess (line 144) | def _preprocess( FILE: src/transformers/models/layoutlmv3/image_processing_pil_layoutlmv3.py class LayoutLMv3ImageProcessorKwargs (line 45) | class LayoutLMv3ImageProcessorKwargs(ImagesKwargs, total=False): function normalize_box (line 65) | def normalize_box(box, width, height): function apply_tesseract (line 75) | def apply_tesseract( class LayoutLMv3ImageProcessorPil (line 123) | class LayoutLMv3ImageProcessorPil(PilBackend): method __init__ (line 136) | def __init__(self, **kwargs: Unpack[LayoutLMv3ImageProcessorKwargs]): method preprocess (line 140) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LayoutLMv3Im... method _preprocess (line 143) | def _preprocess( FILE: src/transformers/models/layoutlmv3/modeling_layoutlmv3.py class LayoutLMv3PatchEmbeddings (line 50) | class LayoutLMv3PatchEmbeddings(nn.Module): method __init__ (line 54) | def __init__(self, config): method forward (line 70) | def forward(self, pixel_values, position_embedding=None): class LayoutLMv3TextEmbeddings (line 85) | class LayoutLMv3TextEmbeddings(nn.Module): method __init__ (line 90) | def __init__(self, config): method calculate_spatial_position_embeddings (line 113) | def calculate_spatial_position_embeddings(self, bbox): method create_position_ids_from_input_ids (line 139) | def create_position_ids_from_input_ids(self, input_ids, padding_idx): method create_position_ids_from_inputs_embeds (line 149) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): method forward (line 161) | def forward( class LayoutLMv3SelfAttention (line 203) | class LayoutLMv3SelfAttention(nn.Module): method __init__ (line 204) | def __init__(self, config): method cogview_attention (line 224) | def cogview_attention(self, attention_scores, alpha=32): method forward (line 236) | def forward( class LayoutLMv3SelfOutput (line 293) | class LayoutLMv3SelfOutput(nn.Module): method __init__ (line 294) | def __init__(self, config): method forward (line 300) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LayoutLMv3Attention (line 308) | class LayoutLMv3Attention(nn.Module): method __init__ (line 309) | def __init__(self, config): method forward (line 314) | def forward( class LayoutLMv3Layer (line 335) | class LayoutLMv3Layer(GradientCheckpointingLayer): method __init__ (line 336) | def __init__(self, config): method forward (line 344) | def forward( method feed_forward_chunk (line 366) | def feed_forward_chunk(self, attention_output): class LayoutLMv3Encoder (line 372) | class LayoutLMv3Encoder(nn.Module): method __init__ (line 373) | def __init__(self, config): method relative_position_bucket (line 393) | def relative_position_bucket(self, relative_position, bidirectional=Tr... method _cal_1d_pos_emb (line 416) | def _cal_1d_pos_emb(self, position_ids): method _cal_2d_pos_emb (line 433) | def _cal_2d_pos_emb(self, bbox): method forward (line 460) | def forward( class LayoutLMv3Intermediate (line 486) | class LayoutLMv3Intermediate(nn.Module): method __init__ (line 487) | def __init__(self, config): method forward (line 495) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LayoutLMv3Output (line 502) | class LayoutLMv3Output(nn.Module): method __init__ (line 503) | def __init__(self, config): method forward (line 509) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LayoutLMv3PreTrainedModel (line 517) | class LayoutLMv3PreTrainedModel(PreTrainedModel): method _init_weights (line 524) | def _init_weights(self, module): class LayoutLMv3Model (line 538) | class LayoutLMv3Model(LayoutLMv3PreTrainedModel): method __init__ (line 539) | def __init__(self, config): method get_input_embeddings (line 570) | def get_input_embeddings(self): method set_input_embeddings (line 573) | def set_input_embeddings(self, value): method create_visual_bbox (line 576) | def create_visual_bbox(self, image_size=(14, 14), max_len=1000): method calculate_visual_bbox (line 599) | def calculate_visual_bbox(self, device, dtype, batch_size): method forward_image (line 604) | def forward_image(self, pixel_values): method forward (line 624) | def forward( class LayoutLMv3ClassificationHead (line 798) | class LayoutLMv3ClassificationHead(nn.Module): method __init__ (line 803) | def __init__(self, config, pool_feature=False): method forward (line 816) | def forward(self, x): class LayoutLMv3ForTokenClassification (line 833) | class LayoutLMv3ForTokenClassification(LayoutLMv3PreTrainedModel): method __init__ (line 834) | def __init__(self, config): method get_input_embeddings (line 847) | def get_input_embeddings(self): method set_input_embeddings (line 850) | def set_input_embeddings(self, value): method forward (line 855) | def forward( class LayoutLMv3ForQuestionAnswering (line 933) | class LayoutLMv3ForQuestionAnswering(LayoutLMv3PreTrainedModel): method __init__ (line 934) | def __init__(self, config): 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 951) | def forward( class LayoutLMv3ForSequenceClassification (line 1048) | class LayoutLMv3ForSequenceClassification(LayoutLMv3PreTrainedModel): method __init__ (line 1049) | def __init__(self, config): method get_input_embeddings (line 1058) | def get_input_embeddings(self): method set_input_embeddings (line 1061) | def set_input_embeddings(self, value): method forward (line 1066) | def forward( FILE: src/transformers/models/layoutlmv3/processing_layoutlmv3.py class LayoutLMv3Processor (line 24) | class LayoutLMv3Processor(ProcessorMixin): method __init__ (line 25) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 29) | def __call__( method get_overflowing_images (line 101) | def get_overflowing_images(self, images, overflow_to_sample_mapping): method model_input_names (line 116) | def model_input_names(self): FILE: src/transformers/models/layoutlmv3/tokenization_layoutlmv3.py class LayoutLMv3Tokenizer (line 114) | class LayoutLMv3Tokenizer(TokenizersBackend): method __init__ (line 169) | def __init__( method __call__ (line 241) | def __call__( method batch_encode_plus (line 393) | def batch_encode_plus( method tokenize (line 449) | def tokenize(self, text: str, pair: str | None = None, add_special_tok... method encode_plus (line 458) | def encode_plus( method _batch_encode_plus (line 526) | def _batch_encode_plus( method _encode_plus (line 678) | def _encode_plus( method _pad (line 746) | def _pad( method build_inputs_with_special_tokens (line 835) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... FILE: src/transformers/models/layoutxlm/configuration_layoutxlm.py class LayoutXLMConfig (line 35) | class LayoutXLMConfig(PreTrainedConfig): method __post_init__ (line 114) | def __post_init__(self, **kwargs): method get_default_detectron2_config (line 123) | def get_default_detectron2_config(cls): method get_detectron2_config (line 153) | def get_detectron2_config(self): FILE: src/transformers/models/layoutxlm/modular_layoutxlm.py class LayoutXLMConfig (line 24) | class LayoutXLMConfig(LayoutLMv2Config): FILE: src/transformers/models/layoutxlm/processing_layoutxlm.py class LayoutXLMProcessor (line 24) | class LayoutXLMProcessor(ProcessorMixin): method __init__ (line 25) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 29) | def __call__( method get_overflowing_images (line 105) | def get_overflowing_images(self, images, overflow_to_sample_mapping): method model_input_names (line 120) | def model_input_names(self): FILE: src/transformers/models/layoutxlm/tokenization_layoutxlm.py class LayoutXLMTokenizer (line 140) | class LayoutXLMTokenizer(TokenizersBackend): method __init__ (line 208) | def __init__( method _get_token_id (line 288) | def _get_token_id(self, token: str) -> int: method encode_plus (line 295) | def encode_plus( method batch_encode_plus (line 354) | def batch_encode_plus( method __call__ (line 414) | def __call__( method tokenize (line 565) | def tokenize(self, text: str, pair: str | None = None, add_special_tok... method _batch_encode_plus (line 580) | def _batch_encode_plus( method _encode_plus (line 735) | def _encode_plus( method _pad (line 803) | def _pad( method build_inputs_with_special_tokens (line 892) | def build_inputs_with_special_tokens( method create_token_type_ids_from_sequences (line 918) | def create_token_type_ids_from_sequences( FILE: src/transformers/models/led/configuration_led.py class LEDConfig (line 24) | class LEDConfig(PreTrainedConfig): FILE: src/transformers/models/led/modeling_led.py function shift_tokens_right (line 38) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... function _prepare_4d_attention_mask_inverted (line 54) | def _prepare_4d_attention_mask_inverted(mask: torch.Tensor, dtype: torch... class LEDLearnedPositionalEmbedding (line 72) | class LEDLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 77) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 80) | def forward(self, input_ids_shape: torch.Size, past_key_values_length:... class LEDEncoderSelfAttention (line 90) | class LEDEncoderSelfAttention(nn.Module): method __init__ (line 91) | def __init__(self, config, layer_id): method forward (line 126) | def forward( method _pad_and_transpose_last_two_dims (line 287) | def _pad_and_transpose_last_two_dims(hidden_states_padded, padding): method _pad_and_diagonalize (line 298) | def _pad_and_diagonalize(chunked_hidden_states): method _chunk (line 347) | def _chunk(hidden_states, window_overlap, onnx_export: bool = False): method _mask_invalid_locations (line 388) | def _mask_invalid_locations(input_tensor, affected_seq_len) -> torch.T... method _sliding_chunks_query_key_matmul (line 403) | def _sliding_chunks_query_key_matmul(self, query: torch.Tensor, key: t... method _sliding_chunks_matmul_attn_probs_value (line 469) | def _sliding_chunks_matmul_attn_probs_value( method _get_global_attn_indices (line 514) | def _get_global_attn_indices(is_index_global_attn): method _concat_with_global_key_attn_probs (line 542) | def _concat_with_global_key_attn_probs( method _compute_attn_output_with_global_indices (line 572) | def _compute_attn_output_with_global_indices( method _compute_global_attn_output_from_hidden (line 608) | def _compute_global_attn_output_from_hidden( class LEDEncoderAttention (line 704) | class LEDEncoderAttention(nn.Module): method __init__ (line 705) | def __init__(self, config, layer_id): method forward (line 710) | def forward( class LEDDecoderAttention (line 736) | class LEDDecoderAttention(nn.Module): method __init__ (line 739) | def __init__( method forward (line 767) | def forward( class LEDEncoderLayer (line 871) | class LEDEncoderLayer(GradientCheckpointingLayer): method __init__ (line 872) | def __init__(self, config: LEDConfig, layer_id: int): method forward (line 884) | def forward( class LEDDecoderLayer (line 927) | class LEDDecoderLayer(GradientCheckpointingLayer): method __init__ (line 928) | def __init__(self, config: LEDConfig, layer_idx=None): method forward (line 956) | def forward( class LEDClassificationHead (line 1030) | class LEDClassificationHead(nn.Module): method __init__ (line 1033) | def __init__( method forward (line 1045) | def forward(self, hidden_states: torch.Tensor): class LEDPreTrainedModel (line 1055) | class LEDPreTrainedModel(PreTrainedModel): method dummy_inputs (line 1061) | def dummy_inputs(self): method _init_weights (line 1070) | def _init_weights(self, module): class LEDEncoderBaseModelOutput (line 1083) | class LEDEncoderBaseModelOutput(ModelOutput): class LEDSeq2SeqModelOutput (line 1122) | class LEDSeq2SeqModelOutput(ModelOutput): class LEDSeq2SeqLMOutput (line 1160) | class LEDSeq2SeqLMOutput(ModelOutput): class LEDSeq2SeqSequenceClassifierOutput (line 1198) | class LEDSeq2SeqSequenceClassifierOutput(ModelOutput): class LEDSeq2SeqQuestionAnsweringModelOutput (line 1236) | class LEDSeq2SeqQuestionAnsweringModelOutput(ModelOutput): class LEDEncoder (line 1267) | class LEDEncoder(LEDPreTrainedModel): method __init__ (line 1277) | def __init__(self, config: LEDConfig): method _merge_to_attention_mask (line 1313) | def _merge_to_attention_mask(self, attention_mask: torch.Tensor, globa... method _pad_to_window_size (line 1325) | def _pad_to_window_size( method forward (line 1368) | def forward( class LEDDecoder (line 1529) | class LEDDecoder(LEDPreTrainedModel): method __init__ (line 1538) | def __init__(self, config: LEDConfig): method forward (line 1558) | def forward( class LEDModel (line 1739) | class LEDModel(LEDPreTrainedModel): method __init__ (line 1745) | def __init__(self, config: LEDConfig): method get_input_embeddings (line 1757) | def get_input_embeddings(self): method set_input_embeddings (line 1760) | def set_input_embeddings(self, value): method forward (line 1766) | def forward( class LEDForConditionalGeneration (line 1881) | class LEDForConditionalGeneration(LEDPreTrainedModel, GenerationMixin): method __init__ (line 1888) | def __init__(self, config: LEDConfig): method resize_token_embeddings (line 1897) | def resize_token_embeddings( method _resize_final_logits_bias (line 1904) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 1914) | def forward( method prepare_decoder_input_ids_from_labels (line 2066) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class LEDForQuestionAnswering (line 2071) | class LEDForQuestionAnswering(LEDPreTrainedModel): method __init__ (line 2072) | def __init__(self, config): method forward (line 2085) | def forward( FILE: src/transformers/models/levit/configuration_levit.py class LevitConfig (line 24) | class LevitConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/levit/convert_levit_timm_to_pytorch.py function convert_weight_and_push (line 34) | def convert_weight_and_push( function convert_weights_and_push (line 81) | def convert_weights_and_push(save_directory: Path, model_name: str | Non... FILE: src/transformers/models/levit/image_processing_levit.py class LevitImageProcessor (line 33) | class LevitImageProcessor(TorchvisionBackend): method __init__ (line 48) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method resize (line 51) | def resize( FILE: src/transformers/models/levit/image_processing_pil_levit.py class LevitImageProcessorPil (line 32) | class LevitImageProcessorPil(PilBackend): method __init__ (line 47) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method resize (line 50) | def resize( FILE: src/transformers/models/levit/modeling_levit.py class LevitForImageClassificationWithTeacherOutput (line 43) | class LevitForImageClassificationWithTeacherOutput(ModelOutput): class LevitConvEmbeddings (line 61) | class LevitConvEmbeddings(nn.Module): method __init__ (line 66) | def __init__( method forward (line 75) | def forward(self, embeddings): class LevitPatchEmbeddings (line 81) | class LevitPatchEmbeddings(nn.Module): method __init__ (line 87) | def __init__(self, config): method forward (line 109) | def forward(self, pixel_values): class MLPLayerWithBN (line 125) | class MLPLayerWithBN(nn.Module): method __init__ (line 126) | def __init__(self, input_dim, output_dim, bn_weight_init=1): method forward (line 131) | def forward(self, hidden_state): class LevitSubsample (line 137) | class LevitSubsample(nn.Module): method __init__ (line 138) | def __init__(self, stride, resolution): method forward (line 143) | def forward(self, hidden_state): class LevitAttention (line 151) | class LevitAttention(nn.Module): method __init__ (line 152) | def __init__(self, hidden_sizes, key_dim, num_attention_heads, attenti... method train (line 184) | def train(self, mode=True): method get_attention_biases (line 189) | def get_attention_biases(self, device): method forward (line 198) | def forward(self, hidden_state): class LevitAttentionSubsample (line 215) | class LevitAttentionSubsample(nn.Module): method __init__ (line 216) | def __init__( method train (line 265) | def train(self, mode=True): method get_attention_biases (line 270) | def get_attention_biases(self, device): method forward (line 279) | def forward(self, hidden_state): class LevitMLPLayer (line 301) | class LevitMLPLayer(nn.Module): method __init__ (line 306) | def __init__(self, input_dim, hidden_dim): method forward (line 312) | def forward(self, hidden_state): class LevitResidualLayer (line 319) | class LevitResidualLayer(nn.Module): method __init__ (line 324) | def __init__(self, module, drop_rate): method forward (line 329) | def forward(self, hidden_state): class LevitStage (line 340) | class LevitStage(nn.Module): method __init__ (line 345) | def __init__( method get_resolution (line 400) | def get_resolution(self): method forward (line 403) | def forward(self, hidden_state): class LevitEncoder (line 409) | class LevitEncoder(nn.Module): method __init__ (line 414) | def __init__(self, config): method forward (line 439) | def forward(self, hidden_state, output_hidden_states=False, return_dic... class LevitClassificationLayer (line 455) | class LevitClassificationLayer(nn.Module): method __init__ (line 460) | def __init__(self, input_dim, output_dim): method forward (line 465) | def forward(self, hidden_state): class LevitPreTrainedModel (line 472) | class LevitPreTrainedModel(PreTrainedModel): method _init_weights (line 479) | def _init_weights(self, module): class LevitModel (line 493) | class LevitModel(LevitPreTrainedModel): method __init__ (line 494) | def __init__(self, config): method forward (line 503) | def forward( class LevitForImageClassification (line 546) | class LevitForImageClassification(LevitPreTrainedModel): method __init__ (line 547) | def __init__(self, config): method forward (line 564) | def forward( class LevitForImageClassificationWithTeacher (line 609) | class LevitForImageClassificationWithTeacher(LevitPreTrainedModel): method __init__ (line 610) | def __init__(self, config): method forward (line 632) | def forward( FILE: src/transformers/models/lfm2/configuration_lfm2.py class Lfm2Config (line 25) | class Lfm2Config(PreTrainedConfig): method __post_init__ (line 81) | def __post_init__(self, **kwargs): FILE: src/transformers/models/lfm2/modeling_lfm2.py class Lfm2RMSNorm (line 50) | class Lfm2RMSNorm(nn.Module): method __init__ (line 51) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 59) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self): class Lfm2RotaryEmbedding (line 70) | class Lfm2RotaryEmbedding(nn.Module): method __init__ (line 73) | def __init__(self, config: Lfm2Config, device=None): method compute_default_rope_parameters (line 90) | def compute_default_rope_parameters( method forward (line 121) | def forward(self, x, position_ids): class Lfm2MLP (line 135) | class Lfm2MLP(nn.Module): method __init__ (line 136) | def __init__(self, config: Lfm2Config): method forward (line 151) | def forward(self, x): function rotate_half (line 155) | def rotate_half(x): function apply_rotary_pos_emb (line 163) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 188) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 200) | def eager_attention_forward( class Lfm2Attention (line 226) | class Lfm2Attention(nn.Module): method __init__ (line 229) | def __init__(self, config: Lfm2Config, layer_idx: int): method forward (line 244) | def forward( function apply_mask_to_padding_states (line 284) | def apply_mask_to_padding_states(hidden_states, attention_mask): class Lfm2ShortConv (line 300) | class Lfm2ShortConv(nn.Module): method __init__ (line 301) | def __init__( method cuda_kernels_forward (line 323) | def cuda_kernels_forward( method slow_forward (line 356) | def slow_forward( method forward (line 389) | def forward( class Lfm2DecoderLayer (line 400) | class Lfm2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 401) | def __init__(self, config: Lfm2Config, layer_idx: int): method forward (line 413) | def forward( class Lfm2PreTrainedModel (line 445) | class Lfm2PreTrainedModel(PreTrainedModel): class Lfm2Model (line 463) | class Lfm2Model(Lfm2PreTrainedModel): method __init__ (line 464) | def __init__(self, config: Lfm2Config): method forward (line 483) | def forward( class Lfm2ForCausalLM (line 541) | class Lfm2ForCausalLM(Lfm2PreTrainedModel, GenerationMixin): method __init__ (line 546) | def __init__(self, config): method forward (line 557) | def forward( FILE: src/transformers/models/lfm2/modular_lfm2.py class Lfm2RMSNorm (line 55) | class Lfm2RMSNorm(LlamaRMSNorm): class Lfm2RotaryEmbedding (line 59) | class Lfm2RotaryEmbedding(Gemma2RotaryEmbedding): class Lfm2MLP (line 63) | class Lfm2MLP(nn.Module): method __init__ (line 64) | def __init__(self, config: Lfm2Config): method forward (line 79) | def forward(self, x): class Lfm2Attention (line 83) | class Lfm2Attention(LlamaAttention): method __init__ (line 84) | def __init__(self, config: Lfm2Config, layer_idx: int): method forward (line 95) | def forward( class Lfm2ShortConv (line 135) | class Lfm2ShortConv(nn.Module): method __init__ (line 136) | def __init__( method cuda_kernels_forward (line 158) | def cuda_kernels_forward( method slow_forward (line 191) | def slow_forward( method forward (line 224) | def forward( class Lfm2DecoderLayer (line 235) | class Lfm2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 236) | def __init__(self, config: Lfm2Config, layer_idx: int): method forward (line 248) | def forward( class Lfm2PreTrainedModel (line 279) | class Lfm2PreTrainedModel(LlamaPreTrainedModel): class Lfm2Model (line 283) | class Lfm2Model(LlamaModel): method __init__ (line 284) | def __init__(self, config: Lfm2Config): method forward (line 289) | def forward( class Lfm2ForCausalLM (line 346) | class Lfm2ForCausalLM(LlamaForCausalLM): FILE: src/transformers/models/lfm2_moe/configuration_lfm2_moe.py class Lfm2MoeConfig (line 24) | class Lfm2MoeConfig(PreTrainedConfig): method __post_init__ (line 79) | def __post_init__(self, **kwargs): FILE: src/transformers/models/lfm2_moe/modeling_lfm2_moe.py class Lfm2MoeRMSNorm (line 57) | class Lfm2MoeRMSNorm(nn.Module): method __init__ (line 58) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 66) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 73) | def extra_repr(self): class Lfm2MoeRotaryEmbedding (line 77) | class Lfm2MoeRotaryEmbedding(nn.Module): method __init__ (line 80) | def __init__(self, config: Lfm2MoeConfig, device=None): method compute_default_rope_parameters (line 97) | def compute_default_rope_parameters( method forward (line 128) | def forward(self, x, position_ids): class Lfm2MoeMLP (line 142) | class Lfm2MoeMLP(nn.Module): method __init__ (line 143) | def __init__(self, config: Lfm2MoeConfig, intermediate_size: int | Non... method forward (line 151) | def forward(self, x): class Lfm2MoeExperts (line 156) | class Lfm2MoeExperts(nn.Module): method __init__ (line 159) | def __init__(self, config): method forward (line 168) | def forward( class Lfm2MoeSparseMoeBlock (line 195) | class Lfm2MoeSparseMoeBlock(nn.Module): method __init__ (line 196) | def __init__(self, config): method route_tokens_to_experts (line 208) | def route_tokens_to_experts(self, router_logits): method forward (line 222) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... function rotate_half (line 231) | def rotate_half(x): function apply_rotary_pos_emb (line 239) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 264) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 276) | def eager_attention_forward( class Lfm2MoeAttention (line 302) | class Lfm2MoeAttention(nn.Module): method __init__ (line 305) | def __init__(self, config: Lfm2MoeConfig, layer_idx: int): method forward (line 320) | def forward( function apply_mask_to_padding_states (line 360) | def apply_mask_to_padding_states(hidden_states, attention_mask): class Lfm2MoeShortConv (line 376) | class Lfm2MoeShortConv(nn.Module): method __init__ (line 377) | def __init__( method cuda_kernels_forward (line 399) | def cuda_kernels_forward( method slow_forward (line 432) | def slow_forward( method forward (line 465) | def forward( class Lfm2MoeDecoderLayer (line 476) | class Lfm2MoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 477) | def __init__(self, config: Lfm2MoeConfig, layer_idx: int): method forward (line 493) | def forward( class Lfm2MoePreTrainedModel (line 525) | class Lfm2MoePreTrainedModel(PreTrainedModel): method _init_weights (line 542) | def _init_weights(self, module): class Lfm2MoeModel (line 553) | class Lfm2MoeModel(Lfm2MoePreTrainedModel): method __init__ (line 554) | def __init__(self, config: Lfm2MoeConfig): method forward (line 573) | def forward( class Lfm2MoeForCausalLM (line 631) | class Lfm2MoeForCausalLM(Lfm2MoePreTrainedModel, GenerationMixin): method __init__ (line 636) | def __init__(self, config): method forward (line 647) | def forward( FILE: src/transformers/models/lfm2_moe/modular_lfm2_moe.py class Lfm2MoeRMSNorm (line 53) | class Lfm2MoeRMSNorm(LlamaRMSNorm): class Lfm2MoeRotaryEmbedding (line 57) | class Lfm2MoeRotaryEmbedding(Lfm2RotaryEmbedding): class Lfm2MoeMLP (line 61) | class Lfm2MoeMLP(Lfm2MLP): method __init__ (line 62) | def __init__(self, config: Lfm2MoeConfig, intermediate_size: int | Non... class Lfm2MoeExperts (line 71) | class Lfm2MoeExperts(Qwen2MoeExperts): method __init__ (line 72) | def __init__(self, config): class Lfm2MoeSparseMoeBlock (line 77) | class Lfm2MoeSparseMoeBlock(nn.Module): method __init__ (line 78) | def __init__(self, config): method route_tokens_to_experts (line 90) | def route_tokens_to_experts(self, router_logits): method forward (line 104) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Lfm2MoeAttention (line 113) | class Lfm2MoeAttention(Lfm2Attention): class Lfm2MoeShortConv (line 117) | class Lfm2MoeShortConv(Lfm2ShortConv): class Lfm2MoeDecoderLayer (line 121) | class Lfm2MoeDecoderLayer(Lfm2DecoderLayer): method __init__ (line 122) | def __init__(self, config: Lfm2MoeConfig, layer_idx: int): class Lfm2MoePreTrainedModel (line 131) | class Lfm2MoePreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 135) | def _init_weights(self, module): class Lfm2MoeModel (line 145) | class Lfm2MoeModel(MixtralModel): method __init__ (line 146) | def __init__(self, config: Lfm2MoeConfig): method forward (line 153) | def forward( class Lfm2MoeForCausalLM (line 210) | class Lfm2MoeForCausalLM(LlamaForCausalLM): FILE: src/transformers/models/lfm2_vl/configuration_lfm2_vl.py class Lfm2VlConfig (line 25) | class Lfm2VlConfig(PreTrainedConfig): method __post_init__ (line 46) | def __post_init__(self, **kwargs): FILE: src/transformers/models/lfm2_vl/image_processing_lfm2_vl.py function round_by_factor (line 40) | def round_by_factor(number: float, factor: int) -> int: function find_closest_aspect_ratio (line 45) | def find_closest_aspect_ratio( function get_image_size_for_max_num_patches (line 87) | def get_image_size_for_max_num_patches( function convert_image_to_patches (line 134) | def convert_image_to_patches(images: "torch.Tensor", patch_size: int) ->... function pad_along_first_dim (line 150) | def pad_along_first_dim( class Lfm2VlImageProcessorKwargs (line 166) | class Lfm2VlImageProcessorKwargs(ImagesKwargs, total=False): class Lfm2VlImageProcessor (line 218) | class Lfm2VlImageProcessor(TorchvisionBackend): method __init__ (line 242) | def __init__(self, **kwargs: Unpack[Lfm2VlImageProcessorKwargs]): method _target_ratios (line 253) | def _target_ratios(self, min_tiles: int, max_tiles: int) -> list[tuple... method _get_grid_layout (line 263) | def _get_grid_layout( method crop_image_to_patches (line 283) | def crop_image_to_patches( method smart_resize (line 331) | def smart_resize( method _is_image_too_large (line 366) | def _is_image_too_large( method resize_and_split (line 382) | def resize_and_split( method _preprocess (line 438) | def _preprocess( FILE: src/transformers/models/lfm2_vl/modeling_lfm2_vl.py class Lfm2VlMultiModalProjector (line 37) | class Lfm2VlMultiModalProjector(nn.Module): method __init__ (line 38) | def __init__(self, config: Lfm2VlConfig): method forward (line 56) | def forward(self, image_features: torch.Tensor): method pixel_unshuffle (line 65) | def pixel_unshuffle(self, hidden_states: torch.Tensor): class Lfm2VlPreTrainedModel (line 77) | class Lfm2VlPreTrainedModel(PreTrainedModel): class Lfm2VlCausalLMOutputWithPast (line 97) | class Lfm2VlCausalLMOutputWithPast(ModelOutput): class Lfm2VlModelOutputWithPast (line 127) | class Lfm2VlModelOutputWithPast(BaseModelOutputWithPast): class Lfm2VlModel (line 147) | class Lfm2VlModel(Lfm2VlPreTrainedModel): method __init__ (line 148) | def __init__(self, config: Lfm2VlConfig): method get_input_embeddings (line 156) | def get_input_embeddings(self): method set_input_embeddings (line 159) | def set_input_embeddings(self, value): method get_image_features (line 166) | def get_image_features( method get_placeholder_mask (line 212) | def get_placeholder_mask( method forward (line 238) | def forward( class Lfm2VlForConditionalGeneration (line 302) | class Lfm2VlForConditionalGeneration(Lfm2VlPreTrainedModel, GenerationMi... method __init__ (line 305) | def __init__(self, config: Lfm2VlConfig): method get_input_embeddings (line 311) | def get_input_embeddings(self): method set_input_embeddings (line 314) | def set_input_embeddings(self, value): method get_output_embeddings (line 317) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 321) | def get_image_features( method forward (line 344) | def forward( method prepare_inputs_for_generation (line 449) | def prepare_inputs_for_generation( FILE: src/transformers/models/lfm2_vl/modular_lfm2_vl.py class Lfm2VlMultiModalProjector (line 37) | class Lfm2VlMultiModalProjector(nn.Module): method __init__ (line 38) | def __init__(self, config: Lfm2VlConfig): method forward (line 56) | def forward(self, image_features: torch.Tensor): method pixel_unshuffle (line 65) | def pixel_unshuffle(self, hidden_states: torch.Tensor): class Lfm2VlPreTrainedModel (line 76) | class Lfm2VlPreTrainedModel(LlavaPreTrainedModel): class Lfm2VlCausalLMOutputWithPast (line 81) | class Lfm2VlCausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class Lfm2VlModelOutputWithPast (line 85) | class Lfm2VlModelOutputWithPast(LlavaModelOutputWithPast): class Lfm2VlModel (line 89) | class Lfm2VlModel(LlavaModel): method __init__ (line 90) | def __init__(self, config: Lfm2VlConfig): method get_image_features (line 97) | def get_image_features( method get_placeholder_mask (line 143) | def get_placeholder_mask( method forward (line 169) | def forward( class Lfm2VlForConditionalGeneration (line 228) | class Lfm2VlForConditionalGeneration(LlavaForConditionalGeneration): method get_image_features (line 230) | def get_image_features( method forward (line 253) | def forward( FILE: src/transformers/models/lfm2_vl/processing_lfm2_vl.py class Lfm2VlTextKwargs (line 31) | class Lfm2VlTextKwargs(TextKwargs, total=False): class Lfm2VlProcessorKwargs (line 42) | class Lfm2VlProcessorKwargs(ProcessingKwargs, total=False): class Lfm2VlProcessor (line 58) | class Lfm2VlProcessor(ProcessorMixin): method __init__ (line 59) | def __init__( method __call__ (line 78) | def __call__( method expand_text_with_placeholders (line 139) | def expand_text_with_placeholders( method _build_image_tokens (line 180) | def _build_image_tokens( method _compute_tokens_per_tile (line 215) | def _compute_tokens_per_tile(self, tile_size: int, encoder_patch_size:... method _compute_tokens_for_image (line 221) | def _compute_tokens_for_image(self, image_size: list[int], encoder_pat... method _get_image_num_tokens (line 228) | def _get_image_num_tokens(self, image_size: list[int], **images_kwargs... method batch_decode (line 246) | def batch_decode(self, *args, **kwargs): method decode (line 254) | def decode(self, *args, **kwargs): method model_input_names (line 263) | def model_input_names(self): FILE: src/transformers/models/lightglue/configuration_lightglue.py class LightGlueConfig (line 31) | class LightGlueConfig(PreTrainedConfig): method __post_init__ (line 75) | def __post_init__(self, **kwargs): method validate_architecture (line 93) | def validate_architecture(self): FILE: src/transformers/models/lightglue/convert_lightglue_to_hf.py function prepare_imgs (line 33) | def prepare_imgs(): function verify_model_outputs (line 42) | def verify_model_outputs(model, device): function convert_old_keys_to_new_keys (line 92) | def convert_old_keys_to_new_keys(state_dict_keys: list[str]): function add_keypoint_detector_state_dict (line 110) | def add_keypoint_detector_state_dict(lightglue_state_dict): function split_weights (line 118) | def split_weights(state_dict): function write_model (line 149) | def write_model( function write_image_processor (line 228) | def write_image_processor(save_dir, model_name, organization, push_to_hu... FILE: src/transformers/models/lightglue/image_processing_lightglue.py class LightGlueImageProcessorKwargs (line 47) | class LightGlueImageProcessorKwargs(ImagesKwargs, total=False): function _is_valid_image (line 56) | def _is_valid_image(image): function validate_and_format_image_pairs (line 62) | def validate_and_format_image_pairs(images: ImageInput): function is_grayscale (line 90) | def is_grayscale( function convert_to_grayscale (line 101) | def convert_to_grayscale( class LightGlueImageProcessor (line 121) | class LightGlueImageProcessor(TorchvisionBackend): method __init__ (line 132) | def __init__(self, **kwargs: Unpack[LightGlueImageProcessorKwargs]): method preprocess (line 136) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LightGlueIma... method _prepare_images_structure (line 139) | def _prepare_images_structure( method _preprocess (line 148) | def _preprocess( method post_process_keypoint_matching (line 191) | def post_process_keypoint_matching( method visualize_keypoint_matching (line 259) | def visualize_keypoint_matching( method _get_color (line 314) | def _get_color(self, score): FILE: src/transformers/models/lightglue/image_processing_pil_lightglue.py class LightGlueImageProcessorKwargs (line 49) | class LightGlueImageProcessorKwargs(ImagesKwargs, total=False): function is_grayscale (line 58) | def is_grayscale(image: np.ndarray): function convert_to_grayscale (line 64) | def convert_to_grayscale(image: ImageInput) -> ImageInput: function validate_and_format_image_pairs (line 93) | def validate_and_format_image_pairs(images: ImageInput): class LightGlueImageProcessorPil (line 122) | class LightGlueImageProcessorPil(PilBackend): method __init__ (line 133) | def __init__(self, **kwargs: Unpack[LightGlueImageProcessorKwargs]): method preprocess (line 137) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LightGlueIma... method _prepare_images_structure (line 140) | def _prepare_images_structure(self, images: ImageInput, **kwargs) -> I... method _preprocess (line 145) | def _preprocess( method post_process_keypoint_matching (line 178) | def post_process_keypoint_matching( method visualize_keypoint_matching (line 248) | def visualize_keypoint_matching( method _get_color (line 296) | def _get_color(self, score): FILE: src/transformers/models/lightglue/modeling_lightglue.py class LightGlueKeypointMatchingOutput (line 48) | class LightGlueKeypointMatchingOutput(ModelOutput): class LightGluePositionalEncoder (line 83) | class LightGluePositionalEncoder(nn.Module): method __init__ (line 84) | def __init__(self, config: LightGlueConfig): method forward (line 88) | def forward( function rotate_half (line 100) | def rotate_half(x): function apply_rotary_pos_emb (line 108) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 136) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 148) | def eager_attention_forward( class LightGlueAttention (line 174) | class LightGlueAttention(nn.Module): method __init__ (line 177) | def __init__(self, config: LightGlueConfig, layer_idx: int): method forward (line 200) | def forward( class LightGlueMLP (line 245) | class LightGlueMLP(nn.Module): method __init__ (line 246) | def __init__(self, config: LightGlueConfig): method forward (line 254) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LightGlueTransformerLayer (line 262) | class LightGlueTransformerLayer(nn.Module): method __init__ (line 263) | def __init__(self, config: LightGlueConfig, layer_idx: int): method forward (line 270) | def forward( function sigmoid_log_double_softmax (line 345) | def sigmoid_log_double_softmax( class LightGlueMatchAssignmentLayer (line 360) | class LightGlueMatchAssignmentLayer(nn.Module): method __init__ (line 361) | def __init__(self, config: LightGlueConfig): method forward (line 368) | def forward(self, descriptors: torch.Tensor, mask: torch.Tensor) -> to... method get_matchability (line 394) | def get_matchability(self, descriptors: torch.Tensor) -> torch.Tensor: class LightGlueTokenConfidenceLayer (line 401) | class LightGlueTokenConfidenceLayer(nn.Module): method __init__ (line 402) | def __init__(self, config: LightGlueConfig): method forward (line 407) | def forward(self, descriptors: torch.Tensor) -> torch.Tensor: class LightGluePreTrainedModel (line 414) | class LightGluePreTrainedModel(PreTrainedModel): function get_matches_from_scores (line 429) | def get_matches_from_scores(scores: torch.Tensor, threshold: float) -> t... function normalize_keypoints (line 461) | def normalize_keypoints(keypoints: torch.Tensor, height: int, width: int... class LightGlueForKeypointMatching (line 488) | class LightGlueForKeypointMatching(LightGluePreTrainedModel): method __init__ (line 503) | def __init__(self, config: LightGlueConfig): method _get_confidence_threshold (line 533) | def _get_confidence_threshold(self, layer_index: int) -> float: method _keypoint_processing (line 538) | def _keypoint_processing( method _get_early_stopped_image_pairs (line 546) | def _get_early_stopped_image_pairs( method _get_keypoint_matching (line 565) | def _get_keypoint_matching(self, descriptors, mask, layer_index, early... method _get_pruning_mask (line 573) | def _get_pruning_mask(self, confidences: torch.Tensor, scores: torch.T... method _do_layer_keypoint_pruning (line 580) | def _do_layer_keypoint_pruning( method _concat_early_stopped_outputs (line 617) | def _concat_early_stopped_outputs( method _do_final_keypoint_pruning (line 649) | def _do_final_keypoint_pruning( method _match_image_pair (line 686) | def _match_image_pair( method forward (line 861) | def forward( FILE: src/transformers/models/lightglue/modular_lightglue.py class LightGlueConfig (line 44) | class LightGlueConfig(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): method validate_architecture (line 106) | def validate_architecture(self): class LightGlueKeypointMatchingOutput (line 122) | class LightGlueKeypointMatchingOutput(ModelOutput): class LightGlueImageProcessorKwargs (line 157) | class LightGlueImageProcessorKwargs(ImagesKwargs, total=False): class LightGlueImageProcessor (line 166) | class LightGlueImageProcessor(SuperGlueImageProcessor): method post_process_keypoint_matching (line 167) | def post_process_keypoint_matching( class LightGlueImageProcessorPil (line 177) | class LightGlueImageProcessorPil(SuperGlueImageProcessorPil): method post_process_keypoint_matching (line 179) | def post_process_keypoint_matching( class LightGluePositionalEncoder (line 188) | class LightGluePositionalEncoder(nn.Module): method __init__ (line 189) | def __init__(self, config: LightGlueConfig): method forward (line 193) | def forward( class LightGlueAttention (line 205) | class LightGlueAttention(LlamaAttention): method __init__ (line 206) | def __init__(self, config: LightGlueConfig, layer_idx: int): method forward (line 210) | def forward( class LightGlueMLP (line 255) | class LightGlueMLP(CLIPMLP): method __init__ (line 256) | def __init__(self, config: LightGlueConfig): method forward (line 261) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LightGlueTransformerLayer (line 269) | class LightGlueTransformerLayer(nn.Module): method __init__ (line 270) | def __init__(self, config: LightGlueConfig, layer_idx: int): method forward (line 277) | def forward( function sigmoid_log_double_softmax (line 352) | def sigmoid_log_double_softmax( class LightGlueMatchAssignmentLayer (line 367) | class LightGlueMatchAssignmentLayer(nn.Module): method __init__ (line 368) | def __init__(self, config: LightGlueConfig): method forward (line 375) | def forward(self, descriptors: torch.Tensor, mask: torch.Tensor) -> to... method get_matchability (line 401) | def get_matchability(self, descriptors: torch.Tensor) -> torch.Tensor: class LightGlueTokenConfidenceLayer (line 408) | class LightGlueTokenConfidenceLayer(nn.Module): method __init__ (line 409) | def __init__(self, config: LightGlueConfig): method forward (line 414) | def forward(self, descriptors: torch.Tensor) -> torch.Tensor: class LightGluePreTrainedModel (line 421) | class LightGluePreTrainedModel(PreTrainedModel): function get_matches_from_scores (line 436) | def get_matches_from_scores(scores: torch.Tensor, threshold: float) -> t... function normalize_keypoints (line 468) | def normalize_keypoints(keypoints: torch.Tensor, height: int, width: int... class LightGlueForKeypointMatching (line 495) | class LightGlueForKeypointMatching(LightGluePreTrainedModel): method __init__ (line 510) | def __init__(self, config: LightGlueConfig): method _get_confidence_threshold (line 540) | def _get_confidence_threshold(self, layer_index: int) -> float: method _keypoint_processing (line 545) | def _keypoint_processing( method _get_early_stopped_image_pairs (line 553) | def _get_early_stopped_image_pairs( method _get_keypoint_matching (line 572) | def _get_keypoint_matching(self, descriptors, mask, layer_index, early... method _get_pruning_mask (line 580) | def _get_pruning_mask(self, confidences: torch.Tensor, scores: torch.T... method _do_layer_keypoint_pruning (line 587) | def _do_layer_keypoint_pruning( method _concat_early_stopped_outputs (line 624) | def _concat_early_stopped_outputs( method _do_final_keypoint_pruning (line 656) | def _do_final_keypoint_pruning( method _match_image_pair (line 693) | def _match_image_pair( method forward (line 868) | def forward( FILE: src/transformers/models/lighton_ocr/configuration_lighton_ocr.py class LightOnOcrConfig (line 30) | class LightOnOcrConfig(PretrainedConfig): method __post_init__ (line 57) | def __post_init__(self, **kwargs): FILE: src/transformers/models/lighton_ocr/modeling_lighton_ocr.py class LightOnOcrRMSNorm (line 39) | class LightOnOcrRMSNorm(nn.Module): method __init__ (line 40) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 48) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 55) | def extra_repr(self): class LightOnOcrPatchMerger (line 59) | class LightOnOcrPatchMerger(nn.Module): method __init__ (line 64) | def __init__(self, config: LightOnOcrConfig): method forward (line 73) | def forward(self, image_features: torch.Tensor, image_sizes: torch.Ten... class LightOnOcrMultiModalProjector (line 97) | class LightOnOcrMultiModalProjector(nn.Module): method __init__ (line 98) | def __init__(self, config: LightOnOcrConfig): method forward (line 107) | def forward(self, image_features: torch.Tensor, image_sizes: torch.Ten... class LightOnOcrModelOutputWithPast (line 122) | class LightOnOcrModelOutputWithPast(BaseModelOutputWithPast): class LightOnOcrPreTrainedModel (line 138) | class LightOnOcrPreTrainedModel(PreTrainedModel): class LightOnOcrModel (line 158) | class LightOnOcrModel(LightOnOcrPreTrainedModel): method __init__ (line 161) | def __init__(self, config: LightOnOcrConfig): method get_input_embeddings (line 168) | def get_input_embeddings(self): method set_input_embeddings (line 171) | def set_input_embeddings(self, value): method get_image_features (line 176) | def get_image_features( method get_placeholder_mask (line 191) | def get_placeholder_mask( method forward (line 217) | def forward( class LightOnOcrCausalLMOutputWithPast (line 269) | class LightOnOcrCausalLMOutputWithPast(ModelOutput): class LightOnOcrForConditionalGeneration (line 298) | class LightOnOcrForConditionalGeneration(LightOnOcrPreTrainedModel, Gene... method __init__ (line 301) | def __init__(self, config: LightOnOcrConfig): method get_input_embeddings (line 307) | def get_input_embeddings(self): method set_input_embeddings (line 310) | def set_input_embeddings(self, value): method get_output_embeddings (line 313) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 317) | def get_image_features( method forward (line 325) | def forward( method prepare_inputs_for_generation (line 394) | def prepare_inputs_for_generation( FILE: src/transformers/models/lighton_ocr/modular_lighton_ocr.py class LightOnOcrConfig (line 46) | class LightOnOcrConfig(PretrainedConfig): method __post_init__ (line 73) | def __post_init__(self, **kwargs): class LightOnOcrProcessorKwargs (line 119) | class LightOnOcrProcessorKwargs(ProcessingKwargs, total=False): class LightOnOcrProcessor (line 131) | class LightOnOcrProcessor(ProcessorMixin): method __init__ (line 132) | def __init__( method __call__ (line 158) | def __call__( method _get_num_multimodal_tokens (line 217) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): class LightOnOcrMultiModalProjector (line 256) | class LightOnOcrMultiModalProjector(Mistral3MultiModalProjector): method __init__ (line 257) | def __init__(self, config: LightOnOcrConfig): class LightOnOcrModelOutputWithPast (line 266) | class LightOnOcrModelOutputWithPast(Mistral3ModelOutputWithPast): class LightOnOcrModel (line 270) | class LightOnOcrModel(Mistral3Model): method __init__ (line 273) | def __init__(self, config: LightOnOcrConfig): method get_image_features (line 282) | def get_image_features( method forward (line 299) | def forward( class LightOnOcrForConditionalGeneration (line 345) | class LightOnOcrForConditionalGeneration(Mistral3ForConditionalGeneration): method get_image_features (line 347) | def get_image_features( FILE: src/transformers/models/lighton_ocr/processing_lighton_ocr.py class LightOnOcrProcessorKwargs (line 31) | class LightOnOcrProcessorKwargs(ProcessingKwargs, total=False): function _num_image_tokens (line 43) | def _num_image_tokens(image_size: tuple[int, int], patch_size: tuple[int... function get_resize_output_image_size (line 63) | def get_resize_output_image_size( class LightOnOcrProcessor (line 103) | class LightOnOcrProcessor(ProcessorMixin): method __init__ (line 104) | def __init__( method __call__ (line 130) | def __call__( method _get_num_multimodal_tokens (line 189) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/lilt/configuration_lilt.py class LiltConfig (line 24) | class LiltConfig(PreTrainedConfig): FILE: src/transformers/models/lilt/modeling_lilt.py class LiltTextEmbeddings (line 41) | class LiltTextEmbeddings(nn.Module): method __init__ (line 42) | def __init__(self, config): method forward (line 62) | def forward( method create_position_ids_from_input_ids (line 98) | def create_position_ids_from_input_ids(self, input_ids, padding_idx): method create_position_ids_from_inputs_embeds (line 111) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): class LiltLayoutEmbeddings (line 127) | class LiltLayoutEmbeddings(nn.Module): method __init__ (line 128) | def __init__(self, config): method forward (line 149) | def forward(self, bbox=None, position_ids=None): class LiltSelfAttention (line 183) | class LiltSelfAttention(nn.Module): method __init__ (line 184) | def __init__(self, config, layer_idx=None): method transpose_for_scores (line 215) | def transpose_for_scores(self, x, r=1): method forward (line 220) | def forward( class LiltSelfOutput (line 289) | class LiltSelfOutput(nn.Module): method __init__ (line 290) | def __init__(self, config): method forward (line 296) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LiltAttention (line 303) | class LiltAttention(nn.Module): method __init__ (line 304) | def __init__(self, config, layer_idx=None): method forward (line 314) | def forward( class LiltIntermediate (line 334) | class LiltIntermediate(nn.Module): method __init__ (line 335) | def __init__(self, config): method forward (line 343) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LiltOutput (line 350) | class LiltOutput(nn.Module): method __init__ (line 351) | def __init__(self, config): method forward (line 357) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LiltLayer (line 364) | class LiltLayer(GradientCheckpointingLayer): method __init__ (line 365) | def __init__(self, config, layer_idx=None): method forward (line 382) | def forward( method feed_forward_chunk (line 411) | def feed_forward_chunk(self, attention_output): method layout_feed_forward_chunk (line 416) | def layout_feed_forward_chunk(self, attention_output): class LiltEncoder (line 422) | class LiltEncoder(nn.Module): method __init__ (line 423) | def __init__(self, config): method forward (line 428) | def forward( class LiltPooler (line 478) | class LiltPooler(nn.Module): method __init__ (line 479) | def __init__(self, config): method forward (line 484) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LiltPreTrainedModel (line 494) | class LiltPreTrainedModel(PreTrainedModel): method _init_weights (line 500) | def _init_weights(self, module): class LiltModel (line 507) | class LiltModel(LiltPreTrainedModel): method __init__ (line 508) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 525) | def get_input_embeddings(self): method set_input_embeddings (line 528) | def set_input_embeddings(self, value): method forward (line 532) | def forward( class LiltForSequenceClassification (line 645) | class LiltForSequenceClassification(LiltPreTrainedModel): method __init__ (line 647) | def __init__(self, config): method forward (line 659) | def forward( class LiltForTokenClassification (line 758) | class LiltForTokenClassification(LiltPreTrainedModel): method __init__ (line 760) | def __init__(self, config): method forward (line 775) | def forward( class LiltClassificationHead (line 856) | class LiltClassificationHead(nn.Module): method __init__ (line 859) | def __init__(self, config): method forward (line 868) | def forward(self, features, **kwargs): class LiltForQuestionAnswering (line 879) | class LiltForQuestionAnswering(LiltPreTrainedModel): method __init__ (line 881) | def __init__(self, config): method forward (line 892) | def forward( FILE: src/transformers/models/llama/configuration_llama.py class LlamaConfig (line 31) | class LlamaConfig(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): method validate_architecture (line 94) | def validate_architecture(self): FILE: src/transformers/models/llama/convert_llama_weights_to_hf.py function is_llama_3 (line 166) | def is_llama_3(version): function compute_intermediate_size (line 170) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 174) | def read_json(path): function write_json (line 179) | def write_json(text, path): function write_model (line 184) | def write_model( class Llama3Converter (line 436) | class Llama3Converter(TikTokenConverter): method __init__ (line 437) | def __init__(self, vocab_file, special_tokens=None, instruct=False, ll... method update_post_processor (line 477) | def update_post_processor(self, tokenizer): function write_tokenizer (line 492) | def write_tokenizer( function main (line 522) | def main(): FILE: src/transformers/models/llama/modeling_llama.py class LlamaRMSNorm (line 53) | class LlamaRMSNorm(nn.Module): method __init__ (line 54) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 62) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 69) | def extra_repr(self): class LlamaRotaryEmbedding (line 73) | class LlamaRotaryEmbedding(nn.Module): method __init__ (line 76) | def __init__(self, config: LlamaConfig, device=None): method compute_default_rope_parameters (line 93) | def compute_default_rope_parameters( method forward (line 124) | def forward(self, x, position_ids): 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, unsqueeze_dim=1): class LlamaMLP (line 171) | class LlamaMLP(nn.Module): method __init__ (line 172) | def __init__(self, config): method forward (line 182) | def forward(self, x): function repeat_kv (line 187) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 199) | def eager_attention_forward( class LlamaAttention (line 225) | class LlamaAttention(nn.Module): method __init__ (line 228) | def __init__(self, config: LlamaConfig, layer_idx: int): method forward (line 251) | def forward( class LlamaDecoderLayer (line 292) | class LlamaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 293) | def __init__(self, config: LlamaConfig, layer_idx: int): method forward (line 303) | def forward( class LlamaPreTrainedModel (line 336) | class LlamaPreTrainedModel(PreTrainedModel): class LlamaModel (line 355) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 356) | def __init__(self, config: LlamaConfig): method forward (line 375) | def forward( class LlamaForCausalLM (line 429) | class LlamaForCausalLM(LlamaPreTrainedModel, GenerationMixin): method __init__ (line 434) | def __init__(self, config): method forward (line 445) | def forward( class LlamaForSequenceClassification (line 502) | class LlamaForSequenceClassification(GenericForSequenceClassification, L... class LlamaForQuestionAnswering (line 505) | class LlamaForQuestionAnswering(GenericForQuestionAnswering, LlamaPreTra... class LlamaForTokenClassification (line 509) | class LlamaForTokenClassification(GenericForTokenClassification, LlamaPr... FILE: src/transformers/models/llama/tokenization_llama.py class LlamaTokenizer (line 39) | class LlamaTokenizer(TokenizersBackend): method __init__ (line 92) | def __init__( FILE: src/transformers/models/llama4/configuration_llama4.py class Llama4VisionConfig (line 29) | class Llama4VisionConfig(PreTrainedConfig): class Llama4TextConfig (line 79) | class Llama4TextConfig(PreTrainedConfig): method __post_init__ (line 175) | def __post_init__(self, **kwargs): class Llama4Config (line 207) | class Llama4Config(PreTrainedConfig): method __post_init__ (line 246) | def __post_init__(self, **kwargs): FILE: src/transformers/models/llama4/convert_llama4_weights_to_hf.py function convert_old_keys_to_new_keys (line 93) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function permute_for_rope (line 111) | def permute_for_rope(input_tensor, n_heads, dim1, dim2): function is_param_same_across_shards (line 121) | def is_param_same_across_shards(key): function get_concat_dim (line 146) | def get_concat_dim(key): function compute_intermediate_size (line 169) | def compute_intermediate_size(hidden_dim, ffn_exp=4, multiple_of=1024, f... function safe_load (line 177) | def safe_load(filename): function preprocess_keys (line 185) | def preprocess_keys(state_dict): function max_context_length (line 198) | def max_context_length(model_path, instruct=False): function write_model (line 212) | def write_model( function get_reserved_special_tokens (line 564) | def get_reserved_special_tokens(name, count, start_index=0): class Llama4Converter (line 618) | class Llama4Converter(TikTokenConverter): method __init__ (line 619) | def __init__( method update_post_processor (line 648) | def update_post_processor(self, tokenizer): function write_tokenizer (line 666) | def write_tokenizer(args): FILE: src/transformers/models/llama4/image_processing_llama4.py function get_factors (line 31) | def get_factors(dividend: int) -> set[int]: function get_max_res_without_distortion (line 51) | def get_max_res_without_distortion( function find_supported_resolutions (line 88) | def find_supported_resolutions(max_num_chunks: int, patch_size: SizeDict... function pad_to_best_fit (line 144) | def pad_to_best_fit( function get_best_fit (line 180) | def get_best_fit( class Llama4ImageProcessorKwargs (line 279) | class Llama4ImageProcessorKwargs(ImagesKwargs, total=False): class Llama4ImageProcessor (line 296) | class Llama4ImageProcessor(TorchvisionBackend): method __init__ (line 309) | def __init__(self, **kwargs: Unpack[Llama4ImageProcessorKwargs]): method preprocess (line 313) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Llama4ImageP... method rescale_and_normalize (line 318) | def rescale_and_normalize( method _preprocess (line 341) | def _preprocess( FILE: src/transformers/models/llama4/modeling_llama4.py class Llama4TextExperts (line 56) | class Llama4TextExperts(nn.Module): method __init__ (line 57) | def __init__(self, config: Llama4TextConfig): method forward (line 67) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Llama4TextMLP (line 89) | class Llama4TextMLP(nn.Module): method __init__ (line 90) | def __init__(self, config, intermediate_size=None): method forward (line 102) | def forward(self, x): class Llama4TextL2Norm (line 107) | class Llama4TextL2Norm(torch.nn.Module): method __init__ (line 108) | def __init__(self, eps: float = 1e-6): method _norm (line 112) | def _norm(self, x): method forward (line 115) | def forward(self, x): method extra_repr (line 118) | def extra_repr(self): class Llama4TextRMSNorm (line 122) | class Llama4TextRMSNorm(nn.Module): method __init__ (line 123) | def __init__(self, hidden_size, eps=1e-5): method _norm (line 131) | def _norm(self, x): method forward (line 134) | def forward(self, x): method extra_repr (line 138) | def extra_repr(self): class Llama4Router (line 142) | class Llama4Router(nn.Linear): method __init__ (line 143) | def __init__(self, config): method forward (line 148) | def forward(self, hidden_states): class Llama4TextMoe (line 157) | class Llama4TextMoe(nn.Module): method __init__ (line 158) | def __init__(self, config): method forward (line 167) | def forward(self, hidden_states): class Llama4TextRotaryEmbedding (line 179) | class Llama4TextRotaryEmbedding(nn.Module): method __init__ (line 183) | def __init__(self, config: Llama4TextConfig, device=None): method compute_default_rope_parameters (line 200) | def compute_default_rope_parameters( method forward (line 232) | def forward(self, x, position_ids): function apply_rotary_emb (line 245) | def apply_rotary_emb( function repeat_kv (line 257) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 270) | def eager_attention_forward( function vision_eager_attention_forward (line 296) | def vision_eager_attention_forward( class Llama4TextAttention (line 321) | class Llama4TextAttention(nn.Module): method __init__ (line 324) | def __init__(self, config: Llama4TextConfig, layer_idx): method forward (line 354) | def forward( class Llama4TextDecoderLayer (line 413) | class Llama4TextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 414) | def __init__(self, config, layer_idx): method forward (line 428) | def forward( class Llama4PreTrainedModel (line 464) | class Llama4PreTrainedModel(PreTrainedModel): method _init_weights (line 477) | def _init_weights(self, module): class Llama4TextModel (line 495) | class Llama4TextModel(Llama4PreTrainedModel): method __init__ (line 506) | def __init__(self, config: Llama4TextConfig): method forward (line 526) | def forward( class Llama4ForCausalLM (line 589) | class Llama4ForCausalLM(Llama4PreTrainedModel, GenerationMixin): method __init__ (line 596) | def __init__(self, config: Llama4TextConfig): method forward (line 607) | def forward( class Llama4CausalLMOutputWithPast (line 674) | class Llama4CausalLMOutputWithPast(ModelOutput): class Llama4VisionMLP2 (line 698) | class Llama4VisionMLP2(torch.nn.Module): method __init__ (line 699) | def __init__(self, config): method forward (line 708) | def forward(self, hidden_states): class Llama4MultiModalProjector (line 715) | class Llama4MultiModalProjector(nn.Module): method __init__ (line 716) | def __init__(self, config): method forward (line 724) | def forward(self, image_features): function pixel_shuffle (line 729) | def pixel_shuffle(input_tensor, shuffle_ratio): class Llama4VisionPixelShuffleMLP (line 749) | class Llama4VisionPixelShuffleMLP(nn.Module): method __init__ (line 750) | def __init__(self, config): method forward (line 757) | def forward(self, encoded_patches: torch.Tensor) -> torch.Tensor: function reshape_for_broadcast (line 763) | def reshape_for_broadcast(freqs_ci: torch.Tensor, query: torch.Tensor): function vision_apply_rotary_emb (line 769) | def vision_apply_rotary_emb( class Llama4VisionAttention (line 783) | class Llama4VisionAttention(nn.Module): method __init__ (line 784) | def __init__(self, config: Llama4VisionConfig): method forward (line 799) | def forward( class Llama4VisionMLP (line 841) | class Llama4VisionMLP(nn.Module): method __init__ (line 842) | def __init__(self, config): method forward (line 849) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Llama4VisionEncoderLayer (line 856) | class Llama4VisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 857) | def __init__(self, config: Llama4VisionConfig): method forward (line 867) | def forward( class Llama4VisionEncoder (line 900) | class Llama4VisionEncoder(nn.Module): method __init__ (line 909) | def __init__(self, config: Llama4VisionConfig): method forward (line 916) | def forward( class Llama4UnfoldConvolution (line 982) | class Llama4UnfoldConvolution(nn.Module): method __init__ (line 983) | def __init__(self, config): method forward (line 995) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Llama4VisionRotaryEmbedding (line 1002) | class Llama4VisionRotaryEmbedding(nn.Module): method __init__ (line 1003) | def __init__(self, config: Llama4VisionConfig): method _compute_freqs_ci (line 1009) | def _compute_freqs_ci(config): method forward (line 1028) | def forward(self, hidden_states): class Llama4VisionModel (line 1032) | class Llama4VisionModel(Llama4PreTrainedModel): method __init__ (line 1038) | def __init__(self, config: Llama4VisionConfig): method get_input_embeddings (line 1063) | def get_input_embeddings(self): method forward (line 1069) | def forward( class Llama4ForConditionalGeneration (line 1170) | class Llama4ForConditionalGeneration(Llama4PreTrainedModel, GenerationMi... method __init__ (line 1176) | def __init__(self, config: Llama4Config): method get_input_embeddings (line 1190) | def get_input_embeddings(self): method set_input_embeddings (line 1193) | def set_input_embeddings(self, value): method get_output_embeddings (line 1196) | def get_output_embeddings(self): method set_output_embeddings (line 1199) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 1202) | def set_decoder(self, decoder): method get_decoder (line 1205) | def get_decoder(self): method get_image_features (line 1211) | def get_image_features( method get_placeholder_mask (line 1227) | def get_placeholder_mask( method forward (line 1253) | def forward( method prepare_inputs_for_generation (line 1379) | def prepare_inputs_for_generation( FILE: src/transformers/models/llama4/processing_llama4.py class Llama4ProcessorKwargs (line 24) | class Llama4ProcessorKwargs(ProcessingKwargs, total=False): class Llama4Processor (line 36) | class Llama4Processor(ProcessorMixin): method __init__ (line 37) | def __init__( method _prompt_split_image (line 94) | def _prompt_split_image(self, aspect_ratio, num_patches_per_chunk): method __call__ (line 122) | def __call__( FILE: src/transformers/models/llava/configuration_llava.py class LlavaConfig (line 26) | class LlavaConfig(PreTrainedConfig): method __post_init__ (line 65) | def __post_init__(self, **kwargs): FILE: src/transformers/models/llava/convert_llava_weights_to_hf.py function load_original_state_dict (line 65) | def load_original_state_dict(model_id): function convert_state_dict_to_hf (line 87) | def convert_state_dict_to_hf(state_dict): function convert_llava_llama_to_hf (line 100) | def convert_llava_llama_to_hf(text_model_id, vision_model_id, output_hub... function main (line 176) | def main(): FILE: src/transformers/models/llava/image_processing_llava.py class LlavaImageProcessor (line 38) | class LlavaImageProcessor(TorchvisionBackend): method __init__ (line 52) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method pad_to_square (line 55) | def pad_to_square( method _preprocess (line 97) | def _preprocess( FILE: src/transformers/models/llava/image_processing_pil_llava.py class LlavaImageProcessorPil (line 31) | class LlavaImageProcessorPil(PilBackend): method __init__ (line 45) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method pad_to_square (line 48) | def pad_to_square( method _preprocess (line 93) | def _preprocess( FILE: src/transformers/models/llava/modeling_llava.py class LlavaModelOutputWithPast (line 42) | class LlavaModelOutputWithPast(BaseModelOutputWithPast): class LlavaCausalLMOutputWithPast (line 63) | class LlavaCausalLMOutputWithPast(ModelOutput): class LlavaMultiModalProjector (line 87) | class LlavaMultiModalProjector(nn.Module): method __init__ (line 88) | def __init__(self, config: LlavaConfig): method forward (line 102) | def forward(self, image_features): class LlavaPreTrainedModel (line 110) | class LlavaPreTrainedModel(PreTrainedModel): class LlavaModel (line 130) | class LlavaModel(LlavaPreTrainedModel): method __init__ (line 131) | def __init__(self, config: LlavaConfig): method get_input_embeddings (line 139) | def get_input_embeddings(self): method set_input_embeddings (line 142) | def set_input_embeddings(self, value): method get_image_features (line 150) | def get_image_features( method get_placeholder_mask (line 197) | def get_placeholder_mask( method forward (line 223) | def forward( class LlavaForConditionalGeneration (line 278) | class LlavaForConditionalGeneration(LlavaPreTrainedModel, GenerationMixin): method __init__ (line 281) | def __init__(self, config: LlavaConfig): method get_input_embeddings (line 287) | def get_input_embeddings(self): method set_input_embeddings (line 290) | def set_input_embeddings(self, value): method get_output_embeddings (line 293) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 297) | def get_image_features( method forward (line 313) | def forward( method prepare_inputs_for_generation (line 390) | def prepare_inputs_for_generation( FILE: src/transformers/models/llava/processing_llava.py class LlavaProcessorKwargs (line 33) | class LlavaProcessorKwargs(ProcessingKwargs, total=False): class LlavaProcessor (line 40) | class LlavaProcessor(ProcessorMixin): method __init__ (line 41) | def __init__( method __call__ (line 72) | def __call__( method _get_num_multimodal_tokens (line 132) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/llava_next/configuration_llava_next.py class LlavaNextConfig (line 26) | class LlavaNextConfig(PreTrainedConfig): method __post_init__ (line 68) | def __post_init__(self, **kwargs): FILE: src/transformers/models/llava_next/convert_llava_next_weights_to_hf.py function load_original_state_dict (line 63) | def load_original_state_dict(model_id): function convert_state_dict_to_hf (line 76) | def convert_state_dict_to_hf(state_dict): function load_image (line 89) | def load_image(): function convert_llava_to_hf (line 96) | def convert_llava_to_hf(model_id, pytorch_dump_folder_path, push_to_hub=... FILE: src/transformers/models/llava_next/image_processing_llava_next.py class LlavaNextImageProcessorKwargs (line 41) | class LlavaNextImageProcessorKwargs(ImagesKwargs, total=False): class LlavaNextImageProcessor (line 53) | class LlavaNextImageProcessor(TorchvisionBackend): method __init__ (line 71) | def __init__(self, **kwargs: Unpack[LlavaNextImageProcessorKwargs]): method preprocess (line 75) | def preprocess( method _get_padding_size (line 80) | def _get_padding_size(self, original_resolution: tuple, target_resolut... method _resize_for_patching (line 88) | def _resize_for_patching( method _pad_for_patching (line 105) | def _pad_for_patching(self, image: "torch.Tensor", target_resolution: ... method _get_image_patches (line 114) | def _get_image_patches( method _pad_for_batching (line 148) | def _pad_for_batching( method _preprocess (line 161) | def _preprocess( FILE: src/transformers/models/llava_next/image_processing_pil_llava_next.py class LlavaNextImageProcessorKwargs (line 38) | class LlavaNextImageProcessorKwargs(ImagesKwargs, total=False): class LlavaNextImageProcessorPil (line 50) | class LlavaNextImageProcessorPil(PilBackend): method __init__ (line 68) | def __init__(self, **kwargs: Unpack[LlavaNextImageProcessorKwargs]): method preprocess (line 72) | def preprocess( method _get_padding_size (line 77) | def _get_padding_size(self, original_resolution: tuple, target_resolut... method _resize_for_patching (line 85) | def _resize_for_patching( method _pad_for_patching (line 99) | def _pad_for_patching(self, image: np.ndarray, target_resolution: tupl... method get_image_patches (line 114) | def get_image_patches( method _pad_for_batching (line 146) | def _pad_for_batching( method _preprocess (line 162) | def _preprocess( FILE: src/transformers/models/llava_next/modeling_llava_next.py function get_anyres_image_grid_shape (line 41) | def get_anyres_image_grid_shape(image_size, grid_pinpoints, patch_size): function image_size_to_num_patches (line 72) | def image_size_to_num_patches(image_size, grid_pinpoints, patch_size: int): function unpad_image (line 109) | def unpad_image(tensor, original_size): class LlavaNextModelOutputWithPast (line 154) | class LlavaNextModelOutputWithPast(BaseModelOutputWithPast): class LlavaNextCausalLMOutputWithPast (line 175) | class LlavaNextCausalLMOutputWithPast(ModelOutput): class LlavaNextMultiModalProjector (line 200) | class LlavaNextMultiModalProjector(nn.Module): method __init__ (line 201) | def __init__(self, config: LlavaNextConfig): method forward (line 215) | def forward(self, image_features): class LlavaNextPreTrainedModel (line 223) | class LlavaNextPreTrainedModel(PreTrainedModel): method _init_weights (line 239) | def _init_weights(self, module): class LlavaNextModel (line 256) | class LlavaNextModel(LlavaNextPreTrainedModel): method __init__ (line 259) | def __init__(self, config: LlavaNextConfig): method get_input_embeddings (line 271) | def get_input_embeddings(self): method set_input_embeddings (line 274) | def set_input_embeddings(self, value): method pack_image_features (line 277) | def pack_image_features(self, image_features, image_sizes, vision_feat... method get_image_features (line 349) | def get_image_features( method get_placeholder_mask (line 419) | def get_placeholder_mask( method forward (line 445) | def forward( class LlavaNextForConditionalGeneration (line 508) | class LlavaNextForConditionalGeneration(LlavaNextPreTrainedModel, Genera... method __init__ (line 511) | def __init__(self, config: LlavaNextConfig): method get_input_embeddings (line 517) | def get_input_embeddings(self): method set_input_embeddings (line 520) | def set_input_embeddings(self, value): method get_output_embeddings (line 523) | def get_output_embeddings(self) -> nn.Module: method pack_image_features (line 526) | def pack_image_features(self, image_features, image_sizes, vision_feat... method get_image_features (line 537) | def get_image_features( method forward (line 569) | def forward( method prepare_inputs_for_generation (line 654) | def prepare_inputs_for_generation( FILE: src/transformers/models/llava_next/processing_llava_next.py class LlavaNextProcessorKwargs (line 34) | class LlavaNextProcessorKwargs(ProcessingKwargs, total=False): class LlavaNextProcessor (line 47) | class LlavaNextProcessor(ProcessorMixin): method __init__ (line 48) | def __init__( method __call__ (line 83) | def __call__( method _get_number_of_features (line 145) | def _get_number_of_features(self, orig_height: int, orig_width: int, h... method _get_unpadded_features (line 163) | def _get_unpadded_features(self, height, width, patches_height, patche... method _get_num_multimodal_tokens (line 187) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/llava_next_video/configuration_llava_next_video.py class LlavaNextVideoConfig (line 32) | class LlavaNextVideoConfig(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): FILE: src/transformers/models/llava_next_video/convert_llava_next_video_weights_to_hf.py function load_original_state_dict (line 126) | def load_original_state_dict(model_id): function convert_state_dict_to_hf (line 139) | def convert_state_dict_to_hf(state_dict): function convert_llava_to_hf (line 152) | def convert_llava_to_hf(model_id, pytorch_dump_folder_path, push_to_hub=... FILE: src/transformers/models/llava_next_video/modeling_llava_next_video.py class LlavaNextVideoModelOutputWithPast (line 52) | class LlavaNextVideoModelOutputWithPast(BaseModelOutputWithPast): class LlavaNextVideoCausalLMOutputWithPast (line 78) | class LlavaNextVideoCausalLMOutputWithPast(ModelOutput): class LlavaNextVideoPooler (line 107) | class LlavaNextVideoPooler(nn.Module): method __init__ (line 108) | def __init__(self, config): method forward (line 130) | def forward(self, image_features): class LlavaNextVideoMultiModalProjector (line 141) | class LlavaNextVideoMultiModalProjector(nn.Module): method __init__ (line 142) | def __init__(self, config: LlavaNextVideoConfig): method forward (line 156) | def forward(self, image_features): class LlavaNextVideoPreTrainedModel (line 164) | class LlavaNextVideoPreTrainedModel(PreTrainedModel): method _init_weights (line 184) | def _init_weights(self, module): function get_anyres_image_grid_shape (line 196) | def get_anyres_image_grid_shape(image_size, grid_pinpoints, patch_size): function image_size_to_num_patches (line 227) | def image_size_to_num_patches(image_size, grid_pinpoints, patch_size: int): function unpad_image (line 264) | def unpad_image(tensor, original_size): class LlavaNextVideoModel (line 308) | class LlavaNextVideoModel(LlavaNextVideoPreTrainedModel): method __init__ (line 311) | def __init__( method get_input_embeddings (line 327) | def get_input_embeddings(self): method set_input_embeddings (line 330) | def set_input_embeddings(self, value): method pack_image_features (line 333) | def pack_image_features(self, image_features, image_sizes, vision_feat... method get_image_features (line 405) | def get_image_features( method get_placeholder_mask (line 473) | def get_placeholder_mask( method forward (line 517) | def forward( method get_video_features (line 601) | def get_video_features( class LlavaNextVideoForConditionalGeneration (line 654) | class LlavaNextVideoForConditionalGeneration(LlavaNextVideoPreTrainedMod... method __init__ (line 657) | def __init__(self, config: LlavaNextVideoConfig): method get_input_embeddings (line 663) | def get_input_embeddings(self): method set_input_embeddings (line 666) | def set_input_embeddings(self, value): method get_output_embeddings (line 669) | def get_output_embeddings(self) -> nn.Module: method pack_image_features (line 672) | def pack_image_features(self, image_features, image_sizes, vision_feat... method get_image_features (line 683) | def get_image_features( method forward (line 715) | def forward( method prepare_inputs_for_generation (line 833) | def prepare_inputs_for_generation( method get_video_features (line 872) | def get_video_features( FILE: src/transformers/models/llava_next_video/modular_llava_next_video.py class LlavaNextVideoConfig (line 48) | class LlavaNextVideoConfig(PreTrainedConfig): method __post_init__ (line 99) | def __post_init__(self, **kwargs): class LlavaNextVideoModelOutputWithPast (line 136) | class LlavaNextVideoModelOutputWithPast(LlavaNextModelOutputWithPast): class LlavaNextVideoCausalLMOutputWithPast (line 154) | class LlavaNextVideoCausalLMOutputWithPast(LlavaNextCausalLMOutputWithPa... class LlavaNextVideoPooler (line 176) | class LlavaNextVideoPooler(nn.Module): method __init__ (line 177) | def __init__(self, config): method forward (line 199) | def forward(self, image_features): class LlavaNextVideoMultiModalProjector (line 210) | class LlavaNextVideoMultiModalProjector(LlavaNextMultiModalProjector): class LlavaNextVideoPreTrainedModel (line 214) | class LlavaNextVideoPreTrainedModel(LlavaNextPreTrainedModel): class LlavaNextVideoModel (line 222) | class LlavaNextVideoModel(LlavaNextModel): method __init__ (line 223) | def __init__(self, config: LlavaNextVideoConfig, **super_kwargs): method get_image_features (line 233) | def get_image_features( method get_video_features (line 306) | def get_video_features( method get_placeholder_mask (line 353) | def get_placeholder_mask( method forward (line 397) | def forward( class LlavaNextVideoForConditionalGeneration (line 471) | class LlavaNextVideoForConditionalGeneration(LlavaNextForConditionalGene... method get_video_features (line 475) | def get_video_features( method forward (line 503) | def forward( method prepare_inputs_for_generation (line 621) | def prepare_inputs_for_generation( FILE: src/transformers/models/llava_next_video/processing_llava_next_video.py class LlavaNextVideoProcessorKwargs (line 32) | class LlavaNextVideoProcessorKwargs(ProcessingKwargs, total=False): class LlavaNextVideoProcessor (line 45) | class LlavaNextVideoProcessor(ProcessorMixin): method __init__ (line 48) | def __init__( method __call__ (line 93) | def __call__( method _get_number_of_features (line 175) | def _get_number_of_features(self, orig_height: int, orig_width: int, h... method _get_unpadded_features (line 194) | def _get_unpadded_features(self, height, width, patches_height, patche... method _get_num_multimodal_tokens (line 218) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/llava_next_video/video_processing_llava_next_video.py class LlavaNextVideoVideoProcessor (line 20) | class LlavaNextVideoVideoProcessor(BaseVideoProcessor): FILE: src/transformers/models/llava_onevision/configuration_llava_onevision.py class LlavaOnevisionConfig (line 26) | class LlavaOnevisionConfig(PreTrainedConfig): method __post_init__ (line 74) | def __post_init__(self, **kwargs): FILE: src/transformers/models/llava_onevision/convert_llava_onevision_weights_to_hf.py function load_original_state_dict (line 62) | def load_original_state_dict(model_id): function convert_state_dict_to_hf (line 79) | def convert_state_dict_to_hf(state_dict): function load_image (line 92) | def load_image(): function convert_llava_to_hf (line 99) | def convert_llava_to_hf(model_id, pytorch_dump_folder_path, push_to_hub=... FILE: src/transformers/models/llava_onevision/image_processing_llava_onevision.py class LlavaOnevisionImageProcessorKwargs (line 42) | class LlavaOnevisionImageProcessorKwargs(ImagesKwargs, total=False): class LlavaOnevisionImageProcessor (line 54) | class LlavaOnevisionImageProcessor(TorchvisionBackend): method __init__ (line 71) | def __init__(self, **kwargs: Unpack[LlavaOnevisionImageProcessorKwargs]): method preprocess (line 75) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LlavaOnevisi... method _get_padding_size (line 87) | def _get_padding_size(self, original_resolution: tuple, target_resolut... method _resize_for_patching (line 95) | def _resize_for_patching( method _pad_for_patching (line 112) | def _pad_for_patching(self, image: "torch.Tensor", target_resolution: ... method _get_image_patches (line 121) | def _get_image_patches( method _pad_for_batching (line 155) | def _pad_for_batching( method _preprocess (line 168) | def _preprocess( method pad_to_square (line 255) | def pad_to_square( FILE: src/transformers/models/llava_onevision/image_processing_pil_llava_onevision.py class LlavaOnevisionImageProcessorKwargs (line 39) | class LlavaOnevisionImageProcessorKwargs(ImagesKwargs, total=False): class LlavaOnevisionImageProcessorPil (line 51) | class LlavaOnevisionImageProcessorPil(PilBackend): method __init__ (line 68) | def __init__(self, **kwargs: Unpack[LlavaOnevisionImageProcessorKwargs]): method preprocess (line 72) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LlavaOnevisi... method _get_padding_size (line 84) | def _get_padding_size(self, original_resolution: tuple, target_resolut... method _resize_for_patching (line 92) | def _resize_for_patching( method _pad_for_patching (line 106) | def _pad_for_patching(self, image: np.ndarray, target_resolution: tupl... method get_image_patches (line 121) | def get_image_patches( method _pad_for_batching (line 153) | def _pad_for_batching( method _preprocess (line 169) | def _preprocess( method pad_to_square (line 261) | def pad_to_square( FILE: src/transformers/models/llava_onevision/modeling_llava_onevision.py class LlavaOnevisionModelOutputWithPast (line 49) | class LlavaOnevisionModelOutputWithPast(BaseModelOutputWithPast): class LlavaOnevisionCausalLMOutputWithPast (line 75) | class LlavaOnevisionCausalLMOutputWithPast(ModelOutput): class LlavaOnevisionPreTrainedModel (line 105) | class LlavaOnevisionPreTrainedModel(PreTrainedModel): method _init_weights (line 125) | def _init_weights(self, module): class LlavaOnevisionMultiModalProjector (line 137) | class LlavaOnevisionMultiModalProjector(nn.Module): method __init__ (line 138) | def __init__(self, config: LlavaOnevisionConfig): method forward (line 152) | def forward(self, image_features): function get_anyres_image_grid_shape (line 159) | def get_anyres_image_grid_shape(image_size, grid_pinpoints, patch_size): function image_size_to_num_patches (line 190) | def image_size_to_num_patches(image_size, grid_pinpoints, patch_size: int): function unpad_image (line 227) | def unpad_image(tensor, original_size): class LlavaOnevisionModel (line 271) | class LlavaOnevisionModel(LlavaOnevisionPreTrainedModel): method __init__ (line 274) | def __init__(self, config): method get_input_embeddings (line 286) | def get_input_embeddings(self): method set_input_embeddings (line 289) | def set_input_embeddings(self, value): method pack_image_features (line 292) | def pack_image_features(self, image_features, image_sizes, image_newli... method get_image_features (line 362) | def get_image_features( method get_placeholder_mask (line 434) | def get_placeholder_mask( method forward (line 478) | def forward( method get_video_features (line 568) | def get_video_features( method apply_pooling (line 614) | def apply_pooling(self, image_features): class LlavaOnevisionForConditionalGeneration (line 634) | class LlavaOnevisionForConditionalGeneration(LlavaOnevisionPreTrainedMod... method __init__ (line 637) | def __init__(self, config: LlavaOnevisionConfig): method get_input_embeddings (line 643) | def get_input_embeddings(self): method set_input_embeddings (line 646) | def set_input_embeddings(self, value): method get_output_embeddings (line 649) | def get_output_embeddings(self) -> nn.Module: method pack_image_features (line 652) | def pack_image_features(self, image_features, image_sizes, vision_feat... method get_image_features (line 663) | def get_image_features( method forward (line 694) | def forward( method prepare_inputs_for_generation (line 798) | def prepare_inputs_for_generation( method get_video_features (line 839) | def get_video_features( FILE: src/transformers/models/llava_onevision/modular_llava_onevision.py class LlavaOnevisionImageProcessorKwargs (line 58) | class LlavaOnevisionImageProcessorKwargs(LlavaNextImageProcessorKwargs): class LlavaOnevisionImageProcessor (line 62) | class LlavaOnevisionImageProcessor(LlavaNextImageProcessor): method pad_to_square (line 78) | def pad_to_square( method preprocess (line 121) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LlavaOnevisi... method _preprocess (line 133) | def _preprocess( class LlavaOnevisionImageProcessorKwargs (line 220) | class LlavaOnevisionImageProcessorKwargs(ImagesKwargs, total=False): class LlavaOnevisionImageProcessorPil (line 231) | class LlavaOnevisionImageProcessorPil(LlavaNextImageProcessorPil): method pad_to_square (line 247) | def pad_to_square( method preprocess (line 293) | def preprocess(self, images: ImageInput, **kwargs: Unpack[LlavaOnevisi... method _preprocess (line 305) | def _preprocess( class LlavaOnevisionModelOutputWithPast (line 398) | class LlavaOnevisionModelOutputWithPast(LlavaNextVideoModelOutputWithPast): class LlavaOnevisionCausalLMOutputWithPast (line 402) | class LlavaOnevisionCausalLMOutputWithPast(LlavaNextVideoCausalLMOutputW... class LlavaOnevisionPreTrainedModel (line 406) | class LlavaOnevisionPreTrainedModel(LlavaNextVideoPreTrainedModel): class LlavaOnevisionModel (line 410) | class LlavaOnevisionModel(LlavaNextVideoModel): method __init__ (line 411) | def __init__(self, config): method pack_image_features (line 415) | def pack_image_features(self, image_features, image_sizes, image_newli... method apply_pooling (line 480) | def apply_pooling(self, image_features): method get_image_features (line 499) | def get_image_features( method get_video_features (line 576) | def get_video_features( method forward (line 625) | def forward( class LlavaOnevisionForConditionalGeneration (line 711) | class LlavaOnevisionForConditionalGeneration(LlavaNextVideoForConditiona... method forward (line 715) | def forward( method prepare_inputs_for_generation (line 819) | def prepare_inputs_for_generation( method get_image_features (line 860) | def get_image_features( FILE: src/transformers/models/llava_onevision/processing_llava_onevision.py class LlavaOnevisionProcessorKwargs (line 35) | class LlavaOnevisionProcessorKwargs(ProcessingKwargs, total=False): class LlavaOnevisionProcessor (line 47) | class LlavaOnevisionProcessor(ProcessorMixin): method __init__ (line 48) | def __init__( method __call__ (line 92) | def __call__( method _expand_image_tokens (line 162) | def _expand_image_tokens( method _get_number_of_features (line 197) | def _get_number_of_features(self, orig_height: int, orig_width: int, h... method _get_unpadded_features (line 216) | def _get_unpadded_features(self, height, width, patches_height, patche... method _get_num_multimodal_tokens (line 247) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... FILE: src/transformers/models/llava_onevision/video_processing_llava_onevision.py class LlavaOnevisionVideoProcessor (line 20) | class LlavaOnevisionVideoProcessor(BaseVideoProcessor): FILE: src/transformers/models/longcat_flash/configuration_longcat_flash.py class LongcatFlashConfig (line 26) | class LongcatFlashConfig(PreTrainedConfig): method __post_init__ (line 108) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 117) | def convert_rope_params_to_dict(self, **kwargs): FILE: src/transformers/models/longcat_flash/modeling_longcat_flash.py class LongcatFlashRMSNorm (line 48) | class LongcatFlashRMSNorm(nn.Module): method __init__ (line 49) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 57) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 64) | def extra_repr(self): class LongcatFlashRotaryEmbedding (line 68) | class LongcatFlashRotaryEmbedding(nn.Module): method __init__ (line 71) | def __init__(self, config: LongcatFlashConfig, device=None): method compute_default_rope_parameters (line 88) | def compute_default_rope_parameters( method forward (line 119) | def forward(self, x, position_ids): class LongcatFlashMLP (line 133) | class LongcatFlashMLP(nn.Module): method __init__ (line 134) | def __init__(self, config, hidden_size=None, intermediate_size=None): method forward (line 144) | def forward(self, x): class LongcatFlashTopkRouter (line 149) | class LongcatFlashTopkRouter(nn.Module): method __init__ (line 150) | def __init__(self, config): method forward (line 161) | def forward(self, hidden_states): method get_topk_indices (line 171) | def get_topk_indices(self, scores): class LongcatFlashExperts (line 177) | class LongcatFlashExperts(nn.Module): method __init__ (line 178) | def __init__(self, config): method forward (line 199) | def forward(self, hidden_states, top_k_index, top_k_weights): class LongcatFlashMoE (line 227) | class LongcatFlashMoE(nn.Module): method __init__ (line 232) | def __init__(self, config): method forward (line 240) | def forward(self, hidden_states): function rotate_half (line 248) | def rotate_half(x): function repeat_kv (line 255) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 267) | def eager_attention_forward( function apply_rotary_pos_emb_interleave (line 292) | def apply_rotary_pos_emb_interleave(q, k, cos, sin, position_ids=None, u... function yarn_get_mscale (line 330) | def yarn_get_mscale(scale=1, mscale=1): class LongcatFlashMLA (line 336) | class LongcatFlashMLA(nn.Module): method __init__ (line 339) | def __init__(self, config, layer_idx: int): method forward (line 391) | def forward( class LongcatFlashDecoderLayer (line 457) | class LongcatFlashDecoderLayer(GradientCheckpointingLayer): method __init__ (line 467) | def __init__(self, config, layer_idx: int): method forward (line 483) | def forward( class LongcatFlashPreTrainedModel (line 539) | class LongcatFlashPreTrainedModel(PreTrainedModel): method _init_weights (line 560) | def _init_weights(self, module): class LongcatFlashModel (line 572) | class LongcatFlashModel(LongcatFlashPreTrainedModel): method __init__ (line 573) | def __init__(self, config): method forward (line 596) | def forward( class LongcatFlashForCausalLM (line 651) | class LongcatFlashForCausalLM(LongcatFlashPreTrainedModel, GenerationMix... method __init__ (line 657) | def __init__(self, config): method forward (line 668) | def forward( FILE: src/transformers/models/longcat_flash/modular_longcat_flash.py class LongcatFlashRMSNorm (line 49) | class LongcatFlashRMSNorm(DeepseekV3RMSNorm): class LongcatFlashRotaryEmbedding (line 53) | class LongcatFlashRotaryEmbedding(DeepseekV3RotaryEmbedding): class LongcatFlashMLP (line 58) | class LongcatFlashMLP(DeepseekV3MLP): method __init__ (line 59) | def __init__(self, config, hidden_size=None, intermediate_size=None): class LongcatFlashTopkRouter (line 66) | class LongcatFlashTopkRouter(DeepseekV3TopkRouter): method __init__ (line 67) | def __init__(self, config): method get_topk_indices (line 82) | def get_topk_indices(self, scores): method forward (line 87) | def forward(self, hidden_states): class LongcatFlashExperts (line 97) | class LongcatFlashExperts(nn.Module): method __init__ (line 98) | def __init__(self, config): method forward (line 119) | def forward(self, hidden_states, top_k_index, top_k_weights): class LongcatFlashMoE (line 147) | class LongcatFlashMoE(nn.Module): method __init__ (line 152) | def __init__(self, config): method forward (line 160) | def forward(self, hidden_states): class LongcatFlashMLA (line 168) | class LongcatFlashMLA(DeepseekV3Attention): method __init__ (line 169) | def __init__(self, config, layer_idx: int): method forward (line 175) | def forward( class LongcatFlashDecoderLayer (line 241) | class LongcatFlashDecoderLayer(GradientCheckpointingLayer): method __init__ (line 251) | def __init__(self, config, layer_idx: int): method forward (line 267) | def forward( class LongcatFlashPreTrainedModel (line 323) | class LongcatFlashPreTrainedModel(PreTrainedModel): method _init_weights (line 344) | def _init_weights(self, module): class LongcatFlashModel (line 355) | class LongcatFlashModel(DeepseekV3Model): method __init__ (line 356) | def __init__(self, config): method forward (line 372) | def forward( class LongcatFlashForCausalLM (line 426) | class LongcatFlashForCausalLM(DeepseekV3ForCausalLM): method __init__ (line 429) | def __init__(self, config): FILE: src/transformers/models/longformer/configuration_longformer.py class LongformerConfig (line 24) | class LongformerConfig(PreTrainedConfig): FILE: src/transformers/models/longformer/convert_longformer_original_pytorch_lightning_to_pytorch.py class LightningModel (line 25) | class LightningModel(pl.LightningModule): method __init__ (line 26) | def __init__(self, model): method forward (line 33) | def forward(self): function convert_longformer_qa_checkpoint_to_pytorch (line 37) | def convert_longformer_qa_checkpoint_to_pytorch( FILE: src/transformers/models/longformer/modeling_longformer.py class LongformerBaseModelOutput (line 40) | class LongformerBaseModelOutput(ModelOutput): class LongformerBaseModelOutputWithPooling (line 78) | class LongformerBaseModelOutputWithPooling(ModelOutput): class LongformerMaskedLMOutput (line 121) | class LongformerMaskedLMOutput(ModelOutput): class LongformerQuestionAnsweringModelOutput (line 164) | class LongformerQuestionAnsweringModelOutput(ModelOutput): class LongformerSequenceClassifierOutput (line 206) | class LongformerSequenceClassifierOutput(ModelOutput): class LongformerMultipleChoiceModelOutput (line 249) | class LongformerMultipleChoiceModelOutput(ModelOutput): class LongformerTokenClassifierOutput (line 294) | class LongformerTokenClassifierOutput(ModelOutput): function _get_question_end_index (line 331) | def _get_question_end_index(input_ids, sep_token_id): function _compute_global_attention_mask (line 347) | def _compute_global_attention_mask(input_ids, sep_token_id, before_sep_t... function create_position_ids_from_input_ids (line 367) | def create_position_ids_from_input_ids(input_ids, padding_idx): class LongformerEmbeddings (line 383) | class LongformerEmbeddings(nn.Module): method __init__ (line 388) | def __init__(self, config): method forward (line 401) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... method create_position_ids_from_inputs_embeds (line 427) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): class LongformerSelfAttention (line 445) | class LongformerSelfAttention(nn.Module): method __init__ (line 446) | def __init__(self, config, layer_id): method forward (line 481) | def forward( method _pad_and_transpose_last_two_dims (line 642) | def _pad_and_transpose_last_two_dims(hidden_states_padded, padding): method _pad_and_diagonalize (line 653) | def _pad_and_diagonalize(chunked_hidden_states): method _chunk (line 702) | def _chunk(hidden_states, window_overlap, onnx_export: bool = False): method _mask_invalid_locations (line 743) | def _mask_invalid_locations(input_tensor, affected_seq_len) -> torch.T... method _sliding_chunks_query_key_matmul (line 758) | def _sliding_chunks_query_key_matmul(self, query: torch.Tensor, key: t... method _sliding_chunks_matmul_attn_probs_value (line 824) | def _sliding_chunks_matmul_attn_probs_value( method _get_global_attn_indices (line 869) | def _get_global_attn_indices(is_index_global_attn): method _concat_with_global_key_attn_probs (line 897) | def _concat_with_global_key_attn_probs( method _compute_attn_output_with_global_indices (line 927) | def _compute_attn_output_with_global_indices( method _compute_global_attn_output_from_hidden (line 963) | def _compute_global_attn_output_from_hidden( class LongformerSelfOutput (line 1060) | class LongformerSelfOutput(nn.Module): method __init__ (line 1061) | def __init__(self, config): method forward (line 1067) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LongformerAttention (line 1074) | class LongformerAttention(nn.Module): method __init__ (line 1075) | def __init__(self, config, layer_id=0): method forward (line 1080) | def forward( class LongformerIntermediate (line 1103) | class LongformerIntermediate(nn.Module): method __init__ (line 1104) | def __init__(self, config): method forward (line 1112) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LongformerOutput (line 1119) | class LongformerOutput(nn.Module): method __init__ (line 1120) | def __init__(self, config): method forward (line 1126) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LongformerLayer (line 1133) | class LongformerLayer(GradientCheckpointingLayer): method __init__ (line 1134) | def __init__(self, config, layer_id=0): method forward (line 1142) | def forward( method ff_chunk (line 1168) | def ff_chunk(self, attn_output): class LongformerEncoder (line 1174) | class LongformerEncoder(nn.Module): method __init__ (line 1175) | def __init__(self, config): method forward (line 1181) | def forward( class LongformerPooler (line 1248) | class LongformerPooler(nn.Module): method __init__ (line 1249) | def __init__(self, config): method forward (line 1254) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LongformerLMHead (line 1264) | class LongformerLMHead(nn.Module): method __init__ (line 1267) | def __init__(self, config): method forward (line 1275) | def forward(self, features, **kwargs): class LongformerPreTrainedModel (line 1287) | class LongformerPreTrainedModel(PreTrainedModel): class LongformerModel (line 1295) | class LongformerModel(LongformerPreTrainedModel): method __init__ (line 1311) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 1336) | def get_input_embeddings(self): method set_input_embeddings (line 1339) | def set_input_embeddings(self, value): method _pad_to_window_size (line 1342) | def _pad_to_window_size( method _merge_to_attention_mask (line 1391) | def _merge_to_attention_mask(self, attention_mask: torch.Tensor, globa... method forward (line 1404) | def forward( class LongformerForMaskedLM (line 1535) | class LongformerForMaskedLM(LongformerPreTrainedModel): method __init__ (line 1541) | def __init__(self, config): method get_output_embeddings (line 1550) | def get_output_embeddings(self): method set_output_embeddings (line 1553) | def set_output_embeddings(self, new_embeddings): method forward (line 1557) | def forward( class LongformerForSequenceClassification (line 1656) | class LongformerForSequenceClassification(LongformerPreTrainedModel): method __init__ (line 1657) | def __init__(self, config): method forward (line 1669) | def forward( class LongformerClassificationHead (line 1759) | class LongformerClassificationHead(nn.Module): method __init__ (line 1762) | def __init__(self, config): method forward (line 1768) | def forward(self, hidden_states, **kwargs): class LongformerForQuestionAnswering (line 1779) | class LongformerForQuestionAnswering(LongformerPreTrainedModel): method __init__ (line 1780) | def __init__(self, config): method forward (line 1791) | def forward( class LongformerForTokenClassification (line 1908) | class LongformerForTokenClassification(LongformerPreTrainedModel): method __init__ (line 1909) | def __init__(self, config): method forward (line 1921) | def forward( class LongformerForMultipleChoice (line 1989) | class LongformerForMultipleChoice(LongformerPreTrainedModel): method __init__ (line 1990) | def __init__(self, config): method forward (line 2001) | def forward( FILE: src/transformers/models/longt5/configuration_longt5.py class LongT5Config (line 24) | class LongT5Config(PreTrainedConfig): method __post_init__ (line 78) | def __post_init__(self, **kwargs): method validate_architecture (line 89) | def validate_architecture(self): FILE: src/transformers/models/longt5/modeling_longt5.py function _pad_to_multiple (line 53) | def _pad_to_multiple(x: torch.Tensor, block_len: int, dim: int, pad_valu... function _split_into_blocks (line 69) | def _split_into_blocks(x: torch.Tensor, block_len: int, dim: int) -> tor... function _concatenate_3_blocks (line 84) | def _concatenate_3_blocks(x: torch.Tensor, block_dim: int, sequence_dim:... function _make_3block_relative_position_ids (line 109) | def _make_3block_relative_position_ids(block_len: int) -> torch.Tensor: function _mask_local_attention_mask (line 118) | def _mask_local_attention_mask(local_attention_mask: torch.Tensor, block... function _get_local_attention_mask (line 127) | def _get_local_attention_mask(attention_mask: torch.Tensor, block_len: i... function _make_global_fixed_block_ids (line 143) | def _make_global_fixed_block_ids( function _make_side_relative_position_ids (line 192) | def _make_side_relative_position_ids(attention_mask: torch.Tensor, globa... function _create_global_aggregates (line 201) | def _create_global_aggregates( class LongT5LayerNorm (line 214) | class LongT5LayerNorm(nn.Module): method __init__ (line 215) | def __init__(self, hidden_size, eps=1e-6): method forward (line 223) | def forward(self, hidden_states): class LongT5DenseActDense (line 253) | class LongT5DenseActDense(nn.Module): method __init__ (line 254) | def __init__(self, config: LongT5Config): method forward (line 261) | def forward(self, hidden_states): class LongT5DenseGatedActDense (line 275) | class LongT5DenseGatedActDense(nn.Module): method __init__ (line 276) | def __init__(self, config: LongT5Config): method forward (line 284) | def forward(self, hidden_states): class LongT5LayerFF (line 294) | class LongT5LayerFF(nn.Module): method __init__ (line 295) | def __init__(self, config: LongT5Config): method forward (line 305) | def forward(self, hidden_states): class LongT5Attention (line 313) | class LongT5Attention(nn.Module): method __init__ (line 314) | def __init__( method _relative_position_bucket (line 349) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 396) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 413) | def forward( class LongT5LocalAttention (line 507) | class LongT5LocalAttention(nn.Module): method __init__ (line 508) | def __init__(self, config: LongT5Config, has_relative_attention_bias: ... method _relative_position_bucket (line 534) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 581) | def compute_bias(self, block_length: int): method forward (line 605) | def forward( class LongT5TransientGlobalAttention (line 679) | class LongT5TransientGlobalAttention(nn.Module): method __init__ (line 680) | def __init__(self, config: LongT5Config, has_relative_attention_bias: ... method _relative_position_bucket (line 710) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 757) | def compute_bias(self, block_length: int): method compute_side_bias (line 781) | def compute_side_bias(self, mask: torch.Tensor, global_segment_ids: to... method forward (line 802) | def forward( class LongT5LayerSelfAttention (line 919) | class LongT5LayerSelfAttention(nn.Module): method __init__ (line 920) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 928) | def forward( class LongT5LayerLocalSelfAttention (line 952) | class LongT5LayerLocalSelfAttention(nn.Module): method __init__ (line 955) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 961) | def forward( class LongT5LayerTransientGlobalSelfAttention (line 981) | class LongT5LayerTransientGlobalSelfAttention(nn.Module): method __init__ (line 984) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 992) | def forward( class LongT5LayerCrossAttention (line 1013) | class LongT5LayerCrossAttention(nn.Module): method __init__ (line 1014) | def __init__(self, config, layer_idx: int | None = None): method forward (line 1020) | def forward( class LongT5Block (line 1044) | class LongT5Block(GradientCheckpointingLayer): method __init__ (line 1045) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 1068) | def forward( class LongT5PreTrainedModel (line 1132) | class LongT5PreTrainedModel(PreTrainedModel): method dummy_inputs (line 1142) | def dummy_inputs(self): method _init_weights (line 1153) | def _init_weights(self, module): method _shift_right (line 1195) | def _shift_right(self, input_ids): class LongT5Stack (line 1217) | class LongT5Stack(LongT5PreTrainedModel): method __init__ (line 1218) | def __init__(self, config): method set_input_embeddings (line 1242) | def set_input_embeddings(self, new_embeddings): method forward (line 1245) | def forward( class LongT5Model (line 1407) | class LongT5Model(LongT5PreTrainedModel): method __init__ (line 1416) | def __init__(self, config: LongT5Config): method get_input_embeddings (line 1433) | def get_input_embeddings(self): method set_input_embeddings (line 1436) | def set_input_embeddings(self, new_embeddings): method forward (line 1442) | def forward( class LongT5ForConditionalGeneration (line 1563) | class LongT5ForConditionalGeneration(LongT5PreTrainedModel, GenerationMi... method __init__ (line 1573) | def __init__(self, config: LongT5Config): method get_input_embeddings (line 1594) | def get_input_embeddings(self): method set_input_embeddings (line 1597) | def set_input_embeddings(self, new_embeddings): method forward (line 1603) | def forward( method prepare_decoder_input_ids_from_labels (line 1743) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class LongT5EncoderModel (line 1748) | class LongT5EncoderModel(LongT5PreTrainedModel): method __init__ (line 1754) | def __init__(self, config: LongT5Config): method get_input_embeddings (line 1765) | def get_input_embeddings(self): method set_input_embeddings (line 1768) | def set_input_embeddings(self, new_embeddings): method forward (line 1773) | def forward( FILE: src/transformers/models/luke/configuration_luke.py class LukeConfig (line 24) | class LukeConfig(PreTrainedConfig): FILE: src/transformers/models/luke/convert_luke_original_pytorch_checkpoint_to_pytorch.py function convert_luke_checkpoint (line 27) | def convert_luke_checkpoint(checkpoint_path, metadata_path, entity_vocab... function load_entity_vocab (line 133) | def load_entity_vocab(entity_vocab_path): FILE: src/transformers/models/luke/modeling_luke.py class BaseLukeModelOutputWithPooling (line 42) | class BaseLukeModelOutputWithPooling(BaseModelOutputWithPooling): class BaseLukeModelOutput (line 65) | class BaseLukeModelOutput(BaseModelOutput): class LukeMaskedLMOutput (line 85) | class LukeMaskedLMOutput(ModelOutput): class EntityClassificationOutput (line 119) | class EntityClassificationOutput(ModelOutput): class EntityPairClassificationOutput (line 144) | class EntityPairClassificationOutput(ModelOutput): class EntitySpanClassificationOutput (line 169) | class EntitySpanClassificationOutput(ModelOutput): class LukeSequenceClassifierOutput (line 194) | class LukeSequenceClassifierOutput(ModelOutput): class LukeTokenClassifierOutput (line 219) | class LukeTokenClassifierOutput(ModelOutput): class LukeQuestionAnsweringModelOutput (line 244) | class LukeQuestionAnsweringModelOutput(ModelOutput): class LukeMultipleChoiceModelOutput (line 268) | class LukeMultipleChoiceModelOutput(ModelOutput): class LukeEmbeddings (line 289) | class LukeEmbeddings(nn.Module): method __init__ (line 294) | def __init__(self, config): method forward (line 309) | def forward( method create_position_ids_from_inputs_embeds (line 342) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): class LukeEntityEmbeddings (line 360) | class LukeEntityEmbeddings(nn.Module): method __init__ (line 361) | def __init__(self, config: LukeConfig): method forward (line 375) | def forward( class LukeSelfAttention (line 403) | class LukeSelfAttention(nn.Module): method __init__ (line 404) | def __init__(self, config): method transpose_for_scores (line 428) | def transpose_for_scores(self, x): method forward (line 433) | def forward( class LukeSelfOutput (line 512) | class LukeSelfOutput(nn.Module): method __init__ (line 513) | def __init__(self, config): method forward (line 519) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LukeAttention (line 526) | class LukeAttention(nn.Module): method __init__ (line 527) | def __init__(self, config): method forward (line 532) | def forward( class LukeIntermediate (line 568) | class LukeIntermediate(nn.Module): method __init__ (line 569) | def __init__(self, config): method forward (line 577) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LukeOutput (line 584) | class LukeOutput(nn.Module): method __init__ (line 585) | def __init__(self, config): method forward (line 591) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class LukeLayer (line 598) | class LukeLayer(GradientCheckpointingLayer): method __init__ (line 599) | def __init__(self, config): method forward (line 607) | def forward( method feed_forward_chunk (line 642) | def feed_forward_chunk(self, attention_output): class LukeEncoder (line 648) | class LukeEncoder(nn.Module): method __init__ (line 649) | def __init__(self, config): method forward (line 655) | def forward( class LukePooler (line 714) | class LukePooler(nn.Module): method __init__ (line 715) | def __init__(self, config): method forward (line 720) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EntityPredictionHeadTransform (line 729) | class EntityPredictionHeadTransform(nn.Module): method __init__ (line 730) | def __init__(self, config): method forward (line 739) | def forward(self, hidden_states): class EntityPredictionHead (line 746) | class EntityPredictionHead(nn.Module): method __init__ (line 747) | def __init__(self, config): method forward (line 754) | def forward(self, hidden_states): class LukePreTrainedModel (line 762) | class LukePreTrainedModel(PreTrainedModel): method _init_weights (line 769) | def _init_weights(self, module: nn.Module): class LukeModel (line 793) | class LukeModel(LukePreTrainedModel): method __init__ (line 794) | def __init__(self, config: LukeConfig, add_pooling_layer: bool = True): method get_input_embeddings (line 811) | def get_input_embeddings(self): method set_input_embeddings (line 814) | def set_input_embeddings(self, value): method get_entity_embeddings (line 817) | def get_entity_embeddings(self): method set_entity_embeddings (line 820) | def set_entity_embeddings(self, value): method forward (line 824) | def forward( method get_extended_attention_mask (line 971) | def get_extended_attention_mask( function create_position_ids_from_input_ids (line 1002) | def create_position_ids_from_input_ids(input_ids, padding_idx): class LukeLMHead (line 1019) | class LukeLMHead(nn.Module): method __init__ (line 1022) | def __init__(self, config): method forward (line 1030) | def forward(self, features, **kwargs): class LukeForMaskedLM (line 1047) | class LukeForMaskedLM(LukePreTrainedModel): method __init__ (line 1053) | def __init__(self, config): method get_output_embeddings (line 1066) | def get_output_embeddings(self): method set_output_embeddings (line 1069) | def set_output_embeddings(self, new_embeddings): method forward (line 1073) | def forward( class LukeForEntityClassification (line 1194) | class LukeForEntityClassification(LukePreTrainedModel): method __init__ (line 1195) | def __init__(self, config): method forward (line 1208) | def forward( class LukeForEntityPairClassification (line 1323) | class LukeForEntityPairClassification(LukePreTrainedModel): method __init__ (line 1324) | def __init__(self, config): method forward (line 1337) | def forward( class LukeForEntitySpanClassification (line 1457) | class LukeForEntitySpanClassification(LukePreTrainedModel): method __init__ (line 1458) | def __init__(self, config): method forward (line 1471) | def forward( class LukeForSequenceClassification (line 1615) | class LukeForSequenceClassification(LukePreTrainedModel): method __init__ (line 1616) | def __init__(self, config): method forward (line 1629) | def forward( class LukeForTokenClassification (line 1741) | class LukeForTokenClassification(LukePreTrainedModel): method __init__ (line 1742) | def __init__(self, config): method forward (line 1756) | def forward( class LukeForQuestionAnswering (line 1844) | class LukeForQuestionAnswering(LukePreTrainedModel): method __init__ (line 1845) | def __init__(self, config): method forward (line 1857) | def forward( class LukeForMultipleChoice (line 1962) | class LukeForMultipleChoice(LukePreTrainedModel): method __init__ (line 1963) | def __init__(self, config): method forward (line 1976) | def forward( FILE: src/transformers/models/luke/tokenization_luke.py class LukeTokenizer (line 131) | class LukeTokenizer(TokenizersBackend): method __init__ (line 235) | def __init__( method build_inputs_with_special_tokens (line 387) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 392) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 399) | def create_token_type_ids_from_sequences( method _decode (line 404) | def _decode( method __call__ (line 426) | def __call__( method _encode_plus (line 617) | def _encode_plus( method _batch_encode_plus (line 724) | def _batch_encode_plus( method _check_entity_input_format (line 871) | def _check_entity_input_format(self, entities: EntityInput | None, ent... method _create_input_sequence (line 889) | def _create_input_sequence( method _batch_prepare_for_model (line 1041) | def _batch_prepare_for_model( method prepare_for_model (line 1126) | def prepare_for_model( method pad (line 1357) | def pad( method _pad (line 1519) | def _pad( FILE: src/transformers/models/lw_detr/configuration_lw_detr.py class LwDetrViTConfig (line 32) | class LwDetrViTConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 84) | def __post_init__(self, **kwargs): method validate_architecture (line 92) | def validate_architecture(self): class LwDetrConfig (line 106) | class LwDetrConfig(PreTrainedConfig): method __post_init__ (line 188) | def __post_init__(self, **kwargs): method validate_architecture (line 207) | def validate_architecture(self): FILE: src/transformers/models/lw_detr/convert_lw_detr_to_hf.py function delete_positional_embeddings_keys (line 192) | def delete_positional_embeddings_keys(state_dict): function convert_old_keys_to_new_keys (line 199) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None, ke... function backbone_read_in_q_k_v (line 216) | def backbone_read_in_q_k_v(state_dict, config): function read_in_q_k_v (line 235) | def read_in_q_k_v(state_dict, config): function get_model_config (line 251) | def get_model_config(model_name: str): function get_backbone_projector_sampling_key_mapping (line 275) | def get_backbone_projector_sampling_key_mapping(config: LwDetrConfig): function prepare_img (line 297) | def prepare_img(): function original_preprocess_image (line 305) | def original_preprocess_image(image_url): function test_models_outputs (line 316) | def test_models_outputs(model: LwDetrForObjectDetection, image_processor... function convert_lw_detr_checkpoint (line 406) | def convert_lw_detr_checkpoint( function main (line 499) | def main(): FILE: src/transformers/models/lw_detr/modeling_lw_detr.py function eager_attention_forward (line 45) | def eager_attention_forward( function repeat_kv (line 70) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class LwDetrViTSelfAttention (line 82) | class LwDetrViTSelfAttention(nn.Module): method __init__ (line 83) | def __init__(self, config: LwDetrViTConfig): method forward (line 104) | def forward( class LwDetrViTAttention (line 138) | class LwDetrViTAttention(nn.Module): method __init__ (line 139) | def __init__(self, config: LwDetrViTConfig): method forward (line 149) | def forward( class LwDetrViTMlp (line 159) | class LwDetrViTMlp(nn.Module): method __init__ (line 160) | def __init__(self, config, in_features: int, hidden_features: int) -> ... method forward (line 167) | def forward(self, x: torch.Tensor) -> torch.Tensor: class LwDetrViTLayer (line 177) | class LwDetrViTLayer(GradientCheckpointingLayer): method __init__ (line 178) | def __init__( method forward (line 197) | def forward( class LwDetrViTEmbeddings (line 227) | class LwDetrViTEmbeddings(nn.Module): method __init__ (line 233) | def __init__(self, config): method get_absolute_positions (line 255) | def get_absolute_positions(self, abs_pos_embeddings, has_cls_token, he... method forward (line 293) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class LwDetrViTPreTrainedModel (line 316) | class LwDetrViTPreTrainedModel(PreTrainedModel): method _init_weights (line 333) | def _init_weights(self, module) -> None: class LwDetrViTEncoder (line 349) | class LwDetrViTEncoder(LwDetrViTPreTrainedModel): method __init__ (line 350) | def __init__(self, config: LwDetrViTConfig): method forward (line 357) | def forward( class LwDetrViTBackbone (line 369) | class LwDetrViTBackbone(BackboneMixin, LwDetrViTPreTrainedModel): method __init__ (line 370) | def __init__(self, config): method get_input_embeddings (line 380) | def get_input_embeddings(self) -> LwDetrViTEmbeddings: method forward (line 386) | def forward(self, pixel_values: torch.Tensor, **kwargs: Unpack[Transfo... class LwDetrConvNormLayer (line 454) | class LwDetrConvNormLayer(nn.Module): method __init__ (line 455) | def __init__( method forward (line 476) | def forward(self, hidden_state): class LwDetrRepVggBlock (line 483) | class LwDetrRepVggBlock(nn.Module): method __init__ (line 484) | def __init__(self, config: LwDetrConfig): method forward (line 494) | def forward(self, x: torch.Tensor) -> torch.Tensor: class LwDetrC2FLayer (line 500) | class LwDetrC2FLayer(nn.Module): method __init__ (line 502) | def __init__(self, config: LwDetrConfig, in_channels: int): method forward (line 518) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LwDetrLayerNorm (line 532) | class LwDetrLayerNorm(nn.LayerNorm): method __init__ (line 538) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 544) | def forward(self, features: torch.Tensor) -> torch.Tensor: class LwDetrSamplingLayer (line 558) | class LwDetrSamplingLayer(nn.Module): method __init__ (line 559) | def __init__(self, config: LwDetrConfig, channel_size: int, scale: flo... method forward (line 576) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LwDetrScaleProjector (line 582) | class LwDetrScaleProjector(nn.Module): method __init__ (line 583) | def __init__(self, config: LwDetrConfig, scale: float): method forward (line 603) | def forward(self, hidden_states_tuple: tuple[torch.Tensor]) -> torch.T... class LwDetrMultiScaleProjector (line 614) | class LwDetrMultiScaleProjector(nn.Module): method __init__ (line 615) | def __init__(self, config: LwDetrConfig): method forward (line 623) | def forward(self, hidden_states: tuple[torch.Tensor]) -> list[torch.Te... class LwDetrConvEncoder (line 630) | class LwDetrConvEncoder(nn.Module): method __init__ (line 631) | def __init__(self, config: LwDetrConfig): method forward (line 636) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class LwDetrAttention (line 648) | class LwDetrAttention(nn.Module): method __init__ (line 649) | def __init__(self, config: LwDetrConfig, layer_idx: int): method forward (line 672) | def forward( class MultiScaleDeformableAttention (line 722) | class MultiScaleDeformableAttention(nn.Module): method forward (line 723) | def forward( class LwDetrMultiscaleDeformableAttention (line 776) | class LwDetrMultiscaleDeformableAttention(nn.Module): method __init__ (line 781) | def __init__(self, config: LwDetrConfig, num_heads: int, n_points: int): method forward (line 813) | def forward( class LwDetrMLP (line 883) | class LwDetrMLP(nn.Module): method __init__ (line 884) | def __init__(self, config: LwDetrConfig): method forward (line 891) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LwDetrDecoderLayer (line 902) | class LwDetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 903) | def __init__(self, config: LwDetrConfig, layer_idx: int): method forward (line 925) | def forward( class LwDetrPreTrainedModel (line 968) | class LwDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 986) | def _init_weights(self, module): class LwDetrDecoderOutput (line 1030) | class LwDetrDecoderOutput(BaseModelOutputWithCrossAttentions): function gen_sine_position_embeddings (line 1049) | def gen_sine_position_embeddings(pos_tensor, hidden_size=256): class LwDetrDecoder (line 1087) | class LwDetrDecoder(LwDetrPreTrainedModel): method __init__ (line 1101) | def __init__(self, config: LwDetrConfig): method get_reference (line 1113) | def get_reference(self, reference_points, valid_ratios): method forward (line 1129) | def forward( class LwDetrModelOutput (line 1181) | class LwDetrModelOutput(ModelOutput): function refine_bboxes (line 1208) | def refine_bboxes(reference_points, deltas): class LwDetrModel (line 1222) | class LwDetrModel(LwDetrPreTrainedModel): method __init__ (line 1223) | def __init__(self, config: LwDetrConfig): method freeze_backbone (line 1249) | def freeze_backbone(self): method unfreeze_backbone (line 1253) | def unfreeze_backbone(self): method get_valid_ratio (line 1257) | def get_valid_ratio(self, mask, dtype=torch.float32): method gen_encoder_output_proposals (line 1268) | def gen_encoder_output_proposals(self, enc_output, padding_mask, spati... method forward (line 1331) | def forward( class LwDetrMLPPredictionHead (line 1479) | class LwDetrMLPPredictionHead(nn.Module): method __init__ (line 1486) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 1492) | def forward(self, x): class LwDetrObjectDetectionOutput (line 1504) | class LwDetrObjectDetectionOutput(ModelOutput): class LwDetrForObjectDetection (line 1559) | class LwDetrForObjectDetection(LwDetrPreTrainedModel): method __init__ (line 1565) | def __init__(self, config: LwDetrConfig): method forward (line 1575) | def forward( FILE: src/transformers/models/lw_detr/modular_lw_detr.py class LwDetrViTConfig (line 58) | class LwDetrViTConfig(VitDetConfig): method __post_init__ (line 98) | def __post_init__(self, **kwargs): method validate_architecture (line 102) | def validate_architecture(self): class LwDetrConfig (line 116) | class LwDetrConfig(PreTrainedConfig): method __post_init__ (line 198) | def __post_init__(self, **kwargs): method validate_architecture (line 217) | def validate_architecture(self): class LwDetrViTSelfAttention (line 224) | class LwDetrViTSelfAttention(ViTSelfAttention): method __init__ (line 225) | def __init__(self, config: LwDetrViTConfig): method forward (line 232) | def forward( class LwDetrViTAttention (line 266) | class LwDetrViTAttention(ViTAttention): method __init__ (line 267) | def __init__(self, config: LwDetrViTConfig): method forward (line 277) | def forward( class LwDetrViTMlp (line 287) | class LwDetrViTMlp(VitDetMlp): class LwDetrViTLayer (line 291) | class LwDetrViTLayer(GradientCheckpointingLayer): method __init__ (line 292) | def __init__( method forward (line 311) | def forward( class LwDetrViTEmbeddings (line 341) | class LwDetrViTEmbeddings(VitDetEmbeddings): class LwDetrViTPreTrainedModel (line 345) | class LwDetrViTPreTrainedModel(VitDetPreTrainedModel): method _init_weights (line 360) | def _init_weights(self, module) -> None: class LwDetrViTEncoder (line 376) | class LwDetrViTEncoder(LwDetrViTPreTrainedModel): method __init__ (line 377) | def __init__(self, config: LwDetrViTConfig): method forward (line 384) | def forward( class LwDetrViTBackbone (line 396) | class LwDetrViTBackbone(VitDetBackbone): method forward (line 397) | def forward(self, pixel_values: torch.Tensor, **kwargs: Unpack[Transfo... class LwDetrConvNormLayer (line 465) | class LwDetrConvNormLayer(RTDetrConvNormLayer): method __init__ (line 466) | def __init__( class LwDetrRepVggBlock (line 486) | class LwDetrRepVggBlock(nn.Module): method __init__ (line 487) | def __init__(self, config: LwDetrConfig): method forward (line 497) | def forward(self, x: torch.Tensor) -> torch.Tensor: class LwDetrC2FLayer (line 503) | class LwDetrC2FLayer(nn.Module): method __init__ (line 505) | def __init__(self, config: LwDetrConfig, in_channels: int): method forward (line 521) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LwDetrLayerNorm (line 535) | class LwDetrLayerNorm(ConvNextLayerNorm): class LwDetrSamplingLayer (line 539) | class LwDetrSamplingLayer(nn.Module): method __init__ (line 540) | def __init__(self, config: LwDetrConfig, channel_size: int, scale: flo... method forward (line 557) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LwDetrScaleProjector (line 563) | class LwDetrScaleProjector(nn.Module): method __init__ (line 564) | def __init__(self, config: LwDetrConfig, scale: float): method forward (line 584) | def forward(self, hidden_states_tuple: tuple[torch.Tensor]) -> torch.T... class LwDetrMultiScaleProjector (line 595) | class LwDetrMultiScaleProjector(nn.Module): method __init__ (line 596) | def __init__(self, config: LwDetrConfig): method forward (line 604) | def forward(self, hidden_states: tuple[torch.Tensor]) -> list[torch.Te... class LwDetrConvEncoder (line 611) | class LwDetrConvEncoder(nn.Module): method __init__ (line 612) | def __init__(self, config: LwDetrConfig): method forward (line 617) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class LwDetrAttention (line 629) | class LwDetrAttention(nn.Module): method __init__ (line 630) | def __init__(self, config: LwDetrConfig, layer_idx: int): method forward (line 653) | def forward( class LwDetrMultiscaleDeformableAttention (line 702) | class LwDetrMultiscaleDeformableAttention(DeformableDetrMultiscaleDeform... method forward (line 703) | def forward( class LwDetrMLP (line 730) | class LwDetrMLP(nn.Module): method __init__ (line 731) | def __init__(self, config: LwDetrConfig): method forward (line 738) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class LwDetrDecoderLayer (line 749) | class LwDetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 750) | def __init__(self, config: LwDetrConfig, layer_idx: int): method forward (line 772) | def forward( class LwDetrPreTrainedModel (line 815) | class LwDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 833) | def _init_weights(self, module): function refine_bboxes (line 868) | def refine_bboxes(reference_points, deltas): class LwDetrDecoderOutput (line 885) | class LwDetrDecoderOutput(DeformableDetrDecoderOutput): class LwDetrDecoder (line 889) | class LwDetrDecoder(LwDetrPreTrainedModel): method __init__ (line 903) | def __init__(self, config: LwDetrConfig): method get_reference (line 915) | def get_reference(self, reference_points, valid_ratios): method forward (line 931) | def forward( class LwDetrModelOutput (line 983) | class LwDetrModelOutput(ModelOutput): class LwDetrModel (line 1016) | class LwDetrModel(DeformableDetrModel): method __init__ (line 1017) | def __init__(self, config: LwDetrConfig): method gen_encoder_output_proposals (line 1043) | def gen_encoder_output_proposals(self, enc_output, padding_mask, spati... method forward (line 1106) | def forward( method get_proposal_pos_embed (line 1253) | def get_proposal_pos_embed(self, proposals): class LwDetrMLPPredictionHead (line 1257) | class LwDetrMLPPredictionHead(DeformableDetrMLPPredictionHead): class LwDetrObjectDetectionOutput (line 1267) | class LwDetrObjectDetectionOutput(ModelOutput): class LwDetrForObjectDetection (line 1322) | class LwDetrForObjectDetection(DeformableDetrForObjectDetection): method __init__ (line 1325) | def __init__(self, config: LwDetrConfig): method forward (line 1335) | def forward( FILE: src/transformers/models/lxmert/configuration_lxmert.py class LxmertConfig (line 24) | class LxmertConfig(PreTrainedConfig): method __post_init__ (line 103) | def __post_init__(self, **kwargs): FILE: src/transformers/models/lxmert/convert_lxmert_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_lxmert (line 29) | def load_tf_weights_in_lxmert(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 108) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, py... FILE: src/transformers/models/lxmert/modeling_lxmert.py class GeLU (line 33) | class GeLU(nn.Module): method __init__ (line 34) | def __init__(self): method forward (line 37) | def forward(self, x): class LxmertModelOutput (line 49) | class LxmertModelOutput(ModelOutput): class LxmertForQuestionAnsweringOutput (line 94) | class LxmertForQuestionAnsweringOutput(ModelOutput): class LxmertForPreTrainingOutput (line 136) | class LxmertForPreTrainingOutput(ModelOutput): class LxmertEmbeddings (line 179) | class LxmertEmbeddings(nn.Module): method __init__ (line 182) | def __init__(self, config): method forward (line 191) | def forward(self, input_ids, token_type_ids=None, inputs_embeds=None): class LxmertAttention (line 217) | class LxmertAttention(nn.Module): method __init__ (line 218) | def __init__(self, config, ctx_dim=None): method forward (line 238) | def forward(self, hidden_states, context, attention_mask=None, output_... class LxmertAttentionOutput (line 277) | class LxmertAttentionOutput(nn.Module): method __init__ (line 278) | def __init__(self, config): method forward (line 284) | def forward(self, hidden_states, input_tensor): class LxmertCrossAttentionLayer (line 291) | class LxmertCrossAttentionLayer(nn.Module): method __init__ (line 292) | def __init__(self, config): method forward (line 297) | def forward(self, input_tensor, ctx_tensor, ctx_att_mask=None, output_... class LxmertSelfAttentionLayer (line 306) | class LxmertSelfAttentionLayer(nn.Module): method __init__ (line 307) | def __init__(self, config): method forward (line 312) | def forward(self, input_tensor, attention_mask, output_attentions=False): class LxmertIntermediate (line 327) | class LxmertIntermediate(nn.Module): method __init__ (line 328) | def __init__(self, config): method forward (line 333) | def forward(self, hidden_states): class LxmertOutput (line 339) | class LxmertOutput(nn.Module): method __init__ (line 340) | def __init__(self, config): method forward (line 346) | def forward(self, hidden_states, input_tensor): class LxmertLayer (line 353) | class LxmertLayer(nn.Module): method __init__ (line 354) | def __init__(self, config): method forward (line 360) | def forward(self, hidden_states, attention_mask=None, output_attention... class LxmertXLayer (line 369) | class LxmertXLayer(nn.Module): method __init__ (line 370) | def __init__(self, config): method cross_att (line 385) | def cross_att( method self_att (line 408) | def self_att(self, lang_input, lang_attention_mask, visual_input, visu... method output_fc (line 414) | def output_fc(self, lang_input, visual_input): method forward (line 425) | def forward( class LxmertVisualFeatureEncoder (line 460) | class LxmertVisualFeatureEncoder(nn.Module): method __init__ (line 461) | def __init__(self, config): method forward (line 476) | def forward(self, visual_feats, visual_pos): class LxmertEncoder (line 487) | class LxmertEncoder(nn.Module): method __init__ (line 488) | def __init__(self, config): method forward (line 506) | def forward( class LxmertPooler (line 568) | class LxmertPooler(nn.Module): method __init__ (line 569) | def __init__(self, config): method forward (line 574) | def forward(self, hidden_states): class LxmertPredictionHeadTransform (line 583) | class LxmertPredictionHeadTransform(nn.Module): method __init__ (line 584) | def __init__(self, config): method forward (line 590) | def forward(self, hidden_states): class LxmertLMPredictionHead (line 597) | class LxmertLMPredictionHead(nn.Module): method __init__ (line 598) | def __init__(self, config): method forward (line 604) | def forward(self, hidden_states): class LxmertVisualAnswerHead (line 610) | class LxmertVisualAnswerHead(nn.Module): method __init__ (line 611) | def __init__(self, config, num_labels): method forward (line 621) | def forward(self, hidden_states): class LxmertVisualObjHead (line 625) | class LxmertVisualObjHead(nn.Module): method __init__ (line 626) | def __init__(self, config): method forward (line 648) | def forward(self, hidden_states): class LxmertPreTrainingHeads (line 656) | class LxmertPreTrainingHeads(nn.Module): method __init__ (line 657) | def __init__(self, config): method forward (line 662) | def forward(self, sequence_output, pooled_output): class LxmertPreTrainedModel (line 669) | class LxmertPreTrainedModel(PreTrainedModel): method _init_weights (line 675) | def _init_weights(self, module): class LxmertModel (line 683) | class LxmertModel(LxmertPreTrainedModel): method __init__ (line 684) | def __init__(self, config): method get_input_embeddings (line 692) | def get_input_embeddings(self): method set_input_embeddings (line 695) | def set_input_embeddings(self, new_embeddings): method forward (line 699) | def forward( class LxmertForPreTraining (line 834) | class LxmertForPreTraining(LxmertPreTrainedModel): method __init__ (line 840) | def __init__(self, config): method resize_token_embeddings (line 895) | def resize_token_embeddings( method _resize_bias (line 903) | def _resize_bias(self, bias, new_num_tokens: int): method resize_num_qa_labels (line 913) | def resize_num_qa_labels(self, num_labels): method _resize_qa_labels (line 937) | def _resize_qa_labels(self, num_labels): method get_qa_logit_layer (line 943) | def get_qa_logit_layer(self) -> nn.Module: method _set_qa_logit_layer (line 954) | def _set_qa_logit_layer(self, qa_logit_layer): method _get_resized_qa_labels (line 957) | def _get_resized_qa_labels(self, cur_qa_logit_layer, num_labels): method forward (line 985) | def forward( class LxmertForQuestionAnswering (line 1131) | class LxmertForQuestionAnswering(LxmertPreTrainedModel): method __init__ (line 1132) | def __init__(self, config): method resize_num_qa_labels (line 1151) | def resize_num_qa_labels(self, num_labels): method _resize_qa_labels (line 1175) | def _resize_qa_labels(self, num_labels): method get_qa_logit_layer (line 1181) | def get_qa_logit_layer(self) -> nn.Module: method _set_qa_logit_layer (line 1193) | def _set_qa_logit_layer(self, qa_logit_layer): method _get_resized_qa_labels (line 1196) | def _get_resized_qa_labels(self, cur_qa_logit_layer, num_labels): method forward (line 1224) | def forward( FILE: src/transformers/models/m2m_100/configuration_m2m_100.py class M2M100Config (line 24) | class M2M100Config(PreTrainedConfig): FILE: src/transformers/models/m2m_100/convert_m2m100_original_checkpoint_to_pytorch.py function remove_ignore_keys_ (line 23) | def remove_ignore_keys_(state_dict): function make_linear_from_emb (line 38) | def make_linear_from_emb(emb): function convert_fairseq_m2m100_checkpoint_from_disk (line 45) | def convert_fairseq_m2m100_checkpoint_from_disk(checkpoint_path): FILE: src/transformers/models/m2m_100/modeling_m2m_100.py function shift_tokens_right (line 50) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class M2M100ScaledWordEmbedding (line 67) | class M2M100ScaledWordEmbedding(nn.Embedding): method __init__ (line 72) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 76) | def forward(self, input_ids: torch.Tensor): class M2M100SinusoidalPositionalEmbedding (line 80) | class M2M100SinusoidalPositionalEmbedding(nn.Module): method __init__ (line 83) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 91) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 100) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 121) | def forward( method create_position_ids_from_inputs_embeds (line 147) | def create_position_ids_from_inputs_embeds(inputs_embeds, past_key_val... method create_position_ids_from_input_ids (line 166) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 183) | def eager_attention_forward( class M2M100Attention (line 212) | class M2M100Attention(nn.Module): method __init__ (line 215) | def __init__( method forward (line 254) | def forward( class M2M100EncoderLayer (line 331) | class M2M100EncoderLayer(GradientCheckpointingLayer): method __init__ (line 332) | def __init__(self, config: M2M100Config): method forward (line 350) | def forward( class M2M100DecoderLayer (line 388) | class M2M100DecoderLayer(GradientCheckpointingLayer): method __init__ (line 389) | def __init__(self, config: M2M100Config, layer_idx: int | None = None): method forward (line 420) | def forward( class M2M100PreTrainedModel (line 482) | class M2M100PreTrainedModel(PreTrainedModel): method _init_weights (line 493) | def _init_weights(self, module): class M2M100Encoder (line 502) | class M2M100Encoder(M2M100PreTrainedModel): method __init__ (line 517) | def __init__(self, config: M2M100Config): method forward (line 547) | def forward( class M2M100Decoder (line 594) | class M2M100Decoder(M2M100PreTrainedModel): method __init__ (line 609) | def __init__(self, config: M2M100Config): method forward (line 636) | def forward( class M2M100Model (line 717) | class M2M100Model(M2M100PreTrainedModel): method __init__ (line 723) | def __init__(self, config: M2M100Config): method get_input_embeddings (line 736) | def get_input_embeddings(self): method set_input_embeddings (line 739) | def set_input_embeddings(self, value): method forward (line 747) | def forward( class M2M100ForConditionalGeneration (line 819) | class M2M100ForConditionalGeneration(M2M100PreTrainedModel, GenerationMi... method __init__ (line 823) | def __init__(self, config: M2M100Config): method forward (line 834) | def forward( FILE: src/transformers/models/m2m_100/tokenization_m2m_100.py class M2M100Tokenizer (line 49) | class M2M100Tokenizer(PreTrainedTokenizer): method __init__ (line 114) | def __init__( method vocab_size (line 179) | def vocab_size(self) -> int: method get_vocab (line 182) | def get_vocab(self) -> dict: method src_lang (line 188) | def src_lang(self) -> str: method src_lang (line 192) | def src_lang(self, new_src_lang: str) -> None: method _tokenize (line 196) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 199) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 204) | def _convert_id_to_token(self, index: int) -> str: method convert_tokens_to_string (line 210) | def convert_tokens_to_string(self, tokens): method get_special_tokens_mask (line 224) | def get_special_tokens_mask( method build_inputs_with_special_tokens (line 254) | def build_inputs_with_special_tokens( method __getstate__ (line 281) | def __getstate__(self) -> dict: method __setstate__ (line 286) | def __setstate__(self, d: dict) -> None: method save_vocabulary (line 295) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method prepare_seq2seq_batch (line 317) | def prepare_seq2seq_batch( method _build_translation_inputs (line 330) | def _build_translation_inputs(self, raw_inputs, src_lang: str | None, ... method _switch_to_input_mode (line 340) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 343) | def _switch_to_target_mode(self): method set_src_lang_special_tokens (line 346) | def set_src_lang_special_tokens(self, src_lang: str) -> None: method set_tgt_lang_special_tokens (line 353) | def set_tgt_lang_special_tokens(self, tgt_lang: str) -> None: method get_lang_token (line 360) | def get_lang_token(self, lang: str) -> str: method get_lang_id (line 363) | def get_lang_id(self, lang: str) -> int: function load_spm (line 368) | def load_spm(path: str, sp_model_kwargs: dict[str, Any]) -> sentencepiec... function load_json (line 374) | def load_json(path: str) -> dict | list: function save_json (line 379) | def save_json(data, path: str) -> None: FILE: src/transformers/models/mamba/configuration_mamba.py class MambaConfig (line 26) | class MambaConfig(PreTrainedConfig): method __post_init__ (line 94) | def __post_init__(self, **kwargs): method layer_types (line 102) | def layer_types(self): FILE: src/transformers/models/mamba/convert_mamba_ssm_checkpoint_to_pytorch.py function convert_ssm_config_to_hf_config (line 31) | def convert_ssm_config_to_hf_config(config_ssm: MambaConfigSSM) -> Mamba... function convert_mamba_ssm_checkpoint_to_huggingface_model (line 52) | def convert_mamba_ssm_checkpoint_to_huggingface_model( function validate_converted_model (line 74) | def validate_converted_model( function convert_mamba_checkpoint_file_to_huggingface_model_file (line 96) | def convert_mamba_checkpoint_file_to_huggingface_model_file( FILE: src/transformers/models/mamba/modeling_mamba.py class MambaMixer (line 58) | class MambaMixer(nn.Module): method __init__ (line 66) | def __init__(self, config: MambaConfig, layer_idx: int, initialize_mix... method init_mamba_weights (line 123) | def init_mamba_weights(self): method warn_slow_implementation (line 144) | def warn_slow_implementation(self): method cuda_kernels_forward (line 167) | def cuda_kernels_forward( method slow_forward (line 270) | def slow_forward(self, input_states, cache_params: Cache | None=None, ... method forward (line 366) | def forward( class MambaRMSNorm (line 381) | class MambaRMSNorm(nn.Module): method __init__ (line 382) | def __init__(self, hidden_size, eps=1e-6): method forward (line 390) | def forward(self, hidden_states): method extra_repr (line 397) | def extra_repr(self): class MambaBlock (line 401) | class MambaBlock(GradientCheckpointingLayer): method __init__ (line 402) | def __init__(self, config, layer_idx): method forward (line 410) | def forward( class MambaPreTrainedModel (line 428) | class MambaPreTrainedModel(PreTrainedModel): method _init_weights (line 436) | def _init_weights(self, module): class MambaOutput (line 479) | class MambaOutput(ModelOutput): class MambaCausalLMOutput (line 499) | class MambaCausalLMOutput(ModelOutput): class MambaModel (line 519) | class MambaModel(MambaPreTrainedModel): method __init__ (line 520) | def __init__(self, config): method load_hook (line 532) | def load_hook(self, state_dict, prefix, *args): method get_input_embeddings (line 538) | def get_input_embeddings(self): method set_input_embeddings (line 541) | def set_input_embeddings(self, new_embeddings): method forward (line 545) | def forward( class MambaForCausalLM (line 614) | class MambaForCausalLM(MambaPreTrainedModel, GenerationMixin): method __init__ (line 617) | def __init__(self, config): method get_input_embeddings (line 624) | def get_input_embeddings(self): method set_input_embeddings (line 627) | def set_input_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 630) | def prepare_inputs_for_generation( method forward (line 656) | def forward( FILE: src/transformers/models/mamba2/configuration_mamba2.py class Mamba2Config (line 26) | class Mamba2Config(PreTrainedConfig): method __post_init__ (line 91) | def __post_init__(self, **kwargs): method validate_architecture (line 97) | def validate_architecture(self): method layer_types (line 107) | def layer_types(self): FILE: src/transformers/models/mamba2/convert_mamba2_ssm_checkpoint_to_pytorch.py function load_state_dict_from_safetensors (line 28) | def load_state_dict_from_safetensors(mamba2_checkpoint_path: str, ckpt_n... function load_state_dict_from_torch (line 38) | def load_state_dict_from_torch(mamba2_checkpoint_path: str, ckpt_name: s... function convert_ssm_config_to_hf_config (line 42) | def convert_ssm_config_to_hf_config(config_ssm: dict, mamba2_model_dict:... function load_and_save_tokenizer (line 69) | def load_and_save_tokenizer( function convert_mamba2_checkpoint_file_to_huggingface_model_file (line 114) | def convert_mamba2_checkpoint_file_to_huggingface_model_file( FILE: src/transformers/models/mamba2/modeling_mamba2.py function pad_tensor_by_size (line 40) | def pad_tensor_by_size(input_tensor: torch.Tensor, pad_size: int): function reshape_into_chunks (line 51) | def reshape_into_chunks(input_tensor, pad_size, chunk_size): function segment_sum (line 71) | def segment_sum(input_tensor): function apply_mask_to_padding_states (line 91) | def apply_mask_to_padding_states(hidden_states, attention_mask): class MambaRMSNormGated (line 103) | class MambaRMSNormGated(torch.nn.Module): method __init__ (line 104) | def __init__(self, hidden_size, eps=1e-6): method forward (line 109) | def forward(self, hidden_states, gate=None): class Mamba2Mixer (line 121) | class Mamba2Mixer(nn.Module): method __init__ (line 129) | def __init__(self, config: Mamba2Config, layer_idx: int, initialize_mi... method init_mamba2_weights (line 223) | def init_mamba2_weights(self): method cuda_kernels_forward (line 238) | def cuda_kernels_forward( method torch_forward (line 398) | def torch_forward( method forward (line 588) | def forward( class Mamba2RMSNorm (line 600) | class Mamba2RMSNorm(nn.Module): method __init__ (line 601) | def __init__(self, hidden_size, eps=1e-6): method forward (line 609) | def forward(self, hidden_states): class Mamba2Block (line 617) | class Mamba2Block(GradientCheckpointingLayer): method __init__ (line 618) | def __init__(self, config, layer_idx): method forward (line 626) | def forward( class Mamba2PreTrainedModel (line 644) | class Mamba2PreTrainedModel(PreTrainedModel): method _init_weights (line 652) | def _init_weights(self, module): class Mamba2Output (line 696) | class Mamba2Output(ModelOutput): class Mamba2CausalLMOutput (line 717) | class Mamba2CausalLMOutput(ModelOutput): class Mamba2Model (line 737) | class Mamba2Model(Mamba2PreTrainedModel): method __init__ (line 738) | def __init__(self, config): method load_hook (line 750) | def load_hook(self, state_dict, prefix, *args): method get_input_embeddings (line 756) | def get_input_embeddings(self): method set_input_embeddings (line 759) | def set_input_embeddings(self, new_embeddings): method forward (line 763) | def forward( class Mamba2ForCausalLM (line 832) | class Mamba2ForCausalLM(Mamba2PreTrainedModel, GenerationMixin): method __init__ (line 835) | def __init__(self, config): method get_input_embeddings (line 842) | def get_input_embeddings(self): method set_input_embeddings (line 845) | def set_input_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 848) | def prepare_inputs_for_generation( method forward (line 874) | def forward( FILE: src/transformers/models/marian/configuration_marian.py class MarianConfig (line 24) | class MarianConfig(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): FILE: src/transformers/models/marian/convert_marian_tatoeba_to_pytorch.py class TatoebaConverter (line 42) | class TatoebaConverter: method __init__ (line 56) | def __init__(self, save_dir="marian_converted"): method convert_models (line 74) | def convert_models(self, tatoeba_ids, dry_run=False): method expand_group_to_two_letter_codes (line 91) | def expand_group_to_two_letter_codes(self, grp_name): method is_group (line 94) | def is_group(self, code, name): method get_tags (line 97) | def get_tags(self, code, name): method resolve_lang_code (line 109) | def resolve_lang_code(self, src, tgt) -> tuple[str, str]: method model_type_info_from_model_name (line 115) | def model_type_info_from_model_name(name): method write_model_card (line 129) | def write_model_card(self, model_dict, dry_run=False) -> str: method download_lang_info (line 277) | def download_lang_info(self): method parse_metadata (line 290) | def parse_metadata(self, model_name, repo_path=DEFAULT_MODEL_DIR, meth... function l2front_matter (line 1303) | def l2front_matter(langs): function dedup (line 1307) | def dedup(lst): FILE: src/transformers/models/marian/convert_marian_to_pytorch.py function remove_suffix (line 33) | def remove_suffix(text: str, suffix: str): function remove_prefix (line 39) | def remove_prefix(text: str, prefix: str): function convert_encoder_layer (line 45) | def convert_encoder_layer(opus_dict, layer_prefix: str, converter: dict): function load_layers_ (line 56) | def load_layers_(layer_lst: nn.ModuleList, opus_state: dict, converter, ... function find_pretrained_model (line 63) | def find_pretrained_model(src_lang: str, tgt_lang: str) -> list[str]: function add_emb_entries (line 75) | def add_emb_entries(wemb, final_bias, n_special_tokens=1): function _cast_yaml_str (line 84) | def _cast_yaml_str(v): function cast_marian_config (line 96) | def cast_marian_config(raw_cfg: dict[str, str]) -> dict: function load_config_from_state_dict (line 103) | def load_config_from_state_dict(opus_dict): function find_model_file (line 111) | def find_model_file(dest_dir): # this one better function convert_opus_name_to_hf_name (line 165) | def convert_opus_name_to_hf_name(x): function convert_hf_name_to_opus_name (line 172) | def convert_hf_name_to_opus_name(hf_model_name): function get_system_metadata (line 184) | def get_system_metadata(repo_root): function write_model_card (line 209) | def write_model_card( function make_registry (line 280) | def make_registry(repo_path="Opus-MT-train/models"): function convert_all_sentencepiece_models (line 297) | def convert_all_sentencepiece_models(model_list=None, repo_path=None, de... function lmap (line 317) | def lmap(f, x) -> list: function fetch_test_set (line 321) | def fetch_test_set(test_set_url): function convert_whole_dir (line 335) | def convert_whole_dir(path=Path("marian_ckpt/")): function _parse_readme (line 343) | def _parse_readme(lns): function save_tokenizer_config (line 366) | def save_tokenizer_config(dest_dir: Path, separate_vocabs=False): function add_to_vocab_ (line 372) | def add_to_vocab_(vocab: dict[str, int], special_tokens: list[str]): function find_vocab_file (line 383) | def find_vocab_file(model_dir): function find_src_vocab_file (line 387) | def find_src_vocab_file(model_dir): function find_tgt_vocab_file (line 391) | def find_tgt_vocab_file(model_dir): function add_special_tokens_to_vocab (line 395) | def add_special_tokens_to_vocab(model_dir: Path, separate_vocab=False) -... function check_equal (line 416) | def check_equal(marian_cfg, k1, k2): function check_marian_cfg_assumptions (line 422) | def check_marian_cfg_assumptions(marian_cfg): class OpusState (line 476) | class OpusState: method __init__ (line 477) | def __init__(self, source_dir, eos_token_id=0): method _check_layer_entries (line 561) | def _check_layer_entries(self): method extra_keys (line 573) | def extra_keys(self): method sub_keys (line 586) | def sub_keys(self, layer_prefix): method load_tokenizer (line 589) | def load_tokenizer(self): method load_marian_model (line 594) | def load_marian_model(self) -> MarianMTModel: function download_and_unzip (line 651) | def download_and_unzip(url, dest_dir): function convert (line 662) | def convert(source_dir: Path, dest_dir): function load_yaml (line 680) | def load_yaml(path): function save_json (line 687) | def save_json(content: dict | list, path: str) -> None: function unzip (line 692) | def unzip(zip_path: str, dest_dir: str) -> None: FILE: src/transformers/models/marian/modeling_marian.py function shift_tokens_right (line 56) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class MarianSinusoidalPositionalEmbedding (line 72) | class MarianSinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 75) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method create_weight (line 78) | def create_weight(self): method forward (line 94) | def forward( function eager_attention_forward (line 107) | def eager_attention_forward( class MarianAttention (line 136) | class MarianAttention(nn.Module): method __init__ (line 139) | def __init__( method forward (line 178) | def forward( class MarianEncoderLayer (line 255) | class MarianEncoderLayer(GradientCheckpointingLayer): method __init__ (line 256) | def __init__(self, config: MarianConfig, layer_idx: int | None = None): method forward (line 275) | def forward( class MarianDecoderLayer (line 307) | class MarianDecoderLayer(GradientCheckpointingLayer): method __init__ (line 308) | def __init__(self, config: MarianConfig, layer_idx: int | None = None): method forward (line 339) | def forward( class MarianPreTrainedModel (line 390) | class MarianPreTrainedModel(PreTrainedModel): method _init_weights (line 401) | def _init_weights(self, module): method dummy_inputs (line 409) | def dummy_inputs(self): class MarianEncoder (line 420) | class MarianEncoder(MarianPreTrainedModel): method __init__ (line 435) | def __init__(self, config: MarianConfig): method forward (line 460) | def forward( class MarianDecoder (line 503) | class MarianDecoder(MarianPreTrainedModel): method __init__ (line 518) | def __init__(self, config: MarianConfig): method forward (line 540) | def forward( class MarianModel (line 626) | class MarianModel(MarianPreTrainedModel): method __init__ (line 632) | def __init__(self, config: MarianConfig): method get_input_embeddings (line 653) | def get_input_embeddings(self): method set_input_embeddings (line 657) | def set_input_embeddings(self, value): method get_decoder_input_embeddings (line 665) | def get_decoder_input_embeddings(self): method set_decoder_input_embeddings (line 673) | def set_decoder_input_embeddings(self, value): method resize_decoder_token_embeddings (line 682) | def resize_decoder_token_embeddings(self, new_num_tokens: int) -> nn.E... method forward (line 708) | def forward( class MarianMTModel (line 802) | class MarianMTModel(MarianPreTrainedModel, GenerationMixin): method __init__ (line 812) | def __init__(self, config: MarianConfig): method resize_token_embeddings (line 829) | def resize_token_embeddings( method _resize_token_embeddings (line 838) | def _resize_token_embeddings(self, new_num_tokens: int, pad_to_multipl... method resize_decoder_token_embeddings (line 860) | def resize_decoder_token_embeddings(self, new_num_tokens): method _resize_final_logits_bias (line 892) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method set_output_embeddings (line 901) | def set_output_embeddings(self, new_embeddings: nn.Embedding): method forward (line 906) | def forward( method prepare_decoder_input_ids_from_labels (line 1001) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class MarianDecoderWrapper (line 1006) | class MarianDecoderWrapper(MarianPreTrainedModel): method __init__ (line 1012) | def __init__(self, config): method forward (line 1017) | def forward(self, *args, **kwargs): class MarianForCausalLM (line 1022) | class MarianForCausalLM(MarianPreTrainedModel, GenerationMixin): method __init__ (line 1027) | def __init__(self, config): method get_input_embeddings (line 1038) | def get_input_embeddings(self): method set_input_embeddings (line 1041) | def set_input_embeddings(self, value): method forward (line 1046) | def forward( FILE: src/transformers/models/marian/tokenization_marian.py class MarianTokenizer (line 45) | class MarianTokenizer(PreTrainedTokenizer): method __init__ (line 107) | def __init__( method _setup_normalizer (line 170) | def _setup_normalizer(self): method normalize (line 179) | def normalize(self, x: str) -> str: method _convert_token_to_id (line 183) | def _convert_token_to_id(self, token): method remove_language_code (line 190) | def remove_language_code(self, text: str): method _tokenize (line 198) | def _tokenize(self, text: str) -> list[str]: method _convert_id_to_token (line 203) | def _convert_id_to_token(self, index: int) -> str: method batch_decode (line 212) | def batch_decode(self, sequences, **kwargs): method decode (line 235) | def decode(self, token_ids, **kwargs): method _decode (line 261) | def _decode( method convert_tokens_to_string (line 278) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method build_inputs_with_special_tokens (line 294) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method _switch_to_input_mode (line 301) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 305) | def _switch_to_target_mode(self): method vocab_size (line 311) | def vocab_size(self) -> int: method save_vocabulary (line 314) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method get_vocab (line 359) | def get_vocab(self) -> dict: method get_src_vocab (line 362) | def get_src_vocab(self): method get_tgt_vocab (line 365) | def get_tgt_vocab(self): method __getstate__ (line 368) | def __getstate__(self) -> dict: method __setstate__ (line 375) | def __setstate__(self, d: dict) -> None: method num_special_tokens_to_add (line 388) | def num_special_tokens_to_add(self, *args, **kwargs): method _special_token_mask (line 392) | def _special_token_mask(self, seq): method get_special_tokens_mask (line 397) | def get_special_tokens_mask( function load_spm (line 409) | def load_spm(path: str, sp_model_kwargs: dict[str, Any]) -> sentencepiec... function save_json (line 415) | def save_json(data, path: str) -> None: function load_json (line 420) | def load_json(path: str) -> dict | list: FILE: src/transformers/models/markuplm/configuration_markuplm.py class MarkupLMConfig (line 24) | class MarkupLMConfig(PreTrainedConfig): FILE: src/transformers/models/markuplm/feature_extraction_markuplm.py class MarkupLMFeatureExtractor (line 32) | class MarkupLMFeatureExtractor(FeatureExtractionMixin): method __init__ (line 42) | def __init__(self, **kwargs): method xpath_soup (line 46) | def xpath_soup(self, element): method get_three_from_single (line 61) | def get_three_from_single(self, html_string): method construct_xpath (line 90) | def construct_xpath(self, xpath_tags, xpath_subscripts): method __call__ (line 98) | def __call__(self, html_strings) -> BatchFeature: FILE: src/transformers/models/markuplm/modeling_markuplm.py class XPathEmbeddings (line 45) | class XPathEmbeddings(nn.Module): method __init__ (line 51) | def __init__(self, config): method forward (line 77) | def forward(self, xpath_tags_seq=None, xpath_subs_seq=None): class MarkupLMEmbeddings (line 95) | class MarkupLMEmbeddings(nn.Module): method __init__ (line 98) | def __init__(self, config): method create_position_ids_from_inputs_embeds (line 124) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 143) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... method forward (line 158) | def forward( class MarkupLMSelfOutput (line 211) | class MarkupLMSelfOutput(nn.Module): method __init__ (line 212) | def __init__(self, config): method forward (line 218) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MarkupLMIntermediate (line 226) | class MarkupLMIntermediate(nn.Module): method __init__ (line 227) | def __init__(self, config): method forward (line 235) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MarkupLMOutput (line 242) | class MarkupLMOutput(nn.Module): method __init__ (line 243) | def __init__(self, config): method forward (line 249) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MarkupLMPooler (line 257) | class MarkupLMPooler(nn.Module): method __init__ (line 258) | def __init__(self, config): method forward (line 263) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MarkupLMPredictionHeadTransform (line 273) | class MarkupLMPredictionHeadTransform(nn.Module): method __init__ (line 274) | def __init__(self, config): method forward (line 283) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MarkupLMLMPredictionHead (line 291) | class MarkupLMLMPredictionHead(nn.Module): method __init__ (line 292) | def __init__(self, config): method forward (line 301) | def forward(self, hidden_states): class MarkupLMOnlyMLMHead (line 308) | class MarkupLMOnlyMLMHead(nn.Module): method __init__ (line 309) | def __init__(self, config): method forward (line 313) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 319) | def eager_attention_forward( class MarkupLMSelfAttention (line 342) | class MarkupLMSelfAttention(nn.Module): method __init__ (line 343) | def __init__(self, config): method forward (line 364) | def forward( class MarkupLMAttention (line 397) | class MarkupLMAttention(nn.Module): method __init__ (line 398) | def __init__(self, config): method forward (line 403) | def forward( class MarkupLMLayer (line 420) | class MarkupLMLayer(GradientCheckpointingLayer): method __init__ (line 421) | def __init__(self, config): method forward (line 429) | def forward( method feed_forward_chunk (line 447) | def feed_forward_chunk(self, attention_output): class MarkupLMEncoder (line 454) | class MarkupLMEncoder(nn.Module): method __init__ (line 455) | def __init__(self, config): method forward (line 461) | def forward( class MarkupLMPreTrainedModel (line 480) | class MarkupLMPreTrainedModel(PreTrainedModel): method _init_weights (line 489) | def _init_weights(self, module): class MarkupLMModel (line 499) | class MarkupLMModel(MarkupLMPreTrainedModel): method __init__ (line 501) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 517) | def get_input_embeddings(self): method set_input_embeddings (line 520) | def set_input_embeddings(self, value): method forward (line 526) | def forward( class MarkupLMForQuestionAnswering (line 605) | class MarkupLMForQuestionAnswering(MarkupLMPreTrainedModel): method __init__ (line 607) | def __init__(self, config): method forward (line 619) | def forward( class MarkupLMForTokenClassification (line 711) | class MarkupLMForTokenClassification(MarkupLMPreTrainedModel): method __init__ (line 713) | def __init__(self, config): method forward (line 729) | def forward( class MarkupLMForSequenceClassification (line 806) | class MarkupLMForSequenceClassification(MarkupLMPreTrainedModel): method __init__ (line 808) | def __init__(self, config): method forward (line 825) | def forward( FILE: src/transformers/models/markuplm/processing_markuplm.py class MarkupLMProcessor (line 25) | class MarkupLMProcessor(ProcessorMixin): method __init__ (line 28) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 32) | def __call__( FILE: src/transformers/models/markuplm/tokenization_markuplm.py class MarkupLMTokenizer (line 91) | class MarkupLMTokenizer(TokenizersBackend): method __init__ (line 153) | def __init__( method get_xpath_seq (line 253) | def get_xpath_seq(self, xpath): method __call__ (line 279) | def __call__( method batch_encode_plus (line 454) | def batch_encode_plus( method tokenize (line 510) | def tokenize(self, text: str, pair: str | None = None, add_special_tok... method encode_plus (line 519) | def encode_plus( method _batch_encode_plus (line 587) | def _batch_encode_plus( method _encode_plus (line 762) | def _encode_plus( method _pad (line 854) | def _pad( method build_inputs_with_special_tokens (line 952) | def build_inputs_with_special_tokens( method create_token_type_ids_from_sequences (line 975) | def create_token_type_ids_from_sequences( method save_vocabulary (line 997) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/mask2former/configuration_mask2former.py class Mask2FormerConfig (line 29) | class Mask2FormerConfig(PreTrainedConfig): method __post_init__ (line 113) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mask2former/convert_mask2former_original_pytorch_checkpoint_to_pytorch.py class TrackedStateDict (line 56) | class TrackedStateDict: method __init__ (line 57) | def __init__(self, to_track: dict): method __getitem__ (line 66) | def __getitem__(self, key: str) -> Any: method __setitem__ (line 69) | def __setitem__(self, key: str, item: Any): method diff (line 73) | def diff(self) -> list[str]: method copy (line 82) | def copy(self) -> dict: function prepare_img (line 88) | def prepare_img(): class Args (line 96) | class Args: function setup_cfg (line 102) | def setup_cfg(args: Args): class OriginalMask2FormerConfigToOursConverter (line 112) | class OriginalMask2FormerConfigToOursConverter: method __call__ (line 113) | def __call__(self, original_config: object) -> Mask2FormerConfig: class OriginalMask2FormerConfigToImageProcessorConverter (line 196) | class OriginalMask2FormerConfigToImageProcessorConverter: method __call__ (line 197) | def __call__(self, original_config: object) -> Mask2FormerImageProcessor: class OriginalMask2FormerCheckpointToOursConverter (line 212) | class OriginalMask2FormerCheckpointToOursConverter: method __init__ (line 213) | def __init__(self, original_model: nn.Module, config: Mask2FormerConfig): method pop_all (line 217) | def pop_all(self, renamed_keys: list[tuple[str, str]], dst_state_dict:... method replace_maskformer_swin_backbone (line 221) | def replace_maskformer_swin_backbone( method replace_swin_backbone (line 380) | def replace_swin_backbone(self, dst_state_dict: StateDict, src_state_d... method replace_pixel_module (line 538) | def replace_pixel_module(self, dst_state_dict: StateDict, src_state_di... method rename_keys_in_masked_attention_decoder (line 622) | def rename_keys_in_masked_attention_decoder(self, dst_state_dict: Stat... method replace_masked_attention_decoder (line 719) | def replace_masked_attention_decoder(self, dst_state_dict: StateDict, ... method replace_keys_qkv_transformer_decoder (line 750) | def replace_keys_qkv_transformer_decoder(self, dst_state_dict: StateDi... method replace_transformer_module (line 769) | def replace_transformer_module(self, dst_state_dict: StateDict, src_st... method replace_universal_segmentation_module (line 784) | def replace_universal_segmentation_module(self, dst_state_dict: StateD... method convert (line 796) | def convert(self, mask2former: Mask2FormerModel) -> Mask2FormerModel: method convert_universal_segmentation (line 811) | def convert_universal_segmentation( method using_dirs (line 825) | def using_dirs(checkpoints_dir: Path, config_dir: Path) -> Iterator[tu... function test (line 847) | def test( function get_model_name (line 908) | def get_model_name(checkpoint_file: Path): FILE: src/transformers/models/mask2former/image_processing_mask2former.py class Mask2FormerImageProcessorKwargs (line 49) | class Mask2FormerImageProcessorKwargs(ImagesKwargs, total=False): function binary_mask_to_rle (line 76) | def binary_mask_to_rle(mask: "torch.Tensor | np.ndarray") -> list[int]: function convert_segmentation_to_rle (line 99) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 120) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... function check_segment_validity (line 148) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 166) | def compute_segments( function convert_segmentation_map_to_binary_masks_fast (line 226) | def convert_segmentation_map_to_binary_masks_fast( class Mask2FormerImageProcessor (line 262) | class Mask2FormerImageProcessor(TorchvisionBackend): method __init__ (line 278) | def __init__(self, **kwargs: Unpack[Mask2FormerImageProcessorKwargs]) ... method to_dict (line 291) | def to_dict(self) -> dict[str, Any]: method reduce_label (line 300) | def reduce_label(self, labels: list["torch.Tensor"]): method resize (line 308) | def resize( method pad (line 358) | def pad( method preprocess (line 387) | def preprocess( method _preprocess_image_like_inputs (line 402) | def _preprocess_image_like_inputs( method _preprocess (line 430) | def _preprocess( method post_process_semantic_segmentation (line 550) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 605) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 726) | def post_process_panoptic_segmentation( FILE: src/transformers/models/mask2former/image_processing_pil_mask2former.py class Mask2FormerImageProcessorKwargs (line 54) | class Mask2FormerImageProcessorKwargs(ImagesKwargs, total=False): function convert_segmentation_map_to_binary_masks (line 80) | def convert_segmentation_map_to_binary_masks( function binary_mask_to_rle (line 117) | def binary_mask_to_rle(mask): function check_segment_validity (line 142) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 161) | def compute_segments( function convert_segmentation_to_rle (line 222) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 244) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... class Mask2FormerImageProcessorPil (line 273) | class Mask2FormerImageProcessorPil(PilBackend): method __init__ (line 289) | def __init__(self, **kwargs: Unpack[Mask2FormerImageProcessorKwargs]) ... method to_dict (line 305) | def to_dict(self) -> dict[str, Any]: method reduce_label (line 314) | def reduce_label(self, labels: list[np.ndarray]): method resize (line 323) | def resize( method pad (line 366) | def pad( method preprocess (line 443) | def preprocess( method _preprocess_image_like_inputs (line 458) | def _preprocess_image_like_inputs( method _preprocess (line 485) | def _preprocess( method post_process_semantic_segmentation (line 587) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 643) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 766) | def post_process_panoptic_segmentation( FILE: src/transformers/models/mask2former/modeling_mask2former.py class Mask2FormerPixelDecoderOutput (line 53) | class Mask2FormerPixelDecoderOutput(ModelOutput): class Mask2FormerMaskedAttentionDecoderOutput (line 80) | class Mask2FormerMaskedAttentionDecoderOutput(BaseModelOutputWithCrossAt... class Mask2FormerPixelLevelModuleOutput (line 115) | class Mask2FormerPixelLevelModuleOutput(ModelOutput): class Mask2FormerModelOutput (line 143) | class Mask2FormerModelOutput(ModelOutput): class Mask2FormerForUniversalSegmentationOutput (line 196) | class Mask2FormerForUniversalSegmentationOutput(ModelOutput): function sample_point (line 245) | def sample_point( function dice_loss (line 278) | def dice_loss(inputs: Tensor, labels: Tensor, num_masks: int) -> Tensor: function sigmoid_cross_entropy_loss (line 308) | def sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: torch.Tenso... function pair_wise_dice_loss (line 328) | def pair_wise_dice_loss(inputs: Tensor, labels: Tensor) -> Tensor: function pair_wise_sigmoid_cross_entropy_loss (line 350) | def pair_wise_sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: t... class Mask2FormerHungarianMatcher (line 378) | class Mask2FormerHungarianMatcher(nn.Module): method __init__ (line 386) | def __init__( method forward (line 413) | def forward( class Mask2FormerLoss (line 485) | class Mask2FormerLoss(nn.Module): method __init__ (line 486) | def __init__(self, config: Mask2FormerConfig, weight_dict: dict[str, f... method _max_by_axis (line 521) | def _max_by_axis(self, sizes: list[list[int]]) -> list[int]: method _pad_images_to_max_in_batch (line 529) | def _pad_images_to_max_in_batch(self, tensors: list[Tensor]) -> tuple[... method loss_labels (line 546) | def loss_labels( method loss_masks (line 580) | def loss_masks( method _get_predictions_permutation_indices (line 642) | def _get_predictions_permutation_indices(self, indices): method _get_targets_permutation_indices (line 648) | def _get_targets_permutation_indices(self, indices): method calculate_uncertainty (line 654) | def calculate_uncertainty(self, logits: torch.Tensor) -> torch.Tensor: method sample_points_using_uncertainty (line 671) | def sample_points_using_uncertainty( method forward (line 726) | def forward( method get_num_masks (line 781) | def get_num_masks(self, class_labels: torch.Tensor, device: torch.devi... function multi_scale_deformable_attention (line 798) | def multi_scale_deformable_attention( class Mask2FormerSinePositionEmbedding (line 841) | class Mask2FormerSinePositionEmbedding(nn.Module): method __init__ (line 847) | def __init__( method forward (line 859) | def forward( class Mask2FormerPixelDecoderEncoderMultiscaleDeformableAttention (line 888) | class Mask2FormerPixelDecoderEncoderMultiscaleDeformableAttention(nn.Mod... method __init__ (line 893) | def __init__(self, embed_dim: int, num_heads: int, n_levels: int, n_po... method with_pos_embed (line 920) | def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Te... method forward (line 923) | def forward( class Mask2FormerPixelDecoderEncoderLayer (line 986) | class Mask2FormerPixelDecoderEncoderLayer(nn.Module): method __init__ (line 987) | def __init__(self, config: Mask2FormerConfig): method forward (line 1005) | def forward( class Mask2FormerPixelDecoderEncoderOnly (line 1076) | class Mask2FormerPixelDecoderEncoderOnly(nn.Module): method __init__ (line 1086) | def __init__(self, config: Mask2FormerConfig): method get_reference_points (line 1096) | def get_reference_points(spatial_shapes_list, valid_ratios, device): method forward (line 1127) | def forward( class Mask2FormerPixelDecoder (line 1205) | class Mask2FormerPixelDecoder(nn.Module): method __init__ (line 1206) | def __init__(self, config: Mask2FormerConfig, feature_channels): method get_valid_ratio (line 1276) | def get_valid_ratio(self, mask, dtype=torch.float32): method forward (line 1287) | def forward( class Mask2FormerPixelLevelModule (line 1389) | class Mask2FormerPixelLevelModule(nn.Module): method __init__ (line 1390) | def __init__(self, config: Mask2FormerConfig): method forward (line 1405) | def forward(self, pixel_values: Tensor, output_hidden_states: bool = F... class Mask2FormerAttention (line 1418) | class Mask2FormerAttention(nn.Module): method __init__ (line 1424) | def __init__( method _shape (line 1449) | def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): method with_pos_embed (line 1452) | def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Te... method forward (line 1455) | def forward( class Mask2FormerMaskedAttentionDecoderLayer (line 1554) | class Mask2FormerMaskedAttentionDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1568) | def __init__(self, config: Mask2FormerConfig): method with_pos_embed (line 1591) | def with_pos_embed(self, tensor, pos: Tensor | None): method forward_post (line 1594) | def forward_post( method forward_pre (line 1653) | def forward_pre( method forward (line 1714) | def forward( class Mask2FormerMaskedAttentionDecoder (line 1768) | class Mask2FormerMaskedAttentionDecoder(nn.Module): method __init__ (line 1781) | def __init__(self, config: Mask2FormerConfig): method forward (line 1804) | def forward( class Mask2FormerPredictionBlock (line 1931) | class Mask2FormerPredictionBlock(nn.Module): method __init__ (line 1932) | def __init__(self, in_dim: int, out_dim: int, activation: nn.Module) -... method forward (line 1939) | def forward(self, input: Tensor) -> Tensor: class Mask2FormerMLPPredictionHead (line 1946) | class Mask2FormerMLPPredictionHead(nn.Module): method __init__ (line 1947) | def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, n... method forward (line 1978) | def forward(self, input: Tensor) -> Tensor: class Mask2FormerMaskPredictor (line 1985) | class Mask2FormerMaskPredictor(nn.Module): method __init__ (line 1986) | def __init__(self, hidden_size: int, num_heads: int, mask_feature_size... method forward (line 2007) | def forward( class Mask2FormerTransformerModule (line 2026) | class Mask2FormerTransformerModule(nn.Module): method __init__ (line 2031) | def __init__(self, in_features: int, config: Mask2FormerConfig): method forward (line 2049) | def forward( class Mask2FormerPreTrainedModel (line 2098) | class Mask2FormerPreTrainedModel(PreTrainedModel): method _init_weights (line 2105) | def _init_weights(self, module: nn.Module): class Mask2FormerModel (line 2176) | class Mask2FormerModel(Mask2FormerPreTrainedModel): method __init__ (line 2179) | def __init__(self, config: Mask2FormerConfig): method forward (line 2187) | def forward( class Mask2FormerForUniversalSegmentation (line 2252) | class Mask2FormerForUniversalSegmentation(Mask2FormerPreTrainedModel): method __init__ (line 2255) | def __init__(self, config: Mask2FormerConfig): method get_loss_dict (line 2270) | def get_loss_dict( method get_loss (line 2294) | def get_loss(self, loss_dict: dict[str, Tensor]) -> Tensor: method get_auxiliary_logits (line 2297) | def get_auxiliary_logits(self, classes: torch.Tensor, output_masks: to... method forward (line 2306) | def forward( FILE: src/transformers/models/mask2former/modular_mask2former.py class Mask2FormerImageProcessorKwargs (line 38) | class Mask2FormerImageProcessorKwargs(ImagesKwargs, total=False): class Mask2FormerImageProcessor (line 64) | class Mask2FormerImageProcessor(MaskFormerImageProcessor): method post_process_semantic_segmentation (line 65) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 120) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 241) | def post_process_panoptic_segmentation( class Mask2FormerImageProcessorPil (line 338) | class Mask2FormerImageProcessorPil(MaskFormerImageProcessorPil): method post_process_semantic_segmentation (line 339) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 395) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 517) | def post_process_panoptic_segmentation( FILE: src/transformers/models/maskformer/configuration_maskformer.py class MaskFormerDetrConfig (line 33) | class MaskFormerDetrConfig(PreTrainedConfig): method __post_init__ (line 99) | def __post_init__(self, **kwargs): class MaskFormerConfig (line 123) | class MaskFormerConfig(PreTrainedConfig): method __post_init__ (line 179) | def __post_init__(self, **kwargs): FILE: src/transformers/models/maskformer/configuration_maskformer_swin.py class MaskFormerSwinConfig (line 25) | class MaskFormerSwinConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 71) | def __post_init__(self, **kwargs): FILE: src/transformers/models/maskformer/convert_maskformer_original_pytorch_checkpoint_to_pytorch.py class TrackedStateDict (line 52) | class TrackedStateDict: method __init__ (line 53) | def __init__(self, to_track: dict): method __getitem__ (line 62) | def __getitem__(self, key: str) -> Any: method __setitem__ (line 65) | def __setitem__(self, key: str, item: Any): method diff (line 69) | def diff(self) -> list[str]: method copy (line 78) | def copy(self) -> dict: function prepare_img (line 84) | def prepare_img(): class Args (line 92) | class Args: function setup_cfg (line 98) | def setup_cfg(args: Args): class OriginalMaskFormerConfigToOursConverter (line 108) | class OriginalMaskFormerConfigToOursConverter: method __call__ (line 109) | def __call__(self, original_config: object) -> MaskFormerConfig: class OriginalMaskFormerConfigToImageProcessorConverter (line 168) | class OriginalMaskFormerConfigToImageProcessorConverter: method __call__ (line 169) | def __call__(self, original_config: object) -> MaskFormerImageProcessor: class OriginalMaskFormerCheckpointToOursConverter (line 185) | class OriginalMaskFormerCheckpointToOursConverter: method __init__ (line 186) | def __init__(self, original_model: nn.Module, config: MaskFormerConfig): method pop_all (line 190) | def pop_all(self, renamed_keys: list[tuple[str, str]], dst_state_dict:... method replace_backbone (line 194) | def replace_backbone(self, dst_state_dict: StateDict, src_state_dict: ... method replace_pixel_module (line 351) | def replace_pixel_module(self, dst_state_dict: StateDict, src_state_di... method rename_keys_in_detr_decoder (line 384) | def rename_keys_in_detr_decoder(self, dst_state_dict: StateDict, src_s... method replace_q_k_v_in_detr_decoder (line 441) | def replace_q_k_v_in_detr_decoder(self, dst_state_dict: StateDict, src... method replace_detr_decoder (line 468) | def replace_detr_decoder(self, dst_state_dict: StateDict, src_state_di... method replace_transformer_module (line 484) | def replace_transformer_module(self, dst_state_dict: StateDict, src_st... method replace_instance_segmentation_module (line 498) | def replace_instance_segmentation_module(self, dst_state_dict: StateDi... method convert (line 519) | def convert(self, mask_former: MaskFormerModel) -> MaskFormerModel: method convert_instance_segmentation (line 534) | def convert_instance_segmentation( method using_dirs (line 547) | def using_dirs(checkpoints_dir: Path, config_dir: Path) -> Iterator[tu... function test (line 558) | def test(original_model, our_model: MaskFormerForInstanceSegmentation, i... function get_name (line 613) | def get_name(checkpoint_file: Path): FILE: src/transformers/models/maskformer/convert_maskformer_resnet_to_pytorch.py function get_maskformer_config (line 39) | def get_maskformer_config(model_name: str): function create_rename_keys (line 82) | def create_rename_keys(config): function rename_key (line 223) | def rename_key(dct, old, new): function read_in_decoder_q_k_v (line 229) | def read_in_decoder_q_k_v(state_dict, config): function prepare_img (line 257) | def prepare_img() -> torch.Tensor: function convert_maskformer_checkpoint (line 265) | def convert_maskformer_checkpoint( FILE: src/transformers/models/maskformer/convert_maskformer_swin_to_pytorch.py function get_maskformer_config (line 39) | def get_maskformer_config(model_name: str): function create_rename_keys (line 77) | def create_rename_keys(config): function rename_key (line 166) | def rename_key(dct, old, new): function read_in_swin_q_k_v (line 172) | def read_in_swin_q_k_v(state_dict, backbone_config): function read_in_decoder_q_k_v (line 198) | def read_in_decoder_q_k_v(state_dict, config): function prepare_img (line 226) | def prepare_img() -> torch.Tensor: function convert_maskformer_checkpoint (line 234) | def convert_maskformer_checkpoint( FILE: src/transformers/models/maskformer/image_processing_maskformer.py function binary_mask_to_rle (line 44) | def binary_mask_to_rle(mask: "torch.Tensor | np.ndarray") -> list[int]: function convert_segmentation_to_rle (line 67) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 88) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... function check_segment_validity (line 116) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 134) | def compute_segments( function convert_segmentation_map_to_binary_masks_fast (line 194) | def convert_segmentation_map_to_binary_masks_fast( class MaskFormerImageProcessorKwargs (line 229) | class MaskFormerImageProcessorKwargs(ImagesKwargs, total=False): class MaskFormerImageProcessor (line 256) | class MaskFormerImageProcessor(TorchvisionBackend): method __init__ (line 272) | def __init__(self, **kwargs: Unpack[MaskFormerImageProcessorKwargs]) -... method to_dict (line 285) | def to_dict(self) -> dict[str, Any]: method reduce_label (line 294) | def reduce_label(self, labels: list["torch.Tensor"]): method resize (line 302) | def resize( method pad (line 352) | def pad( method preprocess (line 381) | def preprocess( method _preprocess_image_like_inputs (line 396) | def _preprocess_image_like_inputs( method _preprocess (line 424) | def _preprocess( method post_process_semantic_segmentation (line 547) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 598) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 715) | def post_process_panoptic_segmentation( FILE: src/transformers/models/maskformer/image_processing_pil_maskformer.py function convert_segmentation_map_to_binary_masks (line 48) | def convert_segmentation_map_to_binary_masks( class MaskFormerImageProcessorKwargs (line 85) | class MaskFormerImageProcessorKwargs(ImagesKwargs, total=False): function binary_mask_to_rle (line 112) | def binary_mask_to_rle(mask): function check_segment_validity (line 137) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 156) | def compute_segments( function convert_segmentation_to_rle (line 217) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 239) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... class MaskFormerImageProcessorPil (line 269) | class MaskFormerImageProcessorPil(PilBackend): method __init__ (line 285) | def __init__(self, **kwargs: Unpack[MaskFormerImageProcessorKwargs]) -... method to_dict (line 301) | def to_dict(self) -> dict[str, Any]: method reduce_label (line 310) | def reduce_label(self, labels: list[np.ndarray]): method resize (line 319) | def resize( method pad (line 362) | def pad( method preprocess (line 439) | def preprocess( method _preprocess_image_like_inputs (line 454) | def _preprocess_image_like_inputs( method _preprocess (line 481) | def _preprocess( method post_process_semantic_segmentation (line 583) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 635) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 754) | def post_process_panoptic_segmentation( FILE: src/transformers/models/maskformer/modeling_maskformer.py class DetrDecoderOutput (line 69) | class DetrDecoderOutput(BaseModelOutputWithCrossAttentions): class MaskFormerPixelLevelModuleOutput (line 94) | class MaskFormerPixelLevelModuleOutput(ModelOutput): class MaskFormerPixelDecoderOutput (line 123) | class MaskFormerPixelDecoderOutput(ModelOutput): class MaskFormerModelOutput (line 140) | class MaskFormerModelOutput(ModelOutput): class MaskFormerForInstanceSegmentationOutput (line 186) | class MaskFormerForInstanceSegmentationOutput(ModelOutput): class MaskFormerDetrDecoderOutput (line 243) | class MaskFormerDetrDecoderOutput(BaseModelOutputWithCrossAttentions): class MaskFormerDetrLearnedPositionEmbedding (line 257) | class MaskFormerDetrLearnedPositionEmbedding(nn.Module): method __init__ (line 262) | def __init__(self, embedding_dim=256): method forward (line 268) | def forward( function eager_attention_forward (line 290) | def eager_attention_forward( class MaskFormerDetrSelfAttention (line 318) | class MaskFormerDetrSelfAttention(nn.Module): method __init__ (line 325) | def __init__( method forward (line 345) | def forward( class MaskFormerDetrCrossAttention (line 384) | class MaskFormerDetrCrossAttention(nn.Module): method __init__ (line 392) | def __init__( method forward (line 412) | def forward( class MaskFormerDetrMLP (line 464) | class MaskFormerDetrMLP(nn.Module): method __init__ (line 465) | def __init__(self, config: MaskFormerDetrConfig, hidden_size: int, int... method forward (line 473) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MaskFormerDetrDecoderLayer (line 481) | class MaskFormerDetrDecoderLayer(GradientCheckpointingLayer): method __init__ (line 482) | def __init__(self, config: MaskFormerDetrConfig): method forward (line 505) | def forward( class MaskFormerDetrConvBlock (line 573) | class MaskFormerDetrConvBlock(nn.Module): method __init__ (line 576) | def __init__(self, in_channels: int, out_channels: int, activation: st... method forward (line 582) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MaskFormerDetrFPNFusionStage (line 586) | class MaskFormerDetrFPNFusionStage(nn.Module): method __init__ (line 589) | def __init__(self, fpn_channels: int, current_channels: int, output_ch... method forward (line 594) | def forward(self, features: torch.Tensor, fpn_features: torch.Tensor) ... class MaskFormerDetrMaskHeadSmallConv (line 608) | class MaskFormerDetrMaskHeadSmallConv(nn.Module): method __init__ (line 616) | def __init__( method forward (line 643) | def forward( class MaskFormerDetrMHAttentionMap (line 677) | class MaskFormerDetrMHAttentionMap(nn.Module): method __init__ (line 680) | def __init__( method forward (line 695) | def forward( class MaskFormerDetrPreTrainedModel (line 729) | class MaskFormerDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 745) | def _init_weights(self, module): class MaskFormerDetrDecoder (line 778) | class MaskFormerDetrDecoder(MaskFormerDetrPreTrainedModel): method __init__ (line 793) | def __init__(self, config: MaskFormerDetrConfig): method forward (line 806) | def forward( function pair_wise_dice_loss (line 894) | def pair_wise_dice_loss(inputs: Tensor, labels: Tensor) -> Tensor: function pair_wise_sigmoid_focal_loss (line 917) | def pair_wise_sigmoid_focal_loss(inputs: Tensor, labels: Tensor, alpha: ... class MaskFormerHungarianMatcher (line 957) | class MaskFormerHungarianMatcher(nn.Module): method __init__ (line 965) | def __init__(self, cost_class: float = 1.0, cost_mask: float = 1.0, co... method forward (line 984) | def forward(self, masks_queries_logits, class_queries_logits, mask_lab... method __repr__ (line 1042) | def __repr__(self): function dice_loss (line 1055) | def dice_loss(inputs: Tensor, labels: Tensor, num_masks: int) -> Tensor: function sigmoid_focal_loss (line 1086) | def sigmoid_focal_loss( class MaskFormerLoss (line 1130) | class MaskFormerLoss(nn.Module): method __init__ (line 1131) | def __init__( method _max_by_axis (line 1164) | def _max_by_axis(self, the_list: list[list[int]]) -> list[int]: method _pad_images_to_max_in_batch (line 1171) | def _pad_images_to_max_in_batch(self, tensors: list[Tensor]) -> tuple[... method loss_labels (line 1190) | def loss_labels( method loss_masks (line 1225) | def loss_masks( method _get_predictions_permutation_indices (line 1267) | def _get_predictions_permutation_indices(self, indices): method _get_targets_permutation_indices (line 1273) | def _get_targets_permutation_indices(self, indices): method forward (line 1279) | def forward( method get_num_masks (line 1333) | def get_num_masks(self, class_labels: torch.Tensor, device: torch.devi... class MaskFormerFPNConvLayer (line 1349) | class MaskFormerFPNConvLayer(nn.Module): method __init__ (line 1350) | def __init__(self, in_features: int, out_features: int, kernel_size: i... method forward (line 1375) | def forward(self, input: Tensor) -> Tensor: class MaskFormerFPNLayer (line 1382) | class MaskFormerFPNLayer(nn.Module): method __init__ (line 1383) | def __init__(self, in_features: int, lateral_features: int): method forward (line 1402) | def forward(self, down: Tensor, left: Tensor) -> Tensor: class MaskFormerFPNModel (line 1410) | class MaskFormerFPNModel(nn.Module): method __init__ (line 1411) | def __init__(self, in_features: int, lateral_widths: list[int], featur... method forward (line 1430) | def forward(self, features: list[Tensor]) -> list[Tensor]: class MaskFormerPixelDecoder (line 1441) | class MaskFormerPixelDecoder(nn.Module): method __init__ (line 1442) | def __init__(self, *args, feature_size: int = 256, mask_feature_size: ... method forward (line 1459) | def forward( class MaskFormerSinePositionEmbedding (line 1475) | class MaskFormerSinePositionEmbedding(nn.Module): method __init__ (line 1481) | def __init__( method forward (line 1493) | def forward( class PredictionBlock (line 1521) | class PredictionBlock(nn.Module): method __init__ (line 1522) | def __init__(self, in_dim: int, out_dim: int, activation: nn.Module) -... method forward (line 1529) | def forward(self, input: Tensor) -> Tensor: class MaskformerMLPPredictionHead (line 1536) | class MaskformerMLPPredictionHead(nn.Module): method __init__ (line 1537) | def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, n... method forward (line 1568) | def forward(self, input: Tensor) -> Tensor: class MaskFormerPixelLevelModule (line 1575) | class MaskFormerPixelLevelModule(nn.Module): method __init__ (line 1576) | def __init__(self, config: MaskFormerConfig): method forward (line 1603) | def forward( class MaskFormerTransformerModule (line 1626) | class MaskFormerTransformerModule(nn.Module): method __init__ (line 1631) | def __init__(self, in_features: int, config: MaskFormerConfig): method forward (line 1640) | def forward( class MaskFormerPreTrainedModel (line 1679) | class MaskFormerPreTrainedModel(PreTrainedModel): method _init_weights (line 1686) | def _init_weights(self, module: nn.Module): class MaskFormerModel (line 1734) | class MaskFormerModel(MaskFormerPreTrainedModel): method __init__ (line 1735) | def __init__(self, config: MaskFormerConfig): method forward (line 1745) | def forward( class MaskFormerForInstanceSegmentation (line 1833) | class MaskFormerForInstanceSegmentation(MaskFormerPreTrainedModel): method __init__ (line 1834) | def __init__(self, config: MaskFormerConfig): method get_loss_dict (line 1861) | def get_loss_dict( method get_loss (line 1880) | def get_loss(self, loss_dict: dict[str, Tensor]) -> Tensor: method get_logits (line 1883) | def get_logits(self, outputs: MaskFormerModelOutput) -> tuple[Tensor, ... method forward (line 1916) | def forward( FILE: src/transformers/models/maskformer/modeling_maskformer_swin.py class MaskFormerSwinModelOutputWithPooling (line 43) | class MaskFormerSwinModelOutputWithPooling(ModelOutput): class MaskFormerSwinBaseModelOutput (line 66) | class MaskFormerSwinBaseModelOutput(ModelOutput): function window_partition (line 81) | def window_partition(input_feature, window_size): function window_reverse (line 94) | def window_reverse(windows, window_size, height, width): function drop_path (line 105) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class MaskFormerSwinEmbeddings (line 120) | class MaskFormerSwinEmbeddings(nn.Module): method __init__ (line 125) | def __init__(self, config): method interpolate_pos_encoding (line 142) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 182) | def forward(self, pixel_values, interpolate_pos_encoding): class MaskFormerSwinPatchEmbeddings (line 199) | class MaskFormerSwinPatchEmbeddings(nn.Module): method __init__ (line 206) | def __init__(self, config): method maybe_pad (line 221) | def maybe_pad(self, pixel_values, height, width): method forward (line 230) | def forward(self, pixel_values: torch.FloatTensor | None) -> tuple[tor... class MaskFormerSwinPatchMerging (line 243) | class MaskFormerSwinPatchMerging(nn.Module): method __init__ (line 256) | def __init__(self, input_resolution: tuple[int], dim: int, norm_layer:... method maybe_pad (line 263) | def maybe_pad(self, input_feature, height, width): method forward (line 271) | def forward(self, input_feature: torch.Tensor, input_dimensions: tuple... class MaskFormerSwinDropPath (line 298) | class MaskFormerSwinDropPath(nn.Module): method __init__ (line 301) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 305) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 308) | def extra_repr(self) -> str: class MaskFormerSwinSelfAttention (line 313) | class MaskFormerSwinSelfAttention(nn.Module): method __init__ (line 314) | def __init__(self, config, dim, num_heads, window_size): method forward (line 340) | def forward( method create_relative_position_index (line 391) | def create_relative_position_index(self): class MaskFormerSwinSelfOutput (line 407) | class MaskFormerSwinSelfOutput(nn.Module): method __init__ (line 408) | def __init__(self, config, dim): method forward (line 413) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MaskFormerSwinAttention (line 421) | class MaskFormerSwinAttention(nn.Module): method __init__ (line 422) | def __init__(self, config, dim, num_heads, window_size): method forward (line 427) | def forward( class MaskFormerSwinIntermediate (line 440) | class MaskFormerSwinIntermediate(nn.Module): method __init__ (line 441) | def __init__(self, config, dim): method forward (line 449) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MaskFormerSwinOutput (line 456) | class MaskFormerSwinOutput(nn.Module): method __init__ (line 457) | def __init__(self, config, dim): method forward (line 462) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MaskFormerSwinLayer (line 468) | class MaskFormerSwinLayer(nn.Module): method __init__ (line 469) | def __init__(self, config, dim, input_resolution, num_heads, drop_path... method get_attn_mask (line 481) | def get_attn_mask(self, input_resolution): method maybe_pad (line 510) | def maybe_pad(self, hidden_states, height, width): method forward (line 518) | def forward(self, hidden_states, input_dimensions, output_attentions=F... class MaskFormerSwinStage (line 576) | class MaskFormerSwinStage(GradientCheckpointingLayer): method __init__ (line 578) | def __init__(self, config, dim, input_resolution, depth, num_heads, dr... method forward (line 604) | def forward(self, hidden_states, input_dimensions, output_attentions=F... class MaskFormerSwinEncoder (line 629) | class MaskFormerSwinEncoder(nn.Module): method __init__ (line 631) | def __init__(self, config, grid_size): method forward (line 653) | def forward( class MaskFormerSwinPreTrainedModel (line 698) | class MaskFormerSwinPreTrainedModel(PreTrainedModel): method _init_weights (line 707) | def _init_weights(self, module): class MaskFormerSwinModel (line 718) | class MaskFormerSwinModel(MaskFormerSwinPreTrainedModel): method __init__ (line 719) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 733) | def get_input_embeddings(self): method forward (line 736) | def forward( class MaskFormerSwinBackbone (line 788) | class MaskFormerSwinBackbone(BackboneMixin, MaskFormerSwinPreTrainedModel): method __init__ (line 800) | def __init__(self, config: MaskFormerSwinConfig): method forward (line 816) | def forward( FILE: src/transformers/models/maskformer/modular_maskformer.py class MaskFormerDetrConfig (line 57) | class MaskFormerDetrConfig(DetrConfig): class MaskFormerConfig (line 63) | class MaskFormerConfig(PreTrainedConfig): method __post_init__ (line 119) | def __post_init__(self, **kwargs): class DetrDecoderOutput (line 166) | class DetrDecoderOutput(DetrDecoderOutput): class MaskFormerPixelLevelModuleOutput (line 181) | class MaskFormerPixelLevelModuleOutput(ModelOutput): class MaskFormerPixelDecoderOutput (line 210) | class MaskFormerPixelDecoderOutput(ModelOutput): class MaskFormerModelOutput (line 227) | class MaskFormerModelOutput(ModelOutput): class MaskFormerForInstanceSegmentationOutput (line 273) | class MaskFormerForInstanceSegmentationOutput(ModelOutput): function upsample_like (line 322) | def upsample_like(pixel_values: Tensor, like: Tensor, mode: str = "bilin... function dice_loss (line 343) | def dice_loss(inputs: Tensor, labels: Tensor, num_masks: int) -> Tensor: function sigmoid_focal_loss (line 374) | def sigmoid_focal_loss( function pair_wise_dice_loss (line 418) | def pair_wise_dice_loss(inputs: Tensor, labels: Tensor) -> Tensor: function pair_wise_sigmoid_focal_loss (line 441) | def pair_wise_sigmoid_focal_loss(inputs: Tensor, labels: Tensor, alpha: ... class MaskFormerDetrDecoder (line 480) | class MaskFormerDetrDecoder(DetrDecoder): class MaskFormerHungarianMatcher (line 485) | class MaskFormerHungarianMatcher(nn.Module): method __init__ (line 493) | def __init__(self, cost_class: float = 1.0, cost_mask: float = 1.0, co... method forward (line 512) | def forward(self, masks_queries_logits, class_queries_logits, mask_lab... method __repr__ (line 570) | def __repr__(self): class MaskFormerLoss (line 583) | class MaskFormerLoss(nn.Module): method __init__ (line 584) | def __init__( method _max_by_axis (line 617) | def _max_by_axis(self, the_list: list[list[int]]) -> list[int]: method _pad_images_to_max_in_batch (line 624) | def _pad_images_to_max_in_batch(self, tensors: list[Tensor]) -> tuple[... method loss_labels (line 643) | def loss_labels( method loss_masks (line 678) | def loss_masks( method _get_predictions_permutation_indices (line 720) | def _get_predictions_permutation_indices(self, indices): method _get_targets_permutation_indices (line 726) | def _get_targets_permutation_indices(self, indices): method forward (line 732) | def forward( method get_num_masks (line 786) | def get_num_masks(self, class_labels: torch.Tensor, device: torch.devi... class MaskFormerFPNConvLayer (line 802) | class MaskFormerFPNConvLayer(nn.Module): method __init__ (line 803) | def __init__(self, in_features: int, out_features: int, kernel_size: i... method forward (line 828) | def forward(self, input: Tensor) -> Tensor: class MaskFormerFPNLayer (line 835) | class MaskFormerFPNLayer(nn.Module): method __init__ (line 836) | def __init__(self, in_features: int, lateral_features: int): method forward (line 855) | def forward(self, down: Tensor, left: Tensor) -> Tensor: class MaskFormerFPNModel (line 863) | class MaskFormerFPNModel(nn.Module): method __init__ (line 864) | def __init__(self, in_features: int, lateral_widths: list[int], featur... method forward (line 883) | def forward(self, features: list[Tensor]) -> list[Tensor]: class MaskFormerPixelDecoder (line 894) | class MaskFormerPixelDecoder(nn.Module): method __init__ (line 895) | def __init__(self, *args, feature_size: int = 256, mask_feature_size: ... method forward (line 912) | def forward( class MaskFormerSinePositionEmbedding (line 928) | class MaskFormerSinePositionEmbedding(nn.Module): method __init__ (line 934) | def __init__( method forward (line 946) | def forward( class PredictionBlock (line 974) | class PredictionBlock(nn.Module): method __init__ (line 975) | def __init__(self, in_dim: int, out_dim: int, activation: nn.Module) -... method forward (line 982) | def forward(self, input: Tensor) -> Tensor: class MaskformerMLPPredictionHead (line 989) | class MaskformerMLPPredictionHead(nn.Module): method __init__ (line 990) | def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, n... method forward (line 1021) | def forward(self, input: Tensor) -> Tensor: class MaskFormerPixelLevelModule (line 1028) | class MaskFormerPixelLevelModule(nn.Module): method __init__ (line 1029) | def __init__(self, config: MaskFormerConfig): method forward (line 1056) | def forward( class MaskFormerTransformerModule (line 1079) | class MaskFormerTransformerModule(nn.Module): method __init__ (line 1084) | def __init__(self, in_features: int, config: MaskFormerConfig): method forward (line 1093) | def forward( class MaskFormerPreTrainedModel (line 1132) | class MaskFormerPreTrainedModel(PreTrainedModel): method _init_weights (line 1139) | def _init_weights(self, module: nn.Module): class MaskFormerModel (line 1187) | class MaskFormerModel(MaskFormerPreTrainedModel): method __init__ (line 1188) | def __init__(self, config: MaskFormerConfig): method forward (line 1198) | def forward( class MaskFormerForInstanceSegmentation (line 1286) | class MaskFormerForInstanceSegmentation(MaskFormerPreTrainedModel): method __init__ (line 1287) | def __init__(self, config: MaskFormerConfig): method get_loss_dict (line 1314) | def get_loss_dict( method get_loss (line 1333) | def get_loss(self, loss_dict: dict[str, Tensor]) -> Tensor: method get_logits (line 1336) | def get_logits(self, outputs: MaskFormerModelOutput) -> tuple[Tensor, ... method forward (line 1369) | def forward( FILE: src/transformers/models/mbart/configuration_mbart.py class MBartConfig (line 24) | class MBartConfig(PreTrainedConfig): FILE: src/transformers/models/mbart/convert_mbart_original_checkpoint_to_pytorch.py function remove_ignore_keys_ (line 23) | def remove_ignore_keys_(state_dict): function make_linear_from_emb (line 36) | def make_linear_from_emb(emb): function convert_fairseq_mbart_checkpoint_from_disk (line 43) | def convert_fairseq_mbart_checkpoint_from_disk( FILE: src/transformers/models/mbart/modeling_mbart.py function shift_tokens_right (line 64) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int): class MBartLearnedPositionalEmbedding (line 85) | class MBartLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 90) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 96) | def forward( class MBartScaledWordEmbedding (line 113) | class MBartScaledWordEmbedding(nn.Embedding): method __init__ (line 118) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 122) | def forward(self, input_ids: torch.Tensor): function eager_attention_forward (line 127) | def eager_attention_forward( class MBartAttention (line 156) | class MBartAttention(nn.Module): method __init__ (line 159) | def __init__( method forward (line 198) | def forward( class MBartEncoderLayer (line 274) | class MBartEncoderLayer(GradientCheckpointingLayer): method __init__ (line 275) | def __init__(self, config: MBartConfig): method forward (line 293) | def forward( class MBartDecoderLayer (line 330) | class MBartDecoderLayer(GradientCheckpointingLayer): method __init__ (line 331) | def __init__(self, config: MBartConfig, layer_idx: int | None = None): method forward (line 362) | def forward( class MBartClassificationHead (line 424) | class MBartClassificationHead(nn.Module): method __init__ (line 427) | def __init__( method forward (line 439) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MBartPreTrainedModel (line 449) | class MBartPreTrainedModel(PreTrainedModel): method _init_weights (line 459) | def _init_weights(self, module): method dummy_inputs (line 465) | def dummy_inputs(self): class MBartEncoder (line 475) | class MBartEncoder(MBartPreTrainedModel): method __init__ (line 490) | def __init__(self, config: MBartConfig): method _backward_compatibility_gradient_checkpointing (line 518) | def _backward_compatibility_gradient_checkpointing(self): method forward (line 525) | def forward( class MBartDecoder (line 592) | class MBartDecoder(MBartPreTrainedModel): method __init__ (line 607) | def __init__(self, config: MBartConfig): method forward (line 635) | def forward( class MBartModel (line 764) | class MBartModel(MBartPreTrainedModel): method __init__ (line 770) | def __init__(self, config: MBartConfig): method get_input_embeddings (line 783) | def get_input_embeddings(self): method set_input_embeddings (line 786) | def set_input_embeddings(self, value): method forward (line 793) | def forward( class MBartForConditionalGeneration (line 884) | class MBartForConditionalGeneration(MBartPreTrainedModel, GenerationMixin): method __init__ (line 889) | def __init__(self, config: MBartConfig): method resize_token_embeddings (line 898) | def resize_token_embeddings( method _resize_final_logits_bias (line 905) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 915) | def forward( method prepare_decoder_input_ids_from_labels (line 1039) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class MBartForSequenceClassification (line 1049) | class MBartForSequenceClassification(MBartPreTrainedModel): method __init__ (line 1050) | def __init__(self, config: MBartConfig, **kwargs): method forward (line 1066) | def forward( class MBartForQuestionAnswering (line 1175) | class MBartForQuestionAnswering(MBartPreTrainedModel): method __init__ (line 1176) | def __init__(self, config): method forward (line 1191) | def forward( class MBartDecoderWrapper (line 1282) | class MBartDecoderWrapper(MBartPreTrainedModel): method __init__ (line 1288) | def __init__(self, config): method forward (line 1293) | def forward(self, *args, **kwargs): class MBartForCausalLM (line 1298) | class MBartForCausalLM(MBartPreTrainedModel, GenerationMixin): method __init__ (line 1303) | def __init__(self, config): method get_input_embeddings (line 1314) | def get_input_embeddings(self): method set_input_embeddings (line 1317) | def set_input_embeddings(self, value): method forward (line 1322) | def forward( FILE: src/transformers/models/mbart/tokenization_mbart.py class MBartTokenizer (line 33) | class MBartTokenizer(TokenizersBackend): method __init__ (line 64) | def __init__( method src_lang (line 149) | def src_lang(self) -> str: method src_lang (line 153) | def src_lang(self, new_src_lang: str) -> None: method _build_translation_inputs (line 157) | def _build_translation_inputs( method _switch_to_input_mode (line 169) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 172) | def _switch_to_target_mode(self): method set_src_lang_special_tokens (line 177) | def set_src_lang_special_tokens(self, src_lang) -> None: method set_tgt_lang_special_tokens (line 192) | def set_tgt_lang_special_tokens(self, lang: str) -> None: FILE: src/transformers/models/mbart50/tokenization_mbart50.py class MBart50Tokenizer (line 33) | class MBart50Tokenizer(TokenizersBackend): method __init__ (line 85) | def __init__( method _build_language_code_mappings (line 209) | def _build_language_code_mappings(self): method _post_init (line 228) | def _post_init(self): method src_lang (line 238) | def src_lang(self) -> str: method src_lang (line 242) | def src_lang(self, new_src_lang: str) -> None: method prepare_seq2seq_batch (line 246) | def prepare_seq2seq_batch( method _switch_to_input_mode (line 258) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 261) | def _switch_to_target_mode(self): method set_src_lang_special_tokens (line 266) | def set_src_lang_special_tokens(self, src_lang: str) -> None: method set_tgt_lang_special_tokens (line 281) | def set_tgt_lang_special_tokens(self, tgt_lang: str) -> None: method _build_translation_inputs (line 296) | def _build_translation_inputs( FILE: src/transformers/models/megatron_bert/configuration_megatron_bert.py class MegatronBertConfig (line 24) | class MegatronBertConfig(PreTrainedConfig): FILE: src/transformers/models/megatron_bert/convert_megatron_bert_checkpoint.py function recursive_print (line 48) | def recursive_print(name, val, spaces=0): function fix_query_key_value_ordering (line 68) | def fix_query_key_value_ordering(param, checkpoint_version, num_splits, ... function convert_megatron_checkpoint (line 94) | def convert_megatron_checkpoint(args, input_state_dict, config): function main (line 275) | def main(): FILE: src/transformers/models/megatron_bert/modeling_megatron_bert.py class MegatronBertEmbeddings (line 49) | class MegatronBertEmbeddings(nn.Module): method __init__ (line 52) | def __init__(self, config): method forward (line 67) | def forward( class MegatronBertSelfAttention (line 103) | class MegatronBertSelfAttention(nn.Module): method __init__ (line 104) | def __init__(self, config, layer_idx=None): method forward (line 125) | def forward( class MegatronBertSelfOutput (line 200) | class MegatronBertSelfOutput(nn.Module): method __init__ (line 201) | def __init__(self, config): method forward (line 206) | def forward(self, hidden_states: torch.Tensor, residual: torch.Tensor)... class MegatronBertAttention (line 213) | class MegatronBertAttention(nn.Module): method __init__ (line 214) | def __init__(self, config, layer_idx=None): method forward (line 220) | def forward( class MegatronBertIntermediate (line 243) | class MegatronBertIntermediate(nn.Module): method __init__ (line 244) | def __init__(self, config): method forward (line 252) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MegatronBertOutput (line 259) | class MegatronBertOutput(nn.Module): method __init__ (line 260) | def __init__(self, config): method forward (line 265) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MegatronBertLayer (line 272) | class MegatronBertLayer(GradientCheckpointingLayer): method __init__ (line 273) | def __init__(self, config, layer_idx=None): method forward (line 288) | def forward( method feed_forward_chunk (line 330) | def feed_forward_chunk(self, attention_output): class MegatronBertEncoder (line 337) | class MegatronBertEncoder(nn.Module): method __init__ (line 338) | def __init__(self, config): method forward (line 348) | def forward( class MegatronBertPooler (line 424) | class MegatronBertPooler(nn.Module): method __init__ (line 425) | def __init__(self, config): method forward (line 430) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MegatronBertPredictionHeadTransform (line 440) | class MegatronBertPredictionHeadTransform(nn.Module): method __init__ (line 441) | def __init__(self, config): method forward (line 450) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MegatronBertLMPredictionHead (line 458) | class MegatronBertLMPredictionHead(nn.Module): method __init__ (line 459) | def __init__(self, config): method forward (line 468) | def forward(self, hidden_states): class MegatronBertOnlyMLMHead (line 475) | class MegatronBertOnlyMLMHead(nn.Module): method __init__ (line 476) | def __init__(self, config): method forward (line 480) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class MegatronBertOnlyNSPHead (line 486) | class MegatronBertOnlyNSPHead(nn.Module): method __init__ (line 487) | def __init__(self, config): method forward (line 491) | def forward(self, pooled_output): class MegatronBertPreTrainingHeads (line 497) | class MegatronBertPreTrainingHeads(nn.Module): method __init__ (line 498) | def __init__(self, config): method forward (line 503) | def forward(self, sequence_output, pooled_output): class MegatronBertPreTrainedModel (line 510) | class MegatronBertPreTrainedModel(PreTrainedModel): method _init_weights (line 516) | def _init_weights(self, module): class MegatronBertForPreTrainingOutput (line 532) | class MegatronBertForPreTrainingOutput(ModelOutput): class MegatronBertModel (line 552) | class MegatronBertModel(MegatronBertPreTrainedModel): method __init__ (line 565) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 581) | def get_input_embeddings(self): method set_input_embeddings (line 584) | def set_input_embeddings(self, value): method forward (line 588) | def forward( class MegatronBertForPreTraining (line 690) | class MegatronBertForPreTraining(MegatronBertPreTrainedModel): method __init__ (line 696) | def __init__(self, config, add_binary_head=True): method get_output_embeddings (line 709) | def get_output_embeddings(self): method set_output_embeddings (line 712) | def set_output_embeddings(self, new_embeddings): method forward (line 717) | def forward( class MegatronBertForCausalLM (line 799) | class MegatronBertForCausalLM(MegatronBertPreTrainedModel, GenerationMix... method __init__ (line 805) | def __init__(self, config): method get_output_embeddings (line 817) | def get_output_embeddings(self): method set_output_embeddings (line 820) | def set_output_embeddings(self, new_embeddings): method forward (line 825) | def forward( class MegatronBertForMaskedLM (line 906) | class MegatronBertForMaskedLM(MegatronBertPreTrainedModel): method __init__ (line 912) | def __init__(self, config): method get_output_embeddings (line 927) | def get_output_embeddings(self): method set_output_embeddings (line 930) | def set_output_embeddings(self, new_embeddings): method forward (line 935) | def forward( class MegatronBertForNextSentencePrediction (line 997) | class MegatronBertForNextSentencePrediction(MegatronBertPreTrainedModel): method __init__ (line 998) | def __init__(self, config): method forward (line 1008) | def forward( class MegatronBertForSequenceClassification (line 1087) | class MegatronBertForSequenceClassification(MegatronBertPreTrainedModel): method __init__ (line 1088) | def __init__(self, config): method forward (line 1100) | def forward( class MegatronBertForMultipleChoice (line 1172) | class MegatronBertForMultipleChoice(MegatronBertPreTrainedModel): method __init__ (line 1173) | def __init__(self, config): method forward (line 1184) | def forward( class MegatronBertForTokenClassification (line 1275) | class MegatronBertForTokenClassification(MegatronBertPreTrainedModel): method __init__ (line 1276) | def __init__(self, config): method forward (line 1288) | def forward( class MegatronBertForQuestionAnswering (line 1341) | class MegatronBertForQuestionAnswering(MegatronBertPreTrainedModel): method __init__ (line 1342) | def __init__(self, config): method forward (line 1353) | def forward( FILE: src/transformers/models/megatron_gpt2/checkpoint_reshaping_and_interoperability.py function add_checkpointing_args (line 32) | def add_checkpointing_args(parser): function add_megatron_checkpoint_args (line 58) | def add_megatron_checkpoint_args(parser): function add_transformers_checkpoint_args (line 116) | def add_transformers_checkpoint_args(parser): function recursive_print (line 172) | def recursive_print(name, val, spaces=0): function megatron_to_transformers_fix_query_key_value_ordering (line 200) | def megatron_to_transformers_fix_query_key_value_ordering( function transformers_to_megatron_fix_query_key_value_ordering (line 234) | def transformers_to_megatron_fix_query_key_value_ordering( function merge_transformers_sharded_states (line 268) | def merge_transformers_sharded_states(path, num_checkpoints): function get_megatron_sharded_states (line 285) | def get_megatron_sharded_states(args, tp_size, pp_size, pp_rank): function get_element_from_dict_by_path (line 309) | def get_element_from_dict_by_path(d, path): function convert_checkpoint_from_megatron_to_transformers (line 325) | def convert_checkpoint_from_megatron_to_transformers(args): function convert_checkpoint_from_transformers_to_megatron (line 608) | def convert_checkpoint_from_transformers_to_megatron(args): function main (line 912) | def main(): FILE: src/transformers/models/megatron_gpt2/convert_megatron_gpt2_checkpoint.py function recursive_print (line 48) | def recursive_print(name, val, spaces=0): function fix_query_key_value_ordering (line 68) | def fix_query_key_value_ordering(param, checkpoint_version, num_splits, ... function convert_megatron_checkpoint (line 94) | def convert_megatron_checkpoint(args, input_state_dict, config): function main (line 312) | def main(): FILE: src/transformers/models/metaclip_2/configuration_metaclip_2.py class MetaClip2TextConfig (line 33) | class MetaClip2TextConfig(PreTrainedConfig): method validate_architecture (line 72) | def validate_architecture(self): class MetaClip2VisionConfig (line 83) | class MetaClip2VisionConfig(PreTrainedConfig): method validate_architecture (line 117) | def validate_architecture(self): class MetaClip2Config (line 128) | class MetaClip2Config(PreTrainedConfig): method __post_init__ (line 163) | def __post_init__(self, **kwargs): FILE: src/transformers/models/metaclip_2/convert_metaclip_2_to_hf.py function load_metaclip2_checkpoint (line 38) | def load_metaclip2_checkpoint(checkpoint_path: str, model_name: str) -> ... function create_hf_config (line 54) | def create_hf_config(tokenizer: AutoTokenizer, model_name: str) -> tuple... function convert_state_dict (line 169) | def convert_state_dict(metaclip_state_dict: dict[str, torch.Tensor]) -> ... function verify_conversion (line 294) | def verify_conversion( function push_to_hub (line 360) | def push_to_hub(hf_model: MetaClip2Model, processor: CLIPProcessor, repo... function main (line 372) | def main(): FILE: src/transformers/models/metaclip_2/modeling_metaclip_2.py class MetaClip2TextEmbeddings (line 42) | class MetaClip2TextEmbeddings(nn.Module): method __init__ (line 43) | def __init__(self, config: MetaClip2TextConfig): method forward (line 55) | def forward( class MetaClip2VisionEmbeddings (line 82) | class MetaClip2VisionEmbeddings(nn.Module): method __init__ (line 83) | def __init__(self, config: MetaClip2VisionConfig): method interpolate_pos_encoding (line 105) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 146) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... function eager_attention_forward (line 165) | def eager_attention_forward( class MetaClip2Attention (line 186) | class MetaClip2Attention(nn.Module): method __init__ (line 189) | def __init__(self, config: MetaClip2VisionConfig | MetaClip2TextConfig): method forward (line 204) | def forward( class MetaClip2MLP (line 243) | class MetaClip2MLP(nn.Module): method __init__ (line 244) | def __init__(self, config): method forward (line 251) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MetaClip2EncoderLayer (line 258) | class MetaClip2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 259) | def __init__(self, config: MetaClip2VisionConfig | MetaClip2TextConfig): method forward (line 267) | def forward( class MetaClip2PreTrainedModel (line 292) | class MetaClip2PreTrainedModel(PreTrainedModel): method _init_weights (line 307) | def _init_weights(self, module): class MetaClip2Encoder (line 368) | class MetaClip2Encoder(nn.Module): method __init__ (line 377) | def __init__(self, config: MetaClip2Config): method forward (line 383) | def forward( class MetaClip2TextTransformer (line 416) | class MetaClip2TextTransformer(MetaClip2PreTrainedModel): method __init__ (line 422) | def __init__(self, config: MetaClip2TextConfig): method forward (line 437) | def forward( class MetaClip2TextModel (line 486) | class MetaClip2TextModel(MetaClip2PreTrainedModel): method __init__ (line 522) | def __init__(self, config: MetaClip2TextConfig): method get_input_embeddings (line 528) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 531) | def set_input_embeddings(self, value): method forward (line 535) | def forward( class MetaClip2TextModelOutput (line 572) | class MetaClip2TextModelOutput(ModelOutput): class MetaClip2TextModelWithProjection (line 585) | class MetaClip2TextModelWithProjection(MetaClip2PreTrainedModel): method __init__ (line 621) | def __init__(self, config: MetaClip2TextConfig): method get_input_embeddings (line 632) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 635) | def set_input_embeddings(self, value): method forward (line 640) | def forward( class MetaClip2Output (line 681) | class MetaClip2Output(ModelOutput): method to_tuple (line 709) | def to_tuple(self) -> tuple[Any]: function contrastive_loss (line 715) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function metaclip_2_loss (line 719) | def metaclip_2_loss(similarity: torch.Tensor) -> torch.Tensor: function _get_vector_norm (line 725) | def _get_vector_norm(tensor: torch.Tensor) -> torch.Tensor: class MetaClip2Model (line 737) | class MetaClip2Model(MetaClip2PreTrainedModel): method __init__ (line 779) | def __init__(self, config: MetaClip2Config): method get_text_features (line 816) | def get_text_features( method get_image_features (line 849) | def get_image_features( method forward (line 888) | def forward( class MetaClip2VisionTransformer (line 969) | class MetaClip2VisionTransformer(MetaClip2PreTrainedModel): method __init__ (line 975) | def __init__(self, config: MetaClip2VisionConfig): method forward (line 989) | def forward( class MetaClip2VisionModel (line 1021) | class MetaClip2VisionModel(MetaClip2PreTrainedModel): method __init__ (line 1065) | def __init__(self, config: MetaClip2VisionConfig): method get_input_embeddings (line 1071) | def get_input_embeddings(self) -> nn.Module: method forward (line 1075) | def forward( class MetaClip2VisionModelOutput (line 1117) | class MetaClip2VisionModelOutput(ModelOutput): class MetaClip2VisionModelWithProjection (line 1130) | class MetaClip2VisionModelWithProjection(MetaClip2PreTrainedModel): method __init__ (line 1172) | def __init__(self, config: MetaClip2VisionConfig): method get_input_embeddings (line 1183) | def get_input_embeddings(self) -> nn.Module: method forward (line 1188) | def forward( class MetaClip2ForImageClassification (line 1238) | class MetaClip2ForImageClassification(MetaClip2PreTrainedModel): method __init__ (line 1242) | def __init__(self, config: MetaClip2Config) -> None: method forward (line 1259) | def forward( FILE: src/transformers/models/metaclip_2/modular_metaclip_2.py class MetaClip2TextConfig (line 51) | class MetaClip2TextConfig(CLIPTextConfig): class MetaClip2VisionConfig (line 71) | class MetaClip2VisionConfig(CLIPVisionConfig): class MetaClip2Config (line 91) | class MetaClip2Config(CLIPConfig): class MetaClip2TextEmbeddings (line 118) | class MetaClip2TextEmbeddings(CLIPTextEmbeddings): class MetaClip2VisionEmbeddings (line 122) | class MetaClip2VisionEmbeddings(CLIPVisionEmbeddings): class MetaClip2Attention (line 126) | class MetaClip2Attention(CLIPAttention): class MetaClip2MLP (line 130) | class MetaClip2MLP(CLIPMLP): class MetaClip2PreTrainedModel (line 135) | class MetaClip2PreTrainedModel(CLIPPreTrainedModel): method _init_weights (line 139) | def _init_weights(self, module): class MetaClip2TextTransformer (line 200) | class MetaClip2TextTransformer(CLIPTextTransformer): method forward (line 201) | def forward( class MetaClip2TextModel (line 245) | class MetaClip2TextModel(CLIPTextModel): method forward (line 276) | def forward( class MetaClip2TextModelWithProjection (line 306) | class MetaClip2TextModelWithProjection(CLIPTextModelWithProjection): method forward (line 337) | def forward( class MetaClip2Model (line 366) | class MetaClip2Model(CLIPModel): method __init__ (line 405) | def __init__(self, config: MetaClip2Config): method forward (line 428) | def forward( method get_text_features (line 477) | def get_text_features( method get_image_features (line 506) | def get_image_features( class MetaClip2VisionModel (line 540) | class MetaClip2VisionModel(CLIPVisionModel): method forward (line 579) | def forward( class MetaClip2VisionModelWithProjection (line 614) | class MetaClip2VisionModelWithProjection(CLIPVisionModelWithProjection): method forward (line 652) | def forward( class MetaClip2ForImageClassification (line 686) | class MetaClip2ForImageClassification(CLIPForImageClassification): FILE: src/transformers/models/mgp_str/configuration_mgp_str.py class MgpstrConfig (line 24) | class MgpstrConfig(PreTrainedConfig): FILE: src/transformers/models/mgp_str/modeling_mgp_str.py function drop_path (line 34) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class MgpstrDropPath (line 50) | class MgpstrDropPath(nn.Module): method __init__ (line 53) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 57) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 60) | def extra_repr(self) -> str: class MgpstrModelOutput (line 70) | class MgpstrModelOutput(ModelOutput): class MgpstrEmbeddings (line 93) | class MgpstrEmbeddings(nn.Module): method __init__ (line 96) | def __init__(self, config: MgpstrConfig): method forward (line 121) | def forward(self, pixel_values): class MgpstrMlp (line 139) | class MgpstrMlp(nn.Module): method __init__ (line 142) | def __init__(self, config: MgpstrConfig, hidden_features): method forward (line 150) | def forward(self, hidden_states): class MgpstrAttention (line 159) | class MgpstrAttention(nn.Module): method __init__ (line 160) | def __init__(self, config: MgpstrConfig): method forward (line 171) | def forward(self, hidden_states): class MgpstrLayer (line 190) | class MgpstrLayer(nn.Module): method __init__ (line 191) | def __init__(self, config: MgpstrConfig, drop_path=None): method forward (line 201) | def forward(self, hidden_states): class MgpstrEncoder (line 216) | class MgpstrEncoder(nn.Module): method __init__ (line 217) | def __init__(self, config: MgpstrConfig): method forward (line 226) | def forward(self, hidden_states, output_attentions=False, output_hidde... class MgpstrA3Module (line 252) | class MgpstrA3Module(nn.Module): method __init__ (line 253) | def __init__(self, config: MgpstrConfig): method forward (line 265) | def forward(self, hidden_states): class MgpstrPreTrainedModel (line 281) | class MgpstrPreTrainedModel(PreTrainedModel): method _init_weights (line 287) | def _init_weights(self, module: nn.Module) -> None: class MgpstrModel (line 303) | class MgpstrModel(MgpstrPreTrainedModel): method __init__ (line 304) | def __init__(self, config: MgpstrConfig): method get_input_embeddings (line 313) | def get_input_embeddings(self) -> nn.Module: method forward (line 317) | def forward( class MgpstrForSceneTextRecognition (line 358) | class MgpstrForSceneTextRecognition(MgpstrPreTrainedModel): method __init__ (line 362) | def __init__(self, config: MgpstrConfig) -> None: method forward (line 380) | def forward( FILE: src/transformers/models/mgp_str/processing_mgp_str.py class DecodeType (line 29) | class DecodeType(ExplicitEnum): class MgpstrProcessor (line 40) | class MgpstrProcessor(ProcessorMixin): method __init__ (line 41) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 49) | def __call__(self, text=None, images=None, return_tensors=None, **kwar... method batch_decode (line 66) | def batch_decode(self, sequences): method _decode_helper (line 108) | def _decode_helper(self, pred_logits, format): method char_decode (line 158) | def char_decode(self, sequences): method bpe_decode (line 171) | def bpe_decode(self, sequences): method wp_decode (line 183) | def wp_decode(self, sequences): method model_input_names (line 197) | def model_input_names(self): FILE: src/transformers/models/mgp_str/tokenization_mgp_str.py class MgpstrTokenizer (line 28) | class MgpstrTokenizer(PreTrainedTokenizer): method __init__ (line 52) | def __init__(self, vocab_file, unk_token="[GO]", bos_token="[GO]", eos... method vocab_size (line 66) | def vocab_size(self): method get_vocab (line 69) | def get_vocab(self): method _tokenize (line 74) | def _tokenize(self, text): method _convert_token_to_id (line 81) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 85) | def _convert_id_to_token(self, index): method save_vocabulary (line 89) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/mimi/configuration_mimi.py class MimiConfig (line 28) | class MimiConfig(PreTrainedConfig): method __post_init__ (line 125) | def __post_init__(self, **kwargs): method validate_architecture (line 135) | def validate_architecture(self): method encodec_frame_rate (line 143) | def encodec_frame_rate(self) -> int: method num_codebooks (line 148) | def num_codebooks(self) -> int: method frame_size (line 153) | def frame_size(self) -> int: method frame_rate (line 177) | def frame_rate(self) -> float: FILE: src/transformers/models/mimi/convert_mimi_checkpoint_to_pytorch.py function assert_param_count (line 33) | def assert_param_count(model_1, model_2): function param_count (line 39) | def param_count(model): function _grab_best_device (line 43) | def _grab_best_device(use_gpu=True): function _convert_model (line 81) | def _convert_model( function convert_checkpoint (line 141) | def convert_checkpoint( FILE: src/transformers/models/mimi/modeling_mimi.py class MimiOutput (line 47) | class MimiOutput(ModelOutput): class MimiConv1dPaddingCache (line 77) | class MimiConv1dPaddingCache: method __init__ (line 86) | def __init__( method _cache_init (line 107) | def _cache_init(self, hidden_states: torch.Tensor, layer_idx: int): method update (line 137) | def update(self, hidden_states: torch.Tensor, layer_idx: int): class MimiEncoderOutput (line 173) | class MimiEncoderOutput(ModelOutput): class MimiDecoderOutput (line 196) | class MimiDecoderOutput(ModelOutput): class MimiConv1d (line 214) | class MimiConv1d(nn.Module): method __init__ (line 217) | def __init__( method apply_weight_norm (line 262) | def apply_weight_norm(self): method remove_weight_norm (line 269) | def remove_weight_norm(self): method _get_extra_padding_for_conv1d (line 273) | def _get_extra_padding_for_conv1d( method _pad1d (line 287) | def _pad1d(hidden_states: torch.Tensor, paddings: tuple[int, int], mod... method _get_output_length (line 305) | def _get_output_length(self, input_length: torch.LongTensor) -> torch.... method forward (line 331) | def forward(self, hidden_states, padding_cache=None): class MimiConvTranspose1d (line 354) | class MimiConvTranspose1d(nn.Module): method __init__ (line 357) | def __init__( method apply_weight_norm (line 393) | def apply_weight_norm(self): method remove_weight_norm (line 400) | def remove_weight_norm(self): method forward (line 403) | def forward(self, hidden_states): class MimiResnetBlock (line 412) | class MimiResnetBlock(nn.Module): method __init__ (line 417) | def __init__(self, config: MimiConfig, dim: int, dilations: list[int]): method forward (line 437) | def forward(self, hidden_states, padding_cache=None): class MimiEncoder (line 454) | class MimiEncoder(nn.Module): method __init__ (line 457) | def __init__(self, config: MimiConfig): method forward (line 490) | def forward(self, hidden_states, padding_cache=None): class MimiLayerScale (line 499) | class MimiLayerScale(nn.Module): method __init__ (line 504) | def __init__(self, config): method forward (line 510) | def forward(self, x: torch.Tensor): class MimiRotaryEmbedding (line 515) | class MimiRotaryEmbedding(nn.Module): method __init__ (line 518) | def __init__(self, config: MimiConfig, device=None): method compute_default_rope_parameters (line 535) | def compute_default_rope_parameters( method forward (line 566) | def forward(self, x, position_ids): function rotate_half (line 581) | def rotate_half(x): function apply_rotary_pos_emb (line 589) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class MimiMLP (line 614) | class MimiMLP(nn.Module): method __init__ (line 615) | def __init__(self, config): method forward (line 623) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function repeat_kv (line 631) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class MimiAttention (line 645) | class MimiAttention(nn.Module): method __init__ (line 648) | def __init__(self, config: MimiConfig, layer_idx: int | None = None): method forward (line 683) | def forward( class MimiFlashAttention2 (line 741) | class MimiFlashAttention2(MimiAttention): method __init__ (line 748) | def __init__(self, *args, **kwargs): method forward (line 756) | def forward( class MimiSdpaAttention (line 852) | class MimiSdpaAttention(MimiAttention): method forward (line 860) | def forward( class MimiTransformerLayer (line 926) | class MimiTransformerLayer(GradientCheckpointingLayer): method __init__ (line 927) | def __init__(self, config: MimiConfig, layer_idx: int): method forward (line 939) | def forward( class MimiTransformerModel (line 996) | class MimiTransformerModel(nn.Module): method __init__ (line 1004) | def __init__(self, config: MimiConfig): method forward (line 1015) | def forward( class MimiDecoder (line 1143) | class MimiDecoder(nn.Module): method __init__ (line 1146) | def __init__(self, config: MimiConfig): method forward (line 1170) | def forward(self, hidden_states): class MimiEuclideanCodebook (line 1176) | class MimiEuclideanCodebook(nn.Module): method __init__ (line 1179) | def __init__(self, config: MimiConfig, epsilon: float = 1e-5): method embed (line 1192) | def embed(self) -> torch.Tensor: method quantize (line 1197) | def quantize(self, hidden_states): method encode (line 1205) | def encode(self, hidden_states): method decode (line 1216) | def decode(self, embed_ind): class MimiVectorQuantization (line 1222) | class MimiVectorQuantization(nn.Module): method __init__ (line 1227) | def __init__(self, config: MimiConfig): method encode (line 1231) | def encode(self, hidden_states): method decode (line 1236) | def decode(self, embed_ind): class MimiResidualVectorQuantizer (line 1242) | class MimiResidualVectorQuantizer(nn.Module): method __init__ (line 1245) | def __init__(self, config: MimiConfig, num_quantizers: int | None = No... method encode (line 1262) | def encode(self, embeddings: torch.Tensor, num_quantizers: int | None ... method decode (line 1282) | def decode(self, codes: torch.Tensor) -> torch.Tensor: class MimiSplitResidualVectorQuantizer (line 1296) | class MimiSplitResidualVectorQuantizer(nn.Module): method __init__ (line 1299) | def __init__(self, config: MimiConfig): method encode (line 1311) | def encode(self, embeddings: torch.Tensor, num_quantizers: float | Non... method decode (line 1340) | def decode(self, codes: torch.Tensor) -> torch.Tensor: class MimiPreTrainedModel (line 1353) | class MimiPreTrainedModel(PreTrainedModel): method _init_weights (line 1367) | def _init_weights(self, module): class MimiModel (line 1411) | class MimiModel(MimiPreTrainedModel): method __init__ (line 1412) | def __init__(self, config: MimiConfig): method _encode_frame (line 1455) | def _encode_frame( method get_encoded_length (line 1490) | def get_encoded_length(self, input_length: torch.LongTensor) -> torch.... method get_audio_codes_mask (line 1505) | def get_audio_codes_mask(self, padding_mask: torch.Tensor, padding_sid... method encode (line 1522) | def encode( method _decode_frame (line 1613) | def _decode_frame( method decode (line 1633) | def decode( method forward (line 1682) | def forward( FILE: src/transformers/models/minimax/configuration_minimax.py class MiniMaxConfig (line 30) | class MiniMaxConfig(PreTrainedConfig): method __post_init__ (line 113) | def __post_init__(self, **kwargs): FILE: src/transformers/models/minimax/modeling_minimax.py class MiniMaxRMSNorm (line 58) | class MiniMaxRMSNorm(nn.Module): method __init__ (line 59) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 67) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 74) | def extra_repr(self): class MiniMaxCache (line 78) | class MiniMaxCache(DynamicCache): method __init__ (line 79) | def __init__(self): method set_linear_cache (line 83) | def set_linear_cache(self, layer_idx, linear_cache): method get_linear_cache (line 89) | def get_linear_cache(self, layer_idx: int): method __len__ (line 94) | def __len__(self): method batch_repeat_interleave (line 97) | def batch_repeat_interleave(self, repeats: int): method batch_select_indices (line 104) | def batch_select_indices(self, indices: torch.Tensor): method crop (line 111) | def crop(self, max_length: int): class MiniMaxLightningAttention (line 115) | class MiniMaxLightningAttention(nn.Module): method __init__ (line 116) | def __init__(self, config: MiniMaxConfig, layer_idx: int): method get_slope_rate (line 138) | def get_slope_rate(self): method decay_factors (line 149) | def decay_factors(self, slope_rate): method forward (line 163) | def forward( class MiniMaxRotaryEmbedding (line 261) | class MiniMaxRotaryEmbedding(nn.Module): method __init__ (line 264) | def __init__(self, config: MiniMaxConfig, device=None): method compute_default_rope_parameters (line 281) | def compute_default_rope_parameters( method forward (line 312) | def forward(self, x, position_ids): function rotate_half (line 326) | def rotate_half(x): function apply_rotary_pos_emb (line 334) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 359) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 371) | def eager_attention_forward( class MiniMaxAttention (line 397) | class MiniMaxAttention(nn.Module): method __init__ (line 400) | def __init__(self, config: MiniMaxConfig, layer_idx: int): method forward (line 414) | def forward( class MiniMaxTopKRouter (line 456) | class MiniMaxTopKRouter(nn.Module): method __init__ (line 457) | def __init__(self, config): method forward (line 464) | def forward(self, hidden_states): class MiniMaxExperts (line 475) | class MiniMaxExperts(nn.Module): method __init__ (line 478) | def __init__(self, config: MiniMaxConfig): method forward (line 487) | def forward( class MiniMaxSparseMoeBlock (line 514) | class MiniMaxSparseMoeBlock(nn.Module): method __init__ (line 515) | def __init__(self, config): method forward (line 522) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class MiniMaxDecoderLayer (line 533) | class MiniMaxDecoderLayer(GradientCheckpointingLayer): method __init__ (line 534) | def __init__(self, config: MiniMaxConfig, layer_idx: int): method forward (line 556) | def forward( class MiniMaxPreTrainedModel (line 587) | class MiniMaxPreTrainedModel(PreTrainedModel): method _init_weights (line 605) | def _init_weights(self, module): class MiniMaxModel (line 623) | class MiniMaxModel(MiniMaxPreTrainedModel): method __init__ (line 624) | def __init__(self, config: MiniMaxConfig): method forward (line 642) | def forward( function load_balancing_loss_func (line 707) | def load_balancing_loss_func( class MiniMaxForCausalLM (line 790) | class MiniMaxForCausalLM(MiniMaxPreTrainedModel, GenerationMixin): method __init__ (line 795) | def __init__(self, config): method forward (line 809) | def forward( class MiniMaxForSequenceClassification (line 892) | class MiniMaxForSequenceClassification(GenericForSequenceClassification,... class MiniMaxForTokenClassification (line 896) | class MiniMaxForTokenClassification(GenericForTokenClassification, MiniM... class MiniMaxForQuestionAnswering (line 900) | class MiniMaxForQuestionAnswering(GenericForQuestionAnswering, MiniMaxPr... FILE: src/transformers/models/minimax/modular_minimax.py class MiniMaxConfig (line 56) | class MiniMaxConfig(PreTrainedConfig): method __post_init__ (line 139) | def __post_init__(self, **kwargs): class MiniMaxRMSNorm (line 151) | class MiniMaxRMSNorm(MixtralRMSNorm): class MiniMaxCache (line 155) | class MiniMaxCache(DynamicCache): method __init__ (line 156) | def __init__(self): method set_linear_cache (line 160) | def set_linear_cache(self, layer_idx, linear_cache): method get_linear_cache (line 166) | def get_linear_cache(self, layer_idx: int): method __len__ (line 171) | def __len__(self): method batch_repeat_interleave (line 174) | def batch_repeat_interleave(self, repeats: int): method batch_select_indices (line 181) | def batch_select_indices(self, indices: torch.Tensor): method crop (line 188) | def crop(self, max_length: int): class MiniMaxLightningAttention (line 192) | class MiniMaxLightningAttention(nn.Module): method __init__ (line 193) | def __init__(self, config: MiniMaxConfig, layer_idx: int): method get_slope_rate (line 215) | def get_slope_rate(self): method decay_factors (line 226) | def decay_factors(self, slope_rate): method forward (line 240) | def forward( class MiniMaxRotaryEmbedding (line 338) | class MiniMaxRotaryEmbedding(Gemma2RotaryEmbedding): class MiniMaxAttention (line 342) | class MiniMaxAttention(MixtralAttention): class MiniMaxTopKRouter (line 346) | class MiniMaxTopKRouter(MixtralTopKRouter): class MiniMaxSparseMoeBlock (line 350) | class MiniMaxSparseMoeBlock(MixtralSparseMoeBlock): class MiniMaxDecoderLayer (line 354) | class MiniMaxDecoderLayer(MixtralDecoderLayer, GradientCheckpointingLayer): method __init__ (line 355) | def __init__(self, config: MiniMaxConfig, layer_idx: int): method forward (line 373) | def forward( class MiniMaxPreTrainedModel (line 403) | class MiniMaxPreTrainedModel(MixtralPreTrainedModel): method _init_weights (line 411) | def _init_weights(self, module): class MiniMaxModel (line 422) | class MiniMaxModel(MixtralModel): method forward (line 425) | def forward( class MiniMaxForCausalLM (line 490) | class MiniMaxForCausalLM(MixtralForCausalLM): method forward (line 491) | def forward(self, **super_kwargs): class MiniMaxForSequenceClassification (line 517) | class MiniMaxForSequenceClassification(MixtralForSequenceClassification): class MiniMaxForTokenClassification (line 521) | class MiniMaxForTokenClassification(MixtralForTokenClassification): class MiniMaxForQuestionAnswering (line 525) | class MiniMaxForQuestionAnswering(MixtralForQuestionAnswering): FILE: src/transformers/models/minimax_m2/configuration_minimax_m2.py class MiniMaxM2Config (line 31) | class MiniMaxM2Config(PreTrainedConfig): FILE: src/transformers/models/minimax_m2/modeling_minimax_m2.py class MiniMaxM2TopKRouter (line 46) | class MiniMaxM2TopKRouter(nn.Module): method __init__ (line 47) | def __init__(self, config): method forward (line 54) | def forward(self, hidden_states, e_score_correction_bias): class MiniMaxM2Experts (line 68) | class MiniMaxM2Experts(nn.Module): method __init__ (line 71) | def __init__(self, config: MiniMaxM2Config): method forward (line 80) | def forward( class MiniMaxM2SparseMoeBlock (line 107) | class MiniMaxM2SparseMoeBlock(nn.Module): method __init__ (line 108) | def __init__(self, config): method forward (line 116) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class MiniMaxM2RMSNorm (line 128) | class MiniMaxM2RMSNorm(nn.Module): method __init__ (line 129) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 137) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 144) | def extra_repr(self): class MiniMaxM2RotaryEmbedding (line 148) | class MiniMaxM2RotaryEmbedding(nn.Module): method __init__ (line 151) | def __init__(self, config: MiniMaxM2Config, device=None): method compute_default_rope_parameters (line 168) | def compute_default_rope_parameters( method forward (line 201) | def forward(self, x, position_ids): function repeat_kv (line 215) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 227) | def eager_attention_forward( function apply_rotary_pos_emb (line 252) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function rotate_half (line 288) | def rotate_half(x): class MiniMaxM2Attention (line 296) | class MiniMaxM2Attention(nn.Module): method __init__ (line 299) | def __init__(self, config: MiniMaxM2Config, layer_idx: int): method forward (line 315) | def forward( class MiniMaxM2DecoderLayer (line 360) | class MiniMaxM2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 361) | def __init__(self, config: MiniMaxM2Config, layer_idx: int): method forward (line 371) | def forward( class MiniMaxM2PreTrainedModel (line 399) | class MiniMaxM2PreTrainedModel(PreTrainedModel): method _init_weights (line 418) | def _init_weights(self, module): class MiniMaxM2Model (line 431) | class MiniMaxM2Model(MiniMaxM2PreTrainedModel): method __init__ (line 432) | def __init__(self, config: MiniMaxM2Config): method forward (line 451) | def forward( function load_balancing_loss_func (line 506) | def load_balancing_loss_func( class MiniMaxM2ForCausalLM (line 589) | class MiniMaxM2ForCausalLM(MiniMaxM2PreTrainedModel, GenerationMixin): method __init__ (line 594) | def __init__(self, config): method forward (line 608) | def forward( FILE: src/transformers/models/minimax_m2/modular_minimax_m2.py class MiniMaxM2Config (line 50) | class MiniMaxM2Config(PreTrainedConfig): class MiniMaxM2TopKRouter (line 113) | class MiniMaxM2TopKRouter(MixtralTopKRouter): method forward (line 114) | def forward(self, hidden_states, e_score_correction_bias): class MiniMaxM2Experts (line 127) | class MiniMaxM2Experts(MixtralExperts): class MiniMaxM2SparseMoeBlock (line 131) | class MiniMaxM2SparseMoeBlock(MixtralSparseMoeBlock): method __init__ (line 132) | def __init__(self, config): method forward (line 136) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class MiniMaxM2RMSNorm (line 147) | class MiniMaxM2RMSNorm(MixtralRMSNorm): class MiniMaxM2RotaryEmbedding (line 151) | class MiniMaxM2RotaryEmbedding(Glm4MoeRotaryEmbedding): class MiniMaxM2Attention (line 155) | class MiniMaxM2Attention(FlexOlmoAttention): method __init__ (line 156) | def __init__(self, config: MiniMaxM2Config, layer_idx: int): class MiniMaxM2PreTrainedModel (line 164) | class MiniMaxM2PreTrainedModel(MixtralPreTrainedModel): method _init_weights (line 166) | def _init_weights(self, module): class MiniMaxM2Model (line 178) | class MiniMaxM2Model(MixtralModel): method forward (line 182) | def forward( class MiniMaxM2ForCausalLM (line 237) | class MiniMaxM2ForCausalLM(MixtralForCausalLM): FILE: src/transformers/models/ministral/configuration_ministral.py class MinistralConfig (line 31) | class MinistralConfig(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): FILE: src/transformers/models/ministral/modeling_ministral.py class MinistralMLP (line 50) | class MinistralMLP(nn.Module): method __init__ (line 51) | def __init__(self, config): method forward (line 61) | def forward(self, x): function rotate_half (line 66) | def rotate_half(x): function apply_rotary_pos_emb (line 74) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 99) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 111) | def eager_attention_forward( class MinistralAttention (line 137) | class MinistralAttention(nn.Module): method __init__ (line 140) | def __init__(self, config, layer_idx: int): method forward (line 157) | def forward( class MinistralRMSNorm (line 200) | class MinistralRMSNorm(nn.Module): method __init__ (line 201) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 209) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 216) | def extra_repr(self): class MinistralDecoderLayer (line 220) | class MinistralDecoderLayer(GradientCheckpointingLayer): method __init__ (line 221) | def __init__(self, config: MinistralConfig, layer_idx: int): method forward (line 231) | def forward( class MinistralPreTrainedModel (line 264) | class MinistralPreTrainedModel(PreTrainedModel): class MinistralRotaryEmbedding (line 282) | class MinistralRotaryEmbedding(nn.Module): method __init__ (line 285) | def __init__(self, config: MinistralConfig, device=None): method compute_default_rope_parameters (line 302) | def compute_default_rope_parameters( method forward (line 333) | def forward(self, x, position_ids): class MinistralModel (line 348) | class MinistralModel(MinistralPreTrainedModel): method __init__ (line 349) | def __init__(self, config: MinistralConfig): method forward (line 368) | def forward( class MinistralForCausalLM (line 430) | class MinistralForCausalLM(MinistralPreTrainedModel, GenerationMixin): method __init__ (line 435) | def __init__(self, config): method forward (line 446) | def forward( class MinistralForSequenceClassification (line 503) | class MinistralForSequenceClassification(GenericForSequenceClassificatio... class MinistralForTokenClassification (line 507) | class MinistralForTokenClassification(GenericForTokenClassification, Min... class MinistralForQuestionAnswering (line 511) | class MinistralForQuestionAnswering(GenericForQuestionAnswering, Ministr... FILE: src/transformers/models/ministral/modular_ministral.py class MinistralConfig (line 46) | class MinistralConfig(MistralConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): class MinistralMLP (line 79) | class MinistralMLP(Qwen2MLP): class MinistralAttention (line 83) | class MinistralAttention(Qwen2Attention): method __init__ (line 84) | def __init__(self, config, layer_idx: int): class MinistralRMSNorm (line 92) | class MinistralRMSNorm(Qwen2RMSNorm): class MinistralDecoderLayer (line 96) | class MinistralDecoderLayer(Qwen2DecoderLayer): class MinistralPreTrainedModel (line 100) | class MinistralPreTrainedModel(Qwen2PreTrainedModel): class MinistralRotaryEmbedding (line 104) | class MinistralRotaryEmbedding(Qwen2RotaryEmbedding): class MinistralModel (line 108) | class MinistralModel(Qwen2Model): method __init__ (line 109) | def __init__(self, config: MinistralConfig): method forward (line 116) | def forward( class MinistralForCausalLM (line 177) | class MinistralForCausalLM(Qwen2ForCausalLM): class MinistralForSequenceClassification (line 181) | class MinistralForSequenceClassification(Qwen2ForSequenceClassification): class MinistralForTokenClassification (line 185) | class MinistralForTokenClassification(Qwen2ForTokenClassification): class MinistralForQuestionAnswering (line 189) | class MinistralForQuestionAnswering(Qwen2ForQuestionAnswering): FILE: src/transformers/models/ministral3/configuration_ministral3.py class Ministral3Config (line 28) | class Ministral3Config(PreTrainedConfig): method __post_init__ (line 93) | def __post_init__(self, **kwargs): FILE: src/transformers/models/ministral3/convert_ministral3_weights_to_hf.py function get_sd_mapping (line 38) | def get_sd_mapping(has_vision: bool) -> dict: function map_old_key_to_new (line 77) | def map_old_key_to_new(old_key, mapping): function read_json (line 88) | def read_json(path): function permute_for_rope (line 93) | def permute_for_rope(tensor, n_heads, dim1, dim2): function convert_state_dict (line 101) | def convert_state_dict(original_state_dict: dict, config: Mistral3Config): function convert_config (line 138) | def convert_config(original_config: dict, max_position_embeddings: int =... function convert_and_write_model (line 228) | def convert_and_write_model(input_dir: str, output_dir: str, max_positio... function convert_and_write_processor_and_tokenizer (line 268) | def convert_and_write_processor_and_tokenizer( function main (line 310) | def main(): FILE: src/transformers/models/ministral3/modeling_ministral3.py function rotate_half (line 35) | def rotate_half(x): function apply_rotary_pos_emb (line 43) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 68) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 80) | def eager_attention_forward( function get_llama_4_attn_scale (line 105) | def get_llama_4_attn_scale(positions_ids: torch.Tensor, beta: float, max... class Ministral3Attention (line 111) | class Ministral3Attention(nn.Module): method __init__ (line 114) | def __init__(self, config: Ministral3Config, layer_idx: int): method forward (line 128) | def forward( class Ministral3MLP (line 176) | class Ministral3MLP(nn.Module): method __init__ (line 177) | def __init__(self, config): method forward (line 187) | def forward(self, x): class Ministral3RMSNorm (line 193) | class Ministral3RMSNorm(nn.Module): method __init__ (line 194) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 202) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 209) | def extra_repr(self): class Ministral3DecoderLayer (line 213) | class Ministral3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 214) | def __init__(self, config: Ministral3Config, layer_idx: int): method forward (line 222) | def forward( class Ministral3PreTrainedModel (line 255) | class Ministral3PreTrainedModel(PreTrainedModel): class Ministral3RotaryEmbedding (line 273) | class Ministral3RotaryEmbedding(nn.Module): method __init__ (line 276) | def __init__(self, config: Ministral3Config, device=None): method compute_default_rope_parameters (line 293) | def compute_default_rope_parameters( method forward (line 324) | def forward(self, x, position_ids): class Ministral3Model (line 339) | class Ministral3Model(Ministral3PreTrainedModel): method __init__ (line 340) | def __init__(self, config: Ministral3Config): method forward (line 359) | def forward( class Ministral3ForCausalLM (line 413) | class Ministral3ForCausalLM(Ministral3PreTrainedModel, GenerationMixin): method __init__ (line 418) | def __init__(self, config): method forward (line 429) | def forward( class Ministral3ForTokenClassification (line 486) | class Ministral3ForTokenClassification(GenericForTokenClassification, Mi... class Ministral3ForSequenceClassification (line 490) | class Ministral3ForSequenceClassification(GenericForSequenceClassificati... class Ministral3ForQuestionAnswering (line 494) | class Ministral3ForQuestionAnswering(GenericForQuestionAnswering, Minist... FILE: src/transformers/models/ministral3/modular_ministral3.py function get_llama_4_attn_scale (line 29) | def get_llama_4_attn_scale(positions_ids: torch.Tensor, beta: float, max... class Ministral3Attention (line 34) | class Ministral3Attention(MistralAttention): method forward (line 35) | def forward( class Ministral3DecoderLayer (line 83) | class Ministral3DecoderLayer(MistralDecoderLayer): class Ministral3PreTrainedModel (line 88) | class Ministral3PreTrainedModel(MistralPreTrainedModel): class Ministral3Model (line 93) | class Ministral3Model(MistralModel): class Ministral3ForCausalLM (line 98) | class Ministral3ForCausalLM(MistralForCausalLM): class Ministral3ForTokenClassification (line 102) | class Ministral3ForTokenClassification(GenericForTokenClassification, Mi... class Ministral3ForSequenceClassification (line 106) | class Ministral3ForSequenceClassification(GenericForSequenceClassificati... class Ministral3ForQuestionAnswering (line 110) | class Ministral3ForQuestionAnswering(GenericForQuestionAnswering, Minist... FILE: src/transformers/models/mistral/configuration_mistral.py class MistralConfig (line 28) | class MistralConfig(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mistral/convert_mistral_weights_to_hf.py function map_old_key_to_new (line 51) | def map_old_key_to_new(old_key): function read_json (line 62) | def read_json(path): function permute_for_rope (line 67) | def permute_for_rope(tensor, n_heads, dim1, dim2): function convert_state_dict (line 75) | def convert_state_dict(original_state_dict: dict, config: MistralConfig): function get_concat_dim (line 102) | def get_concat_dim(key): function convert_state_dict_sharded (line 114) | def convert_state_dict_sharded(loaded_shards: list[dict], config: Mistra... function convert_config (line 162) | def convert_config(original_config: dict, max_position_embeddings: int =... function convert_and_write_model (line 194) | def convert_and_write_model(input_dir: str, output_dir: str, max_positio... function convert_and_write_tokenizer (line 223) | def convert_and_write_tokenizer(input_dir: str, output_dir: str, tokeniz... function main (line 243) | def main(): FILE: src/transformers/models/mistral/modeling_mistral.py class MistralMLP (line 35) | class MistralMLP(nn.Module): method __init__ (line 36) | def __init__(self, config): method forward (line 46) | def forward(self, x): function rotate_half (line 51) | def rotate_half(x): function apply_rotary_pos_emb (line 59) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 84) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 96) | def eager_attention_forward( class MistralAttention (line 122) | class MistralAttention(nn.Module): method __init__ (line 125) | def __init__(self, config: MistralConfig, layer_idx: int): method forward (line 139) | def forward( class MistralRMSNorm (line 182) | class MistralRMSNorm(nn.Module): method __init__ (line 183) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 191) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 198) | def extra_repr(self): class MistralDecoderLayer (line 202) | class MistralDecoderLayer(GradientCheckpointingLayer): method __init__ (line 203) | def __init__(self, config: MistralConfig, layer_idx: int): method forward (line 211) | def forward( class MistralPreTrainedModel (line 244) | class MistralPreTrainedModel(PreTrainedModel): class MistralRotaryEmbedding (line 262) | class MistralRotaryEmbedding(nn.Module): method __init__ (line 265) | def __init__(self, config: MistralConfig, device=None): method compute_default_rope_parameters (line 282) | def compute_default_rope_parameters( method forward (line 313) | def forward(self, x, position_ids): class MistralModel (line 328) | class MistralModel(MistralPreTrainedModel): method __init__ (line 329) | def __init__(self, config: MistralConfig): method forward (line 348) | def forward( class MistralForCausalLM (line 402) | class MistralForCausalLM(MistralPreTrainedModel, GenerationMixin): method __init__ (line 407) | def __init__(self, config): method forward (line 418) | def forward( class MistralForTokenClassification (line 475) | class MistralForTokenClassification(GenericForTokenClassification, Mistr... class MistralForSequenceClassification (line 479) | class MistralForSequenceClassification(GenericForSequenceClassification,... class MistralForQuestionAnswering (line 483) | class MistralForQuestionAnswering(GenericForQuestionAnswering, MistralPr... FILE: src/transformers/models/mistral/modular_mistral.py class MistralMLP (line 36) | class MistralMLP(LlamaMLP): method __init__ (line 37) | def __init__(self, config): class MistralAttention (line 44) | class MistralAttention(LlamaAttention): method __init__ (line 45) | def __init__(self, config: MistralConfig, layer_idx: int): method forward (line 53) | def forward( class MistralDecoderLayer (line 95) | class MistralDecoderLayer(LlamaDecoderLayer): method __init__ (line 96) | def __init__(self, config: MistralConfig, layer_idx: int): class MistralPreTrainedModel (line 102) | class MistralPreTrainedModel(LlamaPreTrainedModel): class MistralModel (line 109) | class MistralModel(LlamaModel): method forward (line 113) | def forward( class MistralForCausalLM (line 166) | class MistralForCausalLM(LlamaForCausalLM): class MistralForTokenClassification (line 170) | class MistralForTokenClassification(LlamaForTokenClassification): class MistralForSequenceClassification (line 174) | class MistralForSequenceClassification(LlamaForSequenceClassification): class MistralForQuestionAnswering (line 178) | class MistralForQuestionAnswering(GenericForQuestionAnswering, MistralPr... FILE: src/transformers/models/mistral3/configuration_mistral3.py class Mistral3Config (line 26) | class Mistral3Config(PreTrainedConfig): method __post_init__ (line 65) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mistral3/convert_mistral3_weights_to_hf.py function map_old_key_to_new (line 63) | def map_old_key_to_new(old_key): function read_json (line 74) | def read_json(path): function permute_for_rope (line 79) | def permute_for_rope(tensor, n_heads, dim1, dim2): function convert_state_dict (line 87) | def convert_state_dict(original_state_dict: dict, config: MistralConfig): function convert_config (line 118) | def convert_config(original_config: dict, max_position_embeddings: int =... function convert_and_write_model (line 171) | def convert_and_write_model(input_dir: str, output_dir: str, max_positio... function convert_and_write_processor (line 191) | def convert_and_write_processor(input_dir: str, output_dir: str): function main (line 217) | def main(): FILE: src/transformers/models/mistral3/modeling_mistral3.py class Mistral3RMSNorm (line 41) | class Mistral3RMSNorm(nn.Module): method __init__ (line 42) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 50) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 57) | def extra_repr(self): class Mistral3PatchMerger (line 61) | class Mistral3PatchMerger(nn.Module): method __init__ (line 66) | def __init__(self, config: Mistral3Config): method forward (line 75) | def forward(self, image_features: torch.Tensor, image_sizes: torch.Ten... class Mistral3MultiModalProjector (line 99) | class Mistral3MultiModalProjector(nn.Module): method __init__ (line 100) | def __init__(self, config: Mistral3Config): method forward (line 118) | def forward(self, image_features: torch.Tensor, image_sizes: torch.Ten... class Mistral3CausalLMOutputWithPast (line 133) | class Mistral3CausalLMOutputWithPast(ModelOutput): class Mistral3ModelOutputWithPast (line 163) | class Mistral3ModelOutputWithPast(BaseModelOutputWithPast): class Mistral3PreTrainedModel (line 179) | class Mistral3PreTrainedModel(PreTrainedModel): class Mistral3Model (line 199) | class Mistral3Model(Mistral3PreTrainedModel): method __init__ (line 200) | def __init__(self, config: Mistral3Config): method get_input_embeddings (line 208) | def get_input_embeddings(self): method set_input_embeddings (line 211) | def set_input_embeddings(self, value): method get_image_features (line 219) | def get_image_features( method get_placeholder_mask (line 254) | def get_placeholder_mask( method forward (line 281) | def forward( class Mistral3ForConditionalGeneration (line 336) | class Mistral3ForConditionalGeneration(Mistral3PreTrainedModel, Generati... method __init__ (line 339) | def __init__(self, config: Mistral3Config): method get_input_embeddings (line 345) | def get_input_embeddings(self): method set_input_embeddings (line 348) | def set_input_embeddings(self, value): method get_output_embeddings (line 351) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 357) | def get_image_features( method forward (line 374) | def forward( method prepare_inputs_for_generation (line 443) | def prepare_inputs_for_generation( FILE: src/transformers/models/mistral3/modular_mistral3.py class Mistral3RMSNorm (line 40) | class Mistral3RMSNorm(MistralRMSNorm): class Mistral3PatchMerger (line 44) | class Mistral3PatchMerger(nn.Module): method __init__ (line 49) | def __init__(self, config: Mistral3Config): method forward (line 58) | def forward(self, image_features: torch.Tensor, image_sizes: torch.Ten... class Mistral3MultiModalProjector (line 82) | class Mistral3MultiModalProjector(nn.Module): method __init__ (line 83) | def __init__(self, config: Mistral3Config): method forward (line 101) | def forward(self, image_features: torch.Tensor, image_sizes: torch.Ten... class Mistral3CausalLMOutputWithPast (line 110) | class Mistral3CausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class Mistral3ModelOutputWithPast (line 114) | class Mistral3ModelOutputWithPast(LlavaModelOutputWithPast): class Mistral3PreTrainedModel (line 118) | class Mistral3PreTrainedModel(LlavaPreTrainedModel): class Mistral3Model (line 122) | class Mistral3Model(LlavaModel): method get_image_features (line 128) | def get_image_features( method forward (line 166) | def forward( class Mistral3ForConditionalGeneration (line 216) | class Mistral3ForConditionalGeneration(LlavaForConditionalGeneration): method get_image_features (line 220) | def get_image_features( method forward (line 237) | def forward( FILE: src/transformers/models/mistral4/configuration_mistral4.py class Mistral4Config (line 25) | class Mistral4Config(PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 130) | def convert_rope_params_to_dict(self, ignore_keys_at_rope_validation: ... FILE: src/transformers/models/mistral4/convert_mistral4_weight_to_hf.py class FP8RescaleMergeAndConcatenate (line 53) | class FP8RescaleMergeAndConcatenate(ConversionOps): method convert (line 63) | def convert( function _get_text_renamings (line 95) | def _get_text_renamings(prefix: str) -> list[WeightRenaming]: function _get_vision_renamings (line 120) | def _get_vision_renamings() -> list[WeightRenaming]: function _is_vision_key (line 141) | def _is_vision_key(key: str) -> bool: function _rename_key (line 146) | def _rename_key( function _rescale_fp8 (line 158) | def _rescale_fp8( function _descale_fp8_to_bf16 (line 168) | def _descale_fp8_to_bf16(tensor: torch.Tensor, scale_inv: torch.Tensor) ... function _permute_for_rope (line 173) | def _permute_for_rope(tensor: torch.Tensor, n_heads: int, dim1: int, dim... function _maybe_permute_vision_rope (line 181) | def _maybe_permute_vision_rope( function _fuse_experts_for_layer (line 200) | def _fuse_experts_for_layer( function fuse_experts (line 279) | def fuse_experts( function convert_state_dict (line 321) | def convert_state_dict( function _read_json (line 362) | def _read_json(path: Path) -> dict: function convert_config (line 367) | def convert_config( function convert_and_write_model (line 475) | def convert_and_write_model( function convert_and_write_processor_and_tokenizer (line 546) | def convert_and_write_processor_and_tokenizer( function main (line 581) | def main() -> None: FILE: src/transformers/models/mistral4/modeling_mistral4.py class Mistral4RMSNorm (line 50) | class Mistral4RMSNorm(nn.Module): method __init__ (line 51) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 59) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self): class Mistral4RotaryEmbedding (line 70) | class Mistral4RotaryEmbedding(nn.Module): method __init__ (line 73) | def __init__(self, config: Mistral4Config, device=None): method compute_default_rope_parameters (line 90) | def compute_default_rope_parameters( method forward (line 121) | def forward(self, x, position_ids): class Mistral4MLP (line 135) | class Mistral4MLP(nn.Module): method __init__ (line 136) | def __init__(self, config, intermediate_size=None): method forward (line 146) | def forward(self, x): class Mistral4TopkRouter (line 151) | class Mistral4TopkRouter(nn.Module): method __init__ (line 152) | def __init__(self, config): method forward (line 159) | def forward(self, hidden_states): class Mistral4NaiveMoe (line 166) | class Mistral4NaiveMoe(nn.Module): method __init__ (line 169) | def __init__(self, config): method forward (line 178) | def forward( class Mistral4MoE (line 205) | class Mistral4MoE(nn.Module): method __init__ (line 210) | def __init__(self, config): method route_tokens_to_experts (line 225) | def route_tokens_to_experts(self, router_logits: torch.Tensor) -> tupl... method forward (line 247) | def forward(self, hidden_states): function rotate_half (line 258) | def rotate_half(x): function apply_rotary_pos_emb (line 266) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 291) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 303) | def eager_attention_forward( function apply_rotary_pos_emb_interleave (line 328) | def apply_rotary_pos_emb_interleave(q, k, cos, sin, position_ids=None, u... function get_llama_4_attn_scale (line 366) | def get_llama_4_attn_scale(positions_ids: torch.Tensor, beta: float, max... class Mistral4Attention (line 371) | class Mistral4Attention(nn.Module): method __init__ (line 374) | def __init__(self, config: Mistral4Config, layer_idx: int): method forward (line 417) | def forward( class Mistral4DecoderLayer (line 490) | class Mistral4DecoderLayer(GradientCheckpointingLayer): method __init__ (line 491) | def __init__(self, config: Mistral4Config, layer_idx: int): method forward (line 505) | def forward( class Mistral4PreTrainedModel (line 537) | class Mistral4PreTrainedModel(PreTrainedModel): method _init_weights (line 557) | def _init_weights(self, module): class Mistral4Model (line 567) | class Mistral4Model(Mistral4PreTrainedModel): method __init__ (line 568) | def __init__(self, config: Mistral4Config): method forward (line 587) | def forward( class Mistral4ForCausalLM (line 641) | class Mistral4ForCausalLM(Mistral4PreTrainedModel, GenerationMixin): method __init__ (line 646) | def __init__(self, config): method forward (line 657) | def forward( class Mistral4ForSequenceClassification (line 714) | class Mistral4ForSequenceClassification(GenericForSequenceClassification... class Mistral4ForTokenClassification (line 718) | class Mistral4ForTokenClassification(GenericForTokenClassification, Mist... FILE: src/transformers/models/mistral4/modular_mistral4.py class Mistral4RMSNorm (line 51) | class Mistral4RMSNorm(LlamaRMSNorm): class Mistral4RotaryEmbedding (line 55) | class Mistral4RotaryEmbedding(LlamaRotaryEmbedding): class Mistral4MLP (line 59) | class Mistral4MLP(Qwen2MoeMLP): class Mistral4TopkRouter (line 63) | class Mistral4TopkRouter(nn.Module): method __init__ (line 64) | def __init__(self, config): method forward (line 71) | def forward(self, hidden_states): class Mistral4NaiveMoe (line 77) | class Mistral4NaiveMoe(DeepseekV3NaiveMoe): class Mistral4MoE (line 81) | class Mistral4MoE(DeepseekV3MoE): method route_tokens_to_experts (line 82) | def route_tokens_to_experts(self, router_logits: torch.Tensor) -> tupl... class Mistral4Attention (line 105) | class Mistral4Attention(DeepseekV3Attention): method __init__ (line 106) | def __init__(self, config: Mistral4Config, layer_idx: int): method forward (line 149) | def forward( class Mistral4DecoderLayer (line 222) | class Mistral4DecoderLayer(DeepseekV3DecoderLayer): method __init__ (line 223) | def __init__(self, config: Mistral4Config, layer_idx: int): class Mistral4PreTrainedModel (line 238) | class Mistral4PreTrainedModel(PreTrainedModel): method _init_weights (line 258) | def _init_weights(self, module): class Mistral4Model (line 267) | class Mistral4Model(LlamaModel): class Mistral4ForCausalLM (line 271) | class Mistral4ForCausalLM(LlamaForCausalLM): class Mistral4ForSequenceClassification (line 275) | class Mistral4ForSequenceClassification(GenericForSequenceClassification... class Mistral4ForTokenClassification (line 279) | class Mistral4ForTokenClassification(GenericForTokenClassification, Mist... FILE: src/transformers/models/mixtral/configuration_mixtral.py class MixtralConfig (line 25) | class MixtralConfig(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mixtral/convert_mixtral_weights_to_hf.py function compute_intermediate_size (line 47) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 51) | def read_json(path): function write_json (line 56) | def write_json(text, path): function write_model (line 61) | def write_model(model_path, input_base_path, model_size): function main (line 220) | def main(): FILE: src/transformers/models/mixtral/modeling_mixtral.py class MixtralExperts (line 62) | class MixtralExperts(nn.Module): method __init__ (line 65) | def __init__(self, config: MixtralConfig): method forward (line 74) | def forward( class MixtralTopKRouter (line 101) | class MixtralTopKRouter(nn.Module): method __init__ (line 102) | def __init__(self, config): method forward (line 109) | def forward(self, hidden_states): class MixtralSparseMoeBlock (line 119) | class MixtralSparseMoeBlock(nn.Module): method __init__ (line 120) | def __init__(self, config): method forward (line 127) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class MixtralRMSNorm (line 139) | class MixtralRMSNorm(nn.Module): method __init__ (line 140) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 148) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 155) | def extra_repr(self): class MixtralRotaryEmbedding (line 159) | class MixtralRotaryEmbedding(nn.Module): method __init__ (line 162) | def __init__(self, config: MixtralConfig, device=None): method compute_default_rope_parameters (line 179) | def compute_default_rope_parameters( method forward (line 210) | def forward(self, x, position_ids): function rotate_half (line 224) | def rotate_half(x): function apply_rotary_pos_emb (line 232) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 257) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 269) | def eager_attention_forward( class MixtralAttention (line 295) | class MixtralAttention(nn.Module): method __init__ (line 298) | def __init__(self, config: MixtralConfig, layer_idx: int): method forward (line 312) | def forward( class MixtralDecoderLayer (line 354) | class MixtralDecoderLayer(GradientCheckpointingLayer): method __init__ (line 355) | def __init__(self, config: MixtralConfig, layer_idx: int): method forward (line 365) | def forward( class MixtralPreTrainedModel (line 393) | class MixtralPreTrainedModel(PreTrainedModel): method _init_weights (line 412) | def _init_weights(self, module): class MixtralModel (line 423) | class MixtralModel(MixtralPreTrainedModel): method __init__ (line 424) | def __init__(self, config: MixtralConfig): method forward (line 443) | def forward( function load_balancing_loss_func (line 498) | def load_balancing_loss_func( class MixtralForCausalLM (line 581) | class MixtralForCausalLM(MixtralPreTrainedModel, GenerationMixin): method __init__ (line 586) | def __init__(self, config): method forward (line 600) | def forward( class MixtralForSequenceClassification (line 683) | class MixtralForSequenceClassification(GenericForSequenceClassification,... class MixtralForTokenClassification (line 687) | class MixtralForTokenClassification(GenericForTokenClassification, Mixtr... class MixtralForQuestionAnswering (line 691) | class MixtralForQuestionAnswering(GenericForQuestionAnswering, MixtralPr... FILE: src/transformers/models/mixtral/modular_mixtral.py function load_balancing_loss_func (line 53) | def load_balancing_loss_func( class MixtralExperts (line 136) | class MixtralExperts(nn.Module): method __init__ (line 139) | def __init__(self, config: MixtralConfig): method forward (line 148) | def forward( class MixtralTopKRouter (line 175) | class MixtralTopKRouter(nn.Module): method __init__ (line 176) | def __init__(self, config): method forward (line 183) | def forward(self, hidden_states): class MixtralSparseMoeBlock (line 193) | class MixtralSparseMoeBlock(nn.Module): method __init__ (line 194) | def __init__(self, config): method forward (line 201) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class MixtralRMSNorm (line 212) | class MixtralRMSNorm(MistralRMSNorm): class MixtralRotaryEmbedding (line 216) | class MixtralRotaryEmbedding(MistralRotaryEmbedding): class MixtralAttention (line 220) | class MixtralAttention(MistralAttention): class MixtralDecoderLayer (line 224) | class MixtralDecoderLayer(GradientCheckpointingLayer): method __init__ (line 225) | def __init__(self, config: MixtralConfig, layer_idx: int): method forward (line 235) | def forward( class MixtralPreTrainedModel (line 262) | class MixtralPreTrainedModel(MistralPreTrainedModel): method _init_weights (line 270) | def _init_weights(self, module): class MixtralModel (line 280) | class MixtralModel(MistralModel): method forward (line 281) | def forward( class MixtralForCausalLM (line 336) | class MixtralForCausalLM(MistralForCausalLM): method __init__ (line 339) | def __init__(self, config): method forward (line 346) | def forward( class MixtralForSequenceClassification (line 429) | class MixtralForSequenceClassification(MistralForSequenceClassification): class MixtralForTokenClassification (line 433) | class MixtralForTokenClassification(MistralForTokenClassification): class MixtralForQuestionAnswering (line 437) | class MixtralForQuestionAnswering(MistralForQuestionAnswering): FILE: src/transformers/models/mlcd/configuration_mlcd.py class MLCDVisionConfig (line 28) | class MLCDVisionConfig(PreTrainedConfig): FILE: src/transformers/models/mlcd/convert_mlcd_weights_to_hf.py function get_mlcd_config (line 119) | def get_mlcd_config(model_name: str) -> MLCDVisionConfig: function get_mlcd_image_processor (line 137) | def get_mlcd_image_processor(model_name: str) -> CLIPImageProcessor: function flatten_nested_dict (line 162) | def flatten_nested_dict(params: dict, parent_key: str = "", sep: str = "... function split_resblocks_layers (line 176) | def split_resblocks_layers(state_dict: dict) -> dict: function chunk_qkv_for_attn (line 194) | def chunk_qkv_for_attn(state_dict: dict) -> dict: function convert_old_keys_to_new_keys (line 212) | def convert_old_keys_to_new_keys(state_dict_keys: list) -> dict: function convert_mlcd_checkpoint (line 236) | def convert_mlcd_checkpoint(model_name, input_dir, output_dir, verify_hi... FILE: src/transformers/models/mlcd/modeling_mlcd.py class MLCDMLP (line 37) | class MLCDMLP(nn.Module): method __init__ (line 38) | def __init__(self, config): method forward (line 45) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MLCDRotaryEmbedding (line 52) | class MLCDRotaryEmbedding(nn.Module): method __init__ (line 55) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 62) | def forward(self, num_patches_height: int, num_patches_width: int) -> ... class MLCDVisionEmbeddings (line 95) | class MLCDVisionEmbeddings(nn.Module): method __init__ (line 96) | def __init__(self, config: MLCDVisionConfig): method interpolate_pos_encoding (line 117) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 158) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: function eager_attention_forward (line 171) | def eager_attention_forward( function rotate_half (line 196) | def rotate_half(x): function repeat_kv (line 203) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function apply_rotary_pos_emb_vision (line 215) | def apply_rotary_pos_emb_vision( class MLCDAttention (line 229) | class MLCDAttention(nn.Module): method __init__ (line 237) | def __init__(self, config: MLCDVisionConfig): method forward (line 253) | def forward( class MLCDEncoderLayer (line 301) | class MLCDEncoderLayer(GradientCheckpointingLayer): method __init__ (line 302) | def __init__(self, config: MLCDVisionConfig): method forward (line 310) | def forward( class MLCDEncoder (line 347) | class MLCDEncoder(nn.Module): method __init__ (line 356) | def __init__(self, config: MLCDVisionConfig): method forward (line 363) | def forward( class MLCDPreTrainedModel (line 400) | class MLCDPreTrainedModel(PreTrainedModel): method _init_weights (line 415) | def _init_weights(self, module): class MLCDVisionTransformer (line 451) | class MLCDVisionTransformer(MLCDPreTrainedModel): method __init__ (line 457) | def __init__(self, config: MLCDVisionConfig): method forward (line 473) | def forward( class MLCDVisionModel (line 513) | class MLCDVisionModel(MLCDPreTrainedModel): method __init__ (line 519) | def __init__(self, config: MLCDVisionConfig): method get_input_embeddings (line 525) | def get_input_embeddings(self) -> nn.Module: method forward (line 529) | def forward( FILE: src/transformers/models/mlcd/modular_mlcd.py class MLCDVisionConfig (line 44) | class MLCDVisionConfig(PreTrainedConfig): class MLCDMLP (line 82) | class MLCDMLP(CLIPMLP): class MLCDRotaryEmbedding (line 86) | class MLCDRotaryEmbedding(VisionRotaryEmbedding): method forward (line 87) | def forward(self, num_patches_height: int, num_patches_width: int) -> ... class MLCDVisionEmbeddings (line 120) | class MLCDVisionEmbeddings(CLIPVisionEmbeddings): method __init__ (line 121) | def __init__(self, config: MLCDVisionConfig): method forward (line 125) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class MLCDAttention (line 138) | class MLCDAttention(CLIPAttention): method __init__ (line 146) | def __init__(self, config: MLCDVisionConfig): method forward (line 151) | def forward( class MLCDEncoderLayer (line 198) | class MLCDEncoderLayer(CLIPEncoderLayer): method __init__ (line 199) | def __init__(self, config: MLCDVisionConfig): method forward (line 203) | def forward( class MLCDEncoder (line 240) | class MLCDEncoder(CLIPEncoder): method __init__ (line 249) | def __init__(self, config: MLCDVisionConfig): method forward (line 253) | def forward( class MLCDPreTrainedModel (line 290) | class MLCDPreTrainedModel(PreTrainedModel): method _init_weights (line 305) | def _init_weights(self, module): class MLCDVisionTransformer (line 341) | class MLCDVisionTransformer(CLIPVisionTransformer): method __init__ (line 342) | def __init__(self, config: MLCDVisionConfig): method forward (line 347) | def forward( class MLCDVisionModel (line 382) | class MLCDVisionModel(CLIPVisionModel): method forward (line 383) | def forward( FILE: src/transformers/models/mllama/configuration_mllama.py class MllamaVisionConfig (line 26) | class MllamaVisionConfig(PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): method validate_architecture (line 85) | def validate_architecture(self): method max_aspect_ratio_id (line 94) | def max_aspect_ratio_id(self) -> int: class MllamaTextConfig (line 100) | class MllamaTextConfig(PreTrainedConfig): method __post_init__ (line 143) | def __post_init__(self, **kwargs): class MllamaConfig (line 151) | class MllamaConfig(PreTrainedConfig): method __post_init__ (line 184) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mllama/convert_mllama_weights_to_hf.py function convert_old_keys_to_new_keys (line 92) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function permute_for_rope (line 110) | def permute_for_rope(input_tensor, n_heads, dim1, dim2): function pre_compute_positional_embedding (line 121) | def pre_compute_positional_embedding(embedding): function is_param_different_across_shards (line 150) | def is_param_different_across_shards(key): function get_concat_dim (line 159) | def get_concat_dim(key): function compute_intermediate_size (line 169) | def compute_intermediate_size(hidden_dim, multiple_of=1024, ffn_dim_mult... function interpolate_positional_embedding (line 176) | def interpolate_positional_embedding( function write_model (line 208) | def write_model( class MllamaConverter (line 472) | class MllamaConverter(TikTokenConverter): method __init__ (line 473) | def __init__( function write_tokenizer (line 495) | def write_tokenizer(tokenizer_path: str, save_dir: str, instruct: bool =... function write_image_processor (line 566) | def write_image_processor(config_path: str, save_dir: str): function main (line 588) | def main(): FILE: src/transformers/models/mllama/image_processing_mllama.py class MllamaImageProcessorKwargs (line 43) | class MllamaImageProcessorKwargs(ImagesKwargs, total=False): function get_all_supported_aspect_ratios (line 53) | def get_all_supported_aspect_ratios(max_image_tiles: int) -> list[tuple[... function get_image_size_fit_to_canvas (line 82) | def get_image_size_fit_to_canvas( function get_optimal_tiled_canvas (line 134) | def get_optimal_tiled_canvas( function _validate_size (line 191) | def _validate_size(size: SizeDict) -> None: function _validate_mllama_preprocess_arguments (line 198) | def _validate_mllama_preprocess_arguments(do_resize, size, do_pad, max_i... function build_aspect_ratio_mask (line 208) | def build_aspect_ratio_mask( function pad_batches_and_tiles (line 247) | def pad_batches_and_tiles( function convert_aspect_ratios_to_ids (line 300) | def convert_aspect_ratios_to_ids( function convert_to_rgb (line 337) | def convert_to_rgb(image: ImageInput) -> ImageInput: class MllamaImageProcessor (line 356) | class MllamaImageProcessor(TorchvisionBackend): method __init__ (line 370) | def __init__(self, **kwargs: Unpack[MllamaImageProcessorKwargs]): method _validate_preprocess_kwargs (line 374) | def _validate_preprocess_kwargs(self, **kwargs): method preprocess (line 379) | def preprocess(self, images: ImageInput, **kwargs: Unpack[MllamaImageP... method _prepare_images_structure (line 382) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method convert_to_rgb (line 387) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: method pad (line 391) | def pad( method resize (line 421) | def resize( method _preprocess (line 477) | def _preprocess( FILE: src/transformers/models/mllama/image_processing_pil_mllama.py function split_to_tiles_np (line 39) | def split_to_tiles_np(image: np.ndarray, num_tiles_height: int, num_tile... function build_aspect_ratio_mask_np (line 52) | def build_aspect_ratio_mask_np(aspect_ratios: list[list[tuple[int, int]]... function pack_images (line 84) | def pack_images( function convert_aspect_ratios_to_ids_np (line 136) | def convert_aspect_ratios_to_ids_np(aspect_ratios: list[list[tuple[int, ... class MllamaImageProcessorKwargs (line 167) | class MllamaImageProcessorKwargs(ImagesKwargs, total=False): function _validate_size (line 177) | def _validate_size(size: SizeDict) -> None: function _validate_mllama_preprocess_arguments (line 185) | def _validate_mllama_preprocess_arguments(do_resize, size, do_pad, max_i... function convert_to_rgb (line 196) | def convert_to_rgb(image: ImageInput) -> ImageInput: function get_all_supported_aspect_ratios (line 216) | def get_all_supported_aspect_ratios(max_image_tiles: int) -> list[tuple[... function get_image_size_fit_to_canvas (line 246) | def get_image_size_fit_to_canvas( function get_optimal_tiled_canvas (line 299) | def get_optimal_tiled_canvas( class MllamaImageProcessorPil (line 357) | class MllamaImageProcessorPil(PilBackend): method __init__ (line 371) | def __init__(self, **kwargs: Unpack[MllamaImageProcessorKwargs]): method _validate_preprocess_kwargs (line 375) | def _validate_preprocess_kwargs(self, **kwargs): method preprocess (line 380) | def preprocess(self, images: ImageInput, **kwargs: Unpack[MllamaImageP... method _prepare_images_structure (line 383) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method convert_to_rgb (line 388) | def convert_to_rgb(self, image: ImageInput) -> ImageInput: method pad (line 392) | def pad( method resize (line 431) | def resize( method _preprocess (line 483) | def _preprocess( FILE: src/transformers/models/mllama/modeling_mllama.py function _prepare_cross_attention_mask (line 50) | def _prepare_cross_attention_mask( function _prepare_aspect_ratio_attention_mask (line 78) | def _prepare_aspect_ratio_attention_mask( class MllamaPrecomputedAspectRatioEmbedding (line 105) | class MllamaPrecomputedAspectRatioEmbedding(nn.Module): method __init__ (line 106) | def __init__(self, config: MllamaVisionConfig, is_gated: bool = True): method forward (line 117) | def forward(self, hidden_state: torch.Tensor, aspect_ratio_ids: torch.... class MllamaPrecomputedPositionEmbedding (line 128) | class MllamaPrecomputedPositionEmbedding(nn.Module): method __init__ (line 129) | def __init__(self, config: MllamaVisionConfig): method forward (line 148) | def forward(self, hidden_state: torch.Tensor, aspect_ratio_ids: torch.... class MllamaVisionMLP (line 166) | class MllamaVisionMLP(nn.Module): method __init__ (line 167) | def __init__(self, config): method forward (line 174) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function repeat_kv (line 182) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 195) | def eager_attention_forward( class MllamaVisionAttention (line 220) | class MllamaVisionAttention(nn.Module): method __init__ (line 221) | def __init__(self, config: MllamaVisionConfig): method forward (line 236) | def forward( class MllamaVisionEncoderLayer (line 274) | class MllamaVisionEncoderLayer(nn.Module): method __init__ (line 275) | def __init__(self, config: MllamaVisionConfig, is_gated: bool = False): method forward (line 293) | def forward( class MllamaVisionEncoder (line 317) | class MllamaVisionEncoder(nn.Module): method __init__ (line 326) | def __init__(self, config: MllamaVisionConfig, num_layers=32, is_gated... method forward (line 333) | def forward( class MllamaTextRMSNorm (line 365) | class MllamaTextRMSNorm(nn.Module): method __init__ (line 366) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 374) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 381) | def extra_repr(self): class MllamaTextCrossAttention (line 385) | class MllamaTextCrossAttention(nn.Module): method __init__ (line 388) | def __init__( method forward (line 412) | def forward( function rotate_half (line 470) | def rotate_half(x): function apply_rotary_pos_emb (line 478) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class MllamaTextSelfAttention (line 503) | class MllamaTextSelfAttention(nn.Module): method __init__ (line 504) | def __init__(self, config: MllamaTextConfig, layer_idx: int): method forward (line 523) | def forward( class MllamaTextMLP (line 569) | class MllamaTextMLP(nn.Module): method __init__ (line 570) | def __init__(self, config): method forward (line 581) | def forward(self, x): class MllamaSelfAttentionDecoderLayer (line 587) | class MllamaSelfAttentionDecoderLayer(GradientCheckpointingLayer): method __init__ (line 588) | def __init__(self, config: MllamaTextConfig, layer_idx: int): method forward (line 600) | def forward( class MllamaCrossAttentionDecoderLayer (line 656) | class MllamaCrossAttentionDecoderLayer(GradientCheckpointingLayer): method __init__ (line 659) | def __init__(self, config: MllamaTextConfig, layer_idx: int) -> None: method forward (line 671) | def forward( class MllamaRotaryEmbedding (line 707) | class MllamaRotaryEmbedding(nn.Module): method __init__ (line 710) | def __init__(self, config: MllamaTextConfig, device=None): method compute_default_rope_parameters (line 727) | def compute_default_rope_parameters( method forward (line 759) | def forward(self, x, position_ids): class MllamaPreTrainedModel (line 774) | class MllamaPreTrainedModel(PreTrainedModel): method _init_weights (line 799) | def _init_weights(self, module): class MllamaVisionModel (line 846) | class MllamaVisionModel(MllamaPreTrainedModel): method __init__ (line 851) | def __init__(self, config: MllamaVisionConfig): method get_input_embeddings (line 888) | def get_input_embeddings(self): method apply_class_embedding (line 894) | def apply_class_embedding(self, hidden_state: torch.Tensor) -> torch.T... method forward (line 903) | def forward( class MllamaTextModel (line 1047) | class MllamaTextModel(MllamaPreTrainedModel): method __init__ (line 1052) | def __init__(self, config: MllamaTextConfig): method forward (line 1077) | def forward( class MllamaForCausalLM (line 1195) | class MllamaForCausalLM(MllamaPreTrainedModel, GenerationMixin): method __init__ (line 1200) | def __init__(self, config): method forward (line 1211) | def forward( class MllamaModel (line 1306) | class MllamaModel(MllamaPreTrainedModel): method __init__ (line 1307) | def __init__(self, config: MllamaConfig): method get_input_embeddings (line 1323) | def get_input_embeddings(self): method set_input_embeddings (line 1326) | def set_input_embeddings(self, value): method forward (line 1331) | def forward( class MllamaForConditionalGeneration (line 1439) | class MllamaForConditionalGeneration(MllamaPreTrainedModel, GenerationMi... method __init__ (line 1442) | def __init__(self, config: MllamaConfig): method get_input_embeddings (line 1448) | def get_input_embeddings(self): method set_input_embeddings (line 1451) | def set_input_embeddings(self, value): method forward (line 1456) | def forward( method prepare_inputs_for_generation (line 1567) | def prepare_inputs_for_generation( method _update_model_kwargs_for_generation (line 1610) | def _update_model_kwargs_for_generation(self, outputs, model_kwargs, i... FILE: src/transformers/models/mllama/processing_mllama.py class MllamaProcessorKwargs (line 26) | class MllamaProcessorKwargs(ProcessingKwargs, total=False): function get_cross_attention_token_mask (line 34) | def get_cross_attention_token_mask(input_ids: list[int], image_token_id:... function convert_sparse_cross_attention_mask_to_dense (line 82) | def convert_sparse_cross_attention_mask_to_dense( function build_string_from_input (line 130) | def build_string_from_input(prompt: str, bos_token: str, image_token: st... class MllamaProcessor (line 168) | class MllamaProcessor(ProcessorMixin): method __init__ (line 169) | def __init__(self, image_processor, tokenizer, chat_template=None): method __call__ (line 183) | def __call__( method post_process_image_text_to_text (line 273) | def post_process_image_text_to_text( method model_input_names (line 301) | def model_input_names(self): FILE: src/transformers/models/mluke/convert_mluke_original_pytorch_checkpoint_to_pytorch.py function convert_luke_checkpoint (line 28) | def convert_luke_checkpoint(checkpoint_path, metadata_path, entity_vocab... function load_original_entity_vocab (line 185) | def load_original_entity_vocab(entity_vocab_path): FILE: src/transformers/models/mluke/tokenization_mluke.py class MLukeTokenizer (line 129) | class MLukeTokenizer(TokenizersBackend): method __init__ (line 217) | def __init__( method _post_init (line 393) | def _post_init(self): method vocab_size (line 418) | def vocab_size(self): method get_vocab (line 421) | def get_vocab(self): method _convert_token_to_id (line 426) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 437) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 444) | def convert_tokens_to_string(self, tokens): method num_special_tokens_to_add (line 449) | def num_special_tokens_to_add(self, pair: bool = False) -> int: method __call__ (line 464) | def __call__( method _encode_plus (line 654) | def _encode_plus( method _batch_encode_plus (line 765) | def _batch_encode_plus( method _check_entity_input_format (line 908) | def _check_entity_input_format(self, entities: EntityInput | None, ent... method _create_input_sequence (line 926) | def _create_input_sequence( method _batch_prepare_for_model (line 1079) | def _batch_prepare_for_model( method prepare_for_model (line 1164) | def prepare_for_model( method pad (line 1395) | def pad( method _pad (line 1557) | def _pad( method save_vocabulary (line 1701) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method build_inputs_with_special_tokens (line 1718) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 1744) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 1772) | def create_token_type_ids_from_sequences( FILE: src/transformers/models/mm_grounding_dino/configuration_mm_grounding_dino.py class MMGroundingDinoConfig (line 33) | class MMGroundingDinoConfig(PreTrainedConfig): method __post_init__ (line 130) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mm_grounding_dino/convert_mm_grounding_dino_to_hf.py function get_mm_grounding_dino_config (line 241) | def get_mm_grounding_dino_config(model_name: str) -> MMGroundingDinoConfig: function get_mm_grounding_dino_processor (line 288) | def get_mm_grounding_dino_processor() -> GroundingDinoProcessor: function correct_unfold_reduction_order (line 296) | def correct_unfold_reduction_order(x: torch.Tensor) -> torch.Tensor: function correct_unfold_norm_order (line 305) | def correct_unfold_norm_order(x: torch.Tensor) -> torch.Tensor: function preprocess_old_state (line 313) | def preprocess_old_state(state_dict: dict, config: MMGroundingDinoConfig... function convert_old_keys_to_new_keys (line 391) | def convert_old_keys_to_new_keys(state_dict_keys: list) -> dict: function convert_mm_to_hf_state (line 409) | def convert_mm_to_hf_state(original_state: dict, hf_cfg: MMGroundingDino... function prepare_test_inputs (line 422) | def prepare_test_inputs(): function convert_mm_grounding_dino_checkpoint (line 431) | def convert_mm_grounding_dino_checkpoint( function parse_args (line 481) | def parse_args(): FILE: src/transformers/models/mm_grounding_dino/modeling_mm_grounding_dino.py class MMGroundingDinoContrastiveEmbedding (line 39) | class MMGroundingDinoContrastiveEmbedding(nn.Module): method __init__ (line 40) | def __init__(self, config): method forward (line 45) | def forward( class MultiScaleDeformableAttention (line 64) | class MultiScaleDeformableAttention(nn.Module): method forward (line 65) | def forward( class MMGroundingDinoLearnedPositionEmbedding (line 118) | class MMGroundingDinoLearnedPositionEmbedding(nn.Module): method __init__ (line 123) | def __init__(self, config): method forward (line 130) | def forward(self, pixel_values, pixel_mask=None): class MMGroundingDinoMultiscaleDeformableAttention (line 143) | class MMGroundingDinoMultiscaleDeformableAttention(nn.Module): method __init__ (line 148) | def __init__(self, config: MMGroundingDinoConfig, num_heads: int, n_po... method forward (line 180) | def forward( class MMGroundingDinoBiMultiHeadAttention (line 250) | class MMGroundingDinoBiMultiHeadAttention(nn.Module): method __init__ (line 251) | def __init__(self, config): method _reshape (line 280) | def _reshape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): method forward (line 283) | def forward( function drop_path (line 401) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class MMGroundingDinoDropPath (line 416) | class MMGroundingDinoDropPath(nn.Module): method __init__ (line 419) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 423) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 426) | def extra_repr(self) -> str: class MMGroundingDinoFusionLayer (line 430) | class MMGroundingDinoFusionLayer(nn.Module): method __init__ (line 431) | def __init__(self, config): method forward (line 446) | def forward( class MMGroundingDinoPreTrainedModel (line 494) | class MMGroundingDinoPreTrainedModel(PreTrainedModel): method _init_weights (line 501) | def _init_weights(self, module): method _set_gradient_checkpointing (line 569) | def _set_gradient_checkpointing(self, module, value=False): class MMGroundingDinoFrozenBatchNorm2d (line 574) | class MMGroundingDinoFrozenBatchNorm2d(nn.Module): method __init__ (line 582) | def __init__(self, n): method _load_from_state_dict (line 589) | def _load_from_state_dict( method forward (line 600) | def forward(self, x): function replace_batch_norm (line 613) | def replace_batch_norm(model): class MMGroundingDinoConvEncoder (line 637) | class MMGroundingDinoConvEncoder(nn.Module): method __init__ (line 645) | def __init__(self, config): method forward (line 663) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class MMGroundingDinoConvModel (line 676) | class MMGroundingDinoConvModel(nn.Module): method __init__ (line 681) | def __init__(self, conv_encoder, position_embedding): method forward (line 686) | def forward(self, pixel_values, pixel_mask): class MMGroundingDinoEncoderOutput (line 705) | class MMGroundingDinoEncoderOutput(ModelOutput): class MMGroundingDinoMultiheadAttention (line 728) | class MMGroundingDinoMultiheadAttention(nn.Module): method __init__ (line 731) | def __init__(self, config, num_attention_heads=None): method forward (line 751) | def forward( class MMGroundingDinoTextEnhancerLayer (line 800) | class MMGroundingDinoTextEnhancerLayer(nn.Module): method __init__ (line 803) | def __init__(self, config): method with_pos_embed (line 820) | def with_pos_embed(self, hidden_state: Tensor, position_embeddings: Te... method forward (line 823) | def forward( class MMGroundingDinoDeformableLayer (line 882) | class MMGroundingDinoDeformableLayer(nn.Module): method __init__ (line 883) | def __init__(self, config: MMGroundingDinoConfig): method forward (line 897) | def forward( function get_sine_pos_embed (line 967) | def get_sine_pos_embed( class MMGroundingDinoEncoderLayer (line 1003) | class MMGroundingDinoEncoderLayer(nn.Module): method __init__ (line 1004) | def __init__(self, config) -> None: method get_text_position_embeddings (line 1013) | def get_text_position_embeddings( method forward (line 1035) | def forward( class MMGroundingDinoEncoder (line 1083) | class MMGroundingDinoEncoder(MMGroundingDinoPreTrainedModel): method __init__ (line 1094) | def __init__(self, config: MMGroundingDinoConfig): method get_reference_points (line 1104) | def get_reference_points(spatial_shapes_list, valid_ratios, device): method forward (line 1134) | def forward( class MMGroundingDinoDecoderOutput (line 1265) | class MMGroundingDinoDecoderOutput(ModelOutput): class MMGroundingDinoDecoderLayer (line 1280) | class MMGroundingDinoDecoderLayer(nn.Module): method __init__ (line 1281) | def __init__(self, config: MMGroundingDinoConfig): method with_pos_embed (line 1310) | def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Te... method forward (line 1313) | def forward( class MMGroundingDinoDecoder (line 1398) | class MMGroundingDinoDecoder(MMGroundingDinoPreTrainedModel): method __init__ (line 1413) | def __init__(self, config: MMGroundingDinoConfig): method forward (line 1432) | def forward( class MMGroundingDinoModelOutput (line 1644) | class MMGroundingDinoModelOutput(ModelOutput): class MMGroundingDinoSinePositionEmbedding (line 1701) | class MMGroundingDinoSinePositionEmbedding(nn.Module): method __init__ (line 1707) | def __init__(self, config): method forward (line 1713) | def forward(self, pixel_values, pixel_mask): function build_position_encoding (line 1731) | def build_position_encoding(config): function generate_masks_with_special_tokens_and_transfer_map (line 1746) | def generate_masks_with_special_tokens_and_transfer_map(input_ids: torch... class MMGroundingDinoModel (line 1800) | class MMGroundingDinoModel(MMGroundingDinoPreTrainedModel): method __init__ (line 1801) | def __init__(self, config: MMGroundingDinoConfig): method freeze_backbone (line 1851) | def freeze_backbone(self): method unfreeze_backbone (line 1855) | def unfreeze_backbone(self): method get_valid_ratio (line 1859) | def get_valid_ratio(self, mask): method generate_encoder_output_proposals (line 1870) | def generate_encoder_output_proposals(self, enc_output, padding_mask, ... method forward (line 1922) | def forward( class MMGroundingDinoMLPPredictionHead (line 2197) | class MMGroundingDinoMLPPredictionHead(nn.Module): method __init__ (line 2204) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 2210) | def forward(self, x): class MMGroundingDinoObjectDetectionOutput (line 2222) | class MMGroundingDinoObjectDetectionOutput(ModelOutput): function build_label_maps (line 2298) | def build_label_maps(logits: torch.FloatTensor, input_ids: torch.LongTen... function build_text_mask (line 2354) | def build_text_mask(logits, attention_mask): class MMGroundingDinoForObjectDetection (line 2371) | class MMGroundingDinoForObjectDetection(MMGroundingDinoPreTrainedModel): method __init__ (line 2379) | def __init__(self, config: MMGroundingDinoConfig): method forward (line 2402) | def forward( FILE: src/transformers/models/mm_grounding_dino/modular_mm_grounding_dino.py class MMGroundingDinoConfig (line 45) | class MMGroundingDinoConfig(PreTrainedConfig): method __post_init__ (line 142) | def __post_init__(self, **kwargs): class MMGroundingDinoContrastiveEmbedding (line 161) | class MMGroundingDinoContrastiveEmbedding(GroundingDinoContrastiveEmbedd... method __init__ (line 162) | def __init__(self, config): method forward (line 166) | def forward( class MMGroundingDinoPreTrainedModel (line 184) | class MMGroundingDinoPreTrainedModel(GroundingDinoPreTrainedModel): method _init_weights (line 186) | def _init_weights(self, module): class MMGroundingDinoConvEncoder (line 192) | class MMGroundingDinoConvEncoder(GroundingDinoConvEncoder): class MMGroundingDinoConvModel (line 196) | class MMGroundingDinoConvModel(GroundingDinoConvModel): class MMGroundingDinoEncoder (line 200) | class MMGroundingDinoEncoder(GroundingDinoEncoder): class MMGroundingDinoDecoder (line 204) | class MMGroundingDinoDecoder(GroundingDinoDecoder): class MMGroundingDinoModel (line 208) | class MMGroundingDinoModel(GroundingDinoModel, MMGroundingDinoPreTrained... method __init__ (line 209) | def __init__(self, config: MMGroundingDinoConfig): class MMGroundingDinoMLPPredictionHead (line 260) | class MMGroundingDinoMLPPredictionHead(GroundingDinoMLPPredictionHead): class MMGroundingDinoForObjectDetection (line 264) | class MMGroundingDinoForObjectDetection(GroundingDinoForObjectDetection,... method __init__ (line 272) | def __init__(self, config: MMGroundingDinoConfig): FILE: src/transformers/models/mobilebert/configuration_mobilebert.py class MobileBertConfig (line 24) | class MobileBertConfig(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mobilebert/convert_mobilebert_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_mobilebert (line 28) | def load_tf_weights_in_mobilebert(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 106) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, mobilebert_conf... FILE: src/transformers/models/mobilebert/modeling_mobilebert.py class NoNorm (line 55) | class NoNorm(nn.Module): method __init__ (line 56) | def __init__(self, feat_size, eps=None): method forward (line 61) | def forward(self, input_tensor: torch.Tensor) -> torch.Tensor: class MobileBertEmbeddings (line 68) | class MobileBertEmbeddings(nn.Module): method __init__ (line 71) | def __init__(self, config): method forward (line 93) | def forward( function eager_attention_forward (line 145) | def eager_attention_forward( class MobileBertSelfAttention (line 173) | class MobileBertSelfAttention(nn.Module): method __init__ (line 174) | def __init__(self, config): method forward (line 191) | def forward( class MobileBertSelfOutput (line 225) | class MobileBertSelfOutput(nn.Module): method __init__ (line 226) | def __init__(self, config): method forward (line 234) | def forward(self, hidden_states: torch.Tensor, residual_tensor: torch.... class MobileBertAttention (line 242) | class MobileBertAttention(nn.Module): method __init__ (line 243) | def __init__(self, config): method forward (line 248) | def forward( class MobileBertIntermediate (line 270) | class MobileBertIntermediate(nn.Module): method __init__ (line 271) | def __init__(self, config): method forward (line 279) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class OutputBottleneck (line 285) | class OutputBottleneck(nn.Module): method __init__ (line 286) | def __init__(self, config): method forward (line 292) | def forward(self, hidden_states: torch.Tensor, residual_tensor: torch.... class MobileBertOutput (line 299) | class MobileBertOutput(nn.Module): method __init__ (line 300) | def __init__(self, config): method forward (line 310) | def forward( class BottleneckLayer (line 323) | class BottleneckLayer(nn.Module): method __init__ (line 324) | def __init__(self, config): method forward (line 329) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Bottleneck (line 335) | class Bottleneck(nn.Module): method __init__ (line 336) | def __init__(self, config): method forward (line 344) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor]: class FFNOutput (line 371) | class FFNOutput(nn.Module): method __init__ (line 372) | def __init__(self, config): method forward (line 377) | def forward(self, hidden_states: torch.Tensor, residual_tensor: torch.... class FFNLayer (line 383) | class FFNLayer(nn.Module): method __init__ (line 384) | def __init__(self, config): method forward (line 389) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileBertLayer (line 395) | class MobileBertLayer(GradientCheckpointingLayer): method __init__ (line 396) | def __init__(self, config): method forward (line 409) | def forward( class MobileBertEncoder (line 439) | class MobileBertEncoder(nn.Module): method __init__ (line 440) | def __init__(self, config): method forward (line 444) | def forward( class MobileBertPooler (line 459) | class MobileBertPooler(nn.Module): method __init__ (line 460) | def __init__(self, config): method forward (line 466) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileBertPredictionHeadTransform (line 478) | class MobileBertPredictionHeadTransform(nn.Module): method __init__ (line 479) | def __init__(self, config): method forward (line 488) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileBertLMPredictionHead (line 495) | class MobileBertLMPredictionHead(nn.Module): method __init__ (line 496) | def __init__(self, config): method forward (line 505) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileBertOnlyMLMHead (line 512) | class MobileBertOnlyMLMHead(nn.Module): method __init__ (line 513) | def __init__(self, config): method forward (line 517) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class MobileBertPreTrainingHeads (line 522) | class MobileBertPreTrainingHeads(nn.Module): method __init__ (line 523) | def __init__(self, config): method forward (line 528) | def forward(self, sequence_output: torch.Tensor, pooled_output: torch.... class MobileBertPreTrainedModel (line 535) | class MobileBertPreTrainedModel(PreTrainedModel): method _init_weights (line 549) | def _init_weights(self, module): class MobileBertForPreTrainingOutput (line 567) | class MobileBertForPreTrainingOutput(ModelOutput): class MobileBertModel (line 587) | class MobileBertModel(MobileBertPreTrainedModel): method __init__ (line 592) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 609) | def get_input_embeddings(self): method set_input_embeddings (line 612) | def set_input_embeddings(self, value): method forward (line 618) | def forward( class MobileBertForPreTraining (line 663) | class MobileBertForPreTraining(MobileBertPreTrainedModel): method __init__ (line 669) | def __init__(self, config): method get_output_embeddings (line 677) | def get_output_embeddings(self): method set_output_embeddings (line 680) | def set_output_embeddings(self, new_embeddings): method resize_token_embeddings (line 684) | def resize_token_embeddings(self, new_num_tokens: int | None = None) -... method forward (line 694) | def forward( class MobileBertForMaskedLM (line 762) | class MobileBertForMaskedLM(MobileBertPreTrainedModel): method __init__ (line 768) | def __init__(self, config): method get_output_embeddings (line 777) | def get_output_embeddings(self): method set_output_embeddings (line 780) | def set_output_embeddings(self, new_embeddings): method resize_token_embeddings (line 784) | def resize_token_embeddings(self, new_num_tokens: int | None = None) -... method forward (line 793) | def forward( class MobileBertOnlyNSPHead (line 835) | class MobileBertOnlyNSPHead(nn.Module): method __init__ (line 836) | def __init__(self, config): method forward (line 840) | def forward(self, pooled_output: torch.Tensor) -> torch.Tensor: class MobileBertForNextSentencePrediction (line 850) | class MobileBertForNextSentencePrediction(MobileBertPreTrainedModel): method __init__ (line 851) | def __init__(self, config): method forward (line 862) | def forward( class MobileBertForSequenceClassification (line 931) | class MobileBertForSequenceClassification(MobileBertPreTrainedModel): method __init__ (line 932) | def __init__(self, config): method forward (line 949) | def forward( class MobileBertForQuestionAnswering (line 1013) | class MobileBertForQuestionAnswering(MobileBertPreTrainedModel): method __init__ (line 1014) | def __init__(self, config): method forward (line 1026) | def forward( class MobileBertForMultipleChoice (line 1082) | class MobileBertForMultipleChoice(MobileBertPreTrainedModel): method __init__ (line 1083) | def __init__(self, config): method forward (line 1098) | def forward( class MobileBertForTokenClassification (line 1181) | class MobileBertForTokenClassification(MobileBertPreTrainedModel): method __init__ (line 1182) | def __init__(self, config): method forward (line 1198) | def forward( FILE: src/transformers/models/mobilenet_v1/configuration_mobilenet_v1.py class MobileNetV1Config (line 24) | class MobileNetV1Config(PreTrainedConfig): method validate_architecture (line 58) | def validate_architecture(self): FILE: src/transformers/models/mobilenet_v1/convert_original_tf_checkpoint_to_pytorch.py function _build_tf_to_pytorch_map (line 39) | def _build_tf_to_pytorch_map(model, config, tf_weights=None): function load_tf_weights_in_mobilenet_v1 (line 86) | def load_tf_weights_in_mobilenet_v1(model, config, tf_checkpoint_path): function get_mobilenet_v1_config (line 142) | def get_mobilenet_v1_config(model_name): function prepare_img (line 168) | def prepare_img(): function convert_movilevit_checkpoint (line 176) | def convert_movilevit_checkpoint(model_name, checkpoint_path, pytorch_du... FILE: src/transformers/models/mobilenet_v1/image_processing_mobilenet_pil_v1.py class MobileNetV1ImageProcessorPil (line 26) | class MobileNetV1ImageProcessorPil(PilBackend): FILE: src/transformers/models/mobilenet_v1/image_processing_mobilenet_v1.py class MobileNetV1ImageProcessor (line 26) | class MobileNetV1ImageProcessor(TorchvisionBackend): FILE: src/transformers/models/mobilenet_v1/modeling_mobilenet_v1.py function apply_tf_padding (line 29) | def apply_tf_padding(features: torch.Tensor, conv_layer: nn.Conv2d) -> t... class MobileNetV1ConvLayer (line 57) | class MobileNetV1ConvLayer(nn.Module): method __init__ (line 58) | def __init__( method forward (line 112) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileNetV1PreTrainedModel (line 124) | class MobileNetV1PreTrainedModel(PreTrainedModel): class MobileNetV1Model (line 134) | class MobileNetV1Model(MobileNetV1PreTrainedModel): method __init__ (line 135) | def __init__(self, config: MobileNetV1Config, add_pooling_layer: bool ... method forward (line 190) | def forward( class MobileNetV1ForImageClassification (line 238) | class MobileNetV1ForImageClassification(MobileNetV1PreTrainedModel): method __init__ (line 239) | def __init__(self, config: MobileNetV1Config) -> None: method forward (line 255) | def forward( FILE: src/transformers/models/mobilenet_v2/configuration_mobilenet_v2.py class MobileNetV2Config (line 24) | class MobileNetV2Config(PreTrainedConfig): method validate_architecture (line 78) | def validate_architecture(self): FILE: src/transformers/models/mobilenet_v2/convert_original_tf_checkpoint_to_pytorch.py function _build_tf_to_pytorch_map (line 40) | def _build_tf_to_pytorch_map(model, config, tf_weights=None): function load_tf_weights_in_mobilenet_v2 (line 152) | def load_tf_weights_in_mobilenet_v2(model, config, tf_checkpoint_path): function get_mobilenet_v2_config (line 209) | def get_mobilenet_v2_config(model_name): function prepare_img (line 246) | def prepare_img(): function convert_movilevit_checkpoint (line 254) | def convert_movilevit_checkpoint(model_name, checkpoint_path, pytorch_du... FILE: src/transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py class MobileNetV2ImageProcessorKwargs (line 36) | class MobileNetV2ImageProcessorKwargs(ImagesKwargs, total=False): class MobileNetV2ImageProcessor (line 48) | class MobileNetV2ImageProcessor(TorchvisionBackend): method __init__ (line 65) | def __init__(self, **kwargs: Unpack[MobileNetV2ImageProcessorKwargs]): method preprocess (line 69) | def preprocess( method _preprocess_image_like_inputs (line 81) | def _preprocess_image_like_inputs( method reduce_label (line 131) | def reduce_label(self, labels: list["torch.Tensor"]) -> list["torch.Te... method _preprocess (line 141) | def _preprocess( method post_process_semantic_segmentation (line 183) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/mobilenet_v2/image_processing_pil_mobilenet_v2.py class MobileNetV2ImageProcessorKwargs (line 40) | class MobileNetV2ImageProcessorKwargs(ImagesKwargs, total=False): class MobileNetV2ImageProcessorPil (line 52) | class MobileNetV2ImageProcessorPil(PilBackend): method __init__ (line 69) | def __init__(self, **kwargs: Unpack[MobileNetV2ImageProcessorKwargs]): method preprocess (line 73) | def preprocess( method _preprocess_image_like_inputs (line 85) | def _preprocess_image_like_inputs( method reduce_label (line 135) | def reduce_label(self, image: np.ndarray) -> np.ndarray: method _preprocess (line 143) | def _preprocess( method post_process_semantic_segmentation (line 176) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py function make_divisible (line 34) | def make_divisible(value: int, divisor: int = 8, min_value: int | None =... function apply_depth_multiplier (line 47) | def apply_depth_multiplier(config: MobileNetV2Config, channels: int) -> ... function apply_tf_padding (line 51) | def apply_tf_padding(features: torch.Tensor, conv_layer: nn.Conv2d) -> t... class MobileNetV2ConvLayer (line 86) | class MobileNetV2ConvLayer(nn.Module): method __init__ (line 87) | def __init__( method forward (line 144) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileNetV2InvertedResidual (line 155) | class MobileNetV2InvertedResidual(nn.Module): method __init__ (line 156) | def __init__( method forward (line 192) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileNetV2Stem (line 202) | class MobileNetV2Stem(nn.Module): method __init__ (line 203) | def __init__(self, config: MobileNetV2Config, in_channels: int, expand... method forward (line 240) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileNetV2PreTrainedModel (line 250) | class MobileNetV2PreTrainedModel(PreTrainedModel): class MobileNetV2Model (line 260) | class MobileNetV2Model(MobileNetV2PreTrainedModel): method __init__ (line 261) | def __init__(self, config: MobileNetV2Config, add_pooling_layer: bool ... method forward (line 326) | def forward( class MobileNetV2ForImageClassification (line 374) | class MobileNetV2ForImageClassification(MobileNetV2PreTrainedModel): method __init__ (line 375) | def __init__(self, config: MobileNetV2Config) -> None: method forward (line 391) | def forward( class MobileNetV2DeepLabV3Plus (line 428) | class MobileNetV2DeepLabV3Plus(nn.Module): method __init__ (line 434) | def __init__(self, config: MobileNetV2Config) -> None: method forward (line 484) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileNetV2ForSemanticSegmentation (line 508) | class MobileNetV2ForSemanticSegmentation(MobileNetV2PreTrainedModel): method __init__ (line 509) | def __init__(self, config: MobileNetV2Config) -> None: method forward (line 520) | def forward( FILE: src/transformers/models/mobilevit/configuration_mobilevit.py class MobileViTConfig (line 24) | class MobileViTConfig(PreTrainedConfig): FILE: src/transformers/models/mobilevit/convert_mlcvnets_to_pytorch.py function get_mobilevit_config (line 39) | def get_mobilevit_config(mobilevit_name): function rename_key (line 73) | def rename_key(name, base_model=False): function convert_state_dict (line 152) | def convert_state_dict(orig_state_dict, model, base_model=False): function prepare_img (line 188) | def prepare_img(): function convert_movilevit_checkpoint (line 196) | def convert_movilevit_checkpoint(mobilevit_name, checkpoint_path, pytorc... FILE: src/transformers/models/mobilevit/image_processing_mobilevit.py class MobileVitImageProcessorKwargs (line 44) | class MobileVitImageProcessorKwargs(ImagesKwargs, total=False): class MobileViTImageProcessor (line 59) | class MobileViTImageProcessor(TorchvisionBackend): method __init__ (line 78) | def __init__(self, **kwargs: Unpack[MobileVitImageProcessorKwargs]): method preprocess (line 82) | def preprocess( method _preprocess_image_like_inputs (line 94) | def _preprocess_image_like_inputs( method reduce_label (line 143) | def reduce_label(self, labels: list["torch.Tensor"]) -> list["torch.Te... method flip_channel_order (line 153) | def flip_channel_order(self, images: "torch.Tensor") -> "torch.Tensor": method _preprocess (line 167) | def _preprocess( method post_process_semantic_segmentation (line 207) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/mobilevit/image_processing_pil_mobilevit.py class MobileVitImageProcessorKwargs (line 44) | class MobileVitImageProcessorKwargs(ImagesKwargs, total=False): class MobileViTImageProcessorPil (line 59) | class MobileViTImageProcessorPil(PilBackend): method __init__ (line 78) | def __init__(self, **kwargs: Unpack[MobileVitImageProcessorKwargs]): method preprocess (line 82) | def preprocess( method _preprocess_image_like_inputs (line 94) | def _preprocess_image_like_inputs( method reduce_label (line 143) | def reduce_label(self, image: np.ndarray) -> np.ndarray: method flip_channel_order (line 150) | def flip_channel_order(self, image: np.ndarray) -> np.ndarray: method _preprocess (line 156) | def _preprocess( method post_process_semantic_segmentation (line 187) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/mobilevit/modeling_mobilevit.py function make_divisible (line 41) | def make_divisible(value: int, divisor: int = 8, min_value: int | None =... class MobileViTConvLayer (line 54) | class MobileViTConvLayer(nn.Module): method __init__ (line 55) | def __init__( method forward (line 109) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTInvertedResidual (line 118) | class MobileViTInvertedResidual(nn.Module): method __init__ (line 123) | def __init__( method forward (line 156) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTMobileNetLayer (line 166) | class MobileViTMobileNetLayer(nn.Module): method __init__ (line 167) | def __init__( method forward (line 183) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTSelfAttention (line 189) | class MobileViTSelfAttention(nn.Module): method __init__ (line 190) | def __init__(self, config: MobileViTConfig, hidden_size: int) -> None: method forward (line 209) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTSelfOutput (line 246) | class MobileViTSelfOutput(nn.Module): method __init__ (line 247) | def __init__(self, config: MobileViTConfig, hidden_size: int) -> None: method forward (line 252) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTAttention (line 258) | class MobileViTAttention(nn.Module): method __init__ (line 259) | def __init__(self, config: MobileViTConfig, hidden_size: int) -> None: method forward (line 264) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTIntermediate (line 270) | class MobileViTIntermediate(nn.Module): method __init__ (line 271) | def __init__(self, config: MobileViTConfig, hidden_size: int, intermed... method forward (line 279) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTOutput (line 285) | class MobileViTOutput(nn.Module): method __init__ (line 286) | def __init__(self, config: MobileViTConfig, hidden_size: int, intermed... method forward (line 291) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MobileViTTransformerLayer (line 298) | class MobileViTTransformerLayer(nn.Module): method __init__ (line 299) | def __init__(self, config: MobileViTConfig, hidden_size: int, intermed... method forward (line 307) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTTransformer (line 317) | class MobileViTTransformer(nn.Module): method __init__ (line 318) | def __init__(self, config: MobileViTConfig, hidden_size: int, num_stag... method forward (line 330) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTLayer (line 336) | class MobileViTLayer(GradientCheckpointingLayer): method __init__ (line 341) | def __init__( method unfolding (line 399) | def unfolding(self, features: torch.Tensor) -> tuple[torch.Tensor, dict]: method folding (line 450) | def folding(self, patches: torch.Tensor, info_dict: dict) -> torch.Ten... method forward (line 479) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTEncoder (line 505) | class MobileViTEncoder(nn.Module): method __init__ (line 506) | def __init__(self, config: MobileViTConfig) -> None: method forward (line 580) | def forward( class MobileViTPreTrainedModel (line 601) | class MobileViTPreTrainedModel(PreTrainedModel): method _init_weights (line 610) | def _init_weights(self, module: nn.Module) -> None: class MobileViTModel (line 626) | class MobileViTModel(MobileViTPreTrainedModel): method __init__ (line 627) | def __init__(self, config: MobileViTConfig, expand_output: bool = True): method forward (line 659) | def forward( class MobileViTForImageClassification (line 708) | class MobileViTForImageClassification(MobileViTPreTrainedModel): method __init__ (line 709) | def __init__(self, config: MobileViTConfig) -> None: method forward (line 725) | def forward( class MobileViTASPPPooling (line 762) | class MobileViTASPPPooling(nn.Module): method __init__ (line 763) | def __init__(self, config: MobileViTConfig, in_channels: int, out_chan... method forward (line 778) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTASPP (line 786) | class MobileViTASPP(nn.Module): method __init__ (line 791) | def __init__(self, config: MobileViTConfig) -> None: method forward (line 834) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTDeepLabV3 (line 845) | class MobileViTDeepLabV3(nn.Module): method __init__ (line 850) | def __init__(self, config: MobileViTConfig) -> None: method forward (line 866) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTForSemanticSegmentation (line 878) | class MobileViTForSemanticSegmentation(MobileViTPreTrainedModel): method __init__ (line 879) | def __init__(self, config: MobileViTConfig) -> None: method forward (line 890) | def forward( FILE: src/transformers/models/mobilevitv2/configuration_mobilevitv2.py class MobileViTV2Config (line 24) | class MobileViTV2Config(PreTrainedConfig): FILE: src/transformers/models/mobilevitv2/convert_mlcvnets_to_pytorch.py function load_orig_config_file (line 41) | def load_orig_config_file(orig_cfg_file): function get_mobilevitv2_config (line 67) | def get_mobilevitv2_config(task_name, orig_cfg_file): function rename_key (line 125) | def rename_key(dct, old, new): function create_rename_keys (line 130) | def create_rename_keys(state_dict, base_model=False): function remove_unused_keys (line 216) | def remove_unused_keys(state_dict): function prepare_img (line 227) | def prepare_img(): function convert_mobilevitv2_checkpoint (line 236) | def convert_mobilevitv2_checkpoint(task_name, checkpoint_path, orig_conf... FILE: src/transformers/models/mobilevitv2/modeling_mobilevitv2.py function make_divisible (line 40) | def make_divisible(value: int, divisor: int = 8, min_value: int | None =... function clip (line 53) | def clip(value: float, min_val: float = float("-inf"), max_val: float = ... class MobileViTV2ConvLayer (line 58) | class MobileViTV2ConvLayer(nn.Module): method __init__ (line 59) | def __init__( method forward (line 113) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTV2InvertedResidual (line 123) | class MobileViTV2InvertedResidual(nn.Module): method __init__ (line 128) | def __init__( method forward (line 161) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTV2MobileNetLayer (line 172) | class MobileViTV2MobileNetLayer(nn.Module): method __init__ (line 173) | def __init__( method forward (line 189) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTV2LinearSelfAttention (line 195) | class MobileViTV2LinearSelfAttention(nn.Module): method __init__ (line 207) | def __init__(self, config: MobileViTV2Config, embed_dim: int) -> None: method forward (line 232) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTV2FFN (line 258) | class MobileViTV2FFN(nn.Module): method __init__ (line 259) | def __init__( method forward (line 291) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTV2TransformerLayer (line 299) | class MobileViTV2TransformerLayer(nn.Module): method __init__ (line 300) | def __init__( method forward (line 314) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTV2Transformer (line 326) | class MobileViTV2Transformer(nn.Module): method __init__ (line 327) | def __init__(self, config: MobileViTV2Config, n_layers: int, d_model: ... method forward (line 344) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTV2Layer (line 350) | class MobileViTV2Layer(GradientCheckpointingLayer): method __init__ (line 355) | def __init__( method unfolding (line 416) | def unfolding(self, feature_map: torch.Tensor) -> tuple[torch.Tensor, ... method folding (line 427) | def folding(self, patches: torch.Tensor, output_size: tuple[int, int])... method forward (line 440) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTV2Encoder (line 464) | class MobileViTV2Encoder(nn.Module): method __init__ (line 465) | def __init__(self, config: MobileViTV2Config) -> None: method forward (line 546) | def forward( class MobileViTV2PreTrainedModel (line 567) | class MobileViTV2PreTrainedModel(PreTrainedModel): method _init_weights (line 576) | def _init_weights(self, module: nn.Module) -> None: class MobileViTV2Model (line 592) | class MobileViTV2Model(MobileViTV2PreTrainedModel): method __init__ (line 593) | def __init__(self, config: MobileViTV2Config, expand_output: bool = Tr... method forward (line 622) | def forward( class MobileViTV2ForImageClassification (line 671) | class MobileViTV2ForImageClassification(MobileViTV2PreTrainedModel): method __init__ (line 672) | def __init__(self, config: MobileViTV2Config) -> None: method forward (line 690) | def forward( class MobileViTV2ASPPPooling (line 728) | class MobileViTV2ASPPPooling(nn.Module): method __init__ (line 729) | def __init__(self, config: MobileViTV2Config, in_channels: int, out_ch... method forward (line 744) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTV2ASPP (line 752) | class MobileViTV2ASPP(nn.Module): method __init__ (line 757) | def __init__(self, config: MobileViTV2Config) -> None: method forward (line 801) | def forward(self, features: torch.Tensor) -> torch.Tensor: class MobileViTV2DeepLabV3 (line 813) | class MobileViTV2DeepLabV3(nn.Module): method __init__ (line 818) | def __init__(self, config: MobileViTV2Config) -> None: method forward (line 834) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MobileViTV2ForSemanticSegmentation (line 846) | class MobileViTV2ForSemanticSegmentation(MobileViTV2PreTrainedModel): method __init__ (line 847) | def __init__(self, config: MobileViTV2Config) -> None: method forward (line 858) | def forward( FILE: src/transformers/models/modernbert/configuration_modernbert.py class ModernBertConfig (line 32) | class ModernBertConfig(PreTrainedConfig): method __post_init__ (line 113) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 124) | def convert_rope_params_to_dict(self, **kwargs): method to_dict (line 154) | def to_dict(self): method sliding_window (line 160) | def sliding_window(self): method sliding_window (line 165) | def sliding_window(self, value): FILE: src/transformers/models/modernbert/modeling_modernbert.py class ModernBertEmbeddings (line 52) | class ModernBertEmbeddings(nn.Module): method __init__ (line 57) | def __init__(self, config: ModernBertConfig): method forward (line 64) | def forward( class ModernBertMLP (line 74) | class ModernBertMLP(nn.Module): method __init__ (line 81) | def __init__(self, config: ModernBertConfig): method forward (line 89) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ModernBertRotaryEmbedding (line 94) | class ModernBertRotaryEmbedding(nn.Module): method __init__ (line 97) | def __init__(self, config: ModernBertConfig, device=None): method compute_default_rope_parameters (line 121) | def compute_default_rope_parameters( method forward (line 158) | def forward(self, x, position_ids, layer_type=None): function eager_attention_forward (line 175) | def eager_attention_forward( function rotate_half (line 197) | def rotate_half(x): function apply_rotary_pos_emb (line 205) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class ModernBertAttention (line 232) | class ModernBertAttention(nn.Module): method __init__ (line 242) | def __init__(self, config: ModernBertConfig, layer_idx: int | None = N... method forward (line 271) | def forward( class ModernBertEncoderLayer (line 313) | class ModernBertEncoderLayer(GradientCheckpointingLayer): method __init__ (line 314) | def __init__(self, config: ModernBertConfig, layer_idx: int | None = N... method forward (line 327) | def forward( class ModernBertPreTrainedModel (line 346) | class ModernBertPreTrainedModel(PreTrainedModel): method _init_weights (line 362) | def _init_weights(self, module: nn.Module): class ModernBertModel (line 424) | class ModernBertModel(ModernBertPreTrainedModel): method __init__ (line 425) | def __init__(self, config: ModernBertConfig): method get_input_embeddings (line 437) | def get_input_embeddings(self): method set_input_embeddings (line 440) | def set_input_embeddings(self, value): method forward (line 446) | def forward( class ModernBertPredictionHead (line 493) | class ModernBertPredictionHead(nn.Module): method __init__ (line 494) | def __init__(self, config: ModernBertConfig): method forward (line 501) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ModernBertForMaskedLM (line 510) | class ModernBertForMaskedLM(ModernBertPreTrainedModel): method __init__ (line 513) | def __init__(self, config: ModernBertConfig): method get_output_embeddings (line 526) | def get_output_embeddings(self): method set_output_embeddings (line 529) | def set_output_embeddings(self, new_embeddings: nn.Linear): method forward (line 534) | def forward( class ModernBertForSequenceClassification (line 581) | class ModernBertForSequenceClassification(ModernBertPreTrainedModel): method __init__ (line 582) | def __init__(self, config: ModernBertConfig): method forward (line 597) | def forward( class ModernBertForTokenClassification (line 672) | class ModernBertForTokenClassification(ModernBertPreTrainedModel): method __init__ (line 673) | def __init__(self, config: ModernBertConfig): method forward (line 687) | def forward( class ModernBertForQuestionAnswering (line 727) | class ModernBertForQuestionAnswering(ModernBertPreTrainedModel): method __init__ (line 728) | def __init__(self, config: ModernBertConfig): method forward (line 741) | def forward( class ModernBertForMultipleChoice (line 784) | class ModernBertForMultipleChoice(ModernBertPreTrainedModel): method __init__ (line 785) | def __init__(self, config: ModernBertConfig): method forward (line 799) | def forward( FILE: src/transformers/models/modernbert/modular_modernbert.py class ModernBertConfig (line 53) | class ModernBertConfig(PreTrainedConfig): method __post_init__ (line 134) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 145) | def convert_rope_params_to_dict(self, **kwargs): method to_dict (line 175) | def to_dict(self): method sliding_window (line 181) | def sliding_window(self): method sliding_window (line 186) | def sliding_window(self, value): class ModernBertEmbeddings (line 191) | class ModernBertEmbeddings(nn.Module): method __init__ (line 196) | def __init__(self, config: ModernBertConfig): method forward (line 203) | def forward( class ModernBertMLP (line 213) | class ModernBertMLP(nn.Module): method __init__ (line 220) | def __init__(self, config: ModernBertConfig): method forward (line 228) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ModernBertRotaryEmbedding (line 233) | class ModernBertRotaryEmbedding(Gemma3RotaryEmbedding): method __init__ (line 234) | def __init__(self, config: ModernBertConfig, device=None): method compute_default_rope_parameters (line 238) | def compute_default_rope_parameters( function apply_rotary_pos_emb (line 248) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class ModernBertAttention (line 275) | class ModernBertAttention(nn.Module): method __init__ (line 285) | def __init__(self, config: ModernBertConfig, layer_idx: int | None = N... method forward (line 314) | def forward( class ModernBertEncoderLayer (line 356) | class ModernBertEncoderLayer(GradientCheckpointingLayer): method __init__ (line 357) | def __init__(self, config: ModernBertConfig, layer_idx: int | None = N... method forward (line 370) | def forward( class ModernBertPreTrainedModel (line 389) | class ModernBertPreTrainedModel(PreTrainedModel): method _init_weights (line 405) | def _init_weights(self, module: nn.Module): class ModernBertModel (line 467) | class ModernBertModel(ModernBertPreTrainedModel): method __init__ (line 468) | def __init__(self, config: ModernBertConfig): method get_input_embeddings (line 480) | def get_input_embeddings(self): method set_input_embeddings (line 483) | def set_input_embeddings(self, value): method forward (line 489) | def forward( class ModernBertPredictionHead (line 536) | class ModernBertPredictionHead(nn.Module): method __init__ (line 537) | def __init__(self, config: ModernBertConfig): method forward (line 544) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ModernBertForMaskedLM (line 553) | class ModernBertForMaskedLM(ModernBertPreTrainedModel): method __init__ (line 556) | def __init__(self, config: ModernBertConfig): method get_output_embeddings (line 569) | def get_output_embeddings(self): method set_output_embeddings (line 572) | def set_output_embeddings(self, new_embeddings: nn.Linear): method forward (line 577) | def forward( class ModernBertForSequenceClassification (line 624) | class ModernBertForSequenceClassification(ModernBertPreTrainedModel): method __init__ (line 625) | def __init__(self, config: ModernBertConfig): method forward (line 640) | def forward( class ModernBertForTokenClassification (line 715) | class ModernBertForTokenClassification(ModernBertPreTrainedModel): method __init__ (line 716) | def __init__(self, config: ModernBertConfig): method forward (line 730) | def forward( class ModernBertForQuestionAnswering (line 770) | class ModernBertForQuestionAnswering(ModernBertPreTrainedModel): method __init__ (line 771) | def __init__(self, config: ModernBertConfig): method forward (line 784) | def forward( class ModernBertForMultipleChoice (line 827) | class ModernBertForMultipleChoice(ModernBertPreTrainedModel): method __init__ (line 828) | def __init__(self, config: ModernBertConfig): method forward (line 842) | def forward( FILE: src/transformers/models/modernbert_decoder/configuration_modernbert_decoder.py class ModernBertDecoderConfig (line 31) | class ModernBertDecoderConfig(PreTrainedConfig): method __post_init__ (line 101) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 116) | def convert_rope_params_to_dict(self, **kwargs): FILE: src/transformers/models/modernbert_decoder/modeling_modernbert_decoder.py class ModernBertDecoderEmbeddings (line 49) | class ModernBertDecoderEmbeddings(nn.Module): method __init__ (line 54) | def __init__(self, config: ModernBertDecoderConfig): method forward (line 61) | def forward( class ModernBertDecoderMLP (line 71) | class ModernBertDecoderMLP(nn.Module): method __init__ (line 78) | def __init__(self, config: ModernBertDecoderConfig): method forward (line 86) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ModernBertDecoderRotaryEmbedding (line 91) | class ModernBertDecoderRotaryEmbedding(nn.Module): method __init__ (line 94) | def __init__(self, config: ModernBertDecoderConfig, device=None): method compute_default_rope_parameters (line 118) | def compute_default_rope_parameters( method forward (line 155) | def forward(self, x, position_ids, layer_type=None): function rotate_half (line 172) | def rotate_half(x): function apply_rotary_pos_emb (line 180) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function eager_attention_forward (line 206) | def eager_attention_forward( class ModernBertDecoderAttention (line 235) | class ModernBertDecoderAttention(nn.Module): method __init__ (line 241) | def __init__(self, config: ModernBertDecoderConfig, layer_idx: int | N... method forward (line 268) | def forward( class ModernBertDecoderLayer (line 310) | class ModernBertDecoderLayer(GradientCheckpointingLayer): method __init__ (line 311) | def __init__(self, config: ModernBertDecoderConfig, layer_idx: int | N... method forward (line 324) | def forward( class ModernBertDecoderPredictionHead (line 356) | class ModernBertDecoderPredictionHead(nn.Module): method __init__ (line 357) | def __init__(self, config: ModernBertDecoderConfig): method forward (line 364) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ModernBertDecoderPreTrainedModel (line 369) | class ModernBertDecoderPreTrainedModel(PreTrainedModel): method _init_weights (line 385) | def _init_weights(self, module: nn.Module): class ModernBertDecoderModel (line 441) | class ModernBertDecoderModel(ModernBertDecoderPreTrainedModel): method __init__ (line 442) | def __init__(self, config: ModernBertDecoderConfig): method get_input_embeddings (line 455) | def get_input_embeddings(self): method set_input_embeddings (line 458) | def set_input_embeddings(self, value): method forward (line 464) | def forward( class ModernBertDecoderForCausalLM (line 533) | class ModernBertDecoderForCausalLM(ModernBertDecoderPreTrainedModel, Gen... method __init__ (line 536) | def __init__(self, config: ModernBertDecoderConfig): method get_output_embeddings (line 546) | def get_output_embeddings(self): method set_output_embeddings (line 549) | def set_output_embeddings(self, new_embeddings): method forward (line 554) | def forward( class ModernBertDecoderForSequenceClassification (line 643) | class ModernBertDecoderForSequenceClassification(ModernBertDecoderPreTra... method __init__ (line 644) | def __init__(self, config: ModernBertDecoderConfig): method forward (line 658) | def forward( FILE: src/transformers/models/modernbert_decoder/modular_modernbert_decoder.py class ModernBertDecoderConfig (line 52) | class ModernBertDecoderConfig(PreTrainedConfig): method __post_init__ (line 122) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 137) | def convert_rope_params_to_dict(self, **kwargs): class ModernBertDecoderEmbeddings (line 168) | class ModernBertDecoderEmbeddings(ModernBertEmbeddings): class ModernBertDecoderMLP (line 172) | class ModernBertDecoderMLP(ModernBertMLP): class ModernBertDecoderRotaryEmbedding (line 176) | class ModernBertDecoderRotaryEmbedding(ModernBertRotaryEmbedding): function eager_attention_forward (line 180) | def eager_attention_forward( class ModernBertDecoderAttention (line 209) | class ModernBertDecoderAttention(nn.Module): method __init__ (line 215) | def __init__(self, config: ModernBertDecoderConfig, layer_idx: int | N... method forward (line 242) | def forward( class ModernBertDecoderLayer (line 284) | class ModernBertDecoderLayer(GradientCheckpointingLayer): method __init__ (line 285) | def __init__(self, config: ModernBertDecoderConfig, layer_idx: int | N... method forward (line 298) | def forward( class ModernBertDecoderPredictionHead (line 330) | class ModernBertDecoderPredictionHead(ModernBertPredictionHead): class ModernBertDecoderPreTrainedModel (line 335) | class ModernBertDecoderPreTrainedModel(ModernBertPreTrainedModel): method _init_weights (line 346) | def _init_weights(self, module: nn.Module): class ModernBertDecoderModel (line 402) | class ModernBertDecoderModel(ModernBertDecoderPreTrainedModel): method __init__ (line 403) | def __init__(self, config: ModernBertDecoderConfig): method get_input_embeddings (line 416) | def get_input_embeddings(self): method set_input_embeddings (line 419) | def set_input_embeddings(self, value): method forward (line 425) | def forward( class ModernBertDecoderForCausalLM (line 494) | class ModernBertDecoderForCausalLM(ModernBertDecoderPreTrainedModel, Gen... method __init__ (line 497) | def __init__(self, config: ModernBertDecoderConfig): method get_output_embeddings (line 507) | def get_output_embeddings(self): method set_output_embeddings (line 510) | def set_output_embeddings(self, new_embeddings): method forward (line 515) | def forward( class ModernBertDecoderForSequenceClassification (line 604) | class ModernBertDecoderForSequenceClassification(ModernBertDecoderPreTra... method __init__ (line 605) | def __init__(self, config: ModernBertDecoderConfig): method forward (line 619) | def forward( FILE: src/transformers/models/modernvbert/configuration_modernvbert.py class ModernVBertConfig (line 32) | class ModernVBertConfig(PreTrainedConfig): method __post_init__ (line 74) | def __post_init__(self, **kwargs): FILE: src/transformers/models/modernvbert/modeling_modernvbert.py class ModernVBertBaseModelOutput (line 46) | class ModernVBertBaseModelOutput(BaseModelOutput): class ModernVBertMaskedLMOutput (line 76) | class ModernVBertMaskedLMOutput(MaskedLMOutput): class ModernVBertConnector (line 106) | class ModernVBertConnector(nn.Module): method __init__ (line 112) | def __init__(self, config): method pixel_shuffle (line 121) | def pixel_shuffle(self, image_hidden_states, pixel_shuffle_factor): method forward (line 140) | def forward(self, image_hidden_states): class ModernVBertPreTrainedModel (line 146) | class ModernVBertPreTrainedModel(PreTrainedModel): method _init_weights (line 160) | def _init_weights(self, module): class ModernVBertModel (line 202) | class ModernVBertModel(ModernVBertPreTrainedModel): method __init__ (line 208) | def __init__(self, config: ModernVBertConfig): method get_input_embeddings (line 226) | def get_input_embeddings(self): method set_input_embeddings (line 229) | def set_input_embeddings(self, value): method inputs_merger (line 232) | def inputs_merger( method get_image_features (line 278) | def get_image_features( method forward (line 343) | def forward( class ModernVBertPredictionHead (line 393) | class ModernVBertPredictionHead(nn.Module): method __init__ (line 394) | def __init__(self, config: ModernVBertConfig): method forward (line 401) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ModernVBertForMaskedLM (line 406) | class ModernVBertForMaskedLM(ModernVBertPreTrainedModel): method __init__ (line 409) | def __init__(self, config: ModernVBertConfig): method get_output_embeddings (line 421) | def get_output_embeddings(self): method set_output_embeddings (line 424) | def set_output_embeddings(self, new_embeddings): method forward (line 440) | def forward( class ModernVBertForSequenceClassification (line 496) | class ModernVBertForSequenceClassification(ModernVBertPreTrainedModel): method __init__ (line 497) | def __init__(self, config: ModernVBertConfig): method forward (line 523) | def forward( class ModernVBertForTokenClassification (line 612) | class ModernVBertForTokenClassification(ModernVBertPreTrainedModel): method __init__ (line 613) | def __init__(self, config: ModernVBertConfig): method forward (line 638) | def forward( FILE: src/transformers/models/modernvbert/modular_modernvbert.py class ModernVBertConfig (line 46) | class ModernVBertConfig(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): class ModernVBertBaseModelOutput (line 103) | class ModernVBertBaseModelOutput(BaseModelOutput): class ModernVBertMaskedLMOutput (line 133) | class ModernVBertMaskedLMOutput(MaskedLMOutput): class ModernVBertConnector (line 163) | class ModernVBertConnector(nn.Module): method __init__ (line 169) | def __init__(self, config): method pixel_shuffle (line 178) | def pixel_shuffle(self, image_hidden_states, pixel_shuffle_factor): method forward (line 197) | def forward(self, image_hidden_states): class ModernVBertPreTrainedModel (line 203) | class ModernVBertPreTrainedModel(SmolVLMPreTrainedModel): method _init_weights (line 208) | def _init_weights(self, module): class ModernVBertModel (line 250) | class ModernVBertModel(SmolVLMModel): method __init__ (line 251) | def __init__(self, config: ModernVBertConfig): method forward (line 280) | def forward( class ModernVBertPredictionHead (line 330) | class ModernVBertPredictionHead(ModernBertPredictionHead): class ModernVBertForMaskedLM (line 335) | class ModernVBertForMaskedLM(ModernVBertPreTrainedModel): method __init__ (line 338) | def __init__(self, config: ModernVBertConfig): method get_output_embeddings (line 350) | def get_output_embeddings(self): method set_output_embeddings (line 353) | def set_output_embeddings(self, new_embeddings): method forward (line 369) | def forward( class ModernVBertForSequenceClassification (line 425) | class ModernVBertForSequenceClassification(ModernVBertPreTrainedModel): method __init__ (line 426) | def __init__(self, config: ModernVBertConfig): method forward (line 452) | def forward( class ModernVBertForTokenClassification (line 541) | class ModernVBertForTokenClassification(ModernVBertPreTrainedModel): method __init__ (line 542) | def __init__(self, config: ModernVBertConfig): method forward (line 567) | def forward( FILE: src/transformers/models/moonshine/configuration_moonshine.py class MoonshineConfig (line 30) | class MoonshineConfig(PreTrainedConfig): method __post_init__ (line 105) | def __post_init__(self, **kwargs): FILE: src/transformers/models/moonshine/convert_usefulsensors_to_hf.py function _get_weights (line 27) | def _get_weights(model_name): function _read_h5_weights (line 35) | def _read_h5_weights(group, current_key="", weights=None): function _convert_layer_names (line 58) | def _convert_layer_names(name, gated_mlp=False): function _convert_weights (line 97) | def _convert_weights(weights, encoder=True): function convert_usefulsensors_moonshine_to_hf (line 117) | def convert_usefulsensors_moonshine_to_hf(model_name, pytorch_dump_folde... FILE: src/transformers/models/moonshine/modeling_moonshine.py class MoonshineEncoderModelOutput (line 57) | class MoonshineEncoderModelOutput(BaseModelOutput): class MoonshineEncoderMLP (line 61) | class MoonshineEncoderMLP(nn.Module): method __init__ (line 62) | def __init__(self, config, hidden_act): method forward (line 69) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MoonshineDecoderMLP (line 76) | class MoonshineDecoderMLP(nn.Module): method __init__ (line 77) | def __init__(self, config, hidden_act): method forward (line 84) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MoonshineRotaryEmbedding (line 92) | class MoonshineRotaryEmbedding(nn.Module): method __init__ (line 95) | def __init__(self, config: MoonshineConfig, device=None): method compute_default_rope_parameters (line 112) | def compute_default_rope_parameters( method forward (line 145) | def forward(self, x, position_ids): function repeat_kv (line 159) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 171) | def eager_attention_forward( function rotate_half (line 196) | def rotate_half(x): function apply_rotary_pos_emb (line 203) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class MoonshineAttention (line 244) | class MoonshineAttention(nn.Module): method __init__ (line 247) | def __init__( method forward (line 284) | def forward( class MoonshineEncoderLayer (line 366) | class MoonshineEncoderLayer(GradientCheckpointingLayer): method __init__ (line 367) | def __init__(self, config: MoonshineConfig, layer_idx: int): method forward (line 383) | def forward( class MoonshineDecoderLayer (line 415) | class MoonshineDecoderLayer(GradientCheckpointingLayer): method __init__ (line 416) | def __init__(self, config: MoonshineConfig, layer_idx: int | None = No... method forward (line 440) | def forward( class MoonshinePreTrainedModel (line 488) | class MoonshinePreTrainedModel(PreTrainedModel): method _get_feat_extract_output_lengths (line 501) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class MoonshineEncoder (line 512) | class MoonshineEncoder(MoonshinePreTrainedModel): method __init__ (line 526) | def __init__(self, config: MoonshineConfig): method get_input_embeddings (line 544) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 547) | def set_input_embeddings(self, value: nn.Module): method forward (line 552) | def forward( class MoonshineDecoder (line 616) | class MoonshineDecoder(MoonshinePreTrainedModel): method __init__ (line 624) | def __init__(self, config: MoonshineConfig): method forward (line 640) | def forward( class MoonshineModel (line 715) | class MoonshineModel(MoonshinePreTrainedModel): method __init__ (line 716) | def __init__(self, config: MoonshineConfig): method get_input_embeddings (line 724) | def get_input_embeddings(self): method set_input_embeddings (line 727) | def set_input_embeddings(self, value): method freeze_encoder (line 730) | def freeze_encoder(self): method _mask_input_features (line 737) | def _mask_input_features(self): method forward (line 746) | def forward( function shift_tokens_right (line 816) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class MoonshineForConditionalGeneration (line 837) | class MoonshineForConditionalGeneration(MoonshinePreTrainedModel, Genera... method __init__ (line 840) | def __init__(self, config: MoonshineConfig): method get_output_embeddings (line 848) | def get_output_embeddings(self): method set_output_embeddings (line 851) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 854) | def get_input_embeddings(self) -> nn.Module: method forward (line 859) | def forward( FILE: src/transformers/models/moonshine/modular_moonshine.py class MoonshineConfig (line 52) | class MoonshineConfig(PreTrainedConfig): method __post_init__ (line 127) | def __post_init__(self, **kwargs): class MoonshineEncoderModelOutput (line 144) | class MoonshineEncoderModelOutput(BaseModelOutput): class MoonshineEncoderMLP (line 148) | class MoonshineEncoderMLP(nn.Module): method __init__ (line 149) | def __init__(self, config, hidden_act): method forward (line 156) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MoonshineDecoderMLP (line 163) | class MoonshineDecoderMLP(nn.Module): method __init__ (line 164) | def __init__(self, config, hidden_act): method forward (line 171) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MoonshineRotaryEmbedding (line 179) | class MoonshineRotaryEmbedding(GlmRotaryEmbedding): class MoonshineAttention (line 183) | class MoonshineAttention(GlmAttention): method __init__ (line 184) | def __init__( method forward (line 205) | def forward( class MoonshineEncoderLayer (line 287) | class MoonshineEncoderLayer(LlamaDecoderLayer): method __init__ (line 288) | def __init__(self, config: MoonshineConfig, layer_idx: int): class MoonshineDecoderLayer (line 304) | class MoonshineDecoderLayer(GradientCheckpointingLayer): method __init__ (line 305) | def __init__(self, config: MoonshineConfig, layer_idx: int | None = No... method forward (line 329) | def forward( class MoonshinePreTrainedModel (line 377) | class MoonshinePreTrainedModel(PreTrainedModel): method _get_feat_extract_output_lengths (line 390) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class MoonshineEncoder (line 401) | class MoonshineEncoder(MoonshinePreTrainedModel): method __init__ (line 415) | def __init__(self, config: MoonshineConfig): method get_input_embeddings (line 433) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 436) | def set_input_embeddings(self, value: nn.Module): method forward (line 441) | def forward( class MoonshineDecoder (line 504) | class MoonshineDecoder(LlamaModel): method __init__ (line 512) | def __init__(self, config: MoonshineConfig): method forward (line 519) | def forward( class MoonshineModel (line 593) | class MoonshineModel(WhisperModel): method _mask_input_features (line 594) | def _mask_input_features(self): method forward (line 599) | def forward( class MoonshineForConditionalGeneration (line 674) | class MoonshineForConditionalGeneration(MoonshinePreTrainedModel, Genera... method __init__ (line 677) | def __init__(self, config: MoonshineConfig): method get_output_embeddings (line 685) | def get_output_embeddings(self): method set_output_embeddings (line 688) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 691) | def get_input_embeddings(self) -> nn.Module: method forward (line 696) | def forward( FILE: src/transformers/models/moonshine_streaming/configuration_moonshine_streaming.py class MoonshineStreamingEncoderConfig (line 26) | class MoonshineStreamingEncoderConfig(PreTrainedConfig): method __post_init__ (line 72) | def __post_init__(self, **kwargs): class MoonshineStreamingConfig (line 81) | class MoonshineStreamingConfig(PreTrainedConfig): method __post_init__ (line 125) | def __post_init__(self, **kwargs): FILE: src/transformers/models/moonshine_streaming/modeling_moonshine_streaming.py class MoonshineStreamingEncoderModelOutput (line 58) | class MoonshineStreamingEncoderModelOutput(BaseModelOutput): class MoonshineStreamingFrameCMVN (line 62) | class MoonshineStreamingFrameCMVN(nn.Module): method __init__ (line 63) | def __init__(self, eps: float = 1e-6): method forward (line 67) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MoonshineStreamingAsinhCompression (line 74) | class MoonshineStreamingAsinhCompression(nn.Module): method __init__ (line 75) | def __init__(self, k_init: float = 0.75): method forward (line 79) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MoonshineStreamingCausalConv1d (line 83) | class MoonshineStreamingCausalConv1d(nn.Conv1d): method __init__ (line 84) | def __init__( method forward (line 96) | def forward(self, x: torch.Tensor, mask: torch.Tensor | None = None) -... class MoonshineStreamingLayerNorm (line 112) | class MoonshineStreamingLayerNorm(nn.Module): method __init__ (line 113) | def __init__(self, dim: int, unit_offset: bool = True, device=None, dt... method forward (line 119) | def forward(self, x: Tensor) -> Tensor: class MoonshineStreamingEncoderMLP (line 125) | class MoonshineStreamingEncoderMLP(nn.Module): method __init__ (line 126) | def __init__(self, config, hidden_act): method forward (line 133) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function repeat_kv (line 140) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 152) | def eager_attention_forward( class MoonshineStreamingEncoderAttention (line 177) | class MoonshineStreamingEncoderAttention(nn.Module): method __init__ (line 178) | def __init__(self, config: MoonshineStreamingConfig, layer_idx: int): method forward (line 201) | def forward( class MoonshineStreamingEncoderLayer (line 234) | class MoonshineStreamingEncoderLayer(GradientCheckpointingLayer): method __init__ (line 235) | def __init__(self, config: MoonshineStreamingConfig, layer_idx: int): method forward (line 243) | def forward( class MoonshineStreamingEncoderEmbedder (line 275) | class MoonshineStreamingEncoderEmbedder(nn.Module): method __init__ (line 276) | def __init__(self, config): method forward (line 289) | def forward(self, input_values, padding_mask=None): class MoonshineStreamingPreTrainedModel (line 310) | class MoonshineStreamingPreTrainedModel(PreTrainedModel): method _get_feat_extract_output_lengths (line 323) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _init_weights (line 333) | def _init_weights(self, module: nn.Module): function sliding_window_mask_function (line 340) | def sliding_window_mask_function(sliding_window: tuple[int, int]) -> Cal... class MoonshineStreamingEncoder (line 356) | class MoonshineStreamingEncoder(MoonshineStreamingPreTrainedModel): method __init__ (line 363) | def __init__(self, config: MoonshineStreamingEncoderConfig): method forward (line 376) | def forward( class MoonshinMoonshineStreamingDecoderMLP (line 426) | class MoonshinMoonshineStreamingDecoderMLP(nn.Module): method __init__ (line 427) | def __init__(self, config): method forward (line 437) | def forward(self, x): class MoonshineStreamingDecoderMLP (line 442) | class MoonshineStreamingDecoderMLP(nn.Module): method __init__ (line 443) | def __init__(self, config, hidden_act): method forward (line 450) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MoonshineStreamingRotaryEmbedding (line 458) | class MoonshineStreamingRotaryEmbedding(nn.Module): method __init__ (line 461) | def __init__(self, config: MoonshineStreamingConfig, device=None): method compute_default_rope_parameters (line 478) | def compute_default_rope_parameters( method forward (line 511) | def forward(self, x, position_ids): function rotate_half (line 525) | def rotate_half(x): function apply_rotary_pos_emb (line 532) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class MoonshineStreamingAttention (line 573) | class MoonshineStreamingAttention(nn.Module): method __init__ (line 576) | def __init__( method forward (line 613) | def forward( class MoonshineStreamingDecoderLayer (line 695) | class MoonshineStreamingDecoderLayer(GradientCheckpointingLayer): method __init__ (line 696) | def __init__(self, config: MoonshineStreamingConfig, layer_idx: int | ... method forward (line 720) | def forward( class MoonshineStreamingDecoder (line 768) | class MoonshineStreamingDecoder(MoonshineStreamingPreTrainedModel): method __init__ (line 776) | def __init__(self, config): method forward (line 800) | def forward( class MoonshineStreamingModel (line 880) | class MoonshineStreamingModel(MoonshineStreamingPreTrainedModel): method __init__ (line 881) | def __init__(self, config): method get_input_embeddings (line 888) | def get_input_embeddings(self): method set_input_embeddings (line 891) | def set_input_embeddings(self, value): method freeze_encoder (line 894) | def freeze_encoder(self): method _mask_input_features (line 901) | def _mask_input_features(self): method forward (line 910) | def forward( function shift_tokens_right (line 980) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class MoonshineStreamingForConditionalGeneration (line 1001) | class MoonshineStreamingForConditionalGeneration(MoonshineStreamingPreTr... method __init__ (line 1004) | def __init__(self, config: MoonshineStreamingConfig): method get_output_embeddings (line 1012) | def get_output_embeddings(self): method set_output_embeddings (line 1015) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 1018) | def get_input_embeddings(self) -> nn.Module: method forward (line 1023) | def forward( FILE: src/transformers/models/moonshine_streaming/modular_moonshine_streaming.py class MoonshineStreamingProcessorKwargs (line 49) | class MoonshineStreamingProcessorKwargs(ProcessingKwargs, total=False): class MoonshineStreamingProcessor (line 59) | class MoonshineStreamingProcessor(Wav2Vec2Processor): ... class MoonshineStreamingEncoderModelOutput (line 68) | class MoonshineStreamingEncoderModelOutput(BaseModelOutput): class MoonshineStreamingFrameCMVN (line 72) | class MoonshineStreamingFrameCMVN(nn.Module): method __init__ (line 73) | def __init__(self, eps: float = 1e-6): method forward (line 77) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MoonshineStreamingAsinhCompression (line 84) | class MoonshineStreamingAsinhCompression(nn.Module): method __init__ (line 85) | def __init__(self, k_init: float = 0.75): method forward (line 89) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MoonshineStreamingCausalConv1d (line 93) | class MoonshineStreamingCausalConv1d(nn.Conv1d): method __init__ (line 94) | def __init__( method forward (line 106) | def forward(self, x: torch.Tensor, mask: torch.Tensor | None = None) -... class MoonshineStreamingLayerNorm (line 122) | class MoonshineStreamingLayerNorm(nn.Module): method __init__ (line 123) | def __init__(self, dim: int, unit_offset: bool = True, device=None, dt... method forward (line 129) | def forward(self, x: Tensor) -> Tensor: class MoonshineStreamingEncoderMLP (line 135) | class MoonshineStreamingEncoderMLP(MoonshineEncoderMLP): ... class MoonshineStreamingEncoderAttention (line 138) | class MoonshineStreamingEncoderAttention(nn.Module): method __init__ (line 139) | def __init__(self, config: MoonshineStreamingConfig, layer_idx: int): method forward (line 162) | def forward( class MoonshineStreamingEncoderLayer (line 195) | class MoonshineStreamingEncoderLayer(MoonshineEncoderLayer): method __init__ (line 196) | def __init__(self, config: MoonshineStreamingConfig, layer_idx: int): class MoonshineStreamingEncoderEmbedder (line 204) | class MoonshineStreamingEncoderEmbedder(nn.Module): method __init__ (line 205) | def __init__(self, config): method forward (line 218) | def forward(self, input_values, padding_mask=None): class MoonshineStreamingPreTrainedModel (line 238) | class MoonshineStreamingPreTrainedModel(MoonshinePreTrainedModel): method _get_feat_extract_output_lengths (line 239) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _init_weights (line 246) | def _init_weights(self, module: nn.Module): function sliding_window_mask_function (line 253) | def sliding_window_mask_function(sliding_window: tuple[int, int]) -> Cal... class MoonshineStreamingEncoder (line 269) | class MoonshineStreamingEncoder(MoonshineStreamingPreTrainedModel): method __init__ (line 276) | def __init__(self, config: MoonshineStreamingEncoderConfig): method forward (line 289) | def forward( class MoonshinMoonshineStreamingDecoderMLP (line 339) | class MoonshinMoonshineStreamingDecoderMLP(LlamaMLP): ... class MoonshineStreamingDecoder (line 342) | class MoonshineStreamingDecoder(MoonshineDecoder): method __init__ (line 343) | def __init__(self, config): method forward (line 354) | def forward( class MoonshineStreamingModel (line 395) | class MoonshineStreamingModel(MoonshineModel): method __init__ (line 396) | def __init__(self, config): class MoonshineStreamingForConditionalGeneration (line 402) | class MoonshineStreamingForConditionalGeneration(MoonshineForConditional... FILE: src/transformers/models/moonshine_streaming/processing_moonshine_streaming.py class MoonshineStreamingProcessorKwargs (line 26) | class MoonshineStreamingProcessorKwargs(ProcessingKwargs, total=False): class MoonshineStreamingProcessor (line 37) | class MoonshineStreamingProcessor(ProcessorMixin): method __init__ (line 38) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 42) | def __call__( method pad (line 74) | def pad(self, *args, **kwargs): method model_input_names (line 108) | def model_input_names(self): FILE: src/transformers/models/moshi/configuration_moshi.py class MoshiDepthConfig (line 26) | class MoshiDepthConfig(PreTrainedConfig): method __post_init__ (line 78) | def __post_init__(self, **kwargs): method validate_architecture (line 85) | def validate_architecture(self): class MoshiConfig (line 93) | class MoshiConfig(PreTrainedConfig): method __post_init__ (line 157) | def __post_init__(self, **kwargs): method validate_architecture (line 187) | def validate_architecture(self): method sampling_rate (line 198) | def sampling_rate(self): method from_audio_encoder_config (line 202) | def from_audio_encoder_config( FILE: src/transformers/models/moshi/convert_moshi_transformers.py function assert_param_count (line 38) | def assert_param_count(model_1, model_2): function param_count (line 44) | def param_count(model): function _grab_best_device (line 48) | def _grab_best_device(use_gpu=True): function _preprocess_state_dict (line 78) | def _preprocess_state_dict(state_dict, config): function _convert_model (line 110) | def _convert_model( function convert_checkpoint (line 198) | def convert_checkpoint( FILE: src/transformers/models/moshi/modeling_moshi.py class MoshiConditionalGenerationGenerateOutput (line 54) | class MoshiConditionalGenerationGenerateOutput(ModelOutput): class MoshiCausalLMOutputWithPast (line 106) | class MoshiCausalLMOutputWithPast(ModelOutput): class MoshiConditionalGenerationOutputWithPast (line 133) | class MoshiConditionalGenerationOutputWithPast(ModelOutput): class MoshiUnconditionalInput (line 172) | class MoshiUnconditionalInput(ModelOutput): class MoshiRMSNorm (line 192) | class MoshiRMSNorm(nn.Module): method __init__ (line 193) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 198) | def _norm(self, x): method forward (line 202) | def forward(self, x): method extra_repr (line 207) | def extra_repr(self): class MoshiFlexibleLinear (line 211) | class MoshiFlexibleLinear(nn.Module): method __init__ (line 212) | def __init__(self, input_size, output_size, num_layers): method forward (line 217) | def forward(self, x, layer_idx=None): class MoshiLinear (line 250) | class MoshiLinear(nn.Module): method __init__ (line 251) | def __init__(self, input_dim, output_dim, num_codebooks, use_flexible_... method forward (line 261) | def forward(self, x, layer_idx=None): class MoshiRotaryEmbedding (line 269) | class MoshiRotaryEmbedding(nn.Module): method __init__ (line 272) | def __init__(self, config: MoshiConfig, device=None): method compute_default_rope_parameters (line 289) | def compute_default_rope_parameters( method forward (line 320) | def forward(self, x, position_ids): function rotate_half (line 335) | def rotate_half(x): function apply_rotary_pos_emb (line 343) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class MoshiGatingMLP (line 368) | class MoshiGatingMLP(nn.Module): method __init__ (line 369) | def __init__(self, config, use_flexible_linear=False): method forward (line 383) | def forward(self, hidden_states: torch.Tensor, layer_idx: int | None =... function repeat_kv (line 394) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class MoshiAttention (line 406) | class MoshiAttention(nn.Module): method __init__ (line 409) | def __init__(self, config: MoshiConfig, layer_idx: int | None = None, ... method forward (line 454) | def forward( class MoshiFlashAttention2 (line 514) | class MoshiFlashAttention2(MoshiAttention): method __init__ (line 521) | def __init__(self, *args, **kwargs): method forward (line 529) | def forward( class MoshiSdpaAttention (line 626) | class MoshiSdpaAttention(MoshiAttention): method forward (line 634) | def forward( class MoshiDecoderLayer (line 702) | class MoshiDecoderLayer(GradientCheckpointingLayer): method __init__ (line 703) | def __init__(self, config: MoshiConfig, layer_idx: int, use_flexible_l... method forward (line 719) | def forward( class MoshiPreTrainedModel (line 764) | class MoshiPreTrainedModel(PreTrainedModel): method _init_weights (line 776) | def _init_weights(self, module): class MoshiDepthDecoder (line 782) | class MoshiDepthDecoder(MoshiPreTrainedModel, GenerationMixin): method __init__ (line 792) | def __init__(self, config: MoshiDepthConfig): method forward (line 818) | def forward( class MoshiModel (line 994) | class MoshiModel(MoshiPreTrainedModel): method __init__ (line 995) | def __init__(self, config: MoshiConfig): method forward (line 1014) | def forward( class MoshiForCausalLM (line 1109) | class MoshiForCausalLM(MoshiPreTrainedModel, GenerationMixin): method __init__ (line 1113) | def __init__(self, config): method forward (line 1123) | def forward( class MoshiForConditionalGeneration (line 1224) | class MoshiForConditionalGeneration(MoshiPreTrainedModel, GenerationMixin): method __init__ (line 1232) | def __init__(self, config: MoshiConfig): method get_depth_decoder (line 1246) | def get_depth_decoder(self): method forward (line 1250) | def forward( method _prepare_attention_mask_for_generation (line 1426) | def _prepare_attention_mask_for_generation( method _prepare_inputs_embeds_for_generation (line 1451) | def _prepare_inputs_embeds_for_generation( method generate (line 1553) | def generate( method prepare_inputs_for_generation (line 1806) | def prepare_inputs_for_generation( method _update_model_kwargs_for_generation (line 1878) | def _update_model_kwargs_for_generation( method get_input_embeddings (line 1896) | def get_input_embeddings(self): method set_input_embeddings (line 1899) | def set_input_embeddings(self, value): method get_output_embeddings (line 1902) | def get_output_embeddings(self): method set_output_embeddings (line 1905) | def set_output_embeddings(self, new_embeddings): method freeze_audio_encoder (line 1908) | def freeze_audio_encoder(self): method freeze_depth_decoder (line 1916) | def freeze_depth_decoder(self): method apply_delay_pattern_mask (line 1926) | def apply_delay_pattern_mask(input_ids, decoder_pad_token_mask): method build_delay_pattern_mask (line 1934) | def build_delay_pattern_mask( method get_unconditional_inputs (line 1979) | def get_unconditional_inputs(self, num_samples=1): method _check_and_maybe_initialize_inputs (line 2020) | def _check_and_maybe_initialize_inputs( FILE: src/transformers/models/mpnet/configuration_mpnet.py class MPNetConfig (line 25) | class MPNetConfig(PreTrainedConfig): FILE: src/transformers/models/mpnet/modeling_mpnet.py class MPNetPreTrainedModel (line 43) | class MPNetPreTrainedModel(PreTrainedModel): method _init_weights (line 48) | def _init_weights(self, module): class MPNetEmbeddings (line 57) | class MPNetEmbeddings(nn.Module): method __init__ (line 58) | def __init__(self, config): method forward (line 72) | def forward(self, input_ids=None, position_ids=None, inputs_embeds=Non... method create_position_ids_from_inputs_embeds (line 98) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): class MPNetSelfAttention (line 116) | class MPNetSelfAttention(nn.Module): method __init__ (line 117) | def __init__(self, config): method forward (line 136) | def forward( class MPNetAttention (line 189) | class MPNetAttention(nn.Module): method __init__ (line 190) | def __init__(self, config): method forward (line 196) | def forward( class MPNetIntermediate (line 216) | class MPNetIntermediate(nn.Module): method __init__ (line 217) | def __init__(self, config): method forward (line 225) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MPNetOutput (line 232) | class MPNetOutput(nn.Module): method __init__ (line 233) | def __init__(self, config): method forward (line 239) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MPNetLayer (line 246) | class MPNetLayer(nn.Module): method __init__ (line 247) | def __init__(self, config): method forward (line 253) | def forward( class MPNetEncoder (line 276) | class MPNetEncoder(nn.Module): method __init__ (line 277) | def __init__(self, config): method forward (line 284) | def forward( method compute_position_bias (line 324) | def compute_position_bias(self, x, position_ids=None, num_buckets=32): method relative_position_bucket (line 343) | def relative_position_bucket(relative_position, num_buckets=32, max_di... class MPNetPooler (line 364) | class MPNetPooler(nn.Module): method __init__ (line 365) | def __init__(self, config): method forward (line 370) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MPNetModel (line 380) | class MPNetModel(MPNetPreTrainedModel): method __init__ (line 381) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 396) | def get_input_embeddings(self): method set_input_embeddings (line 399) | def set_input_embeddings(self, value): method forward (line 403) | def forward( class MPNetForMaskedLM (line 458) | class MPNetForMaskedLM(MPNetPreTrainedModel): method __init__ (line 464) | def __init__(self, config): method get_output_embeddings (line 473) | def get_output_embeddings(self): method set_output_embeddings (line 476) | def set_output_embeddings(self, new_embeddings): method forward (line 481) | def forward( class MPNetLMHead (line 531) | class MPNetLMHead(nn.Module): method __init__ (line 534) | def __init__(self, config): method forward (line 542) | def forward(self, features, **kwargs): class MPNetForSequenceClassification (line 559) | class MPNetForSequenceClassification(MPNetPreTrainedModel): method __init__ (line 560) | def __init__(self, config): method forward (line 571) | def forward( class MPNetForMultipleChoice (line 639) | class MPNetForMultipleChoice(MPNetPreTrainedModel): method __init__ (line 640) | def __init__(self, config): method forward (line 651) | def forward( class MPNetForTokenClassification (line 731) | class MPNetForTokenClassification(MPNetPreTrainedModel): method __init__ (line 732) | def __init__(self, config): method forward (line 744) | def forward( class MPNetClassificationHead (line 795) | class MPNetClassificationHead(nn.Module): method __init__ (line 798) | def __init__(self, config): method forward (line 804) | def forward(self, features, **kwargs): class MPNetForQuestionAnswering (line 815) | class MPNetForQuestionAnswering(MPNetPreTrainedModel): method __init__ (line 816) | def __init__(self, config): method forward (line 827) | def forward( function create_position_ids_from_input_ids (line 889) | def create_position_ids_from_input_ids(input_ids, padding_idx): FILE: src/transformers/models/mpnet/tokenization_mpnet.py class MPNetTokenizer (line 30) | class MPNetTokenizer(TokenizersBackend): method __init__ (line 89) | def __init__( method mask_token (line 168) | def mask_token(self) -> str: method mask_token (line 183) | def mask_token(self, value): FILE: src/transformers/models/mpt/configuration_mpt.py class MptAttentionConfig (line 26) | class MptAttentionConfig(PreTrainedConfig): class MptConfig (line 71) | class MptConfig(PreTrainedConfig): method __post_init__ (line 142) | def __post_init__(self, **kwargs): FILE: src/transformers/models/mpt/modeling_mpt.py function build_mpt_alibi_tensor (line 42) | def build_mpt_alibi_tensor(num_heads, sequence_length, alibi_bias_max=8,... class MptAttention (line 65) | class MptAttention(nn.Module): method __init__ (line 70) | def __init__(self, config: MptConfig, layer_idx: int | None = None): method forward (line 86) | def forward( class MptMLP (line 137) | class MptMLP(nn.Module): method __init__ (line 138) | def __init__(self, config: MptConfig): method forward (line 147) | def forward(self, hidden_states: torch.Tensor, residual: torch.Tensor)... class MptBlock (line 158) | class MptBlock(GradientCheckpointingLayer): method __init__ (line 159) | def __init__(self, config: MptConfig, layer_idx: int | None = None): method forward (line 179) | def forward( class MptPreTrainedModel (line 216) | class MptPreTrainedModel(PreTrainedModel): class MptModel (line 224) | class MptModel(MptPreTrainedModel): method __init__ (line 225) | def __init__(self, config: MptConfig): method get_input_embeddings (line 247) | def get_input_embeddings(self): method build_mpt_alibi_tensor (line 250) | def build_mpt_alibi_tensor(self, num_heads, sequence_length, alibi_bia... method set_input_embeddings (line 253) | def set_input_embeddings(self, new_embeddings: torch.Tensor): method forward (line 257) | def forward( class MptForCausalLM (line 368) | class MptForCausalLM(MptPreTrainedModel, GenerationMixin): method __init__ (line 371) | def __init__(self, config: MptConfig): method set_output_embeddings (line 379) | def set_output_embeddings(self, new_embeddings: torch.Tensor): method forward (line 383) | def forward( class MptForSequenceClassification (line 463) | class MptForSequenceClassification(MptPreTrainedModel): method __init__ (line 464) | def __init__(self, config: MptConfig): method set_output_embeddings (line 473) | def set_output_embeddings(self, new_embeddings: torch.Tensor): method forward (line 477) | def forward( class MptForTokenClassification (line 582) | class MptForTokenClassification(MptPreTrainedModel): method __init__ (line 583) | def __init__(self, config: MptConfig): method forward (line 601) | def forward( class MptForQuestionAnswering (line 671) | class MptForQuestionAnswering(MptPreTrainedModel): method __init__ (line 672) | def __init__(self, config): method forward (line 681) | def forward( FILE: src/transformers/models/mra/configuration_mra.py class MraConfig (line 24) | class MraConfig(PreTrainedConfig): FILE: src/transformers/models/mra/convert_mra_pytorch_to_pytorch.py function rename_key (line 23) | def rename_key(orig_key): function convert_checkpoint_helper (line 63) | def convert_checkpoint_helper(max_position_embeddings, orig_state_dict): function convert_mra_checkpoint (line 78) | def convert_mra_checkpoint(checkpoint_path, mra_config_file, pytorch_dum... FILE: src/transformers/models/mra/modeling_mra.py function load_cuda_kernels (line 51) | def load_cuda_kernels(): function sparse_max (line 60) | def sparse_max(sparse_qk_prod, indices, query_num_block, key_num_block): function sparse_mask (line 88) | def sparse_mask(mask, indices, block_size=32): function mm_to_sparse (line 111) | def mm_to_sparse(dense_query, dense_key, indices, block_size=32): function sparse_dense_mm (line 151) | def sparse_dense_mm(sparse_query, indices, dense_key, query_num_block, b... function transpose_indices (line 191) | def transpose_indices(indices, dim_1_block, dim_2_block): class MraSampledDenseMatMul (line 195) | class MraSampledDenseMatMul(torch.autograd.Function): method forward (line 197) | def forward(ctx, dense_query, dense_key, indices, block_size): method backward (line 204) | def backward(ctx, grad): method operator_call (line 215) | def operator_call(dense_query, dense_key, indices, block_size=32): class MraSparseDenseMatMul (line 219) | class MraSparseDenseMatMul(torch.autograd.Function): method forward (line 221) | def forward(ctx, sparse_query, indices, dense_key, query_num_block): method backward (line 228) | def backward(ctx, grad): method operator_call (line 238) | def operator_call(sparse_query, indices, dense_key, query_num_block): class MraReduceSum (line 242) | class MraReduceSum: method operator_call (line 244) | def operator_call(sparse_query, indices, query_num_block, key_num_block): function get_low_resolution_logit (line 271) | def get_low_resolution_logit(query, key, block_size, mask=None, value=No... function get_block_idxes (line 311) | def get_block_idxes( function mra2_attention (line 349) | def mra2_attention( class MraEmbeddings (line 464) | class MraEmbeddings(nn.Module): method __init__ (line 467) | def __init__(self, config): method forward (line 484) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class MraSelfAttention (line 519) | class MraSelfAttention(nn.Module): method __init__ (line 520) | def __init__(self, config): method forward (line 552) | def forward(self, hidden_states, attention_mask=None): class MraSelfOutput (line 616) | class MraSelfOutput(nn.Module): method __init__ (line 617) | def __init__(self, config): method forward (line 623) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MraAttention (line 630) | class MraAttention(nn.Module): method __init__ (line 631) | def __init__(self, config): method forward (line 636) | def forward(self, hidden_states, attention_mask=None): class MraIntermediate (line 644) | class MraIntermediate(nn.Module): method __init__ (line 645) | def __init__(self, config): method forward (line 653) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MraOutput (line 660) | class MraOutput(nn.Module): method __init__ (line 661) | def __init__(self, config): method forward (line 667) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MraLayer (line 674) | class MraLayer(GradientCheckpointingLayer): method __init__ (line 675) | def __init__(self, config): method forward (line 684) | def forward(self, hidden_states, attention_mask=None): method feed_forward_chunk (line 697) | def feed_forward_chunk(self, attention_output): class MraEncoder (line 703) | class MraEncoder(nn.Module): method __init__ (line 704) | def __init__(self, config): method forward (line 710) | def forward( class MraPredictionHeadTransform (line 739) | class MraPredictionHeadTransform(nn.Module): method __init__ (line 740) | def __init__(self, config): method forward (line 749) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MraLMPredictionHead (line 757) | class MraLMPredictionHead(nn.Module): method __init__ (line 758) | def __init__(self, config): method forward (line 767) | def forward(self, hidden_states): class MraOnlyMLMHead (line 774) | class MraOnlyMLMHead(nn.Module): method __init__ (line 775) | def __init__(self, config): method forward (line 779) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class MraPreTrainedModel (line 786) | class MraPreTrainedModel(PreTrainedModel): method _init_weights (line 792) | def _init_weights(self, module: nn.Module): class MraModel (line 803) | class MraModel(MraPreTrainedModel): method __init__ (line 804) | def __init__(self, config): method get_input_embeddings (line 814) | def get_input_embeddings(self): method set_input_embeddings (line 817) | def set_input_embeddings(self, value): method forward (line 821) | def forward( class MraForMaskedLM (line 891) | class MraForMaskedLM(MraPreTrainedModel): method __init__ (line 897) | def __init__(self, config): method get_output_embeddings (line 906) | def get_output_embeddings(self): method set_output_embeddings (line 909) | def set_output_embeddings(self, new_embeddings): method forward (line 914) | def forward( class MraClassificationHead (line 965) | class MraClassificationHead(nn.Module): method __init__ (line 968) | def __init__(self, config): method forward (line 976) | def forward(self, features, **kwargs): class MraForSequenceClassification (line 992) | class MraForSequenceClassification(MraPreTrainedModel): method __init__ (line 993) | def __init__(self, config): method forward (line 1003) | def forward( class MraForMultipleChoice (line 1071) | class MraForMultipleChoice(MraPreTrainedModel): method __init__ (line 1072) | def __init__(self, config): method forward (line 1083) | def forward( class MraForTokenClassification (line 1174) | class MraForTokenClassification(MraPreTrainedModel): method __init__ (line 1175) | def __init__(self, config): method forward (line 1187) | def forward( class MraForQuestionAnswering (line 1247) | class MraForQuestionAnswering(MraPreTrainedModel): method __init__ (line 1248) | def __init__(self, config): method forward (line 1261) | def forward( FILE: src/transformers/models/mt5/configuration_mt5.py class MT5Config (line 24) | class MT5Config(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): method validate_architecture (line 83) | def validate_architecture(self): FILE: src/transformers/models/mt5/modeling_mt5.py class MT5LayerNorm (line 47) | class MT5LayerNorm(nn.Module): method __init__ (line 48) | def __init__(self, hidden_size, eps=1e-6): method forward (line 56) | def forward(self, hidden_states): class MT5DenseActDense (line 73) | class MT5DenseActDense(nn.Module): method __init__ (line 74) | def __init__(self, config: MT5Config): method forward (line 81) | def forward(self, hidden_states): class MT5DenseGatedActDense (line 96) | class MT5DenseGatedActDense(nn.Module): method __init__ (line 97) | def __init__(self, config: MT5Config): method forward (line 105) | def forward(self, hidden_states): class MT5LayerFF (line 126) | class MT5LayerFF(nn.Module): method __init__ (line 127) | def __init__(self, config: MT5Config): method forward (line 137) | def forward(self, hidden_states): class MT5Attention (line 145) | class MT5Attention(nn.Module): method __init__ (line 146) | def __init__( method _relative_position_bucket (line 181) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 228) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 245) | def forward( class MT5LayerSelfAttention (line 340) | class MT5LayerSelfAttention(nn.Module): method __init__ (line 341) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 349) | def forward( class MT5LayerCrossAttention (line 374) | class MT5LayerCrossAttention(nn.Module): method __init__ (line 375) | def __init__(self, config, layer_idx: int | None = None): method forward (line 381) | def forward( class MT5Block (line 406) | class MT5Block(GradientCheckpointingLayer): method __init__ (line 407) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 419) | def forward( class MT5ClassificationHead (line 497) | class MT5ClassificationHead(nn.Module): method __init__ (line 500) | def __init__(self, config: MT5Config): method forward (line 506) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MT5PreTrainedModel (line 517) | class MT5PreTrainedModel(PreTrainedModel): method dummy_inputs (line 527) | def dummy_inputs(self): method _init_weights (line 538) | def _init_weights(self, module): method _shift_right (line 592) | def _shift_right(self, input_ids): class MT5Stack (line 615) | class MT5Stack(MT5PreTrainedModel): method __init__ (line 616) | def __init__(self, config): method set_input_embeddings (line 632) | def set_input_embeddings(self, new_embeddings): method forward (line 635) | def forward( class MT5Model (line 794) | class MT5Model(MT5PreTrainedModel): method __init__ (line 821) | def __init__(self, config: MT5Config): method get_input_embeddings (line 839) | def get_input_embeddings(self): method set_input_embeddings (line 843) | def set_input_embeddings(self, new_embeddings): method forward (line 850) | def forward( class MT5ForConditionalGeneration (line 971) | class MT5ForConditionalGeneration(MT5PreTrainedModel, GenerationMixin): method __init__ (line 998) | def __init__(self, config: MT5Config): method get_input_embeddings (line 1019) | def get_input_embeddings(self): method set_input_embeddings (line 1022) | def set_input_embeddings(self, new_embeddings): method forward (line 1028) | def forward( method prepare_decoder_input_ids_from_labels (line 1169) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class MT5EncoderModel (line 1174) | class MT5EncoderModel(MT5PreTrainedModel): method __init__ (line 1196) | def __init__(self, config: MT5Config): method get_input_embeddings (line 1209) | def get_input_embeddings(self): method set_input_embeddings (line 1213) | def set_input_embeddings(self, new_embeddings): method forward (line 1219) | def forward( class MT5ForSequenceClassification (line 1272) | class MT5ForSequenceClassification(MT5PreTrainedModel): method __init__ (line 1276) | def __init__(self, config: MT5Config): method forward (line 1286) | def forward( class MT5ForTokenClassification (line 1419) | class MT5ForTokenClassification(MT5PreTrainedModel): method __init__ (line 1421) | def __init__(self, config: MT5Config): method forward (line 1434) | def forward( class MT5ForQuestionAnswering (line 1492) | class MT5ForQuestionAnswering(MT5PreTrainedModel): method __init__ (line 1500) | def __init__(self, config: MT5Config): method get_input_embeddings (line 1523) | def get_input_embeddings(self): method set_input_embeddings (line 1527) | def set_input_embeddings(self, new_embeddings): method forward (line 1534) | def forward( FILE: src/transformers/models/musicflamingo/configuration_musicflamingo.py class MusicFlamingoConfig (line 32) | class MusicFlamingoConfig(PreTrainedConfig): method __post_init__ (line 75) | def __post_init__(self, **kwargs): FILE: src/transformers/models/musicflamingo/convert_musicflamingo_to_hf.py function _load_json (line 45) | def _load_json(p: Path): function write_processor (line 52) | def write_processor(src_root: Path, dst_root: Path): function _resolve_component_dir (line 124) | def _resolve_component_dir(dirpath: Path): function merge_and_shard_weights (line 141) | def merge_and_shard_weights(src_root: Path, dst_root: Path, processor: M... function main (line 273) | def main() -> None: FILE: src/transformers/models/musicflamingo/modeling_musicflamingo.py class MusicFlamingoRotaryEmbedding (line 45) | class MusicFlamingoRotaryEmbedding(nn.Module): method __init__ (line 56) | def __init__(self, config: MusicFlamingoConfig, device=None): method compute_default_rope_parameters (line 75) | def compute_default_rope_parameters( method forward (line 107) | def forward(self, timestamps: Tensor, seq_len: int) -> tuple[Tensor, T... method _compute_position_angles (line 126) | def _compute_position_angles(self, inv_freq): class MusicFlamingoPreTrainedModel (line 135) | class MusicFlamingoPreTrainedModel(PreTrainedModel): method _init_weights (line 146) | def _init_weights(self, module): class MusicFlamingoMultiModalProjector (line 153) | class MusicFlamingoMultiModalProjector(nn.Module): method __init__ (line 159) | def __init__(self, config: MusicFlamingoConfig): method forward (line 169) | def forward(self, audio_features): function rotate_half (line 176) | def rotate_half(x): function apply_rotary_time_emb (line 183) | def apply_rotary_time_emb(hidden_states, cos, sin): class MusicFlamingoForConditionalGeneration (line 201) | class MusicFlamingoForConditionalGeneration(MusicFlamingoPreTrainedModel... method __init__ (line 206) | def __init__(self, config: MusicFlamingoConfig): method get_input_embeddings (line 217) | def get_input_embeddings(self): method set_input_embeddings (line 220) | def set_input_embeddings(self, value): method get_output_embeddings (line 223) | def get_output_embeddings(self): method set_output_embeddings (line 226) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 229) | def set_decoder(self, decoder): method get_decoder (line 232) | def get_decoder(self): method get_audio_features (line 239) | def get_audio_features( method forward (line 273) | def forward( method prepare_inputs_for_generation (line 364) | def prepare_inputs_for_generation(self, *args, is_first_iteration: boo... method _build_audio_timestamps (line 378) | def _build_audio_timestamps( FILE: src/transformers/models/musicflamingo/modular_musicflamingo.py class MusicFlamingoConfig (line 43) | class MusicFlamingoConfig(AudioFlamingo3Config): method __post_init__ (line 78) | def __post_init__(self, **kwargs): class MusicFlamingoProcessor (line 87) | class MusicFlamingoProcessor(AudioFlamingo3Processor): method __init__ (line 113) | def __init__( method _expand_audio_tokens (line 136) | def _expand_audio_tokens(self, text, padding_mask, per_sample_windows): method _get_audio_tokens_mask (line 147) | def _get_audio_tokens_mask(self, input_ids): method apply_transcription_request (line 154) | def apply_transcription_request(self, *args, **kwargs): method decode (line 157) | def decode(self, *args, **kwargs): method batch_decode (line 160) | def batch_decode(self, *args, **kwargs): method _strip_assistant_prefix_and_quotes (line 163) | def _strip_assistant_prefix_and_quotes(self, *args, **kwargs): function rotate_half (line 167) | def rotate_half(x): function apply_rotary_time_emb (line 174) | def apply_rotary_time_emb(hidden_states, cos, sin): class MusicFlamingoRotaryEmbedding (line 187) | class MusicFlamingoRotaryEmbedding(MoonshineRotaryEmbedding): method __init__ (line 196) | def __init__(self, config: MusicFlamingoConfig, device=None): method _compute_position_angles (line 201) | def _compute_position_angles(self, inv_freq): method forward (line 209) | def forward(self, timestamps: Tensor, seq_len: int) -> tuple[Tensor, T... class MusicFlamingoPreTrainedModel (line 229) | class MusicFlamingoPreTrainedModel(AudioFlamingo3PreTrainedModel): method _init_weights (line 233) | def _init_weights(self, module): class MusicFlamingoForConditionalGeneration (line 245) | class MusicFlamingoForConditionalGeneration(AudioFlamingo3ForConditional... method __init__ (line 246) | def __init__(self, config: MusicFlamingoConfig): method _build_audio_timestamps (line 250) | def _build_audio_timestamps( method get_audio_features (line 288) | def get_audio_features( method forward (line 322) | def forward( FILE: src/transformers/models/musicflamingo/processing_musicflamingo.py class MusicFlamingoProcessorKwargs (line 40) | class MusicFlamingoProcessorKwargs(ProcessingKwargs, total=False): class MusicFlamingoProcessor (line 57) | class MusicFlamingoProcessor(ProcessorMixin): method __init__ (line 83) | def __init__( method _get_audio_token_length (line 102) | def _get_audio_token_length(self, audio_lengths): method _expand_audio_tokens (line 107) | def _expand_audio_tokens(self, text, padding_mask, per_sample_windows): method _get_audio_tokens_mask (line 118) | def _get_audio_tokens_mask(self, input_ids): method __call__ (line 125) | def __call__( method model_input_names (line 221) | def model_input_names(self) -> list[str]: FILE: src/transformers/models/musicgen/configuration_musicgen.py class MusicgenDecoderConfig (line 27) | class MusicgenDecoderConfig(PreTrainedConfig): method validate_architecture (line 56) | def validate_architecture(self): class MusicgenConfig (line 64) | class MusicgenConfig(PreTrainedConfig): method __post_init__ (line 125) | def __post_init__(self, **kwargs): method sampling_rate (line 152) | def sampling_rate(self): FILE: src/transformers/models/musicgen/convert_musicgen_transformers.py function rename_keys (line 43) | def rename_keys(name): function rename_state_dict (line 69) | def rename_state_dict(state_dict: OrderedDict, hidden_size: int) -> tupl... function decoder_config_from_checkpoint (line 90) | def decoder_config_from_checkpoint(checkpoint: str) -> MusicgenDecoderCo... function convert_musicgen_checkpoint (line 130) | def convert_musicgen_checkpoint(checkpoint, pytorch_dump_folder=None, re... FILE: src/transformers/models/musicgen/modeling_musicgen.py class MusicgenUnconditionalInput (line 69) | class MusicgenUnconditionalInput(ModelOutput): function shift_tokens_right (line 86) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class MusicgenSinusoidalPositionalEmbedding (line 106) | class MusicgenSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 109) | def __init__(self, num_positions: int, embedding_dim: int): method make_weights (line 115) | def make_weights(self, num_embeddings: int, embedding_dim: int): method get_embedding (line 124) | def get_embedding(num_embeddings: int, embedding_dim: int): method forward (line 140) | def forward(self, input_ids: torch.Tensor, past_key_values_length: int... function eager_attention_forward (line 151) | def eager_attention_forward( class MusicgenAttention (line 179) | class MusicgenAttention(nn.Module): method __init__ (line 182) | def __init__( method forward (line 215) | def forward( class MusicgenDecoderLayer (line 292) | class MusicgenDecoderLayer(GradientCheckpointingLayer): method __init__ (line 293) | def __init__(self, config: MusicgenDecoderConfig, layer_idx=None): method forward (line 326) | def forward( class MusicgenPreTrainedModel (line 388) | class MusicgenPreTrainedModel(PreTrainedModel): method _init_weights (line 398) | def _init_weights(self, module): class MusicgenDecoder (line 417) | class MusicgenDecoder(MusicgenPreTrainedModel): method __init__ (line 428) | def __init__(self, config: MusicgenDecoderConfig): method forward (line 460) | def forward( class MusicgenModel (line 564) | class MusicgenModel(MusicgenPreTrainedModel): method __init__ (line 565) | def __init__(self, config: MusicgenDecoderConfig): method get_input_embeddings (line 571) | def get_input_embeddings(self): method set_input_embeddings (line 574) | def set_input_embeddings(self, value): method forward (line 580) | def forward( class MusicgenForCausalLM (line 641) | class MusicgenForCausalLM(MusicgenPreTrainedModel, GenerationMixin): method __init__ (line 644) | def __init__(self, config: MusicgenDecoderConfig): method get_input_embeddings (line 657) | def get_input_embeddings(self): method set_input_embeddings (line 660) | def set_input_embeddings(self, value): method get_output_embeddings (line 663) | def get_output_embeddings(self): method set_output_embeddings (line 666) | def set_output_embeddings(self, new_embeddings): method forward (line 672) | def forward( method prepare_inputs_for_generation (line 772) | def prepare_inputs_for_generation( method build_delay_pattern_mask (line 814) | def build_delay_pattern_mask(self, input_ids: torch.LongTensor, pad_to... method apply_delay_pattern_mask (line 888) | def apply_delay_pattern_mask(input_ids, decoder_pad_token_mask): method generate (line 897) | def generate( class MusicgenForConditionalGeneration (line 1123) | class MusicgenForConditionalGeneration(MusicgenPreTrainedModel, Generati... method __init__ (line 1130) | def __init__( method get_input_embeddings (line 1233) | def get_input_embeddings(self): method get_output_embeddings (line 1236) | def get_output_embeddings(self): method set_output_embeddings (line 1239) | def set_output_embeddings(self, new_embeddings): method from_sub_models_pretrained (line 1243) | def from_sub_models_pretrained( method forward (line 1441) | def forward( method prepare_inputs_for_generation (line 1603) | def prepare_inputs_for_generation( method _prepare_decoder_input_ids_for_generation (line 1649) | def _prepare_decoder_input_ids_for_generation( method _prepare_text_encoder_kwargs_for_generation (line 1696) | def _prepare_text_encoder_kwargs_for_generation( method _prepare_audio_encoder_kwargs_for_generation (line 1745) | def _prepare_audio_encoder_kwargs_for_generation( method prepare_decoder_input_ids_from_labels (line 1821) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method resize_token_embeddings (line 1824) | def resize_token_embeddings(self, *args, **kwargs): method freeze_audio_encoder (line 1831) | def freeze_audio_encoder(self): method freeze_text_encoder (line 1839) | def freeze_text_encoder(self): method _maybe_initialize_input_ids_for_generation (line 1847) | def _maybe_initialize_input_ids_for_generation( method _get_decoder_start_token_id (line 1875) | def _get_decoder_start_token_id( method generate (line 1894) | def generate( method get_unconditional_inputs (line 2139) | def get_unconditional_inputs(self, num_samples=1): FILE: src/transformers/models/musicgen/processing_musicgen.py class MusicgenProcessor (line 27) | class MusicgenProcessor(ProcessorMixin): method __init__ (line 28) | def __init__(self, feature_extractor, tokenizer): method get_decoder_prompt_ids (line 31) | def get_decoder_prompt_ids(self, task=None, language=None, no_timestam... method __call__ (line 35) | def __call__(self, *args, **kwargs): method batch_decode (line 40) | def batch_decode(self, *args, **kwargs): method _decode_audio (line 58) | def _decode_audio(self, audio_values, padding_mask: Any = None) -> lis... FILE: src/transformers/models/musicgen_melody/configuration_musicgen_melody.py class MusicgenMelodyDecoderConfig (line 25) | class MusicgenMelodyDecoderConfig(PreTrainedConfig): method validate_architecture (line 59) | def validate_architecture(self): class MusicgenMelodyConfig (line 67) | class MusicgenMelodyConfig(PreTrainedConfig): method __post_init__ (line 132) | def __post_init__(self, **kwargs): method sampling_rate (line 159) | def sampling_rate(self): FILE: src/transformers/models/musicgen_melody/convert_musicgen_melody_transformers.py function rename_keys (line 46) | def rename_keys(name): function rename_state_dict (line 74) | def rename_state_dict(state_dict: OrderedDict, hidden_size: int) -> tupl... function decoder_config_from_checkpoint (line 98) | def decoder_config_from_checkpoint(checkpoint: str) -> MusicgenMelodyDec... function convert_musicgen_melody_checkpoint (line 133) | def convert_musicgen_melody_checkpoint( FILE: src/transformers/models/musicgen_melody/feature_extraction_musicgen_melody.py class MusicgenMelodyFeatureExtractor (line 40) | class MusicgenMelodyFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 83) | def __init__( method _torch_extract_fbank_features (line 116) | def _torch_extract_fbank_features(self, waveform: torch.Tensor) -> tor... method _extract_stem_indices (line 147) | def _extract_stem_indices(self, audio, sampling_rate=None): method __call__ (line 182) | def __call__( method to_dict (line 316) | def to_dict(self) -> dict[str, Any]: FILE: src/transformers/models/musicgen_melody/modeling_musicgen_melody.py class MusicgenMelodyOutputWithPast (line 66) | class MusicgenMelodyOutputWithPast(ModelOutput): function shift_tokens_right (line 91) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class MusicgenMelodySinusoidalPositionalEmbedding (line 112) | class MusicgenMelodySinusoidalPositionalEmbedding(nn.Module): method __init__ (line 115) | def __init__(self, num_positions: int, embedding_dim: int): method make_weights (line 121) | def make_weights(self, num_embeddings: int, embedding_dim: int): method get_embedding (line 130) | def get_embedding(num_embeddings: int, embedding_dim: int): method forward (line 147) | def forward(self, inputs_embeds: torch.Tensor, past_key_values_length:... function eager_attention_forward (line 158) | def eager_attention_forward( class MusicgenMelodyAttention (line 187) | class MusicgenMelodyAttention(nn.Module): method __init__ (line 190) | def __init__( method forward (line 223) | def forward( class MusicgenMelodyDecoderLayer (line 300) | class MusicgenMelodyDecoderLayer(GradientCheckpointingLayer): method __init__ (line 301) | def __init__(self, config: MusicgenMelodyDecoderConfig, layer_idx=None): method forward (line 325) | def forward( class MusicgenMelodyPreTrainedModel (line 366) | class MusicgenMelodyPreTrainedModel(PreTrainedModel): method _init_weights (line 376) | def _init_weights(self, module): class MusicgenMelodyDecoder (line 396) | class MusicgenMelodyDecoder(MusicgenMelodyPreTrainedModel): method __init__ (line 407) | def __init__(self, config: MusicgenMelodyDecoderConfig): method forward (line 440) | def forward( class MusicgenMelodyModel (line 552) | class MusicgenMelodyModel(MusicgenMelodyPreTrainedModel): method __init__ (line 553) | def __init__(self, config: MusicgenMelodyDecoderConfig): method get_input_embeddings (line 559) | def get_input_embeddings(self): method set_input_embeddings (line 562) | def set_input_embeddings(self, value): method forward (line 569) | def forward( class MusicgenMelodyForCausalLM (line 636) | class MusicgenMelodyForCausalLM(MusicgenMelodyPreTrainedModel, Generatio... method __init__ (line 639) | def __init__(self, config: MusicgenMelodyDecoderConfig): method get_input_embeddings (line 652) | def get_input_embeddings(self): method set_input_embeddings (line 655) | def set_input_embeddings(self, value): method get_output_embeddings (line 658) | def get_output_embeddings(self): method set_output_embeddings (line 661) | def set_output_embeddings(self, new_embeddings): method forward (line 668) | def forward( method prepare_inputs_for_generation (line 768) | def prepare_inputs_for_generation( method build_delay_pattern_mask (line 823) | def build_delay_pattern_mask(self, input_ids: torch.LongTensor, pad_to... method apply_delay_pattern_mask (line 897) | def apply_delay_pattern_mask(input_ids, decoder_pad_token_mask): method generate (line 907) | def generate( class MusicgenMelodyForConditionalGeneration (line 1103) | class MusicgenMelodyForConditionalGeneration(PreTrainedModel, Generation... method __init__ (line 1112) | def __init__( method _init_weights (line 1181) | def _init_weights(self, module): method get_input_embeddings (line 1190) | def get_input_embeddings(self): method get_output_embeddings (line 1193) | def get_output_embeddings(self): method set_output_embeddings (line 1196) | def set_output_embeddings(self, new_embeddings): method from_sub_models_pretrained (line 1201) | def from_sub_models_pretrained( method forward (line 1402) | def forward( method prepare_inputs_for_generation (line 1564) | def prepare_inputs_for_generation( method _prepare_decoder_input_ids_for_generation (line 1621) | def _prepare_decoder_input_ids_for_generation( method _prepare_encoder_hidden_states_kwargs_for_generation (line 1668) | def _prepare_encoder_hidden_states_kwargs_for_generation( method prepare_decoder_input_ids_from_labels (line 1768) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method resize_token_embeddings (line 1771) | def resize_token_embeddings(self, *args, **kwargs): method _maybe_initialize_input_ids_for_generation (line 1778) | def _maybe_initialize_input_ids_for_generation( method freeze_audio_encoder (line 1800) | def freeze_audio_encoder(self): method freeze_text_encoder (line 1808) | def freeze_text_encoder(self): method _get_decoder_start_token_id (line 1817) | def _get_decoder_start_token_id( method generate (line 1836) | def generate( FILE: src/transformers/models/musicgen_melody/processing_musicgen_melody.py class MusicgenMelodyProcessor (line 29) | class MusicgenMelodyProcessor(ProcessorMixin): method __init__ (line 30) | def __init__(self, feature_extractor, tokenizer): method get_decoder_prompt_ids (line 34) | def get_decoder_prompt_ids(self, task=None, language=None, no_timestam... method __call__ (line 38) | def __call__(self, *args, **kwargs): method batch_decode (line 44) | def batch_decode(self, *args, **kwargs): method _decode_audio (line 63) | def _decode_audio(self, audio_values, attention_mask: Any = None) -> l... method get_unconditional_inputs (line 90) | def get_unconditional_inputs(self, num_samples=1, return_tensors="pt"): FILE: src/transformers/models/mvp/configuration_mvp.py class MvpConfig (line 24) | class MvpConfig(PreTrainedConfig): FILE: src/transformers/models/mvp/modeling_mvp.py function shift_tokens_right (line 46) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class MvpLearnedPositionalEmbedding (line 63) | class MvpLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 68) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 74) | def forward( class MvpAttention (line 90) | class MvpAttention(nn.Module): method __init__ (line 93) | def __init__( method forward (line 122) | def forward( class MvpEncoderLayer (line 237) | class MvpEncoderLayer(GradientCheckpointingLayer): method __init__ (line 238) | def __init__(self, config: MvpConfig): method forward (line 254) | def forward( class MvpDecoderLayer (line 298) | class MvpDecoderLayer(GradientCheckpointingLayer): method __init__ (line 299) | def __init__(self, config: MvpConfig, layer_idx=None): method forward (line 327) | def forward( class MvpClassificationHead (line 407) | class MvpClassificationHead(nn.Module): method __init__ (line 410) | def __init__( method forward (line 422) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MvpPrompt (line 431) | class MvpPrompt(nn.Module): method __init__ (line 434) | def __init__(self, config, num_layers, num_heads): method forward (line 448) | def forward(self, prompt_ids: torch.Tensor) -> tuple[torch.Tensor]: class MvpPreTrainedModel (line 457) | class MvpPreTrainedModel(PreTrainedModel): method _init_weights (line 462) | def _init_weights(self, module): method dummy_inputs (line 468) | def dummy_inputs(self): class MvpEncoder (line 478) | class MvpEncoder(MvpPreTrainedModel): method __init__ (line 489) | def __init__(self, config: MvpConfig, embed_tokens: nn.Embedding | Non... method forward (line 522) | def forward( class MvpDecoder (line 641) | class MvpDecoder(MvpPreTrainedModel): method __init__ (line 651) | def __init__(self, config: MvpConfig, use_prompt: bool | None = False): method forward (line 685) | def forward( class MvpModel (line 870) | class MvpModel(MvpPreTrainedModel): method __init__ (line 877) | def __init__(self, config: MvpConfig): method get_input_embeddings (line 890) | def get_input_embeddings(self): method set_input_embeddings (line 893) | def set_input_embeddings(self, value): method set_lightweight_tuning (line 898) | def set_lightweight_tuning(self): method forward (line 907) | def forward( class MvpForConditionalGeneration (line 1018) | class MvpForConditionalGeneration(MvpPreTrainedModel, GenerationMixin): method __init__ (line 1023) | def __init__(self, config: MvpConfig): method resize_token_embeddings (line 1032) | def resize_token_embeddings( method _resize_final_logits_bias (line 1039) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method set_lightweight_tuning (line 1048) | def set_lightweight_tuning(self): method forward (line 1053) | def forward( method prepare_decoder_input_ids_from_labels (line 1173) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class MvpForSequenceClassification (line 1183) | class MvpForSequenceClassification(MvpPreTrainedModel): method __init__ (line 1184) | def __init__(self, config: MvpConfig, **kwargs): method set_lightweight_tuning (line 1197) | def set_lightweight_tuning(self): method forward (line 1202) | def forward( class MvpForQuestionAnswering (line 1345) | class MvpForQuestionAnswering(MvpPreTrainedModel): method __init__ (line 1346) | def __init__(self, config): method set_lightweight_tuning (line 1358) | def set_lightweight_tuning(self): method forward (line 1363) | def forward( class MvpDecoderWrapper (line 1501) | class MvpDecoderWrapper(MvpPreTrainedModel): method __init__ (line 1507) | def __init__(self, config): method forward (line 1512) | def forward(self, *args, **kwargs): class MvpForCausalLM (line 1516) | class MvpForCausalLM(MvpPreTrainedModel, GenerationMixin): method __init__ (line 1519) | def __init__(self, config): method get_input_embeddings (line 1530) | def get_input_embeddings(self): method set_input_embeddings (line 1533) | def set_input_embeddings(self, value): method set_lightweight_tuning (line 1536) | def set_lightweight_tuning(self): method forward (line 1541) | def forward( FILE: src/transformers/models/myt5/convert_myt5_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_t5 (line 29) | def load_tf_weights_in_t5(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 135) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, py... FILE: src/transformers/models/myt5/tokenization_myt5.py class ByteRewriter (line 31) | class ByteRewriter: method __init__ (line 44) | def __init__(self, rewriting_rules: str | dict[str, str]): method add_leaf (line 57) | def add_leaf(self, hash_tree: dict[str, dict | list[str]], byte_in_seq... method construct_hash_tree (line 72) | def construct_hash_tree(self, rewriting_rules: dict[str, str]) -> dict... method search_hash_tree (line 85) | def search_hash_tree(self, byte_sequence: list[str]) -> None | list[str]: method rewrite_bytes (line 98) | def rewrite_bytes(self, in_bytes: list[str], reverse=False) -> list[str]: class MyT5Tokenizer (line 133) | class MyT5Tokenizer(PreTrainedTokenizer): method __init__ (line 163) | def __init__( method vocab_size (line 210) | def vocab_size(self): method get_vocab (line 214) | def get_vocab(self): method get_special_tokens_mask (line 220) | def get_special_tokens_mask( method _add_eos_if_not_present (line 248) | def _add_eos_if_not_present(self, token_ids: list[int]) -> list[int]: method create_token_type_ids_from_sequences (line 259) | def create_token_type_ids_from_sequences( method build_inputs_with_special_tokens (line 282) | def build_inputs_with_special_tokens( method _tokenize (line 308) | def _tokenize(self, text: str, **kwargs) -> list[str]: method _convert_token_to_id (line 316) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 326) | def _convert_id_to_token(self, index): method morphological_encode (line 331) | def morphological_encode(self, indices: list[str]) -> list[str]: method morphological_decode (line 337) | def morphological_decode(self, indices: list[str]) -> list[str]: method convert_tokens_to_string (line 343) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 366) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/nanochat/configuration_nanochat.py class NanoChatConfig (line 25) | class NanoChatConfig(PretrainedConfig): method __post_init__ (line 74) | def __post_init__(self, **kwargs): FILE: src/transformers/models/nanochat/convert_nanochat_checkpoints.py function infer_kv_heads (line 26) | def infer_kv_heads(config: NanoChatConfig, state_dict: dict[str, torch.T... function convert_layer (line 39) | def convert_layer(old_prefix: str, new_prefix: str) -> dict[str, str]: function load_config_from_checkpoint (line 50) | def load_config_from_checkpoint(input_path: Path) -> NanoChatConfig: function write_model (line 130) | def write_model(input_dir, output_dir): function write_tokenizer (line 224) | def write_tokenizer(input_dir, output_dir): function run_test (line 257) | def run_test(output_dir: str, prompt: str, max_new_tokens: int = 64) -> ... function main (line 272) | def main(): FILE: src/transformers/models/nanochat/modeling_nanochat.py class NanoChatRMSNorm (line 45) | class NanoChatRMSNorm(torch.nn.Module): method __init__ (line 46) | def __init__(self, eps: float = 1e-6): method _norm (line 50) | def _norm(self, x): method forward (line 53) | def forward(self, x): method extra_repr (line 56) | def extra_repr(self): class NanoChatRotaryEmbedding (line 60) | class NanoChatRotaryEmbedding(nn.Module): method __init__ (line 63) | def __init__(self, config: NanoChatConfig, device=None): method compute_default_rope_parameters (line 80) | def compute_default_rope_parameters( method forward (line 111) | def forward(self, x, position_ids): function apply_rotary_pos_emb (line 126) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 151) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 163) | def eager_attention_forward( function rotate_half (line 188) | def rotate_half(x): class NanoChatAttention (line 196) | class NanoChatAttention(nn.Module): method __init__ (line 199) | def __init__(self, config: NanoChatConfig, layer_idx: int): method forward (line 225) | def forward( class NanoChatMLP (line 270) | class NanoChatMLP(nn.Module): method __init__ (line 271) | def __init__(self, config): method forward (line 278) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class NanoChatDecoderLayer (line 285) | class NanoChatDecoderLayer(GradientCheckpointingLayer): method __init__ (line 286) | def __init__(self, config: NanoChatConfig, layer_idx: int): method forward (line 297) | def forward( class NanoChatPreTrainedModel (line 330) | class NanoChatPreTrainedModel(PreTrainedModel): method _init_weights (line 347) | def _init_weights(self, module: nn.Module) -> None: class NanoChatModel (line 358) | class NanoChatModel(NanoChatPreTrainedModel): method __init__ (line 359) | def __init__(self, config: NanoChatConfig): method forward (line 379) | def forward( class NanoChatForCausalLM (line 433) | class NanoChatForCausalLM(NanoChatPreTrainedModel, GenerationMixin): method __init__ (line 438) | def __init__(self, config): method forward (line 449) | def forward( FILE: src/transformers/models/nanochat/modular_nanochat.py class NanoChatRMSNorm (line 43) | class NanoChatRMSNorm(Llama4TextL2Norm): class NanoChatRotaryEmbedding (line 47) | class NanoChatRotaryEmbedding(LlamaRotaryEmbedding): function rotate_half (line 51) | def rotate_half(x): class NanoChatAttention (line 58) | class NanoChatAttention(Qwen3Attention): method __init__ (line 59) | def __init__(self, config: NanoChatConfig, layer_idx: int): method forward (line 67) | def forward( class NanoChatMLP (line 112) | class NanoChatMLP(CLIPMLP): method __init__ (line 113) | def __init__(self, config): class NanoChatDecoderLayer (line 119) | class NanoChatDecoderLayer(LlamaDecoderLayer): method __init__ (line 120) | def __init__(self, config: NanoChatConfig, layer_idx: int): class NanoChatPreTrainedModel (line 128) | class NanoChatPreTrainedModel(LlamaPreTrainedModel): method _init_weights (line 129) | def _init_weights(self, module: nn.Module) -> None: class NanoChatModel (line 140) | class NanoChatModel(LlamaModel): method __init__ (line 141) | def __init__(self, config: NanoChatConfig): method forward (line 146) | def forward( class NanoChatForCausalLM (line 200) | class NanoChatForCausalLM(Gemma2ForCausalLM): method forward (line 203) | def forward(self, **super_kwargs) -> CausalLMOutputWithPast: FILE: src/transformers/models/nemotron/configuration_nemotron.py class NemotronConfig (line 26) | class NemotronConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/nemotron/convert_nemotron_nemo_to_hf.py function get_args (line 54) | def get_args(): function convert_hf_config (line 93) | def convert_hf_config(nemo_config, tokenizer, vocab_size, dtype, hf_outp... function convert (line 134) | def convert(input_nemo_file, output_hf_file, precision=None, cpu_only=Fa... function extract_nemotron_tokenizer (line 298) | def extract_nemotron_tokenizer(nemo_file, model_config, output_hf_path, ... FILE: src/transformers/models/nemotron/modeling_nemotron.py function _cast_if_autocast_enabled (line 56) | def _cast_if_autocast_enabled(device_type, *args): class NemotronLayerNorm1P (line 64) | class NemotronLayerNorm1P(nn.LayerNorm): method __init__ (line 65) | def __init__( method forward (line 76) | def forward(self, input: Tensor) -> Tensor: class NemotronRotaryEmbedding (line 86) | class NemotronRotaryEmbedding(nn.Module): method __init__ (line 89) | def __init__(self, config: NemotronConfig, device=None): method compute_default_rope_parameters (line 107) | def compute_default_rope_parameters( method forward (line 140) | def forward(self, x, position_ids): function rotate_half (line 155) | def rotate_half(x): function apply_rotary_pos_emb (line 162) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class NemotronMLP (line 193) | class NemotronMLP(nn.Module): method __init__ (line 194) | def __init__(self, config): method forward (line 203) | def forward(self, x): function repeat_kv (line 208) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class NemotronAttention (line 220) | class NemotronAttention(nn.Module): method __init__ (line 223) | def __init__(self, config: NemotronConfig, layer_idx: int | None = None): method forward (line 251) | def forward( class NemotronFlashAttention2 (line 302) | class NemotronFlashAttention2(NemotronAttention): method __init__ (line 309) | def __init__(self, *args, **kwargs): method forward (line 317) | def forward( class NemotronSdpaAttention (line 409) | class NemotronSdpaAttention(NemotronAttention): method forward (line 416) | def forward( class NemotronDecoderLayer (line 485) | class NemotronDecoderLayer(GradientCheckpointingLayer): method __init__ (line 487) | def __init__(self, config: NemotronConfig, layer_idx: int): method forward (line 497) | def forward( class NemotronPreTrainedModel (line 533) | class NemotronPreTrainedModel(PreTrainedModel): method _init_weights (line 549) | def _init_weights(self, module): class NemotronModel (line 557) | class NemotronModel(NemotronPreTrainedModel): method __init__ (line 565) | def __init__(self, config: NemotronConfig): method forward (line 584) | def forward( class NemotronForCausalLM (line 639) | class NemotronForCausalLM(NemotronPreTrainedModel, GenerationMixin): method __init__ (line 642) | def __init__(self, config): method forward (line 653) | def forward( class NemotronForSequenceClassification (line 714) | class NemotronForSequenceClassification(GenericForSequenceClassification... class NemotronForQuestionAnswering (line 717) | class NemotronForQuestionAnswering(GenericForQuestionAnswering, Nemotron... class NemotronForTokenClassification (line 721) | class NemotronForTokenClassification(GenericForTokenClassification, Nemo... FILE: src/transformers/models/nemotron_h/configuration_nemotron_h.py class NemotronHConfig (line 27) | class NemotronHConfig(PreTrainedConfig): method __post_init__ (line 142) | def __post_init__(self, **kwargs): method validate_layers_block_type (line 194) | def validate_layers_block_type(self): method num_hidden_layers (line 229) | def num_hidden_layers(self) -> int: method num_hidden_layers (line 237) | def num_hidden_layers(self, value): method hybrid_override_pattern (line 246) | def hybrid_override_pattern(self) -> str: method mtp_hybrid_override_pattern (line 254) | def mtp_hybrid_override_pattern(self) -> str: method _list_to_pattern (line 262) | def _list_to_pattern(layers_list: list) -> str: method _pattern_to_list (line 268) | def _pattern_to_list(pattern: str) -> list: FILE: src/transformers/models/nemotron_h/modeling_nemotron_h.py function pad_tensor_by_size (line 60) | def pad_tensor_by_size(input_tensor: torch.Tensor, pad_size: int): function reshape_into_chunks (line 71) | def reshape_into_chunks(input_tensor, pad_size, chunk_size): function segment_sum (line 91) | def segment_sum(input_tensor): class NemotronHMamba2Mixer (line 114) | class NemotronHMamba2Mixer(nn.Module): method __init__ (line 122) | def __init__(self, config: NemotronHConfig, layer_idx: int | None = No... method cuda_kernels_forward (line 216) | def cuda_kernels_forward( method torch_forward (line 367) | def torch_forward(self, input_states, cache_params: Cache | None=None,... method forward (line 549) | def forward( class NemotronHRMSNorm (line 567) | class NemotronHRMSNorm(nn.Module): method __init__ (line 568) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 576) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 583) | def extra_repr(self): class NemotronHMLP (line 587) | class NemotronHMLP(nn.Module): method __init__ (line 588) | def __init__(self, config, intermediate_size=None): method forward (line 597) | def forward(self, x): class NemotronHExperts (line 602) | class NemotronHExperts(nn.Module): method __init__ (line 610) | def __init__(self, config): method forward (line 627) | def forward(self, hidden_states: torch.Tensor, top_k_index: torch.Tens... class NemotronHMoE (line 663) | class NemotronHMoE(nn.Module): method __init__ (line 672) | def __init__(self, config, layer_idx: int | None = None): method route_tokens_to_experts (line 697) | def route_tokens_to_experts(self, router_logits): method forward (line 722) | def forward(self, hidden_states): class NemotronHTopkRouter (line 739) | class NemotronHTopkRouter(nn.Module): method __init__ (line 740) | def __init__(self, config): method forward (line 748) | def forward(self, hidden_states): function rotate_half (line 754) | def rotate_half(x): function apply_rotary_pos_emb (line 762) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 787) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 799) | def eager_attention_forward( class NemotronHAttention (line 825) | class NemotronHAttention(nn.Module): method __init__ (line 828) | def __init__(self, config: NemotronHConfig, layer_idx: int): method forward (line 842) | def forward( class NemotronHBlock (line 886) | class NemotronHBlock(GradientCheckpointingLayer): method __init__ (line 902) | def __init__(self, config, layer_idx): method forward (line 911) | def forward( class NemotronHPreTrainedModel (line 942) | class NemotronHPreTrainedModel(PreTrainedModel): method _init_weights (line 962) | def _init_weights(self, module): class NemotronHModel (line 1016) | class NemotronHModel(NemotronHPreTrainedModel): method __init__ (line 1017) | def __init__(self, config): method get_input_embeddings (line 1027) | def get_input_embeddings(self): method set_input_embeddings (line 1030) | def set_input_embeddings(self, new_embeddings): method forward (line 1035) | def forward( method _update_mamba_mask (line 1096) | def _update_mamba_mask(self, attention_mask, past_key_values): class NemotronHForCausalLM (line 1111) | class NemotronHForCausalLM(NemotronHPreTrainedModel, GenerationMixin): method __init__ (line 1114) | def __init__(self, config: NemotronHConfig): method forward (line 1125) | def forward( method prepare_inputs_for_generation (line 1186) | def prepare_inputs_for_generation( FILE: src/transformers/models/nemotron_h/modular_nemotron_h.py class NemotronHMamba2Mixer (line 49) | class NemotronHMamba2Mixer(Zamba2MambaMixer): method __init__ (line 50) | def __init__(self, config: NemotronHConfig, layer_idx: int | None = No... method forward (line 88) | def forward( class NemotronHRMSNorm (line 105) | class NemotronHRMSNorm(LlamaRMSNorm): class NemotronHMLP (line 109) | class NemotronHMLP(NemotronMLP): method __init__ (line 110) | def __init__(self, config, intermediate_size=None): class NemotronHExperts (line 121) | class NemotronHExperts(nn.Module): method __init__ (line 129) | def __init__(self, config): method forward (line 146) | def forward(self, hidden_states: torch.Tensor, top_k_index: torch.Tens... class NemotronHMoE (line 182) | class NemotronHMoE(DeepseekV3MoE): method __init__ (line 191) | def __init__(self, config, layer_idx: int | None = None): method forward (line 209) | def forward(self, hidden_states): class NemotronHTopkRouter (line 226) | class NemotronHTopkRouter(DeepseekV3TopkRouter): class NemotronHAttention (line 230) | class NemotronHAttention(JambaAttention): method forward (line 231) | def forward( class NemotronHBlock (line 248) | class NemotronHBlock(GradientCheckpointingLayer): method __init__ (line 264) | def __init__(self, config, layer_idx): method forward (line 273) | def forward( class NemotronHPreTrainedModel (line 304) | class NemotronHPreTrainedModel(PreTrainedModel): method _init_weights (line 324) | def _init_weights(self, module): class NemotronHModel (line 378) | class NemotronHModel(NemotronHPreTrainedModel): method __init__ (line 379) | def __init__(self, config): method get_input_embeddings (line 389) | def get_input_embeddings(self): method set_input_embeddings (line 392) | def set_input_embeddings(self, new_embeddings): method forward (line 397) | def forward( method _update_mamba_mask (line 458) | def _update_mamba_mask(self, attention_mask, past_key_values): class NemotronHForCausalLM (line 472) | class NemotronHForCausalLM(ZambaForCausalLM): method forward (line 477) | def forward( FILE: src/transformers/models/nllb/tokenization_nllb.py class NllbTokenizer (line 33) | class NllbTokenizer(TokenizersBackend): method __init__ (line 89) | def __init__( method src_lang (line 185) | def src_lang(self) -> str: method src_lang (line 189) | def src_lang(self, new_src_lang: str) -> None: method _build_translation_inputs (line 193) | def _build_translation_inputs( method prepare_seq2seq_batch (line 205) | def prepare_seq2seq_batch( method _switch_to_input_mode (line 259) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 262) | def _switch_to_target_mode(self): method set_src_lang_special_tokens (line 267) | def set_src_lang_special_tokens(self, src_lang) -> None: method set_tgt_lang_special_tokens (line 292) | def set_tgt_lang_special_tokens(self, lang: str) -> None: FILE: src/transformers/models/nllb_moe/configuration_nllb_moe.py class NllbMoeConfig (line 26) | class NllbMoeConfig(PreTrainedConfig): FILE: src/transformers/models/nllb_moe/convert_nllb_moe_sharded_original_checkpoint_to_pytorch.py function remove_ignore_keys_ (line 25) | def remove_ignore_keys_(state_dict): function make_linear_from_emb (line 40) | def make_linear_from_emb(emb): function rename_fairseq_keys (line 47) | def rename_fairseq_keys(state_dict, expert_idx=None): function shard_on_the_fly (line 72) | def shard_on_the_fly(switch_checkpoint_path, dump_path, num_experts, dty... FILE: src/transformers/models/nllb_moe/modeling_nllb_moe.py class NllbMoeScaledWordEmbedding (line 49) | class NllbMoeScaledWordEmbedding(nn.Embedding): method __init__ (line 54) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 58) | def forward(self, input_ids: torch.Tensor): class NllbMoeSinusoidalPositionalEmbedding (line 63) | class NllbMoeSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 66) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 74) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 83) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 104) | def forward( method create_position_ids_from_inputs_embeds (line 130) | def create_position_ids_from_inputs_embeds(inputs_embeds, past_key_val... method create_position_ids_from_input_ids (line 149) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class NllbMoeTop2Router (line 165) | class NllbMoeTop2Router(nn.Module): method __init__ (line 177) | def __init__(self, config: NllbMoeConfig): method _cast_classifier (line 190) | def _cast_classifier(self): method normalize_router_probabilities (line 198) | def normalize_router_probabilities(self, router_probs, top_1_mask, top... method route_tokens (line 206) | def route_tokens( method forward (line 291) | def forward(self, hidden_states: torch.Tensor, padding_mask: torch.Lon... class NllbMoeDenseActDense (line 318) | class NllbMoeDenseActDense(nn.Module): method __init__ (line 319) | def __init__(self, config: NllbMoeConfig, ffn_dim: int): method forward (line 326) | def forward(self, hidden_states: torch.Tensor): class NllbMoeExperts (line 340) | class NllbMoeExperts(nn.ModuleDict): method __init__ (line 341) | def __init__(self, config: NllbMoeConfig, ffn_dim: int): method forward (line 349) | def forward(self, hidden_states: torch.Tensor, router_mask: torch.Tens... class NllbMoeSparseMLP (line 367) | class NllbMoeSparseMLP(nn.Module): method __init__ (line 372) | def __init__(self, config: NllbMoeConfig, ffn_dim: int): method forward (line 378) | def forward(self, hidden_states: torch.Tensor, padding_mask: torch.Ten... function eager_attention_forward (line 387) | def eager_attention_forward( class NllbMoeAttention (line 415) | class NllbMoeAttention(nn.Module): method __init__ (line 418) | def __init__( method forward (line 451) | def forward( class NllbMoeEncoderLayer (line 514) | class NllbMoeEncoderLayer(GradientCheckpointingLayer): method __init__ (line 515) | def __init__(self, config: NllbMoeConfig, is_sparse: bool = False, lay... method forward (line 535) | def forward( class NllbMoeDecoderLayer (line 558) | class NllbMoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 559) | def __init__(self, config: NllbMoeConfig, is_sparse: bool = False, lay... method forward (line 592) | def forward( class NllbMoePreTrainedModel (line 647) | class NllbMoePreTrainedModel(PreTrainedModel): method _init_weights (line 659) | def _init_weights(self, module): class NllbMoeEncoder (line 668) | class NllbMoeEncoder(NllbMoePreTrainedModel): method __init__ (line 675) | def __init__(self, config: NllbMoeConfig): method forward (line 708) | def forward( class NllbMoeDecoder (line 742) | class NllbMoeDecoder(NllbMoePreTrainedModel): method __init__ (line 760) | def __init__(self, config: NllbMoeConfig): method forward (line 793) | def forward( class NllbMoeModel (line 861) | class NllbMoeModel(NllbMoePreTrainedModel): method __init__ (line 867) | def __init__(self, config: NllbMoeConfig): method get_input_embeddings (line 880) | def get_input_embeddings(self): method set_input_embeddings (line 883) | def set_input_embeddings(self, value): method forward (line 890) | def forward( function load_balancing_loss_func (line 937) | def load_balancing_loss_func( function shift_tokens_right (line 1019) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class NllbMoeForConditionalGeneration (line 1040) | class NllbMoeForConditionalGeneration(NllbMoePreTrainedModel, Generation... method __init__ (line 1046) | def __init__(self, config: NllbMoeConfig): method forward (line 1058) | def forward( FILE: src/transformers/models/nougat/convert_nougat_to_hf.py function get_configs (line 38) | def get_configs(model): function rename_key (line 67) | def rename_key(name): function convert_state_dict (line 101) | def convert_state_dict(orig_state_dict, model): function convert_nougat_checkpoint (line 141) | def convert_nougat_checkpoint(model_tag, pytorch_dump_folder_path=None, ... FILE: src/transformers/models/nougat/image_processing_nougat.py class NougatImageProcessorKwargs (line 41) | class NougatImageProcessorKwargs(ImagesKwargs, total=False): class NougatImageProcessor (line 57) | class NougatImageProcessor(TorchvisionBackend): method __init__ (line 71) | def __init__(self, **kwargs: Unpack[NougatImageProcessorKwargs]): method preprocess (line 75) | def preprocess(self, images: ImageInput, **kwargs: Unpack[NougatImageP... method python_find_non_zero (line 78) | def python_find_non_zero( method python_bounding_rect (line 89) | def python_bounding_rect(self, coordinates): method crop_margin (line 100) | def crop_margin( method align_long_axis (line 130) | def align_long_axis( method thumbnail (line 156) | def thumbnail( method pad_images (line 191) | def pad_images( method resize (line 220) | def resize( method _preprocess (line 250) | def _preprocess( FILE: src/transformers/models/nougat/image_processing_pil_nougat.py class NougatImageProcessorKwargs (line 43) | class NougatImageProcessorKwargs(ImagesKwargs, total=False): class NougatImageProcessorPil (line 59) | class NougatImageProcessorPil(PilBackend): method __init__ (line 73) | def __init__(self, **kwargs: Unpack[NougatImageProcessorKwargs]): method preprocess (line 77) | def preprocess(self, images: ImageInput, **kwargs: Unpack[NougatImageP... method python_find_non_zero (line 80) | def python_find_non_zero(self, image: np.ndarray): method python_bounding_rect (line 87) | def python_bounding_rect(self, coordinates): method crop_margin (line 96) | def crop_margin( method align_long_axis (line 126) | def align_long_axis( method thumbnail (line 152) | def thumbnail( method pad_images (line 189) | def pad_images( method resize (line 219) | def resize( method _preprocess (line 254) | def _preprocess( FILE: src/transformers/models/nougat/processing_nougat.py class NougatProcessor (line 27) | class NougatProcessor(ProcessorMixin): method __init__ (line 28) | def __init__(self, image_processor, tokenizer): method __call__ (line 32) | def __call__( method post_process_generation (line 134) | def post_process_generation(self, *args, **kwargs): FILE: src/transformers/models/nougat/tokenization_nougat.py function markdown_compatible (line 42) | def markdown_compatible(text: str) -> str: function normalize_list_like_lines (line 84) | def normalize_list_like_lines(generation): function find_next_punctuation (line 135) | def find_next_punctuation(text: str, start_idx=0): function truncate_repetitions (line 153) | def truncate_repetitions(text: str, min_len: int = 30) -> str: function remove_numbers (line 221) | def remove_numbers(lines): function get_slices (line 233) | def get_slices(lines, clean_lines): function remove_slice_from_lines (line 282) | def remove_slice_from_lines(lines, clean_text, slice) -> str: class NougatTokenizer (line 347) | class NougatTokenizer(TokenizersBackend): method __init__ (line 392) | def __init__( method remove_hallucinated_references (line 463) | def remove_hallucinated_references(self, text: str) -> str: method correct_tables (line 493) | def correct_tables(self, generation: str) -> str: method post_process_single (line 528) | def post_process_single(self, generation: str, fix_markdown: bool = Tr... method post_process_generation (line 623) | def post_process_generation( FILE: src/transformers/models/nystromformer/configuration_nystromformer.py class NystromformerConfig (line 24) | class NystromformerConfig(PreTrainedConfig): FILE: src/transformers/models/nystromformer/convert_nystromformer_original_pytorch_checkpoint_to_pytorch.py function rename_key (line 24) | def rename_key(orig_key): function convert_checkpoint_helper (line 62) | def convert_checkpoint_helper(config, orig_state_dict): function convert_nystromformer_checkpoint (line 79) | def convert_nystromformer_checkpoint(checkpoint_path, nystromformer_conf... FILE: src/transformers/models/nystromformer/modeling_nystromformer.py class NystromformerEmbeddings (line 45) | class NystromformerEmbeddings(nn.Module): method __init__ (line 48) | def __init__(self, config): method forward (line 67) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class NystromformerSelfAttention (line 102) | class NystromformerSelfAttention(nn.Module): method __init__ (line 103) | def __init__(self, config): method iterative_inv (line 141) | def iterative_inv(self, mat, n_iter=6): method forward (line 162) | def forward(self, hidden_states, attention_mask=None, output_attention... class NystromformerSelfOutput (line 236) | class NystromformerSelfOutput(nn.Module): method __init__ (line 237) | def __init__(self, config): method forward (line 243) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class NystromformerAttention (line 250) | class NystromformerAttention(nn.Module): method __init__ (line 251) | def __init__(self, config): method forward (line 256) | def forward(self, hidden_states, attention_mask=None, output_attention... class NystromformerIntermediate (line 264) | class NystromformerIntermediate(nn.Module): method __init__ (line 265) | def __init__(self, config): method forward (line 273) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class NystromformerOutput (line 280) | class NystromformerOutput(nn.Module): method __init__ (line 281) | def __init__(self, config): method forward (line 287) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class NystromformerLayer (line 294) | class NystromformerLayer(GradientCheckpointingLayer): method __init__ (line 295) | def __init__(self, config): method forward (line 304) | def forward(self, hidden_states, attention_mask=None, output_attention... method feed_forward_chunk (line 317) | def feed_forward_chunk(self, attention_output): class NystromformerEncoder (line 323) | class NystromformerEncoder(nn.Module): method __init__ (line 324) | def __init__(self, config): method forward (line 330) | def forward( class NystromformerPredictionHeadTransform (line 364) | class NystromformerPredictionHeadTransform(nn.Module): method __init__ (line 365) | def __init__(self, config): method forward (line 374) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class NystromformerLMPredictionHead (line 382) | class NystromformerLMPredictionHead(nn.Module): method __init__ (line 383) | def __init__(self, config): method forward (line 392) | def forward(self, hidden_states): class NystromformerOnlyMLMHead (line 399) | class NystromformerOnlyMLMHead(nn.Module): method __init__ (line 400) | def __init__(self, config): method forward (line 404) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class NystromformerPreTrainedModel (line 410) | class NystromformerPreTrainedModel(PreTrainedModel): method _init_weights (line 415) | def _init_weights(self, module): class NystromformerModel (line 423) | class NystromformerModel(NystromformerPreTrainedModel): method __init__ (line 424) | def __init__(self, config): method get_input_embeddings (line 434) | def get_input_embeddings(self): method set_input_embeddings (line 437) | def set_input_embeddings(self, value): method forward (line 441) | def forward( class NystromformerForMaskedLM (line 514) | class NystromformerForMaskedLM(NystromformerPreTrainedModel): method __init__ (line 520) | def __init__(self, config): method get_output_embeddings (line 529) | def get_output_embeddings(self): method set_output_embeddings (line 532) | def set_output_embeddings(self, new_embeddings): method forward (line 537) | def forward( class NystromformerClassificationHead (line 589) | class NystromformerClassificationHead(nn.Module): method __init__ (line 592) | def __init__(self, config): method forward (line 600) | def forward(self, features, **kwargs): class NystromformerForSequenceClassification (line 616) | class NystromformerForSequenceClassification(NystromformerPreTrainedModel): method __init__ (line 617) | def __init__(self, config): method forward (line 627) | def forward( class NystromformerForMultipleChoice (line 697) | class NystromformerForMultipleChoice(NystromformerPreTrainedModel): method __init__ (line 698) | def __init__(self, config): method forward (line 709) | def forward( class NystromformerForTokenClassification (line 802) | class NystromformerForTokenClassification(NystromformerPreTrainedModel): method __init__ (line 803) | def __init__(self, config): method forward (line 815) | def forward( class NystromformerForQuestionAnswering (line 868) | class NystromformerForQuestionAnswering(NystromformerPreTrainedModel): method __init__ (line 869) | def __init__(self, config): method forward (line 882) | def forward( FILE: src/transformers/models/olmo/configuration_olmo.py class OlmoConfig (line 30) | class OlmoConfig(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/olmo/convert_olmo_weights_to_hf.py function compute_intermediate_size (line 51) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 55) | def read_json(path): function write_json (line 60) | def write_json(text, path): function write_model (line 65) | def write_model(model_path, input_base_path, tokenizer_path=None, fix_eo... function _write_tokenizer (line 186) | def _write_tokenizer( function main (line 212) | def main(): FILE: src/transformers/models/olmo/modeling_olmo.py class OlmoLayerNorm (line 49) | class OlmoLayerNorm(nn.Module): method __init__ (line 52) | def __init__(self, hidden_size: int) -> None: method forward (line 56) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class OlmoMLP (line 63) | class OlmoMLP(nn.Module): method __init__ (line 64) | def __init__(self, config): method forward (line 74) | def forward(self, x): class OlmoRotaryEmbedding (line 79) | class OlmoRotaryEmbedding(nn.Module): method __init__ (line 82) | def __init__(self, config: OlmoConfig, device=None): method compute_default_rope_parameters (line 99) | def compute_default_rope_parameters( method forward (line 130) | def forward(self, x, position_ids): function rotate_half (line 143) | def rotate_half(x): function repeat_kv (line 150) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 162) | def eager_attention_forward( function apply_rotary_pos_emb (line 187) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class OlmoAttention (line 214) | class OlmoAttention(nn.Module): method __init__ (line 217) | def __init__(self, config: OlmoConfig, layer_idx: int): method forward (line 240) | def forward( class OlmoDecoderLayer (line 290) | class OlmoDecoderLayer(GradientCheckpointingLayer): method __init__ (line 291) | def __init__(self, config: OlmoConfig, layer_idx: int): method forward (line 300) | def forward( class OlmoPreTrainedModel (line 333) | class OlmoPreTrainedModel(PreTrainedModel): class OlmoModel (line 352) | class OlmoModel(OlmoPreTrainedModel): method __init__ (line 353) | def __init__(self, config: OlmoConfig): method forward (line 372) | def forward( class OlmoForCausalLM (line 426) | class OlmoForCausalLM(OlmoPreTrainedModel, GenerationMixin): method __init__ (line 431) | def __init__(self, config): method forward (line 442) | def forward( FILE: src/transformers/models/olmo/modular_olmo.py class OlmoLayerNorm (line 47) | class OlmoLayerNorm(nn.Module): method __init__ (line 50) | def __init__(self, hidden_size: int) -> None: method forward (line 54) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class OlmoMLP (line 61) | class OlmoMLP(LlamaMLP): method __init__ (line 62) | def __init__(self, config): class OlmoRotaryEmbedding (line 71) | class OlmoRotaryEmbedding(LlamaRotaryEmbedding): method forward (line 74) | def forward(self, x, position_ids): function apply_rotary_pos_emb (line 87) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class OlmoAttention (line 113) | class OlmoAttention(LlamaAttention): method forward (line 114) | def forward( class OlmoDecoderLayer (line 164) | class OlmoDecoderLayer(LlamaDecoderLayer): method __init__ (line 165) | def __init__(self, config: OlmoConfig, layer_idx: int): class OlmoModel (line 172) | class OlmoModel(LlamaModel): method __init__ (line 173) | def __init__(self, config: OlmoConfig): class OlmoForCausalLM (line 181) | class OlmoForCausalLM(LlamaForCausalLM): FILE: src/transformers/models/olmo2/configuration_olmo2.py class Olmo2Config (line 35) | class Olmo2Config(PreTrainedConfig): method __post_init__ (line 90) | def __post_init__(self, **kwargs): FILE: src/transformers/models/olmo2/convert_olmo2_weights_to_hf.py function compute_intermediate_size (line 54) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 58) | def read_json(path): function write_json (line 63) | def write_json(text, path): function write_model (line 68) | def write_model( function _write_tokenizer (line 218) | def _write_tokenizer( function main (line 250) | def main(): FILE: src/transformers/models/olmo2/modeling_olmo2.py class Olmo2RMSNorm (line 51) | class Olmo2RMSNorm(nn.Module): method __init__ (line 52) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 60) | def forward(self, hidden_states) -> torch.Tensor: method extra_repr (line 67) | def extra_repr(self): class Olmo2RotaryEmbedding (line 71) | class Olmo2RotaryEmbedding(nn.Module): method __init__ (line 74) | def __init__(self, config: Olmo2Config, device=None): method compute_default_rope_parameters (line 91) | def compute_default_rope_parameters( method forward (line 122) | def forward(self, x, position_ids): function repeat_kv (line 135) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 147) | def eager_attention_forward( function apply_rotary_pos_emb (line 172) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function rotate_half (line 198) | def rotate_half(x): class Olmo2Attention (line 206) | class Olmo2Attention(nn.Module): method __init__ (line 209) | def __init__(self, config: Olmo2Config, layer_idx: int | None = None): method forward (line 234) | def forward( class Olmo2MLP (line 279) | class Olmo2MLP(nn.Module): method __init__ (line 280) | def __init__(self, config): method forward (line 290) | def forward(self, x): class Olmo2DecoderLayer (line 295) | class Olmo2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 296) | def __init__(self, config: Olmo2Config, layer_idx: int): method forward (line 305) | def forward( class Olmo2PreTrainedModel (line 337) | class Olmo2PreTrainedModel(PreTrainedModel): class Olmo2Model (line 356) | class Olmo2Model(Olmo2PreTrainedModel): method __init__ (line 357) | def __init__(self, config: Olmo2Config): method forward (line 376) | def forward( class Olmo2ForCausalLM (line 430) | class Olmo2ForCausalLM(Olmo2PreTrainedModel, GenerationMixin): method __init__ (line 435) | def __init__(self, config): method forward (line 446) | def forward( FILE: src/transformers/models/olmo2/modular_olmo2.py class Olmo2Config (line 49) | class Olmo2Config(OlmoConfig): class Olmo2RMSNorm (line 89) | class Olmo2RMSNorm(LlamaRMSNorm): method forward (line 90) | def forward(self, hidden_states): class Olmo2RotaryEmbedding (line 98) | class Olmo2RotaryEmbedding(OlmoRotaryEmbedding): function rotate_half (line 102) | def rotate_half(x): class Olmo2Attention (line 112) | class Olmo2Attention(OlmoAttention): method __init__ (line 113) | def __init__(self, config: Olmo2Config, layer_idx: int | None = None): method forward (line 118) | def forward( class Olmo2DecoderLayer (line 166) | class Olmo2DecoderLayer(OlmoDecoderLayer): method __init__ (line 167) | def __init__(self, config: Olmo2Config, layer_idx: int): method forward (line 174) | def forward( class Olmo2PreTrainedModel (line 205) | class Olmo2PreTrainedModel(LlamaPreTrainedModel): class Olmo2Model (line 211) | class Olmo2Model(OlmoModel): method __init__ (line 212) | def __init__(self, config: Olmo2Config): class Olmo2ForCausalLM (line 221) | class Olmo2ForCausalLM(OlmoForCausalLM): FILE: src/transformers/models/olmo3/configuration_olmo3.py class Olmo3Config (line 30) | class Olmo3Config(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): FILE: src/transformers/models/olmo3/convert_olmo3_weights_to_hf.py function compute_intermediate_size (line 67) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 71) | def read_json(path): function write_json (line 76) | def write_json(text, path): function normalize_path (line 81) | def normalize_path(path: Path | str) -> str: function generate_uuid (line 85) | def generate_uuid() -> str: function get_bytes_range (line 89) | def get_bytes_range(path: Path | str, bytes_start: int, num_bytes: int) ... function _narrow_tensor_by_index (line 95) | def _narrow_tensor_by_index(tensor: torch.Tensor, offsets: Sequence[int]... class _StorageInfo (line 110) | class _StorageInfo: class _StoragePrefix (line 119) | class _StoragePrefix: class RemoteFileSystemReader (line 123) | class RemoteFileSystemReader(dist_cp.StorageReader): method __init__ (line 129) | def __init__( method _get_bytes (line 148) | def _get_bytes(self, relative_path: str, offset: int, length: int) -> ... method _get_content_for_read (line 152) | def _get_content_for_read(self, read_item: ReadItem) -> tuple[ReadItem... method reset (line 157) | def reset(self, checkpoint_id: Path | str | None = None) -> None: method read_data (line 163) | def read_data(self, plan: dist_cp.LoadPlan, planner: dist_cp.LoadPlann... method read_metadata (line 200) | def read_metadata(self) -> Metadata: method set_up_storage_reader (line 227) | def set_up_storage_reader(self, metadata: Metadata, is_coordinator: bo... method prepare_local_plan (line 232) | def prepare_local_plan(self, plan: dist_cp.LoadPlan) -> dist_cp.LoadPlan: method prepare_global_plan (line 235) | def prepare_global_plan(self, global_plan: list[dist_cp.LoadPlan]) -> ... method checkpoint_id (line 239) | def checkpoint_id(self) -> str: method validate_checkpoint_id (line 243) | def validate_checkpoint_id(cls, checkpoint_id: Path | str) -> bool: function load_model (line 248) | def load_model(model_path: str): function write_model (line 288) | def write_model( function _write_tokenizer (line 416) | def _write_tokenizer( function main (line 426) | def main(): FILE: src/transformers/models/olmo3/modeling_olmo3.py class Olmo3RMSNorm (line 44) | class Olmo3RMSNorm(nn.Module): method __init__ (line 45) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 53) | def forward(self, hidden_states) -> torch.Tensor: method extra_repr (line 60) | def extra_repr(self): function repeat_kv (line 64) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 76) | def eager_attention_forward( function apply_rotary_pos_emb (line 101) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function rotate_half (line 127) | def rotate_half(x): class Olmo3Attention (line 135) | class Olmo3Attention(nn.Module): method __init__ (line 138) | def __init__(self, config: Olmo3Config, layer_idx: int): method forward (line 165) | def forward( class Olmo3MLP (line 211) | class Olmo3MLP(nn.Module): method __init__ (line 212) | def __init__(self, config): method forward (line 222) | def forward(self, x): class Olmo3DecoderLayer (line 227) | class Olmo3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 228) | def __init__(self, config: Olmo3Config, layer_idx: int): method forward (line 237) | def forward( class Olmo3RotaryEmbedding (line 268) | class Olmo3RotaryEmbedding(nn.Module): method __init__ (line 271) | def __init__(self, config: Olmo3Config, device=None): method compute_default_rope_parameters (line 288) | def compute_default_rope_parameters( method forward (line 319) | def forward(self, x, position_ids): class Olmo3PreTrainedModel (line 334) | class Olmo3PreTrainedModel(PreTrainedModel): class Olmo3Model (line 353) | class Olmo3Model(Olmo3PreTrainedModel): method __init__ (line 354) | def __init__(self, config: Olmo3Config): method forward (line 373) | def forward( class Olmo3ForCausalLM (line 434) | class Olmo3ForCausalLM(Olmo3PreTrainedModel, GenerationMixin): method __init__ (line 439) | def __init__(self, config): method forward (line 450) | def forward( FILE: src/transformers/models/olmo3/modular_olmo3.py class Olmo3Config (line 44) | class Olmo3Config(Olmo2Config): method __post_init__ (line 82) | def __post_init__(self, **kwargs): class Olmo3RMSNorm (line 94) | class Olmo3RMSNorm(Olmo2RMSNorm): class Olmo3Attention (line 100) | class Olmo3Attention(Olmo2Attention): method __init__ (line 101) | def __init__(self, config: Olmo3Config, layer_idx: int): method forward (line 106) | def forward( class Olmo3DecoderLayer (line 152) | class Olmo3DecoderLayer(Olmo2DecoderLayer): class Olmo3RotaryEmbedding (line 156) | class Olmo3RotaryEmbedding(Gemma2RotaryEmbedding): class Olmo3PreTrainedModel (line 160) | class Olmo3PreTrainedModel(Olmo2PreTrainedModel): class Olmo3Model (line 167) | class Olmo3Model(Olmo2Model): method __init__ (line 168) | def __init__(self, config: Olmo3Config): method forward (line 176) | def forward( class Olmo3ForCausalLM (line 236) | class Olmo3ForCausalLM(Olmo2ForCausalLM): FILE: src/transformers/models/olmo_hybrid/configuration_olmo_hybrid.py class OlmoHybridConfig (line 31) | class OlmoHybridConfig(PreTrainedConfig): method __post_init__ (line 121) | def __post_init__(self, **kwargs): method validate_architecture (line 145) | def validate_architecture(self): FILE: src/transformers/models/olmo_hybrid/convert_olmo_hybrid_weights_to_hf.py function strtobool (line 78) | def strtobool(val): function read_json (line 97) | def read_json(path): function write_json (line 102) | def write_json(text, path): function normalize_path (line 107) | def normalize_path(path: Path | str) -> str: function generate_uuid (line 111) | def generate_uuid() -> str: function get_bytes_range (line 115) | def get_bytes_range(path: Path | str, bytes_start: int, num_bytes: int) ... function _narrow_tensor_by_index (line 121) | def _narrow_tensor_by_index(tensor: torch.Tensor, offsets: Sequence[int]... class _StorageInfo (line 133) | class _StorageInfo: class _StoragePrefix (line 142) | class _StoragePrefix: class RemoteFileSystemReader (line 146) | class RemoteFileSystemReader(dist_cp.StorageReader): method __init__ (line 152) | def __init__( method _get_bytes (line 171) | def _get_bytes(self, relative_path: str, offset: int, length: int) -> ... method _get_content_for_read (line 175) | def _get_content_for_read(self, read_item: ReadItem) -> tuple[ReadItem... method reset (line 180) | def reset(self, checkpoint_id: Path | str | None = None) -> None: method read_data (line 186) | def read_data(self, plan: dist_cp.LoadPlan, planner: dist_cp.LoadPlann... method read_metadata (line 218) | def read_metadata(self) -> Metadata: method set_up_storage_reader (line 245) | def set_up_storage_reader(self, metadata: Metadata, is_coordinator: bo... method prepare_local_plan (line 250) | def prepare_local_plan(self, plan: dist_cp.LoadPlan) -> dist_cp.LoadPlan: method prepare_global_plan (line 253) | def prepare_global_plan(self, global_plan: list[dist_cp.LoadPlan]) -> ... method checkpoint_id (line 257) | def checkpoint_id(self) -> str: method validate_checkpoint_id (line 261) | def validate_checkpoint_id(cls, checkpoint_id: Path | str) -> bool: class _RestrictedUnpickler (line 266) | class _RestrictedUnpickler(pickle.Unpickler): method find_class (line 272) | def find_class(self, module, name): function restricted_loads (line 282) | def restricted_loads(data): function restricted_load (line 287) | def restricted_load(file): function load_model (line 292) | def load_model(model_path: str): function get_layer_types_from_config (line 327) | def get_layer_types_from_config(olmo_config: dict) -> list[str]: function convert_attention_layer_weights (line 348) | def convert_attention_layer_weights( function convert_fla_layer_weights (line 372) | def convert_fla_layer_weights( function write_model (line 400) | def write_model( function _write_tokenizer (line 574) | def _write_tokenizer( function main (line 592) | def main(): FILE: src/transformers/models/olmo_hybrid/modeling_olmo_hybrid.py class OlmoHybridDynamicCache (line 60) | class OlmoHybridDynamicCache: method __init__ (line 69) | def __init__(self, config: OlmoHybridConfig): method __len__ (line 84) | def __len__(self): method update (line 87) | def update( method reorder_cache (line 103) | def reorder_cache(self, beam_idx: torch.LongTensor): method get_seq_length (line 138) | def get_seq_length(self, layer_idx: int | None = 0) -> int: method get_mask_sizes (line 146) | def get_mask_sizes(self, query_length: int, layer_idx: int) -> tuple[i... method has_previous_state (line 157) | def has_previous_state(self): class OlmoHybridRMSNormGated (line 162) | class OlmoHybridRMSNormGated(nn.Module): method __init__ (line 163) | def __init__(self, hidden_size, eps=1e-6, **kwargs): method forward (line 168) | def forward(self, hidden_states, gate=None): class OlmoHybridRMSNorm (line 181) | class OlmoHybridRMSNorm(nn.Module): method __init__ (line 182) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 190) | def forward(self, hidden_states) -> torch.Tensor: method extra_repr (line 197) | def extra_repr(self): class OlmoHybridShortConvolution (line 201) | class OlmoHybridShortConvolution(nn.Conv1d): method __init__ (line 202) | def __init__( method forward (line 221) | def forward( function repeat_kv (line 254) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 266) | def eager_attention_forward( function apply_rotary_pos_emb (line 291) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function rotate_half (line 317) | def rotate_half(x): class OlmoHybridAttention (line 325) | class OlmoHybridAttention(nn.Module): method __init__ (line 334) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): method forward (line 359) | def forward( class OlmoHybridRotaryEmbedding (line 407) | class OlmoHybridRotaryEmbedding(nn.Module): method __init__ (line 414) | def __init__(self, config: OlmoHybridConfig, device=None): method compute_default_rope_parameters (line 431) | def compute_default_rope_parameters( method forward (line 462) | def forward(self, x, position_ids): function apply_mask_to_padding_states (line 477) | def apply_mask_to_padding_states(hidden_states, attention_mask): function l2norm (line 489) | def l2norm(x: torch.FloatTensor, dim: int = -1, eps: float = 1e-6): function torch_chunk_gated_delta_rule (line 495) | def torch_chunk_gated_delta_rule( function torch_recurrent_gated_delta_rule (line 575) | def torch_recurrent_gated_delta_rule( class OlmoHybridGatedDeltaNet (line 622) | class OlmoHybridGatedDeltaNet(nn.Module): method __init__ (line 633) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): method forward (line 713) | def forward( class OlmoHybridMLP (line 804) | class OlmoHybridMLP(nn.Module): method __init__ (line 805) | def __init__(self, config): method forward (line 815) | def forward(self, x): class OlmoHybridAttentionDecoderLayer (line 820) | class OlmoHybridAttentionDecoderLayer(GradientCheckpointingLayer): method __init__ (line 821) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): method forward (line 831) | def forward( class OlmoHybridLinearAttentionDecoderLayer (line 862) | class OlmoHybridLinearAttentionDecoderLayer(GradientCheckpointingLayer): method __init__ (line 863) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): method forward (line 872) | def forward( class OlmoHybridPreTrainedModel (line 901) | class OlmoHybridPreTrainedModel(PreTrainedModel): method _init_weights (line 917) | def _init_weights(self, module): class OlmoHybridModel (line 934) | class OlmoHybridModel(OlmoHybridPreTrainedModel): method __init__ (line 935) | def __init__(self, config: OlmoHybridConfig): method forward (line 959) | def forward( method _update_linear_attn_mask (line 1017) | def _update_linear_attn_mask(self, attention_mask, past_key_values): class OlmoHybridForCausalLM (line 1033) | class OlmoHybridForCausalLM(OlmoHybridPreTrainedModel, GenerationMixin): method __init__ (line 1038) | def __init__(self, config): method forward (line 1049) | def forward( FILE: src/transformers/models/olmo_hybrid/modular_olmo_hybrid.py class OlmoHybridConfig (line 79) | class OlmoHybridConfig(LlamaConfig): method __post_init__ (line 160) | def __post_init__(self, **kwargs): method validate_architecture (line 184) | def validate_architecture(self): class OlmoHybridDynamicCache (line 192) | class OlmoHybridDynamicCache: method __init__ (line 201) | def __init__(self, config: OlmoHybridConfig): method __len__ (line 216) | def __len__(self): method update (line 219) | def update( method reorder_cache (line 235) | def reorder_cache(self, beam_idx: torch.LongTensor): method get_seq_length (line 270) | def get_seq_length(self, layer_idx: int | None = 0) -> int: method get_mask_sizes (line 278) | def get_mask_sizes(self, query_length: int, layer_idx: int) -> tuple[i... method has_previous_state (line 289) | def has_previous_state(self): class OlmoHybridRMSNormGated (line 294) | class OlmoHybridRMSNormGated(Qwen3NextRMSNormGated): class OlmoHybridRMSNorm (line 298) | class OlmoHybridRMSNorm(Olmo3RMSNorm): class OlmoHybridShortConvolution (line 302) | class OlmoHybridShortConvolution(nn.Conv1d): method __init__ (line 303) | def __init__( method forward (line 322) | def forward( class OlmoHybridAttention (line 355) | class OlmoHybridAttention(Olmo3Attention): method __init__ (line 364) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): method forward (line 370) | def forward( class OlmoHybridRotaryEmbedding (line 418) | class OlmoHybridRotaryEmbedding(Olmo3RotaryEmbedding): method forward (line 425) | def forward(self, x, position_ids): class OlmoHybridGatedDeltaNet (line 440) | class OlmoHybridGatedDeltaNet(nn.Module): method __init__ (line 451) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): method forward (line 531) | def forward( class OlmoHybridMLP (line 622) | class OlmoHybridMLP(Olmo3MLP): class OlmoHybridAttentionDecoderLayer (line 626) | class OlmoHybridAttentionDecoderLayer(Olmo3DecoderLayer): method __init__ (line 627) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): class OlmoHybridLinearAttentionDecoderLayer (line 633) | class OlmoHybridLinearAttentionDecoderLayer(LlamaDecoderLayer): method __init__ (line 634) | def __init__(self, config: OlmoHybridConfig, layer_idx: int): method forward (line 643) | def forward( class OlmoHybridPreTrainedModel (line 672) | class OlmoHybridPreTrainedModel(Qwen3NextPreTrainedModel): method _init_weights (line 681) | def _init_weights(self, module): class OlmoHybridModel (line 698) | class OlmoHybridModel(Qwen3NextModel): method __init__ (line 699) | def __init__(self, config: OlmoHybridConfig): method forward (line 719) | def forward( class OlmoHybridForCausalLM (line 778) | class OlmoHybridForCausalLM(Olmo3ForCausalLM): FILE: src/transformers/models/olmoe/configuration_olmoe.py class OlmoeConfig (line 23) | class OlmoeConfig(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): FILE: src/transformers/models/olmoe/convert_olmoe_weights_to_hf.py function compute_intermediate_size (line 77) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 81) | def read_json(path): function write_json (line 86) | def write_json(text, path): function write_model (line 91) | def write_model(model_path, input_base_path, tokenizer_path=None, fix_eo... function _write_tokenizer (line 218) | def _write_tokenizer( function main (line 244) | def main(): FILE: src/transformers/models/olmoe/modeling_olmoe.py class OlmoeRMSNorm (line 49) | class OlmoeRMSNorm(nn.Module): method __init__ (line 50) | def __init__(self, hidden_size, eps=1e-5) -> None: method forward (line 58) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 65) | def extra_repr(self): class OlmoeRotaryEmbedding (line 69) | class OlmoeRotaryEmbedding(nn.Module): method __init__ (line 72) | def __init__(self, config: OlmoeConfig, device=None): method compute_default_rope_parameters (line 89) | def compute_default_rope_parameters( method forward (line 120) | def forward(self, x, position_ids): class OlmoeMLP (line 134) | class OlmoeMLP(nn.Module): method __init__ (line 135) | def __init__(self, config): method forward (line 145) | def forward(self, x): function rotate_half (line 150) | def rotate_half(x): function apply_rotary_pos_emb (line 158) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 183) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 195) | def eager_attention_forward( class OlmoeAttention (line 221) | class OlmoeAttention(nn.Module): method __init__ (line 224) | def __init__(self, config: OlmoeConfig, layer_idx: int | None = None): method forward (line 251) | def forward( class OlmoeExperts (line 302) | class OlmoeExperts(nn.Module): method __init__ (line 305) | def __init__(self, config: OlmoeConfig): method forward (line 314) | def forward( class OlmoeTopKRouter (line 341) | class OlmoeTopKRouter(nn.Module): method __init__ (line 342) | def __init__(self, config): method forward (line 350) | def forward(self, hidden_states): class OlmoeSparseMoeBlock (line 362) | class OlmoeSparseMoeBlock(nn.Module): method __init__ (line 363) | def __init__(self, config): method forward (line 368) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class OlmoeDecoderLayer (line 378) | class OlmoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 379) | def __init__(self, config: OlmoeConfig, layer_idx: int): method forward (line 387) | def forward( class OlmoePreTrainedModel (line 420) | class OlmoePreTrainedModel(PreTrainedModel): method _init_weights (line 437) | def _init_weights(self, module): class OlmoeModel (line 447) | class OlmoeModel(OlmoePreTrainedModel): method __init__ (line 448) | def __init__(self, config: OlmoeConfig): method forward (line 466) | def forward( function load_balancing_loss_func (line 522) | def load_balancing_loss_func( class OlmoeForCausalLM (line 605) | class OlmoeForCausalLM(OlmoePreTrainedModel, GenerationMixin): method __init__ (line 610) | def __init__(self, config): method forward (line 624) | def forward( FILE: src/transformers/models/olmoe/modular_olmoe.py class OlmoeRMSNorm (line 45) | class OlmoeRMSNorm(LlamaRMSNorm): method __init__ (line 46) | def __init__(self, hidden_size, eps=1e-5): class OlmoeRotaryEmbedding (line 50) | class OlmoeRotaryEmbedding(LlamaRotaryEmbedding): class OlmoeMLP (line 54) | class OlmoeMLP(GemmaMLP): class OlmoeAttention (line 58) | class OlmoeAttention(LlamaAttention): method __init__ (line 59) | def __init__(self, config: OlmoeConfig, layer_idx: int | None = None): method forward (line 66) | def forward( class OlmoeExperts (line 116) | class OlmoeExperts(MixtralExperts): class OlmoeTopKRouter (line 120) | class OlmoeTopKRouter(Qwen2MoeTopKRouter): class OlmoeSparseMoeBlock (line 124) | class OlmoeSparseMoeBlock(nn.Module): method __init__ (line 125) | def __init__(self, config): method forward (line 130) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class OlmoeDecoderLayer (line 140) | class OlmoeDecoderLayer(LlamaDecoderLayer): method __init__ (line 141) | def __init__(self, config: OlmoeConfig, layer_idx: int): class OlmoePreTrainedModel (line 151) | class OlmoePreTrainedModel(PreTrainedModel): method _init_weights (line 168) | def _init_weights(self, module): class OlmoeModel (line 178) | class OlmoeModel(MixtralModel): method __init__ (line 179) | def __init__(self, config: OlmoeConfig): method forward (line 188) | def forward( class OlmoeForCausalLM (line 244) | class OlmoeForCausalLM(MixtralForCausalLM, GenerationMixin): method __init__ (line 247) | def __init__(self, config): method forward (line 252) | def forward(self, **super_kwargs): FILE: src/transformers/models/omdet_turbo/configuration_omdet_turbo.py class OmDetTurboConfig (line 31) | class OmDetTurboConfig(PreTrainedConfig): method __post_init__ (line 151) | def __post_init__(self, **kwargs): method to_dict (line 183) | def to_dict(self): FILE: src/transformers/models/omdet_turbo/convert_omdet_turbo_to_hf.py function get_omdet_turbo_config (line 38) | def get_omdet_turbo_config(model_name, use_timm_backbone): function create_rename_keys_vision (line 65) | def create_rename_keys_vision(state_dict, config): function create_rename_keys_language (line 136) | def create_rename_keys_language(state_dict): function rename_key (line 155) | def rename_key(dct, old, new): function read_in_q_k_v_vision (line 161) | def read_in_q_k_v_vision(state_dict, config): function read_in_q_k_v_text (line 183) | def read_in_q_k_v_text(state_dict, config): function read_in_q_k_v_encoder (line 208) | def read_in_q_k_v_encoder(state_dict, config): function read_in_q_k_v_decoder (line 222) | def read_in_q_k_v_decoder(state_dict, config): function run_test (line 237) | def run_test(model, processor): function convert_omdet_turbo_checkpoint (line 260) | def convert_omdet_turbo_checkpoint(args): FILE: src/transformers/models/omdet_turbo/modeling_omdet_turbo.py class OmDetTurboEncoderOutput (line 54) | class OmDetTurboEncoderOutput(ModelOutput): class OmDetTurboDecoderOutput (line 74) | class OmDetTurboDecoderOutput(ModelOutput): class OmDetTurboObjectDetectionOutput (line 109) | class OmDetTurboObjectDetectionOutput(ModelOutput): class MultiScaleDeformableAttention (line 164) | class MultiScaleDeformableAttention(nn.Module): method forward (line 165) | def forward( class OmDetTurboLRUCache (line 218) | class OmDetTurboLRUCache: method __init__ (line 219) | def __init__(self, capacity: int): method has (line 224) | def has(self, key) -> bool: method get (line 227) | def get(self, key): method put (line 237) | def put(self, key, value) -> None: class OmDetTurboLanguageBackbone (line 253) | class OmDetTurboLanguageBackbone(nn.Module): method __init__ (line 254) | def __init__(self, config: OmDetTurboConfig): method forward (line 259) | def forward(self, hidden_states, mask=None, encode_type="task"): class OmDetTurboVisionBackbone (line 277) | class OmDetTurboVisionBackbone(nn.Module): method __init__ (line 278) | def __init__(self, config: OmDetTurboConfig): method forward (line 286) | def forward(self, pixel_values): class OmDetTurboMultiscaleDeformableAttention (line 298) | class OmDetTurboMultiscaleDeformableAttention(nn.Module): method __init__ (line 303) | def __init__(self, config: OmDetTurboConfig, num_heads: int, n_points:... method forward (line 335) | def forward( class OmDetTurboConvNormLayer (line 407) | class OmDetTurboConvNormLayer(nn.Module): method __init__ (line 408) | def __init__(self, config, in_channels, out_channels, kernel_size, str... method forward (line 421) | def forward(self, hidden_state): class OmDetTurboRepVggBlock (line 429) | class OmDetTurboRepVggBlock(nn.Module): method __init__ (line 434) | def __init__(self, config: OmDetTurboConfig): method forward (line 443) | def forward(self, x): class OmDetTurboCSPRepLayer (line 449) | class OmDetTurboCSPRepLayer(nn.Module): method __init__ (line 454) | def __init__(self, config: OmDetTurboConfig): method forward (line 471) | def forward(self, hidden_state): class OmDetTurboMultiheadAttention (line 478) | class OmDetTurboMultiheadAttention(nn.Module): method __init__ (line 481) | def __init__(self, config, hidden_size, num_attention_heads, dropout): method forward (line 497) | def forward( class OmDetTurboEncoderLayer (line 545) | class OmDetTurboEncoderLayer(nn.Module): method __init__ (line 546) | def __init__(self, config: OmDetTurboConfig): method with_pos_embed (line 563) | def with_pos_embed(tensor, pos_embed): method forward (line 566) | def forward( class OmDetTurboEncoder (line 617) | class OmDetTurboEncoder(nn.Module): method __init__ (line 618) | def __init__(self, config: OmDetTurboConfig): method forward (line 623) | def forward( class OmDetTurboHybridEncoder (line 642) | class OmDetTurboHybridEncoder(nn.Module): method __init__ (line 651) | def __init__(self, config: OmDetTurboConfig): method build_2d_sincos_position_embedding (line 705) | def build_2d_sincos_position_embedding( method forward (line 722) | def forward( class OmDetTurboMLPWithDropout (line 818) | class OmDetTurboMLPWithDropout(nn.Module): method __init__ (line 819) | def __init__(self, config): method forward (line 826) | def forward(self, x): class OmDetTurboMLP (line 830) | class OmDetTurboMLP(nn.Module): method __init__ (line 833) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 842) | def forward(self, x): class OmDetTurboResidualLayer (line 848) | class OmDetTurboResidualLayer(nn.Module): method __init__ (line 853) | def __init__(self, config): method forward (line 858) | def forward(self, x, y): class OmDetTurboTaskEncoder (line 862) | class OmDetTurboTaskEncoder(nn.Module): method __init__ (line 863) | def __init__(self, config): method forward (line 868) | def forward(self, x): class OmDetTurboDeformableTransformerDecoderLayer (line 874) | class OmDetTurboDeformableTransformerDecoderLayer(GradientCheckpointingL... method __init__ (line 879) | def __init__(self, config): method with_pos_embed (line 910) | def with_pos_embed(tensor, pos): method forward (line 913) | def forward( class OmDetTurboPreTrainedModel (line 984) | class OmDetTurboPreTrainedModel(PreTrainedModel): method _init_weights (line 991) | def _init_weights(self, module): method _set_gradient_checkpointing (line 1029) | def _set_gradient_checkpointing(self, module, value=False): method _get_cache_key_at_index (line 1034) | def _get_cache_key_at_index(input_ids, attention_mask, index): method get_cached_class_embeddings (line 1040) | def get_cached_class_embeddings(self, classes_input_ids, classes_atten... method get_cached_task_embeddings (line 1064) | def get_cached_task_embeddings(self, tasks_input_ids, tasks_attention_... method get_language_embedding (line 1107) | def get_language_embedding( function _cosine_similarity_scaled (line 1133) | def _cosine_similarity_scaled(a, b, logit_scale): function get_class_similarity (line 1141) | def get_class_similarity(class_distance_type, cls_feature, class_proj): function _inverse_sigmoid (line 1152) | def _inverse_sigmoid(x, eps=1e-5): class OmDetTurboDecoder (line 1159) | class OmDetTurboDecoder(OmDetTurboPreTrainedModel): method __init__ (line 1160) | def __init__(self, config: OmDetTurboConfig): method generate_anchors (line 1210) | def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device... method _get_encoder_input (line 1238) | def _get_encoder_input(self, vision_features): method _get_decoder_input (line 1258) | def _get_decoder_input( method forward (line 1313) | def forward( class OmDetTurboForObjectDetection (line 1473) | class OmDetTurboForObjectDetection(OmDetTurboPreTrainedModel): method __init__ (line 1474) | def __init__(self, config: OmDetTurboConfig): method get_input_embeddings (line 1487) | def get_input_embeddings(self): method set_input_embeddings (line 1490) | def set_input_embeddings(self, value): method resize_token_embeddings (line 1493) | def resize_token_embeddings( method forward (line 1504) | def forward( FILE: src/transformers/models/omdet_turbo/processing_omdet_turbo.py class OmDetTurboTextKwargs (line 38) | class OmDetTurboTextKwargs(TextKwargs, total=False): class OmDetTurboProcessorKwargs (line 57) | class OmDetTurboProcessorKwargs(ProcessingKwargs, total=False): function clip_boxes (line 77) | def clip_boxes(box, box_size: tuple[int, int]): function compute_score (line 97) | def compute_score(boxes): function _post_process_boxes_for_image (line 111) | def _post_process_boxes_for_image( class OmDetTurboProcessor (line 190) | class OmDetTurboProcessor(ProcessorMixin): method __init__ (line 191) | def __init__(self, image_processor, tokenizer): method __call__ (line 195) | def __call__( method model_input_names (line 240) | def model_input_names(self): method _get_default_image_size (line 251) | def _get_default_image_size(self) -> tuple[int, int]: method post_process_grounded_object_detection (line 264) | def post_process_grounded_object_detection( FILE: src/transformers/models/oneformer/configuration_oneformer.py class OneFormerConfig (line 26) | class OneFormerConfig(PreTrainedConfig): method __post_init__ (line 144) | def __post_init__(self, **kwargs): FILE: src/transformers/models/oneformer/convert_to_hf_oneformer.py class TrackedStateDict (line 62) | class TrackedStateDict: method __init__ (line 63) | def __init__(self, to_track: dict): method __getitem__ (line 72) | def __getitem__(self, key: str) -> Any: method __setitem__ (line 75) | def __setitem__(self, key: str, item: Any): method diff (line 79) | def diff(self) -> list[str]: method copy (line 88) | def copy(self) -> dict: function prepare_img (line 94) | def prepare_img(): class Args (line 102) | class Args: function setup_cfg (line 108) | def setup_cfg(args: Args): class OriginalOneFormerConfigToOursConverter (line 121) | class OriginalOneFormerConfigToOursConverter: method __call__ (line 122) | def __call__(self, original_config: object, is_swin: bool) -> OneForme... class OriginalOneFormerConfigToProcessorConverter (line 206) | class OriginalOneFormerConfigToProcessorConverter: method __call__ (line 207) | def __call__(self, original_config: object, model_repo: str) -> OneFor... class OriginalOneFormerCheckpointToOursConverter (line 241) | class OriginalOneFormerCheckpointToOursConverter: method __init__ (line 242) | def __init__(self, original_model: nn.Module, config: OneFormerConfig): method pop_all (line 246) | def pop_all(self, renamed_keys: list[tuple[str, str]], dst_state_dict:... method replace_swin_backbone (line 251) | def replace_swin_backbone(self, dst_state_dict: StateDict, src_state_d... method replace_dinat_backbone (line 410) | def replace_dinat_backbone(self, dst_state_dict: StateDict, src_state_... method replace_pixel_module (line 547) | def replace_pixel_module(self, dst_state_dict: StateDict, src_state_di... method replace_keys_qkv_transformer_decoder (line 635) | def replace_keys_qkv_transformer_decoder(self, dst_state_dict: StateDi... method replace_transformer_module (line 654) | def replace_transformer_module(self, dst_state_dict: StateDict, src_st... method replace_task_mlp (line 816) | def replace_task_mlp(self, dst_state_dict: StateDict, src_state_dict: ... method replace_text_projector (line 835) | def replace_text_projector(self, dst_state_dict: StateDict, src_state_... method replace_text_mapper (line 852) | def replace_text_mapper(self, dst_state_dict: StateDict, src_state_dic... method convert (line 906) | def convert(self, oneformer: OneFormerModel, is_swin: bool) -> OneForm... method using_dirs (line 925) | def using_dirs(checkpoints_dir: Path, config_dir: Path) -> Iterator[tu... function post_process_sem_seg_output (line 936) | def post_process_sem_seg_output(outputs: OneFormerForUniversalSegmentati... function test (line 962) | def test( function get_name (line 1060) | def get_name(checkpoint_file: Path): FILE: src/transformers/models/oneformer/image_processing_oneformer.py class OneFormerImageProcessorKwargs (line 55) | class OneFormerImageProcessorKwargs(ImagesKwargs, total=False): function prepare_metadata (line 79) | def prepare_metadata(class_info): function load_metadata (line 93) | def load_metadata(repo_id, class_info_file): function make_pixel_mask (line 115) | def make_pixel_mask(image: "torch.Tensor", output_size: tuple[int, int])... function binary_mask_to_rle (line 132) | def binary_mask_to_rle(mask): function convert_segmentation_to_rle (line 163) | def convert_segmentation_to_rle(segmentation): function remove_low_and_no_objects (line 184) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... function check_segment_validity (line 212) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 230) | def compute_segments( class OneFormerImageProcessor (line 289) | class OneFormerImageProcessor(TorchvisionBackend): method __init__ (line 311) | def __init__(self, **kwargs: Unpack[OneFormerImageProcessorKwargs]): method preprocess (line 317) | def preprocess( method _preprocess_image_like_inputs (line 335) | def _preprocess_image_like_inputs( method _preprocess (line 364) | def _preprocess( method _pad_image (line 425) | def _pad_image( method pad (line 455) | def pad( method convert_segmentation_map_to_binary_masks (line 490) | def convert_segmentation_map_to_binary_masks( method get_semantic_annotations (line 530) | def get_semantic_annotations(self, label, num_class_obj): method get_instance_annotations (line 565) | def get_instance_annotations(self, label, num_class_obj): method get_panoptic_annotations (line 597) | def get_panoptic_annotations(self, label, num_class_obj): method encode_inputs (line 626) | def encode_inputs( method post_process_semantic_segmentation (line 706) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 758) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 878) | def post_process_panoptic_segmentation( FILE: src/transformers/models/oneformer/image_processing_pil_oneformer.py function make_pixel_mask (line 57) | def make_pixel_mask(image: np.ndarray, output_size: tuple[int, int]) -> ... class OneFormerImageProcessorKwargs (line 74) | class OneFormerImageProcessorKwargs(ImagesKwargs, total=False): function binary_mask_to_rle (line 99) | def binary_mask_to_rle(mask): function check_segment_validity (line 124) | def check_segment_validity(mask_labels, mask_probs, k, mask_threshold=0.... function compute_segments (line 143) | def compute_segments( function convert_segmentation_to_rle (line 202) | def convert_segmentation_to_rle(segmentation): function load_metadata (line 224) | def load_metadata(repo_id, class_info_file): function prepare_metadata (line 247) | def prepare_metadata(class_info): function remove_low_and_no_objects (line 262) | def remove_low_and_no_objects(masks, scores, labels, object_mask_thresho... class OneFormerImageProcessorPil (line 292) | class OneFormerImageProcessorPil(PilBackend): method __init__ (line 314) | def __init__(self, **kwargs: Unpack[OneFormerImageProcessorKwargs]): method preprocess (line 320) | def preprocess( method _preprocess_image_like_inputs (line 338) | def _preprocess_image_like_inputs( method _preprocess (line 366) | def _preprocess( method _pad_image (line 418) | def _pad_image(self, image: np.ndarray, output_size: tuple[int, int], ... method pad (line 457) | def pad( method convert_segmentation_map_to_binary_masks (line 498) | def convert_segmentation_map_to_binary_masks( method get_semantic_annotations (line 534) | def get_semantic_annotations(self, label, num_class_obj): method get_instance_annotations (line 578) | def get_instance_annotations(self, label, num_class_obj): method get_panoptic_annotations (line 619) | def get_panoptic_annotations(self, label, num_class_obj): method encode_inputs (line 657) | def encode_inputs( method post_process_semantic_segmentation (line 747) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 797) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 917) | def post_process_panoptic_segmentation( FILE: src/transformers/models/oneformer/modeling_oneformer.py function _get_clones (line 56) | def _get_clones(module, N): function multi_scale_deformable_attention (line 60) | def multi_scale_deformable_attention( function dice_loss (line 103) | def dice_loss(inputs: Tensor, labels: Tensor, num_masks: int) -> Tensor: function sigmoid_cross_entropy_loss (line 134) | def sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: torch.Tenso... function pair_wise_dice_loss (line 154) | def pair_wise_dice_loss(inputs: Tensor, labels: Tensor) -> Tensor: function pair_wise_sigmoid_cross_entropy_loss (line 177) | def pair_wise_sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: t... function sample_point (line 205) | def sample_point( class OneFormerHungarianMatcher (line 238) | class OneFormerHungarianMatcher(nn.Module): method __init__ (line 239) | def __init__( method forward (line 267) | def forward(self, masks_queries_logits, class_queries_logits, mask_lab... class OneFormerLoss (line 347) | class OneFormerLoss(nn.Module): method __init__ (line 348) | def __init__( method _max_by_axis (line 402) | def _max_by_axis(self, the_list: list[list[int]]) -> list[int]: method _pad_images_to_max_in_batch (line 409) | def _pad_images_to_max_in_batch(self, tensors: list[Tensor]) -> tuple[... method loss_contrastive (line 428) | def loss_contrastive(self, contrastive_queries_logits: Tensor, text_qu... method loss_labels (line 465) | def loss_labels( method loss_masks (line 500) | def loss_masks( method calculate_uncertainty (line 558) | def calculate_uncertainty(self, logits: torch.Tensor) -> torch.Tensor: method sample_points_using_uncertainty (line 576) | def sample_points_using_uncertainty( method _get_predictions_permutation_indices (line 631) | def _get_predictions_permutation_indices(self, indices): method _get_targets_permutation_indices (line 637) | def _get_targets_permutation_indices(self, indices): method forward (line 643) | def forward( method get_num_masks (line 718) | def get_num_masks(self, class_labels: torch.Tensor, device: torch.devi... class OneFormerTransformerDecoderOutput (line 741) | class OneFormerTransformerDecoderOutput(BaseModelOutput): class OneFormerPixelDecoderOutput (line 770) | class OneFormerPixelDecoderOutput(ModelOutput): class OneFormerPixelLevelModuleOutput (line 797) | class OneFormerPixelLevelModuleOutput(ModelOutput): class OneFormerModelOutput (line 820) | class OneFormerModelOutput(ModelOutput): class OneFormerForUniversalSegmentationOutput (line 877) | class OneFormerForUniversalSegmentationOutput(ModelOutput): class OneFormerPixelDecoderEncoderMultiscaleDeformableAttention (line 938) | class OneFormerPixelDecoderEncoderMultiscaleDeformableAttention(nn.Module): method __init__ (line 943) | def __init__(self, embed_dim: int, num_heads: int, n_levels: int, n_po... method with_pos_embed (line 970) | def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Te... method forward (line 973) | def forward( class OneFormerPixelDecoderEncoderLayer (line 1031) | class OneFormerPixelDecoderEncoderLayer(nn.Module): method __init__ (line 1032) | def __init__(self, config: OneFormerConfig): method forward (line 1052) | def forward( class OneFormerPixelDecoderEncoderOnly (line 1123) | class OneFormerPixelDecoderEncoderOnly(nn.Module): method __init__ (line 1134) | def __init__(self, config: OneFormerConfig): method get_reference_points (line 1142) | def get_reference_points(spatial_shapes, valid_ratios, device): method forward (line 1171) | def forward( class OneFormerPixelDecoder (line 1247) | class OneFormerPixelDecoder(nn.Module): method __init__ (line 1248) | def __init__(self, config: OneFormerConfig, feature_channels): method get_valid_ratio (line 1333) | def get_valid_ratio(self, mask, dtype=torch.float32): method forward (line 1344) | def forward( class OneFormerPixelLevelModule (line 1447) | class OneFormerPixelLevelModule(nn.Module): method __init__ (line 1448) | def __init__(self, config: OneFormerConfig): method forward (line 1462) | def forward(self, pixel_values: Tensor, output_hidden_states: bool = F... class OneFormerAttention (line 1473) | class OneFormerAttention(nn.Module): method __init__ (line 1479) | def __init__( method _shape (line 1504) | def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): method with_pos_embed (line 1507) | def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Te... method forward (line 1510) | def forward( class OneFormerTransformerDecoderSelfAttentionLayer (line 1609) | class OneFormerTransformerDecoderSelfAttentionLayer(nn.Module): method __init__ (line 1610) | def __init__( method with_pos_embed (line 1622) | def with_pos_embed(self, tensor, pos: Tensor | None): method forward_post (line 1625) | def forward_post( method forward_pre (line 1640) | def forward_pre( method forward (line 1655) | def forward( class OneFormerTransformerDecoderCrossAttentionLayer (line 1667) | class OneFormerTransformerDecoderCrossAttentionLayer(nn.Module): method __init__ (line 1668) | def __init__( method with_pos_embed (line 1680) | def with_pos_embed(self, tensor, pos: Tensor | None): method forward_post (line 1683) | def forward_post( method forward_pre (line 1704) | def forward_pre( method forward (line 1725) | def forward( class OneFormerTransformerDecoderFFNLayer (line 1739) | class OneFormerTransformerDecoderFFNLayer(nn.Module): method __init__ (line 1740) | def __init__( method with_pos_embed (line 1760) | def with_pos_embed(self, tensor, pos: Tensor | None): method forward_post (line 1763) | def forward_post(self, output): method forward_pre (line 1769) | def forward_pre(self, output): method forward (line 1775) | def forward(self, output): class OneFormerMLPPredictionHead (line 1781) | class OneFormerMLPPredictionHead(nn.Module): method __init__ (line 1782) | def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, n... method forward (line 1808) | def forward(self, input: Tensor) -> Tensor: class OneFormerTransformerDecoderLayer (line 1813) | class OneFormerTransformerDecoderLayer(nn.Module): method __init__ (line 1814) | def __init__(self, config: OneFormerConfig): method forward (line 1843) | def forward( class OneFormerTransformerDecoderQueryTransformerDecoder (line 1900) | class OneFormerTransformerDecoderQueryTransformerDecoder(nn.Module): method __init__ (line 1901) | def __init__(self, decoder_layer, num_layers, norm=None, return_interm... method forward (line 1908) | def forward( class OneFormerTransformerDecoderQueryTransformerDecoderLayer (line 1947) | class OneFormerTransformerDecoderQueryTransformerDecoderLayer(nn.Module): method __init__ (line 1948) | def __init__( method with_pos_embed (line 1976) | def with_pos_embed(self, tensor, pos: Tensor | None): method forward_post (line 1979) | def forward_post( method forward_pre (line 2010) | def forward_pre( method forward (line 2041) | def forward( class OneFormerTransformerDecoderQueryTransformer (line 2075) | class OneFormerTransformerDecoderQueryTransformer(nn.Module): method __init__ (line 2076) | def __init__( method forward (line 2104) | def forward(self, src, mask, query_embed, pos_embed, task_token=None): class OneFormerTransformerDecoder (line 2121) | class OneFormerTransformerDecoder(nn.Module): method __init__ (line 2126) | def __init__(self, in_channels: int, config: OneFormerConfig): method forward (line 2165) | def forward( method forward_prediction_heads (line 2249) | def forward_prediction_heads(self, output, mask_features, attention_ma... method _get_aux_predictions (line 2269) | def _get_aux_predictions(self, outputs_class, outputs_seg_masks): class OneFormerTransformerModule (line 2277) | class OneFormerTransformerModule(nn.Module): method __init__ (line 2282) | def __init__(self, in_features: int, config: OneFormerConfig): method forward (line 2299) | def forward( class OneFormerSinePositionEmbedding (line 2353) | class OneFormerSinePositionEmbedding(nn.Module): method __init__ (line 2359) | def __init__( method forward (line 2371) | def forward( class PredictionBlock (line 2400) | class PredictionBlock(nn.Module): method __init__ (line 2401) | def __init__(self, in_dim: int, out_dim: int, activation: nn.Module) -... method forward (line 2408) | def forward(self, input: Tensor) -> Tensor: class OneFormerTextMapperAttention (line 2415) | class OneFormerTextMapperAttention(nn.Module): method __init__ (line 2416) | def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, at... method forward (line 2431) | def forward(self, q, k, v): class OneFormerTextTransformerDecoderLayer (line 2451) | class OneFormerTextTransformerDecoderLayer(nn.Module): method __init__ (line 2452) | def __init__( method forward (line 2472) | def forward(self, hidden_state, mem): class OneFormerTextContextDecoder (line 2481) | class OneFormerTextContextDecoder(nn.Module): method __init__ (line 2482) | def __init__( method forward (line 2516) | def forward(self, text, visual): class OneFormerTextMLP (line 2526) | class OneFormerTextMLP(nn.Module): method __init__ (line 2527) | def __init__( method forward (line 2538) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class OneFormerTextTransformerLayer (line 2545) | class OneFormerTextTransformerLayer(GradientCheckpointingLayer): method __init__ (line 2546) | def __init__(self, width: int, heads: int, attn_mask: torch.Tensor, la... method forward (line 2554) | def forward( class OneFormerTextTransformer (line 2579) | class OneFormerTextTransformer(nn.Module): method __init__ (line 2580) | def __init__( method forward (line 2597) | def forward(self, hidden_states: torch.Tensor): class OneFormerTextEncoder (line 2603) | class OneFormerTextEncoder(nn.Module): method __init__ (line 2604) | def __init__( method build_attention_mask (line 2630) | def build_attention_mask(self): method forward (line 2638) | def forward(self, text): class OneFormerTextMapper (line 2650) | class OneFormerTextMapper(nn.Module): method __init__ (line 2651) | def __init__(self, config: OneFormerConfig): method forward (line 2675) | def forward( method encode_text (line 2683) | def encode_text(self, text): class OneFormerTaskModel (line 2711) | class OneFormerTaskModel(nn.Module): method __init__ (line 2712) | def __init__(self, config: OneFormerConfig): method forward (line 2721) | def forward(self, inputs: Tensor) -> Tensor: class OneFormerPreTrainedModel (line 2727) | class OneFormerPreTrainedModel(PreTrainedModel): method _init_weights (line 2734) | def _init_weights(self, module: nn.Module): class OneFormerModel (line 2818) | class OneFormerModel(OneFormerPreTrainedModel): method __init__ (line 2821) | def __init__(self, config: OneFormerConfig): method forward (line 2836) | def forward( class OneFormerForUniversalSegmentation (line 2954) | class OneFormerForUniversalSegmentation(OneFormerPreTrainedModel): method __init__ (line 2957) | def __init__(self, config: OneFormerConfig): method get_loss_dict (line 2988) | def get_loss_dict( method get_loss (line 3018) | def get_loss(self, loss_dict: dict[str, Tensor]) -> Tensor: method forward (line 3022) | def forward( FILE: src/transformers/models/oneformer/processing_oneformer.py class OneFormerProcessor (line 27) | class OneFormerProcessor(ProcessorMixin): method __init__ (line 28) | def __init__( method _preprocess_text (line 45) | def _preprocess_text(self, text_list=None, max_length=77): method __call__ (line 62) | def __call__(self, images=None, task_inputs=None, segmentation_maps=No... method encode_inputs (line 119) | def encode_inputs(self, images=None, task_inputs=None, segmentation_ma... method post_process_semantic_segmentation (line 159) | def post_process_semantic_segmentation(self, *args, **kwargs): method post_process_instance_segmentation (line 166) | def post_process_instance_segmentation(self, *args, **kwargs): method post_process_panoptic_segmentation (line 173) | def post_process_panoptic_segmentation(self, *args, **kwargs): FILE: src/transformers/models/openai/configuration_openai.py class OpenAIGPTConfig (line 25) | class OpenAIGPTConfig(PreTrainedConfig): FILE: src/transformers/models/openai/convert_openai_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_openai_gpt (line 30) | def load_tf_weights_in_openai_gpt(model, config, openai_checkpoint_folde... function convert_openai_checkpoint_to_pytorch (line 108) | def convert_openai_checkpoint_to_pytorch(openai_checkpoint_folder_path, ... FILE: src/transformers/models/openai/modeling_openai.py class Attention (line 46) | class Attention(nn.Module): method __init__ (line 47) | def __init__(self, nx, n_positions, config, scale=False): method _attn (line 67) | def _attn(self, q, k, v, attention_mask=None, output_attentions=False): method merge_heads (line 87) | def merge_heads(self, x): method split_heads (line 92) | def split_heads(self, x, k=False): method forward (line 100) | def forward(self, x, attention_mask=None, output_attentions=False): class MLP (line 118) | class MLP(nn.Module): method __init__ (line 119) | def __init__(self, n_state, config): # in MLP: n_state=3072 (4 * n_embd) method forward (line 127) | def forward(self, x): class Block (line 133) | class Block(nn.Module): method __init__ (line 134) | def __init__(self, n_positions, config, scale=False): method forward (line 142) | def forward(self, x, attention_mask=None, output_attentions=False): class OpenAIGPTSequenceSummary (line 159) | class OpenAIGPTSequenceSummary(nn.Module): method __init__ (line 185) | def __init__(self, config: OpenAIGPTConfig): method forward (line 214) | def forward( class OpenAIGPTPreTrainedModel (line 259) | class OpenAIGPTPreTrainedModel(PreTrainedModel): method _init_weights (line 263) | def _init_weights(self, module): class OpenAIGPTDoubleHeadsModelOutput (line 280) | class OpenAIGPTDoubleHeadsModelOutput(ModelOutput): class OpenAIGPTModel (line 301) | class OpenAIGPTModel(OpenAIGPTPreTrainedModel): method __init__ (line 302) | def __init__(self, config): method get_input_embeddings (line 314) | def get_input_embeddings(self): method set_input_embeddings (line 317) | def set_input_embeddings(self, new_embeddings): method forward (line 321) | def forward( class OpenAIGPTLMHeadModel (line 416) | class OpenAIGPTLMHeadModel(OpenAIGPTPreTrainedModel, GenerationMixin): method __init__ (line 419) | def __init__(self, config): method forward (line 428) | def forward( method prepare_inputs_for_generation (line 481) | def prepare_inputs_for_generation(self, input_ids: torch.LongTensor, *... class OpenAIGPTDoubleHeadsModel (line 501) | class OpenAIGPTDoubleHeadsModel(OpenAIGPTPreTrainedModel): method __init__ (line 504) | def __init__(self, config): method forward (line 516) | def forward( class OpenAIGPTForSequenceClassification (line 618) | class OpenAIGPTForSequenceClassification(OpenAIGPTPreTrainedModel): method __init__ (line 619) | def __init__(self, config): method forward (line 629) | def forward( FILE: src/transformers/models/openai/tokenization_openai.py class OpenAIGPTTokenizer (line 28) | class OpenAIGPTTokenizer(TokenizersBackend): method __init__ (line 59) | def __init__( method do_lower_case (line 94) | def do_lower_case(self): FILE: src/transformers/models/opt/configuration_opt.py class OPTConfig (line 24) | class OPTConfig(PreTrainedConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): FILE: src/transformers/models/opt/convert_opt_original_pytorch_checkpoint_to_pytorch.py function load_checkpoint (line 29) | def load_checkpoint(checkpoint_path): function convert_opt_checkpoint (line 79) | def convert_opt_checkpoint(checkpoint_path, pytorch_dump_folder_path, co... FILE: src/transformers/models/opt/modeling_opt.py class OPTLearnedPositionalEmbedding (line 45) | class OPTLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 50) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 56) | def forward( function eager_attention_forward (line 74) | def eager_attention_forward( class OPTAttention (line 97) | class OPTAttention(nn.Module): method __init__ (line 100) | def __init__( method forward (line 135) | def forward( class OPTDecoderLayer (line 184) | class OPTDecoderLayer(GradientCheckpointingLayer): method __init__ (line 185) | def __init__(self, config: OPTConfig, layer_idx: int | None = None): method forward (line 202) | def forward( class OPTPreTrainedModel (line 257) | class OPTPreTrainedModel(PreTrainedModel): class OPTDecoder (line 273) | class OPTDecoder(OPTPreTrainedModel): method __init__ (line 281) | def __init__(self, config: OPTConfig): method forward (line 321) | def forward( class OPTModel (line 400) | class OPTModel(OPTPreTrainedModel): method __init__ (line 401) | def __init__(self, config: OPTConfig): method get_input_embeddings (line 407) | def get_input_embeddings(self): method set_input_embeddings (line 410) | def set_input_embeddings(self, value): method forward (line 415) | def forward( class OPTForCausalLM (line 443) | class OPTForCausalLM(OPTPreTrainedModel, GenerationMixin): method __init__ (line 446) | def __init__(self, config): method get_input_embeddings (line 456) | def get_input_embeddings(self): method set_input_embeddings (line 459) | def set_input_embeddings(self, value): method forward (line 464) | def forward( class OPTForSequenceClassification (line 541) | class OPTForSequenceClassification(OPTPreTrainedModel): method __init__ (line 542) | def __init__(self, config: OPTConfig): method forward (line 553) | def forward( method get_input_embeddings (line 636) | def get_input_embeddings(self): method set_input_embeddings (line 639) | def set_input_embeddings(self, value): class OPTForQuestionAnswering (line 644) | class OPTForQuestionAnswering(OPTPreTrainedModel): method __init__ (line 645) | def __init__(self, config: OPTConfig): method forward (line 655) | def forward( method get_input_embeddings (line 738) | def get_input_embeddings(self): method set_input_embeddings (line 741) | def set_input_embeddings(self, value): FILE: src/transformers/models/ovis2/configuration_ovis2.py class Ovis2VisionConfig (line 25) | class Ovis2VisionConfig(PreTrainedConfig): class Ovis2Config (line 58) | class Ovis2Config(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): FILE: src/transformers/models/ovis2/convert_ovis2_weights_to_hf.py function create_tokenizer (line 113) | def create_tokenizer(model_name_or_path, save_dir): function create_image_processor (line 134) | def create_image_processor(save_dir): function extract_vision_config_from_original (line 151) | def extract_vision_config_from_original(orig_config): function get_ovis2_config (line 185) | def get_ovis2_config(model_name_or_path): function load_orig_state_dict (line 216) | def load_orig_state_dict(model_name_or_path): function convert_orig2hf (line 235) | def convert_orig2hf(state_dict, dim): function convert_model (line 277) | def convert_model(model_name_or_path): function main (line 309) | def main(): FILE: src/transformers/models/ovis2/image_processing_ovis2.py function get_all_supported_aspect_ratios (line 37) | def get_all_supported_aspect_ratios(min_image_tiles: int, max_image_tile... function get_optimal_tiled_canvas (line 48) | def get_optimal_tiled_canvas( function compute_patch_covering_area (line 75) | def compute_patch_covering_area(left: int, upper: int, right: int, lower... function split_image_into_grid (line 85) | def split_image_into_grid(h: int, w: int, grid: tuple[int, int]) -> list... function get_min_tile_covering_grid (line 101) | def get_min_tile_covering_grid( class Ovis2ImageProcessorKwargs (line 127) | class Ovis2ImageProcessorKwargs(ImagesKwargs, total=False): class Ovis2ImageProcessor (line 151) | class Ovis2ImageProcessor(TorchvisionBackend): method __init__ (line 167) | def __init__(self, **kwargs: Unpack[Ovis2ImageProcessorKwargs]): method preprocess (line 171) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Ovis2ImagePr... method crop_image_to_patches (line 174) | def crop_image_to_patches( method _preprocess (line 259) | def _preprocess( FILE: src/transformers/models/ovis2/image_processing_pil_ovis2.py class Ovis2ImageProcessorKwargs (line 37) | class Ovis2ImageProcessorKwargs(ImagesKwargs, total=False): function get_all_supported_aspect_ratios (line 62) | def get_all_supported_aspect_ratios(min_image_tiles: int, max_image_tile... function compute_patch_covering_area (line 73) | def compute_patch_covering_area(left: int, upper: int, right: int, lower... function split_image_into_grid (line 84) | def split_image_into_grid(h: int, w: int, grid: tuple[int, int]) -> list... function get_min_tile_covering_grid (line 101) | def get_min_tile_covering_grid( function get_optimal_tiled_canvas (line 129) | def get_optimal_tiled_canvas( class Ovis2ImageProcessorPil (line 157) | class Ovis2ImageProcessorPil(PilBackend): method __init__ (line 173) | def __init__(self, **kwargs: Unpack[Ovis2ImageProcessorKwargs]): method preprocess (line 177) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Ovis2ImagePr... method crop_image_to_patches (line 180) | def crop_image_to_patches( method _preprocess (line 242) | def _preprocess( FILE: src/transformers/models/ovis2/modeling_ovis2.py class BaseModelOutputWithVisualIndicatorFeatures (line 46) | class BaseModelOutputWithVisualIndicatorFeatures(BaseModelOutputWithPool... class Ovis2ModelOutputWithPast (line 61) | class Ovis2ModelOutputWithPast(BaseModelOutputWithPast): class Ovis2CausalLMOutputWithPast (line 82) | class Ovis2CausalLMOutputWithPast(ModelOutput): class Ovis2RMSNorm (line 107) | class Ovis2RMSNorm(nn.Module): method __init__ (line 108) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 116) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 123) | def extra_repr(self): class Ovis2VisionMLP (line 127) | class Ovis2VisionMLP(nn.Module): method __init__ (line 128) | def __init__(self, config): method forward (line 138) | def forward(self, x): class Ovis2VisionEmbeddings (line 143) | class Ovis2VisionEmbeddings(nn.Module): method __init__ (line 144) | def __init__(self, config: Ovis2VisionConfig): method forward (line 165) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: function eager_attention_forward (line 176) | def eager_attention_forward( class Ovis2VisionAttention (line 199) | class Ovis2VisionAttention(nn.Module): method __init__ (line 202) | def __init__(self, config): method forward (line 221) | def forward( class Ovis2MLP (line 260) | class Ovis2MLP(nn.Module): method __init__ (line 261) | def __init__(self, config): method forward (line 271) | def forward(self, x): class Ovis2VisionEncoderLayer (line 276) | class Ovis2VisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 277) | def __init__(self, config: Ovis2VisionConfig): method forward (line 284) | def forward( class Ovis2VisionEncoder (line 301) | class Ovis2VisionEncoder(nn.Module): method __init__ (line 310) | def __init__(self, config: Ovis2VisionConfig): method forward (line 319) | def forward( class Ovis2VisionTransformer (line 332) | class Ovis2VisionTransformer(nn.Module): method __init__ (line 333) | def __init__(self, config: Ovis2VisionConfig): method forward (line 342) | def forward( class Ovis2VisualEmbeddingTable (line 362) | class Ovis2VisualEmbeddingTable(nn.Embedding): method forward (line 363) | def forward(self, visual_tokens: torch.Tensor) -> torch.Tensor: class Ovis2PreTrainedModel (line 369) | class Ovis2PreTrainedModel(PreTrainedModel): method _init_weights (line 384) | def _init_weights(self, module): function hard_softmax (line 390) | def hard_softmax(logits: torch.Tensor, dim: int): class Ovis2VisionModel (line 400) | class Ovis2VisionModel(Ovis2PreTrainedModel): method __init__ (line 407) | def __init__(self, config: Ovis2VisionConfig): method forward (line 424) | def forward( class Ovis2Model (line 470) | class Ovis2Model(Ovis2PreTrainedModel): method __init__ (line 471) | def __init__(self, config: Ovis2Config): method get_input_embeddings (line 482) | def get_input_embeddings(self): method set_input_embeddings (line 485) | def set_input_embeddings(self, value): method get_image_features (line 492) | def get_image_features( method get_placeholder_mask (line 520) | def get_placeholder_mask( method forward (line 546) | def forward( class Ovis2ForConditionalGeneration (line 613) | class Ovis2ForConditionalGeneration(Ovis2PreTrainedModel, GenerationMixin): method __init__ (line 616) | def __init__(self, config: Ovis2Config): method get_input_embeddings (line 622) | def get_input_embeddings(self): method set_input_embeddings (line 625) | def set_input_embeddings(self, value): method get_output_embeddings (line 628) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 632) | def get_image_features( method forward (line 639) | def forward( method prepare_inputs_for_generation (line 712) | def prepare_inputs_for_generation( FILE: src/transformers/models/ovis2/modular_ovis2.py function hard_softmax (line 39) | def hard_softmax(logits: torch.Tensor, dim: int): class BaseModelOutputWithVisualIndicatorFeatures (line 51) | class BaseModelOutputWithVisualIndicatorFeatures(BaseModelOutputWithPool... class Ovis2ModelOutputWithPast (line 60) | class Ovis2ModelOutputWithPast(LlavaNextModelOutputWithPast): class Ovis2CausalLMOutputWithPast (line 64) | class Ovis2CausalLMOutputWithPast(LlavaNextCausalLMOutputWithPast): class Ovis2RMSNorm (line 68) | class Ovis2RMSNorm(LlamaRMSNorm): class Ovis2VisionMLP (line 72) | class Ovis2VisionMLP(LlamaMLP): class Ovis2VisionEmbeddings (line 76) | class Ovis2VisionEmbeddings(SiglipVisionEmbeddings): method __init__ (line 77) | def __init__(self, config: Ovis2VisionConfig): method interpolate_pos_encoding (line 81) | def interpolate_pos_encoding(self): method forward (line 84) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class Ovis2VisionAttention (line 95) | class Ovis2VisionAttention(Aimv2Attention): class Ovis2VisionEncoderLayer (line 99) | class Ovis2VisionEncoderLayer(Aimv2EncoderLayer): method __init__ (line 100) | def __init__(self, config: Ovis2VisionConfig): class Ovis2VisionEncoder (line 105) | class Ovis2VisionEncoder(SiglipEncoder): method __init__ (line 106) | def __init__(self, config: Ovis2VisionConfig): method forward (line 112) | def forward( class Ovis2VisionTransformer (line 125) | class Ovis2VisionTransformer(nn.Module): method __init__ (line 126) | def __init__(self, config: Ovis2VisionConfig): method forward (line 135) | def forward( class Ovis2VisualEmbeddingTable (line 155) | class Ovis2VisualEmbeddingTable(nn.Embedding): method forward (line 156) | def forward(self, visual_tokens: torch.Tensor) -> torch.Tensor: class Ovis2PreTrainedModel (line 162) | class Ovis2PreTrainedModel(PreTrainedModel): method _init_weights (line 177) | def _init_weights(self, module): class Ovis2VisionModel (line 183) | class Ovis2VisionModel(Ovis2PreTrainedModel): method __init__ (line 190) | def __init__(self, config: Ovis2VisionConfig): method forward (line 207) | def forward( class Ovis2Model (line 248) | class Ovis2Model(LlavaModel): method __init__ (line 249) | def __init__(self, config: Ovis2Config): method get_image_features (line 264) | def get_image_features( method forward (line 294) | def forward( class Ovis2ForConditionalGeneration (line 361) | class Ovis2ForConditionalGeneration(LlavaForConditionalGeneration, Gener... method __init__ (line 362) | def __init__(self, config: Ovis2Config): method get_image_features (line 367) | def get_image_features( method forward (line 374) | def forward( FILE: src/transformers/models/ovis2/processing_ovis2.py class Ovis2ProcessorKwargs (line 26) | class Ovis2ProcessorKwargs(ProcessingKwargs, total=False): class Ovis2Processor (line 36) | class Ovis2Processor(ProcessorMixin): method __init__ (line 37) | def __init__( method __call__ (line 62) | def __call__( method _expand_image_tokens (line 101) | def _expand_image_tokens( method batch_decode (line 128) | def batch_decode(self, *args, **kwargs): method decode (line 135) | def decode(self, *args, **kwargs): method model_input_names (line 143) | def model_input_names(self): FILE: src/transformers/models/owlv2/configuration_owlv2.py class Owlv2TextConfig (line 28) | class Owlv2TextConfig(PreTrainedConfig): class Owlv2VisionConfig (line 67) | class Owlv2VisionConfig(PreTrainedConfig): class Owlv2Config (line 104) | class Owlv2Config(PreTrainedConfig): method __post_init__ (line 115) | def __post_init__(self, **kwargs): FILE: src/transformers/models/owlv2/convert_owlv2_to_hf.py function get_owlv2_config (line 46) | def get_owlv2_config(model_name): function flatten_nested_dict (line 96) | def flatten_nested_dict(params, parent_key="", sep="/"): function create_rename_keys (line 110) | def create_rename_keys(config, model_name): function rename_and_reshape_key (line 215) | def rename_and_reshape_key(dct, old, new, config): function convert_owlv2_checkpoint (line 236) | def convert_owlv2_checkpoint(model_name, checkpoint_path, pytorch_dump_f... FILE: src/transformers/models/owlv2/image_processing_owlv2.py function _upcast (line 39) | def _upcast(t): function box_area (line 47) | def box_area(boxes): function box_iou (line 62) | def box_iou(boxes1, boxes2): function _scale_boxes (line 78) | def _scale_boxes(boxes, target_sizes): class Owlv2ImageProcessor (line 110) | class Owlv2ImageProcessor(TorchvisionBackend): method __init__ (line 126) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method post_process_object_detection (line 136) | def post_process_object_detection( method post_process_image_guided_detection (line 189) | def post_process_image_guided_detection(self, outputs, threshold=0.0, ... method _pad_images (line 266) | def _pad_images(self, images: "torch.Tensor", constant_value: float = ... method pad (line 279) | def pad( method resize (line 303) | def resize( method _preprocess (line 357) | def _preprocess( FILE: src/transformers/models/owlv2/image_processing_pil_owlv2.py function _upcast (line 45) | def _upcast(t): function box_area (line 55) | def box_area(boxes): function box_iou (line 71) | def box_iou(boxes1, boxes2): function _preprocess_resize_output_shape (line 89) | def _preprocess_resize_output_shape(image, output_shape): function _clip_warp_output (line 128) | def _clip_warp_output(input_image, output_image): function _scale_boxes (line 158) | def _scale_boxes(boxes, target_sizes): class Owlv2ImageProcessorPil (line 191) | class Owlv2ImageProcessorPil(PilBackend): method __init__ (line 207) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method post_process_object_detection (line 218) | def post_process_object_detection( method post_process_image_guided_detection (line 274) | def post_process_image_guided_detection(self, outputs, threshold=0.0, ... method pad (line 353) | def pad(self, image: np.ndarray, constant_value: float = 0.0) -> np.nd... method resize (line 368) | def resize( method _preprocess (line 425) | def _preprocess( FILE: src/transformers/models/owlv2/modeling_owlv2.py function contrastive_loss (line 54) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function owlv2_loss (line 59) | def owlv2_loss(similarity: torch.Tensor) -> torch.Tensor: class Owlv2Output (line 67) | class Owlv2Output(ModelOutput): method to_tuple (line 96) | def to_tuple(self) -> tuple[Any]: function _upcast (line 104) | def _upcast(t: Tensor) -> Tensor: function box_area (line 113) | def box_area(boxes: Tensor) -> Tensor: function box_iou (line 130) | def box_iou(boxes1, boxes2): function generalized_box_iou (line 147) | def generalized_box_iou(boxes1, boxes2): class Owlv2ObjectDetectionOutput (line 177) | class Owlv2ObjectDetectionOutput(ModelOutput): method to_tuple (line 220) | def to_tuple(self) -> tuple[Any]: class Owlv2ImageGuidedObjectDetectionOutput (line 234) | class Owlv2ImageGuidedObjectDetectionOutput(ModelOutput): method to_tuple (line 272) | def to_tuple(self) -> tuple[Any]: class Owlv2VisionEmbeddings (line 280) | class Owlv2VisionEmbeddings(nn.Module): method __init__ (line 281) | def __init__(self, config: Owlv2VisionConfig): method interpolate_pos_encoding (line 302) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 343) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class Owlv2TextEmbeddings (line 358) | class Owlv2TextEmbeddings(nn.Module): method __init__ (line 359) | def __init__(self, config: Owlv2TextConfig): method forward (line 369) | def forward( function eager_attention_forward (line 390) | def eager_attention_forward( class Owlv2Attention (line 419) | class Owlv2Attention(nn.Module): method __init__ (line 422) | def __init__(self, config): method forward (line 442) | def forward( class Owlv2MLP (line 477) | class Owlv2MLP(nn.Module): method __init__ (line 478) | def __init__(self, config): method forward (line 485) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Owlv2EncoderLayer (line 493) | class Owlv2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 494) | def __init__(self, config: Owlv2VisionConfig | Owlv2TextConfig): method forward (line 502) | def forward( class Owlv2PreTrainedModel (line 528) | class Owlv2PreTrainedModel(PreTrainedModel): method _init_weights (line 548) | def _init_weights(self, module: nn.Module): class Owlv2Encoder (line 594) | class Owlv2Encoder(nn.Module): method __init__ (line 603) | def __init__(self, config: Owlv2Config): method forward (line 609) | def forward( class Owlv2TextTransformer (line 643) | class Owlv2TextTransformer(Owlv2PreTrainedModel): method __init__ (line 644) | def __init__(self, config: Owlv2TextConfig): method forward (line 658) | def forward( class Owlv2TextModel (line 707) | class Owlv2TextModel(Owlv2PreTrainedModel): method __init__ (line 711) | def __init__(self, config: Owlv2TextConfig): method get_input_embeddings (line 717) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 720) | def set_input_embeddings(self, value): method forward (line 724) | def forward( class Owlv2VisionTransformer (line 758) | class Owlv2VisionTransformer(Owlv2PreTrainedModel): method __init__ (line 759) | def __init__(self, config: Owlv2VisionConfig): method forward (line 773) | def forward( class Owlv2VisionModel (line 802) | class Owlv2VisionModel(Owlv2PreTrainedModel): method __init__ (line 807) | def __init__(self, config: Owlv2VisionConfig): method get_input_embeddings (line 813) | def get_input_embeddings(self) -> nn.Module: method forward (line 817) | def forward( class Owlv2Model (line 853) | class Owlv2Model(Owlv2PreTrainedModel): method __init__ (line 856) | def __init__(self, config: Owlv2Config): method get_text_features (line 878) | def get_text_features( method get_image_features (line 915) | def get_image_features( method forward (line 949) | def forward( class Owlv2BoxPredictionHead (line 1028) | class Owlv2BoxPredictionHead(nn.Module): method __init__ (line 1029) | def __init__(self, config: Owlv2Config, out_dim: int = 4): method forward (line 1038) | def forward(self, image_features: torch.Tensor) -> torch.FloatTensor: class Owlv2ClassPredictionHead (line 1048) | class Owlv2ClassPredictionHead(nn.Module): method __init__ (line 1049) | def __init__(self, config: Owlv2Config): method forward (line 1060) | def forward( class Owlv2ForObjectDetection (line 1096) | class Owlv2ForObjectDetection(Owlv2PreTrainedModel): method __init__ (line 1099) | def __init__(self, config: Owlv2Config): method normalize_grid_corner_coordinates (line 1121) | def normalize_grid_corner_coordinates(num_patches_height: int, num_pat... method objectness_predictor (line 1137) | def objectness_predictor(self, image_features: torch.FloatTensor) -> t... method compute_box_bias (line 1152) | def compute_box_bias(self, num_patches_height: int, num_patches_width:... method box_predictor (line 1171) | def box_predictor( method class_predictor (line 1205) | def class_predictor( method image_text_embedder (line 1225) | def image_text_embedder( method image_embedder (line 1273) | def image_embedder( method embed_image_query (line 1315) | def embed_image_query( method image_guided_detection (line 1361) | def image_guided_detection( method forward (line 1461) | def forward( FILE: src/transformers/models/owlv2/modular_owlv2.py function _preprocess_resize_output_shape (line 51) | def _preprocess_resize_output_shape(image, output_shape): function _clip_warp_output (line 90) | def _clip_warp_output(input_image, output_image): function _scale_boxes (line 120) | def _scale_boxes(boxes, target_sizes): class Owlv2ImageProcessor (line 152) | class Owlv2ImageProcessor(OwlViTImageProcessor): method _pad_images (line 165) | def _pad_images(self, images: "torch.Tensor", constant_value: float = ... method pad (line 178) | def pad( method resize (line 202) | def resize( method _preprocess (line 256) | def _preprocess( class Owlv2ImageProcessorPil (line 316) | class Owlv2ImageProcessorPil(OwlViTImageProcessorPil): method pad (line 329) | def pad(self, image: np.ndarray, constant_value: float = 0.0) -> np.nd... method resize (line 344) | def resize( method _preprocess (line 401) | def _preprocess( FILE: src/transformers/models/owlv2/processing_owlv2.py class Owlv2ImagesKwargs (line 38) | class Owlv2ImagesKwargs(ImagesKwargs, total=False): class Owlv2ProcessorKwargs (line 49) | class Owlv2ProcessorKwargs(ProcessingKwargs, total=False): class Owlv2Processor (line 62) | class Owlv2Processor(ProcessorMixin): method __init__ (line 63) | def __init__(self, image_processor, tokenizer, **kwargs): method __call__ (line 68) | def __call__( method post_process_grounded_object_detection (line 144) | def post_process_grounded_object_detection( method post_process_image_guided_detection (line 193) | def post_process_image_guided_detection( FILE: src/transformers/models/owlvit/configuration_owlvit.py class OwlViTTextConfig (line 27) | class OwlViTTextConfig(PreTrainedConfig): class OwlViTVisionConfig (line 65) | class OwlViTVisionConfig(PreTrainedConfig): class OwlViTConfig (line 101) | class OwlViTConfig(PreTrainedConfig): method __post_init__ (line 112) | def __post_init__(self, **kwargs): FILE: src/transformers/models/owlvit/convert_owlvit_original_flax_to_hf.py function flatten_nested_dict (line 78) | def flatten_nested_dict(params, parent_key="", sep="/"): function to_f32 (line 91) | def to_f32(params): function copy_attn_layer (line 95) | def copy_attn_layer(hf_attn_layer, pt_attn_layer): function copy_mlp (line 115) | def copy_mlp(hf_mlp, pt_mlp): function copy_linear (line 120) | def copy_linear(hf_linear, pt_linear): function copy_layer (line 125) | def copy_layer(hf_layer, pt_layer): function copy_layers (line 137) | def copy_layers(hf_layers, pt_layers): function copy_encoder (line 142) | def copy_encoder(hf_encoder, pt_model): function copy_text_model_and_projection (line 154) | def copy_text_model_and_projection(hf_model, pt_model): function copy_vision_model_and_projection (line 162) | def copy_vision_model_and_projection(hf_model, pt_model): function copy_class_merge_token (line 179) | def copy_class_merge_token(hf_model, flax_params): function copy_class_box_heads (line 188) | def copy_class_box_heads(hf_model, flax_params): function copy_flax_attn_params (line 226) | def copy_flax_attn_params(hf_backbone, flax_attn_params): function _convert_attn_layers (line 256) | def _convert_attn_layers(params): function convert_clip_backbone (line 275) | def convert_clip_backbone(flax_params, torch_config): function convert_owlvit_checkpoint (line 325) | def convert_owlvit_checkpoint(pt_backbone, flax_params, attn_params, pyt... FILE: src/transformers/models/owlvit/image_processing_owlvit.py function _upcast (line 34) | def _upcast(t): function _scale_boxes (line 42) | def _scale_boxes(boxes, target_sizes): function box_area (line 70) | def box_area(boxes): function box_iou (line 85) | def box_iou(boxes1, boxes2): class OwlViTImageProcessor (line 102) | class OwlViTImageProcessor(TorchvisionBackend): method __init__ (line 116) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method post_process_object_detection (line 126) | def post_process_object_detection( method post_process_image_guided_detection (line 179) | def post_process_image_guided_detection(self, outputs, threshold=0.0, ... FILE: src/transformers/models/owlvit/image_processing_pil_owlvit.py function _upcast (line 26) | def _upcast(t): function _scale_boxes (line 37) | def _scale_boxes(boxes, target_sizes): function box_area (line 66) | def box_area(boxes): function box_iou (line 82) | def box_iou(boxes1, boxes2): class OwlViTImageProcessorPil (line 108) | class OwlViTImageProcessorPil(PilBackend): method __init__ (line 122) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method post_process_object_detection (line 133) | def post_process_object_detection( method post_process_image_guided_detection (line 189) | def post_process_image_guided_detection(self, outputs, threshold=0.0, ... FILE: src/transformers/models/owlvit/modeling_owlvit.py function contrastive_loss (line 54) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function owlvit_loss (line 59) | def owlvit_loss(similarity: torch.Tensor) -> torch.Tensor: class OwlViTOutput (line 67) | class OwlViTOutput(ModelOutput): method to_tuple (line 96) | def to_tuple(self) -> tuple[Any]: function _upcast (line 104) | def _upcast(t: Tensor) -> Tensor: function box_area (line 113) | def box_area(boxes: Tensor) -> Tensor: function box_iou (line 130) | def box_iou(boxes1, boxes2): function generalized_box_iou (line 147) | def generalized_box_iou(boxes1, boxes2): class OwlViTObjectDetectionOutput (line 177) | class OwlViTObjectDetectionOutput(ModelOutput): method to_tuple (line 216) | def to_tuple(self) -> tuple[Any]: class OwlViTImageGuidedObjectDetectionOutput (line 229) | class OwlViTImageGuidedObjectDetectionOutput(ModelOutput): method to_tuple (line 267) | def to_tuple(self) -> tuple[Any]: class OwlViTVisionEmbeddings (line 274) | class OwlViTVisionEmbeddings(nn.Module): method __init__ (line 275) | def __init__(self, config: OwlViTVisionConfig): method interpolate_pos_encoding (line 296) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 334) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class OwlViTTextEmbeddings (line 347) | class OwlViTTextEmbeddings(nn.Module): method __init__ (line 348) | def __init__(self, config: OwlViTTextConfig): method forward (line 358) | def forward( function eager_attention_forward (line 379) | def eager_attention_forward( class OwlViTAttention (line 407) | class OwlViTAttention(nn.Module): method __init__ (line 410) | def __init__(self, config): method forward (line 430) | def forward( class OwlViTMLP (line 465) | class OwlViTMLP(nn.Module): method __init__ (line 466) | def __init__(self, config): method forward (line 473) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class OwlViTEncoderLayer (line 481) | class OwlViTEncoderLayer(GradientCheckpointingLayer): method __init__ (line 482) | def __init__(self, config: OwlViTVisionConfig | OwlViTTextConfig): method forward (line 490) | def forward( class OwlViTPreTrainedModel (line 515) | class OwlViTPreTrainedModel(PreTrainedModel): method _init_weights (line 535) | def _init_weights(self, module: nn.Module): class OwlViTEncoder (line 581) | class OwlViTEncoder(nn.Module): method __init__ (line 590) | def __init__(self, config: OwlViTConfig): method forward (line 596) | def forward( class OwlViTTextTransformer (line 629) | class OwlViTTextTransformer(OwlViTPreTrainedModel): method __init__ (line 630) | def __init__(self, config: OwlViTTextConfig): method forward (line 644) | def forward( class OwlViTTextModel (line 692) | class OwlViTTextModel(OwlViTPreTrainedModel): method __init__ (line 696) | def __init__(self, config: OwlViTTextConfig): method get_input_embeddings (line 702) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 705) | def set_input_embeddings(self, value): method forward (line 709) | def forward( class OwlViTVisionTransformer (line 742) | class OwlViTVisionTransformer(OwlViTPreTrainedModel): method __init__ (line 743) | def __init__(self, config: OwlViTVisionConfig): method forward (line 757) | def forward( class OwlViTVisionModel (line 785) | class OwlViTVisionModel(OwlViTPreTrainedModel): method __init__ (line 790) | def __init__(self, config: OwlViTVisionConfig): method get_input_embeddings (line 796) | def get_input_embeddings(self) -> nn.Module: method forward (line 800) | def forward( class OwlViTModel (line 835) | class OwlViTModel(OwlViTPreTrainedModel): method __init__ (line 838) | def __init__(self, config: OwlViTConfig): method get_text_features (line 860) | def get_text_features( method get_image_features (line 897) | def get_image_features( method forward (line 931) | def forward( class OwlViTBoxPredictionHead (line 1009) | class OwlViTBoxPredictionHead(nn.Module): method __init__ (line 1010) | def __init__(self, config: OwlViTConfig, out_dim: int = 4): method forward (line 1019) | def forward(self, image_features: torch.Tensor) -> torch.FloatTensor: class OwlViTClassPredictionHead (line 1028) | class OwlViTClassPredictionHead(nn.Module): method __init__ (line 1029) | def __init__(self, config: OwlViTConfig): method forward (line 1040) | def forward( class OwlViTForObjectDetection (line 1076) | class OwlViTForObjectDetection(OwlViTPreTrainedModel): method __init__ (line 1079) | def __init__(self, config: OwlViTConfig): method normalize_grid_corner_coordinates (line 1098) | def normalize_grid_corner_coordinates(num_patches_height: int, num_pat... method compute_box_bias (line 1114) | def compute_box_bias(self, num_patches_height: int, num_patches_width:... method box_predictor (line 1132) | def box_predictor( method class_predictor (line 1165) | def class_predictor( method image_text_embedder (line 1184) | def image_text_embedder( method image_embedder (line 1231) | def image_embedder( method embed_image_query (line 1272) | def embed_image_query( method image_guided_detection (line 1318) | def image_guided_detection( method forward (line 1403) | def forward( FILE: src/transformers/models/owlvit/processing_owlvit.py class OwlViTImagesKwargs (line 38) | class OwlViTImagesKwargs(ImagesKwargs, total=False): class OwlViTProcessorKwargs (line 49) | class OwlViTProcessorKwargs(ProcessingKwargs, total=False): class OwlViTProcessor (line 62) | class OwlViTProcessor(ProcessorMixin): method __init__ (line 63) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 67) | def __call__( method post_process (line 142) | def post_process(self, *args, **kwargs): method post_process_grounded_object_detection (line 149) | def post_process_grounded_object_detection( method post_process_image_guided_detection (line 197) | def post_process_image_guided_detection( FILE: src/transformers/models/paddleocr_vl/configuration_paddleocr_vl.py class PaddleOCRVisionConfig (line 37) | class PaddleOCRVisionConfig(PreTrainedConfig): class PaddleOCRTextConfig (line 73) | class PaddleOCRTextConfig(PreTrainedConfig): method __post_init__ (line 131) | def __post_init__(self, **kwargs): class PaddleOCRVLConfig (line 141) | class PaddleOCRVLConfig(PreTrainedConfig): method __post_init__ (line 172) | def __post_init__(self, **kwargs): FILE: src/transformers/models/paddleocr_vl/image_processing_paddleocr_vl.py class PaddleOCRVLImageProcessorKwargs (line 39) | class PaddleOCRVLImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 56) | def smart_resize( class PaddleOCRVLImageProcessor (line 89) | class PaddleOCRVLImageProcessor(TorchvisionBackend): method __init__ (line 105) | def __init__(self, **kwargs: Unpack[PaddleOCRVLImageProcessorKwargs]): method _standardize_kwargs (line 122) | def _standardize_kwargs( method preprocess (line 138) | def preprocess( method _preprocess (line 145) | def _preprocess( method get_number_of_image_patches (line 226) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/paddleocr_vl/image_processing_pil_paddleocr_vl.py class PaddleOCRVLImageProcessorKwargs (line 38) | class PaddleOCRVLImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 55) | def smart_resize( class PaddleOCRVLImageProcessorPil (line 88) | class PaddleOCRVLImageProcessorPil(PilBackend): method __init__ (line 104) | def __init__(self, **kwargs: Unpack[PaddleOCRVLImageProcessorKwargs]): method _standardize_kwargs (line 121) | def _standardize_kwargs( method preprocess (line 137) | def preprocess( method _preprocess (line 144) | def _preprocess( method get_number_of_image_patches (line 224) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/paddleocr_vl/modeling_paddleocr_vl.py class PaddleOCRProjector (line 55) | class PaddleOCRProjector(nn.Module): method __init__ (line 56) | def __init__(self, config: PaddleOCRVLConfig): method forward (line 67) | def forward(self, image_features: torch.Tensor, image_grid_thw: torch.... class PaddleOCRVisionRotaryEmbedding (line 91) | class PaddleOCRVisionRotaryEmbedding(nn.Module): method __init__ (line 94) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 101) | def forward(self, seqlen: int) -> torch.Tensor: class PaddleOCRRotaryEmbedding (line 107) | class PaddleOCRRotaryEmbedding(nn.Module): method __init__ (line 110) | def __init__(self, config: PaddleOCRVLConfig, device=None): method compute_default_rope_parameters (line 127) | def compute_default_rope_parameters( method forward (line 157) | def forward(self, x, position_ids): class PaddleOCRMLP (line 173) | class PaddleOCRMLP(nn.Module): method __init__ (line 174) | def __init__(self, config: PaddleOCRTextConfig): method forward (line 185) | def forward(self, x): function repeat_kv (line 190) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 202) | def eager_attention_forward( function rotate_half (line 227) | def rotate_half(x): function apply_multimodal_rotary_pos_emb (line 234) | def apply_multimodal_rotary_pos_emb(q, k, cos, sin, mrope_section, unsqu... class PaddleOCRAttention (line 279) | class PaddleOCRAttention(nn.Module): method __init__ (line 285) | def __init__(self, config: PaddleOCRVLConfig, layer_idx: int | None = ... method forward (line 313) | def forward( class PaddleOCRRMSNorm (line 365) | class PaddleOCRRMSNorm(nn.Module): method __init__ (line 366) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 374) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 381) | def extra_repr(self): class PaddleOCRDecoderLayer (line 385) | class PaddleOCRDecoderLayer(GradientCheckpointingLayer): method __init__ (line 386) | def __init__(self, config: PaddleOCRTextConfig, layer_idx: int): method forward (line 396) | def forward( class PaddleOCRVLPreTrainedModel (line 429) | class PaddleOCRVLPreTrainedModel(PreTrainedModel): method _init_weights (line 447) | def _init_weights(self, module): class PaddleOCRTextModel (line 457) | class PaddleOCRTextModel(PaddleOCRVLPreTrainedModel): method __init__ (line 458) | def __init__(self, config: PaddleOCRTextConfig): method forward (line 477) | def forward( class PaddleOCRVisionEmbeddings (line 538) | class PaddleOCRVisionEmbeddings(nn.Module): method __init__ (line 539) | def __init__(self, config: PaddleOCRVisionConfig): method interpolate_pos_encoding (line 559) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 588) | def forward( function apply_rotary_pos_emb_vision (line 623) | def apply_rotary_pos_emb_vision( class PaddleOCRVisionAttention (line 637) | class PaddleOCRVisionAttention(nn.Module): method __init__ (line 640) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 661) | def forward( class PaddleOCRVisionMLP (line 742) | class PaddleOCRVisionMLP(nn.Module): method __init__ (line 743) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 750) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PaddleOCRVisionEncoderLayer (line 757) | class PaddleOCRVisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 758) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 767) | def forward( class PaddleOCRVisionEncoder (line 799) | class PaddleOCRVisionEncoder(nn.Module): method __init__ (line 808) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 821) | def forward( class PaddleOCRVisionTransformer (line 879) | class PaddleOCRVisionTransformer(PaddleOCRVLPreTrainedModel): method __init__ (line 888) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 901) | def forward( class PaddleOCRVisionModel (line 939) | class PaddleOCRVisionModel(PaddleOCRVLPreTrainedModel): method __init__ (line 944) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 952) | def forward( class PaddleOCRVLModelOutputWithPast (line 982) | class PaddleOCRVLModelOutputWithPast(ModelOutput): class PaddleOCRVLCausalLMOutputWithPast (line 1006) | class PaddleOCRVLCausalLMOutputWithPast(ModelOutput): class PaddleOCRVLModel (line 1030) | class PaddleOCRVLModel(PaddleOCRVLPreTrainedModel): method __init__ (line 1036) | def __init__(self, config: PaddleOCRVLConfig): method get_input_embeddings (line 1046) | def get_input_embeddings(self): method set_input_embeddings (line 1049) | def set_input_embeddings(self, value): method get_vision_position_ids (line 1052) | def get_vision_position_ids( method get_rope_index (line 1108) | def get_rope_index( method get_image_features (line 1214) | def get_image_features( method get_placeholder_mask (line 1249) | def get_placeholder_mask( method compute_3d_position_ids (line 1273) | def compute_3d_position_ids( method forward (line 1323) | def forward( class PaddleOCRVLForConditionalGeneration (line 1383) | class PaddleOCRVLForConditionalGeneration(PaddleOCRVLPreTrainedModel, Ge... method __init__ (line 1387) | def __init__(self, config): method get_input_embeddings (line 1394) | def get_input_embeddings(self): method set_input_embeddings (line 1397) | def set_input_embeddings(self, value): method get_image_features (line 1401) | def get_image_features( method forward (line 1417) | def forward( method prepare_inputs_for_generation (line 1512) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1550) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1588) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1639) | def _expand_inputs_for_generation( FILE: src/transformers/models/paddleocr_vl/modular_paddleocr_vl.py function smart_resize (line 94) | def smart_resize( class PaddleOCRVLImageProcessorKwargs (line 126) | class PaddleOCRVLImageProcessorKwargs(ImagesKwargs, total=False): class PaddleOCRVLImageProcessorPil (line 143) | class PaddleOCRVLImageProcessorPil(Qwen2VLImageProcessorPil): method _preprocess (line 147) | def _preprocess( method get_number_of_image_patches (line 227) | def get_number_of_image_patches(self, height: int, width: int, images_... class PaddleOCRVLImageProcessor (line 254) | class PaddleOCRVLImageProcessor(Qwen2VLImageProcessor): method _preprocess (line 258) | def _preprocess( method get_number_of_image_patches (line 339) | def get_number_of_image_patches(self, height: int, width: int, images_... class PaddleOCRVLProcessorKwargs (line 366) | class PaddleOCRVLProcessorKwargs(ProcessingKwargs, total=False): class PaddleOCRVLProcessor (line 375) | class PaddleOCRVLProcessor(ProcessorMixin): method __init__ (line 391) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 396) | def __call__( class PaddleOCRVisionConfig (line 475) | class PaddleOCRVisionConfig(SiglipVisionConfig): class PaddleOCRTextConfig (line 507) | class PaddleOCRTextConfig(Ernie4_5Config): class PaddleOCRVLConfig (line 513) | class PaddleOCRVLConfig(Qwen2VLConfig): class PaddleOCRProjector (line 539) | class PaddleOCRProjector(nn.Module): method __init__ (line 540) | def __init__(self, config: PaddleOCRVLConfig): method forward (line 551) | def forward(self, image_features: torch.Tensor, image_grid_thw: torch.... class PaddleOCRVisionRotaryEmbedding (line 575) | class PaddleOCRVisionRotaryEmbedding(VisionRotaryEmbedding): class PaddleOCRRotaryEmbedding (line 579) | class PaddleOCRRotaryEmbedding(Qwen2VLRotaryEmbedding): class PaddleOCRMLP (line 583) | class PaddleOCRMLP(Ernie4_5MLP): method __init__ (line 584) | def __init__(self, config: PaddleOCRTextConfig): class PaddleOCRAttention (line 588) | class PaddleOCRAttention(Qwen2_5OmniAttention): method __init__ (line 589) | def __init__(self, config: PaddleOCRVLConfig, layer_idx: int | None = ... class PaddleOCRRMSNorm (line 599) | class PaddleOCRRMSNorm(Ernie4_5RMSNorm): class PaddleOCRDecoderLayer (line 603) | class PaddleOCRDecoderLayer(Ernie4_5DecoderLayer): method __init__ (line 604) | def __init__(self, config: PaddleOCRTextConfig, layer_idx: int): class PaddleOCRVLPreTrainedModel (line 609) | class PaddleOCRVLPreTrainedModel(PreTrainedModel): method _init_weights (line 627) | def _init_weights(self, module): class PaddleOCRTextModel (line 636) | class PaddleOCRTextModel(PaddleOCRVLPreTrainedModel, Ernie4_5Model): method __init__ (line 637) | def __init__(self, config: PaddleOCRTextConfig): method forward (line 643) | def forward( class PaddleOCRVisionEmbeddings (line 704) | class PaddleOCRVisionEmbeddings(SiglipVisionEmbeddings): method __init__ (line 705) | def __init__(self, config: PaddleOCRVisionConfig): method interpolate_pos_encoding (line 708) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 729) | def forward( class PaddleOCRVisionAttention (line 764) | class PaddleOCRVisionAttention(VideoLlama3VisionAttention): method __init__ (line 765) | def __init__(self, config: PaddleOCRVisionConfig): class PaddleOCRVisionMLP (line 769) | class PaddleOCRVisionMLP(SiglipMLP): method __init__ (line 770) | def __init__(self, config: PaddleOCRVisionConfig): class PaddleOCRVisionEncoderLayer (line 774) | class PaddleOCRVisionEncoderLayer(VideoLlama3VisionEncoderLayer): method __init__ (line 775) | def __init__(self, config: PaddleOCRVisionConfig): class PaddleOCRVisionEncoder (line 779) | class PaddleOCRVisionEncoder(VideoLlama3VisionEncoder): method __init__ (line 780) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 787) | def forward( class PaddleOCRVisionTransformer (line 845) | class PaddleOCRVisionTransformer(PaddleOCRVLPreTrainedModel): method __init__ (line 854) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 867) | def forward( class PaddleOCRVisionModel (line 905) | class PaddleOCRVisionModel(PaddleOCRVLPreTrainedModel): method __init__ (line 910) | def __init__(self, config: PaddleOCRVisionConfig): method forward (line 918) | def forward( class PaddleOCRVLModelOutputWithPast (line 942) | class PaddleOCRVLModelOutputWithPast(Qwen2VLModelOutputWithPast): class PaddleOCRVLCausalLMOutputWithPast (line 946) | class PaddleOCRVLCausalLMOutputWithPast(Qwen2VLCausalLMOutputWithPast): class PaddleOCRVLModel (line 950) | class PaddleOCRVLModel(Qwen2VLModel): method __init__ (line 953) | def __init__(self, config: PaddleOCRVLConfig): method get_input_embeddings (line 962) | def get_input_embeddings(self): method set_input_embeddings (line 965) | def set_input_embeddings(self, value): method get_video_features (line 968) | def get_video_features(self): method get_image_features (line 973) | def get_image_features( method get_placeholder_mask (line 1008) | def get_placeholder_mask( method forward (line 1033) | def forward( class PaddleOCRVLForConditionalGeneration (line 1093) | class PaddleOCRVLForConditionalGeneration(Qwen2VLForConditionalGeneration): method get_video_features (line 1096) | def get_video_features(self): method forward (line 1101) | def forward( FILE: src/transformers/models/paddleocr_vl/processing_paddleocr_vl.py class PaddleOCRVLProcessorKwargs (line 32) | class PaddleOCRVLProcessorKwargs(ProcessingKwargs, total=False): class PaddleOCRVLProcessor (line 41) | class PaddleOCRVLProcessor(ProcessorMixin): method __init__ (line 57) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 62) | def __call__( FILE: src/transformers/models/paligemma/configuration_paligemma.py class PaliGemmaConfig (line 24) | class PaliGemmaConfig(PreTrainedConfig): method __post_init__ (line 62) | def __post_init__(self, **kwargs): FILE: src/transformers/models/paligemma/convert_paligemma2_weights_to_hf.py function get_paligemma2_config (line 80) | def get_paligemma2_config(variant: str, precision: str): function slice_state_dict (line 134) | def slice_state_dict(state_dict, config): function flatten_nested_dict (line 281) | def flatten_nested_dict(params, parent_key="", sep="/", precision: int =... function convert_paligemma2_checkpoint (line 301) | def convert_paligemma2_checkpoint( FILE: src/transformers/models/paligemma/convert_paligemma_weights_to_hf.py function get_paligemma_config (line 45) | def get_paligemma_config(variant: str, precision: str): function slice_state_dict (line 91) | def slice_state_dict(state_dict, config): function flatten_nested_dict (line 205) | def flatten_nested_dict(params, parent_key="", sep="/"): function convert_paligemma_checkpoint (line 220) | def convert_paligemma_checkpoint( FILE: src/transformers/models/paligemma/modeling_paligemma.py class PaligemmaModelOutputWithPast (line 52) | class PaligemmaModelOutputWithPast(BaseModelOutputWithPast): class PaliGemmaCausalLMOutputWithPast (line 68) | class PaliGemmaCausalLMOutputWithPast(ModelOutput): class PaliGemmaMultiModalProjector (line 92) | class PaliGemmaMultiModalProjector(nn.Module): method __init__ (line 93) | def __init__(self, config: PaliGemmaConfig): method forward (line 97) | def forward(self, image_features): function token_type_ids_mask_function (line 103) | def token_type_ids_mask_function( function create_causal_mask_mapping (line 144) | def create_causal_mask_mapping( class PaliGemmaPreTrainedModel (line 217) | class PaliGemmaPreTrainedModel(PreTrainedModel): class PaliGemmaModel (line 236) | class PaliGemmaModel(PaliGemmaPreTrainedModel): method __init__ (line 240) | def __init__(self, config: PaliGemmaConfig): method get_input_embeddings (line 253) | def get_input_embeddings(self): method set_input_embeddings (line 257) | def set_input_embeddings(self, value): method get_image_features (line 264) | def get_image_features( method get_placeholder_mask (line 274) | def get_placeholder_mask( method forward (line 300) | def forward( class PaliGemmaForConditionalGeneration (line 407) | class PaliGemmaForConditionalGeneration(PaliGemmaPreTrainedModel, Genera... method __init__ (line 410) | def __init__(self, config: PaliGemmaConfig): method get_input_embeddings (line 416) | def get_input_embeddings(self): method set_input_embeddings (line 419) | def set_input_embeddings(self, value): method get_image_features (line 423) | def get_image_features(self, pixel_values: torch.FloatTensor, **kwargs... method forward (line 428) | def forward( method prepare_inputs_for_generation (line 504) | def prepare_inputs_for_generation( method create_masks_for_generate (line 549) | def create_masks_for_generate( FILE: src/transformers/models/paligemma/processing_paligemma.py class PaliGemmaTextKwargs (line 39) | class PaliGemmaTextKwargs(TextKwargs): class PaliGemmaProcessorKwargs (line 49) | class PaliGemmaProcessorKwargs(ProcessingKwargs, total=False): function is_url (line 63) | def is_url(val) -> bool: function is_image_or_image_url (line 68) | def is_image_or_image_url(elem): function _is_str_or_image (line 72) | def _is_str_or_image(elem): function build_string_from_input (line 76) | def build_string_from_input(prompt, bos_token, image_seq_len, image_toke... class PaliGemmaProcessor (line 99) | class PaliGemmaProcessor(ProcessorMixin): method __init__ (line 100) | def __init__( method __call__ (line 129) | def __call__( method _get_num_multimodal_tokens (line 247) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 266) | def model_input_names(self): FILE: src/transformers/models/parakeet/configuration_parakeet.py class ParakeetEncoderConfig (line 24) | class ParakeetEncoderConfig(PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): class ParakeetCTCConfig (line 95) | class ParakeetCTCConfig(PreTrainedConfig): method __post_init__ (line 129) | def __post_init__(self, **kwargs): FILE: src/transformers/models/parakeet/convert_nemo_to_hf.py function convert_key (line 52) | def convert_key(key, mapping): function extract_nemo_archive (line 58) | def extract_nemo_archive(nemo_file_path: str, extract_dir: str) -> dict[... function write_processor (line 151) | def write_processor(nemo_config: dict, model_files, output_dir, push_to_... function convert_encoder_config (line 207) | def convert_encoder_config(nemo_config): function load_and_convert_state_dict (line 260) | def load_and_convert_state_dict(model_files): function write_ctc_model (line 275) | def write_ctc_model(encoder_config, converted_state_dict, output_dir, pu... function write_encoder_model (line 301) | def write_encoder_model(encoder_config, converted_state_dict, output_dir... function write_model (line 332) | def write_model(nemo_config, model_files, model_type, output_dir, push_t... function main (line 350) | def main( FILE: src/transformers/models/parakeet/feature_extraction_parakeet.py class ParakeetFeatureExtractor (line 36) | class ParakeetFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 65) | def __init__( method _torch_extract_fbank_features (line 99) | def _torch_extract_fbank_features(self, waveform, device="cpu"): method __call__ (line 127) | def __call__( FILE: src/transformers/models/parakeet/modeling_parakeet.py class ParakeetEncoderModelOutput (line 47) | class ParakeetEncoderModelOutput(BaseModelOutput): class ParakeetEncoderRelPositionalEncoding (line 51) | class ParakeetEncoderRelPositionalEncoding(nn.Module): method __init__ (line 56) | def __init__(self, config: ParakeetEncoderConfig, device=None): method forward (line 71) | def forward(self, hidden_states: torch.Tensor): class ParakeetEncoderFeedForward (line 101) | class ParakeetEncoderFeedForward(nn.Module): method __init__ (line 102) | def __init__(self, config: ParakeetEncoderConfig): method forward (line 109) | def forward(self, hidden_states): class ParakeetEncoderConvolutionModule (line 116) | class ParakeetEncoderConvolutionModule(nn.Module): method __init__ (line 117) | def __init__(self, config: ParakeetEncoderConfig, module_config=None): method forward (line 151) | def forward(self, hidden_states, attention_mask=None): function rotate_half (line 188) | def rotate_half(x): function apply_rotary_pos_emb (line 196) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 221) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 233) | def eager_attention_forward( class ParakeetEncoderAttention (line 259) | class ParakeetEncoderAttention(nn.Module): method __init__ (line 262) | def __init__(self, config: ParakeetEncoderConfig, layer_idx: int): method forward (line 291) | def forward( method _rel_shift (line 348) | def _rel_shift(self, attention_scores): class ParakeetEncoderSubsamplingConv2D (line 357) | class ParakeetEncoderSubsamplingConv2D(nn.Module): method __init__ (line 358) | def __init__(self, config: ParakeetEncoderConfig): method _get_output_length (line 393) | def _get_output_length(self, input_lengths: torch.Tensor, conv_layer: ... method forward (line 404) | def forward(self, input_features: torch.Tensor, attention_mask: torch.... class ParakeetEncoderBlock (line 426) | class ParakeetEncoderBlock(GradientCheckpointingLayer): method __init__ (line 427) | def __init__(self, config: ParakeetEncoderConfig, layer_idx: int | Non... method forward (line 442) | def forward( class ParakeetPreTrainedModel (line 474) | class ParakeetPreTrainedModel(PreTrainedModel): method _init_weights (line 496) | def _init_weights(self, module): method _get_subsampling_output_length (line 515) | def _get_subsampling_output_length(self, input_lengths: torch.Tensor): method _get_output_attention_mask (line 532) | def _get_output_attention_mask(self, attention_mask: torch.Tensor, tar... class ParakeetEncoder (line 549) | class ParakeetEncoder(ParakeetPreTrainedModel): method __init__ (line 553) | def __init__(self, config: ParakeetEncoderConfig): method forward (line 576) | def forward( class ParakeetGenerateOutput (line 645) | class ParakeetGenerateOutput(ModelOutput): class ParakeetForCTC (line 676) | class ParakeetForCTC(ParakeetPreTrainedModel): method __init__ (line 679) | def __init__(self, config: ParakeetCTCConfig): method forward (line 689) | def forward( method generate (line 761) | def generate( FILE: src/transformers/models/parakeet/modular_parakeet.py class ParakeetEncoderModelOutput (line 43) | class ParakeetEncoderModelOutput(BaseModelOutput): class ParakeetEncoderRelPositionalEncoding (line 47) | class ParakeetEncoderRelPositionalEncoding(nn.Module): method __init__ (line 52) | def __init__(self, config: ParakeetEncoderConfig, device=None): method forward (line 67) | def forward(self, hidden_states: torch.Tensor): class ParakeetEncoderFeedForward (line 97) | class ParakeetEncoderFeedForward(nn.Module): method __init__ (line 98) | def __init__(self, config: ParakeetEncoderConfig): method forward (line 105) | def forward(self, hidden_states): class ParakeetEncoderConvolutionModule (line 112) | class ParakeetEncoderConvolutionModule(FastSpeech2ConformerConvolutionMo... method __init__ (line 113) | def __init__(self, config: ParakeetEncoderConfig, module_config=None): class ParakeetEncoderAttention (line 117) | class ParakeetEncoderAttention(LlamaAttention): method __init__ (line 120) | def __init__(self, config: ParakeetEncoderConfig, layer_idx: int): method forward (line 130) | def forward( method _rel_shift (line 187) | def _rel_shift(self, attention_scores): class ParakeetEncoderSubsamplingConv2D (line 196) | class ParakeetEncoderSubsamplingConv2D(nn.Module): method __init__ (line 197) | def __init__(self, config: ParakeetEncoderConfig): method _get_output_length (line 232) | def _get_output_length(self, input_lengths: torch.Tensor, conv_layer: ... method forward (line 243) | def forward(self, input_features: torch.Tensor, attention_mask: torch.... class ParakeetEncoderBlock (line 265) | class ParakeetEncoderBlock(GradientCheckpointingLayer): method __init__ (line 266) | def __init__(self, config: ParakeetEncoderConfig, layer_idx: int | Non... method forward (line 281) | def forward( class ParakeetPreTrainedModel (line 313) | class ParakeetPreTrainedModel(PreTrainedModel): method _init_weights (line 335) | def _init_weights(self, module): method _get_subsampling_output_length (line 354) | def _get_subsampling_output_length(self, input_lengths: torch.Tensor): method _get_output_attention_mask (line 371) | def _get_output_attention_mask(self, attention_mask: torch.Tensor, tar... class ParakeetEncoder (line 388) | class ParakeetEncoder(ParakeetPreTrainedModel): method __init__ (line 392) | def __init__(self, config: ParakeetEncoderConfig): method forward (line 415) | def forward( class ParakeetGenerateOutput (line 484) | class ParakeetGenerateOutput(ModelOutput): class ParakeetForCTC (line 515) | class ParakeetForCTC(ParakeetPreTrainedModel): method __init__ (line 518) | def __init__(self, config: ParakeetCTCConfig): method forward (line 528) | def forward( method generate (line 600) | def generate( FILE: src/transformers/models/parakeet/processing_parakeet.py class ParakeetProcessorKwargs (line 24) | class ParakeetProcessorKwargs(ProcessingKwargs, total=False): class ParakeetProcessor (line 41) | class ParakeetProcessor(ProcessorMixin): method __init__ (line 42) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 46) | def __call__( method model_input_names (line 89) | def model_input_names(self): FILE: src/transformers/models/parakeet/tokenization_parakeet.py class ParakeetTokenizer (line 20) | class ParakeetTokenizer(TokenizersBackend): method _decode (line 28) | def _decode( FILE: src/transformers/models/patchtsmixer/configuration_patchtsmixer.py class PatchTSMixerConfig (line 24) | class PatchTSMixerConfig(PreTrainedConfig): method __post_init__ (line 160) | def __post_init__(self, **kwargs): FILE: src/transformers/models/patchtsmixer/modeling_patchtsmixer.py class PatchTSMixerGatedAttention (line 38) | class PatchTSMixerGatedAttention(nn.Module): method __init__ (line 47) | def __init__(self, in_size: int, out_size: int): method forward (line 52) | def forward(self, inputs): class PatchTSMixerBatchNorm (line 59) | class PatchTSMixerBatchNorm(nn.Module): method __init__ (line 64) | def __init__(self, config: PatchTSMixerConfig): method forward (line 68) | def forward(self, inputs: torch.Tensor): class PatchTSMixerPositionalEncoding (line 81) | class PatchTSMixerPositionalEncoding(nn.Module): method __init__ (line 86) | def __init__(self, config: PatchTSMixerConfig): method _init_pe (line 95) | def _init_pe(config: PatchTSMixerConfig) -> nn.Parameter: method forward (line 114) | def forward(self, patch_input: torch.Tensor): class PatchTSMixerNormLayer (line 120) | class PatchTSMixerNormLayer(nn.Module): method __init__ (line 128) | def __init__(self, config: PatchTSMixerConfig): method forward (line 138) | def forward(self, inputs: torch.Tensor): class PatchTSMixerMLP (line 169) | class PatchTSMixerMLP(nn.Module): method __init__ (line 170) | def __init__(self, in_features, out_features, config): method forward (line 178) | def forward(self, inputs: torch.Tensor): class PatchTSMixerChannelFeatureMixerBlock (line 192) | class PatchTSMixerChannelFeatureMixerBlock(nn.Module): method __init__ (line 200) | def __init__(self, config: PatchTSMixerConfig): method forward (line 216) | def forward(self, inputs: torch.Tensor): function eager_attention_forward (line 241) | def eager_attention_forward( class PatchTSMixerAttention (line 270) | class PatchTSMixerAttention(nn.Module): method __init__ (line 273) | def __init__( method forward (line 304) | def forward( class PatchMixerBlock (line 356) | class PatchMixerBlock(nn.Module): method __init__ (line 364) | def __init__(self, config: PatchTSMixerConfig): method forward (line 390) | def forward(self, hidden_state): class FeatureMixerBlock (line 426) | class FeatureMixerBlock(nn.Module): method __init__ (line 435) | def __init__(self, config: PatchTSMixerConfig): method forward (line 451) | def forward(self, hidden: torch.Tensor): class PatchTSMixerLayer (line 471) | class PatchTSMixerLayer(nn.Module): method __init__ (line 481) | def __init__(self, config: PatchTSMixerConfig): method forward (line 492) | def forward(self, hidden: torch.Tensor): class PatchTSMixerBlock (line 509) | class PatchTSMixerBlock(nn.Module): method __init__ (line 517) | def __init__(self, config: PatchTSMixerConfig): method forward (line 524) | def forward(self, hidden_state, output_hidden_states: bool = False): class PatchTSMixerForPredictionHead (line 550) | class PatchTSMixerForPredictionHead(nn.Module): method __init__ (line 558) | def __init__(self, config: PatchTSMixerConfig, distribution_output=None): method forward (line 576) | def forward(self, hidden_features): class PatchTSMixerLinearHead (line 606) | class PatchTSMixerLinearHead(nn.Module): method __init__ (line 614) | def __init__(self, config: PatchTSMixerConfig, distribution_output=None): method forward (line 642) | def forward(self, hidden_features): class PatchTSMixerPreTrainedModel (line 678) | class PatchTSMixerPreTrainedModel(PreTrainedModel): method _init_weights (line 687) | def _init_weights(self, module): class PatchTSMixerPretrainHead (line 709) | class PatchTSMixerPretrainHead(nn.Module): method __init__ (line 717) | def __init__(self, config: PatchTSMixerConfig): method forward (line 723) | def forward(self, hidden_features): function random_masking (line 740) | def random_masking( function forecast_masking (line 799) | def forecast_masking( class PatchTSMixerPatchify (line 868) | class PatchTSMixerPatchify(nn.Module): method __init__ (line 876) | def __init__(self, config: PatchTSMixerConfig): method forward (line 893) | def forward(self, past_values: torch.Tensor): class PatchTSMixerMasking (line 917) | class PatchTSMixerMasking(nn.Module): method __init__ (line 930) | def __init__(self, config: PatchTSMixerConfig): method forward (line 941) | def forward(self, patch_input: torch.Tensor): class PatchTSMixerStdScaler (line 978) | class PatchTSMixerStdScaler(nn.Module): method __init__ (line 984) | def __init__(self, config: PatchTSMixerConfig): method forward (line 990) | def forward( class PatchTSMixerMeanScaler (line 1014) | class PatchTSMixerMeanScaler(nn.Module): method __init__ (line 1020) | def __init__(self, config: PatchTSMixerConfig): method forward (line 1027) | def forward( class PatchTSMixerNOPScaler (line 1069) | class PatchTSMixerNOPScaler(nn.Module): method __init__ (line 1074) | def __init__(self, config: PatchTSMixerConfig): method forward (line 1079) | def forward( class PatchTSMixerEncoderOutput (line 1102) | class PatchTSMixerEncoderOutput(ModelOutput): class PatchTSMixerEncoder (line 1114) | class PatchTSMixerEncoder(PatchTSMixerPreTrainedModel): method __init__ (line 1123) | def __init__(self, config: PatchTSMixerConfig): method forward (line 1139) | def forward( class PatchTSMixerModelOutput (line 1189) | class PatchTSMixerModelOutput(ModelOutput): class PatchTSMixerModel (line 1220) | class PatchTSMixerModel(PatchTSMixerPreTrainedModel): method __init__ (line 1221) | def __init__(self, config: PatchTSMixerConfig, mask_input: bool = False): method forward (line 1248) | def forward( class PatchTSMixerForPreTrainingOutput (line 1323) | class PatchTSMixerForPreTrainingOutput(ModelOutput): class PatchTSMixerForPretraining (line 1346) | class PatchTSMixerForPretraining(PatchTSMixerPreTrainedModel): method __init__ (line 1347) | def __init__(self, config: PatchTSMixerConfig): method forward (line 1358) | def forward( class PatchTSMixerForPredictionOutput (line 1436) | class PatchTSMixerForPredictionOutput(ModelOutput): class SamplePatchTSMixerPredictionOutput (line 1467) | class SamplePatchTSMixerPredictionOutput(ModelOutput): class SamplePatchTSMixerRegressionOutput (line 1483) | class SamplePatchTSMixerRegressionOutput(ModelOutput): function nll (line 1493) | def nll(input: torch.distributions.Distribution, target: torch.Tensor) -... function weighted_average (line 1501) | def weighted_average(input_tensor: torch.Tensor, weights: torch.Tensor |... class PatchTSMixerForPrediction (line 1525) | class PatchTSMixerForPrediction(PatchTSMixerPreTrainedModel): method __init__ (line 1537) | def __init__(self, config: PatchTSMixerConfig): method forward (line 1569) | def forward( method generate (line 1692) | def generate( class PatchTSMixerForTimeSeriesClassificationOutput (line 1746) | class PatchTSMixerForTimeSeriesClassificationOutput(ModelOutput): class PatchTSMixerForTimeSeriesClassification (line 1764) | class PatchTSMixerForTimeSeriesClassification(PatchTSMixerPreTrainedModel): method __init__ (line 1776) | def __init__(self, config: PatchTSMixerConfig): method forward (line 1793) | def forward( class PatchTSMixerForRegressionOutput (line 1880) | class PatchTSMixerForRegressionOutput(ModelOutput): class InjectScalerStatistics4D (line 1898) | class InjectScalerStatistics4D(nn.Module): method __init__ (line 1899) | def __init__(self, d_model: int, num_patches: int, expansion: int = 2): method forward (line 1908) | def forward(self, inputs: torch.Tensor, loc: torch.Tensor, scale: torc... class PatchTSMixerForRegression (line 1943) | class PatchTSMixerForRegression(PatchTSMixerPreTrainedModel): method __init__ (line 1944) | def __init__(self, config: PatchTSMixerConfig): method forward (line 1983) | def forward( method generate (line 2077) | def generate( FILE: src/transformers/models/patchtst/configuration_patchtst.py class PatchTSTConfig (line 24) | class PatchTSTConfig(PreTrainedConfig): FILE: src/transformers/models/patchtst/modeling_patchtst.py function eager_attention_forward (line 39) | def eager_attention_forward( class PatchTSTAttention (line 68) | class PatchTSTAttention(nn.Module): method __init__ (line 71) | def __init__( method forward (line 102) | def forward( class PatchTSTBatchNorm (line 154) | class PatchTSTBatchNorm(nn.Module): method __init__ (line 159) | def __init__(self, config: PatchTSTConfig): method forward (line 163) | def forward(self, inputs: torch.Tensor): function random_masking (line 176) | def random_masking( function forecast_masking (line 234) | def forecast_masking( class PatchTSTPatchify (line 302) | class PatchTSTPatchify(nn.Module): method __init__ (line 310) | def __init__(self, config: PatchTSTConfig): method forward (line 327) | def forward(self, past_values: torch.Tensor): class PatchTSTMasking (line 350) | class PatchTSTMasking(nn.Module): method __init__ (line 363) | def __init__(self, config: PatchTSTConfig): method forward (line 374) | def forward(self, patch_input: torch.Tensor): class PatchTSTEncoderLayer (line 410) | class PatchTSTEncoderLayer(nn.Module): method __init__ (line 415) | def __init__(self, config: PatchTSTConfig): method forward (line 465) | def forward(self, hidden_state: torch.Tensor, output_attentions: bool ... class PatchTSTPreTrainedModel (line 550) | class PatchTSTPreTrainedModel(PreTrainedModel): method _init_weights (line 561) | def _init_weights(self, module: nn.Module): method _set_gradient_checkpointing (line 596) | def _set_gradient_checkpointing(self, module, value=False): class PatchTSTEmbedding (line 601) | class PatchTSTEmbedding(nn.Module): method __init__ (line 602) | def __init__(self, config: PatchTSTConfig): method forward (line 614) | def forward(self, patch_input: torch.Tensor): class PatchTSTPositionalEncoding (line 637) | class PatchTSTPositionalEncoding(nn.Module): method __init__ (line 642) | def __init__(self, config: PatchTSTConfig, num_patches: int): method _init_pe (line 658) | def _init_pe(config: PatchTSTConfig, num_patches: int) -> nn.Parameter: method forward (line 677) | def forward(self, patch_input: torch.Tensor): class PatchTSTEncoder (line 693) | class PatchTSTEncoder(PatchTSTPreTrainedModel): method __init__ (line 698) | def __init__(self, config: PatchTSTConfig, num_patches: int): method forward (line 712) | def forward( class PatchTSTModelOutput (line 762) | class PatchTSTModelOutput(ModelOutput): class PatchTSTForPretrainingOutput (line 795) | class PatchTSTForPretrainingOutput(ModelOutput): class PatchTSTForRegressionOutput (line 815) | class PatchTSTForRegressionOutput(ModelOutput): class PatchTSTForPredictionOutput (line 835) | class PatchTSTForPredictionOutput(ModelOutput): class PatchTSTForClassificationOutput (line 867) | class PatchTSTForClassificationOutput(ModelOutput): class SamplePatchTSTOutput (line 889) | class SamplePatchTSTOutput(ModelOutput): function nll (line 899) | def nll(input: torch.distributions.Distribution, target: torch.Tensor) -... function weighted_average (line 907) | def weighted_average(input_tensor: torch.Tensor, weights: torch.Tensor |... class PatchTSTStdScaler (line 932) | class PatchTSTStdScaler(nn.Module): method __init__ (line 938) | def __init__(self, config: PatchTSTConfig): method forward (line 944) | def forward( class PatchTSTMeanScaler (line 968) | class PatchTSTMeanScaler(nn.Module): method __init__ (line 974) | def __init__(self, config: PatchTSTConfig): method forward (line 981) | def forward( class PatchTSTNOPScaler (line 1023) | class PatchTSTNOPScaler(nn.Module): method __init__ (line 1028) | def __init__(self, config: PatchTSTConfig): method forward (line 1033) | def forward( class PatchTSTScaler (line 1050) | class PatchTSTScaler(nn.Module): method __init__ (line 1051) | def __init__(self, config: PatchTSTConfig): method forward (line 1060) | def forward( class PatchTSTModel (line 1079) | class PatchTSTModel(PatchTSTPreTrainedModel): method __init__ (line 1080) | def __init__(self, config: PatchTSTConfig): method forward (line 1098) | def forward( class PatchTSTMaskPretrainHead (line 1192) | class PatchTSTMaskPretrainHead(nn.Module): method __init__ (line 1197) | def __init__(self, config: PatchTSTConfig): method forward (line 1203) | def forward(self, embedding: torch.Tensor) -> torch.Tensor: class PatchTSTForPretraining (line 1225) | class PatchTSTForPretraining(PatchTSTPreTrainedModel): method __init__ (line 1226) | def __init__(self, config: PatchTSTConfig): method forward (line 1236) | def forward( class PatchTSTClassificationHead (line 1337) | class PatchTSTClassificationHead(nn.Module): method __init__ (line 1338) | def __init__(self, config: PatchTSTConfig): method forward (line 1346) | def forward(self, embedding: torch.Tensor): class PatchTSTForClassification (line 1379) | class PatchTSTForClassification(PatchTSTPreTrainedModel): method __init__ (line 1380) | def __init__(self, config: PatchTSTConfig): method forward (line 1395) | def forward( class PatchTSTPredictionHead (line 1472) | class PatchTSTPredictionHead(nn.Module): method __init__ (line 1473) | def __init__(self, config: PatchTSTConfig, num_patches: int, distribut... method forward (line 1516) | def forward(self, embedding: torch.Tensor): class PatchTSTForPrediction (line 1573) | class PatchTSTForPrediction(PatchTSTPreTrainedModel): method __init__ (line 1574) | def __init__(self, config: PatchTSTConfig): method forward (line 1603) | def forward( method generate (line 1714) | def generate( class PatchTSTRegressionHead (line 1762) | class PatchTSTRegressionHead(nn.Module): method __init__ (line 1767) | def __init__(self, config: PatchTSTConfig, distribution_output=None): method forward (line 1784) | def forward(self, embedding: torch.Tensor): class PatchTSTForRegression (line 1822) | class PatchTSTForRegression(PatchTSTPreTrainedModel): method __init__ (line 1823) | def __init__(self, config: PatchTSTConfig): method forward (line 1850) | def forward( method generate (line 1925) | def generate( FILE: src/transformers/models/pe_audio/configuration_pe_audio.py class PeAudioEncoderConfig (line 26) | class PeAudioEncoderConfig(PreTrainedConfig): method __post_init__ (line 70) | def __post_init__(self, **kwargs): class PeAudioConfig (line 90) | class PeAudioConfig(PretrainedConfig): method __post_init__ (line 122) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pe_audio/feature_extraction_pe_audio.py class PeAudioFeatureExtractor (line 26) | class PeAudioFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 46) | def __init__( method _reflect_pad (line 57) | def _reflect_pad(self, wav): method __call__ (line 63) | def __call__( FILE: src/transformers/models/pe_audio/modeling_pe_audio.py class Snake1d (line 47) | class Snake1d(nn.Module): method __init__ (line 52) | def __init__(self, hidden_dim): method forward (line 56) | def forward(self, hidden_states): class PeAudioDacResidualUnit (line 64) | class PeAudioDacResidualUnit(nn.Module): method __init__ (line 69) | def __init__(self, dimension: int = 16, dilation: int = 1): method forward (line 78) | def forward(self, hidden_state): class PeAudioDacEncoderBlock (line 101) | class PeAudioDacEncoderBlock(nn.Module): method __init__ (line 104) | def __init__(self, config: PreTrainedConfig, stride: int = 1, stride_i... method forward (line 116) | def forward(self, hidden_state): class PeAudioDacEncoder (line 125) | class PeAudioDacEncoder(nn.Module): method __init__ (line 128) | def __init__(self, config: PreTrainedConfig): method forward (line 146) | def forward(self, hidden_state): class PeAudioEncoderEmbedder (line 158) | class PeAudioEncoderEmbedder(nn.Module): method __init__ (line 159) | def __init__(self, config: PeAudioEncoderConfig): method forward (line 166) | def forward( class PeAudioContrastiveHead (line 184) | class PeAudioContrastiveHead(nn.Module): method __init__ (line 185) | def __init__( method forward (line 194) | def forward(self, x: torch.Tensor) -> torch.FloatTensor: class PeAudioMaskedGroupNorm (line 198) | class PeAudioMaskedGroupNorm(nn.GroupNorm): method forward (line 199) | def forward(self, x, padding_mask=None): class PeAudioConvBlock1d (line 222) | class PeAudioConvBlock1d(nn.Module): method __init__ (line 223) | def __init__(self, config): method forward (line 234) | def forward(self, x, padding_mask=None): class PeAudioResnetBlock1d (line 240) | class PeAudioResnetBlock1d(nn.Module): method __init__ (line 241) | def __init__(self, config): method forward (line 246) | def forward(self, hidden_states, padding_mask=None): class PeAudioEncoderPatchEmbedder (line 269) | class PeAudioEncoderPatchEmbedder(nn.Module): method __init__ (line 270) | def __init__(self, config): method forward (line 275) | def forward(self, inputs_embeds, padding_mask=None): function repeat_kv (line 290) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 302) | def eager_attention_forward( function stack_freqs (line 327) | def stack_freqs(cos: torch.Tensor, sin: torch.Tensor): function apply_rotary_pos_emb (line 335) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class PeAudioEncoderRMSNorm (line 344) | class PeAudioEncoderRMSNorm(nn.Module): method __init__ (line 345) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 353) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 360) | def extra_repr(self): class PeAudioEncoderAttention (line 365) | class PeAudioEncoderAttention(nn.Module): method __init__ (line 368) | def __init__(self, config, layer_idx): method forward (line 398) | def forward( class PeAudioEncoderMLP (line 435) | class PeAudioEncoderMLP(nn.Module): method __init__ (line 436) | def __init__(self, config): method forward (line 446) | def forward(self, x): class PeAudioEncoderLayer (line 451) | class PeAudioEncoderLayer(GradientCheckpointingLayer): method __init__ (line 452) | def __init__(self, config, layer_idx): method forward (line 462) | def forward( class PeAudioPreTrainedModel (line 495) | class PeAudioPreTrainedModel(PreTrainedModel): method _init_weights (line 513) | def _init_weights(self, module): class PeAudioEncoderOutput (line 542) | class PeAudioEncoderOutput(BaseModelOutputWithPooling): class PeAudioEncoderRotaryEmbedding (line 547) | class PeAudioEncoderRotaryEmbedding(nn.Module): method __init__ (line 550) | def __init__(self, config: PeAudioEncoderConfig, device=None): method compute_default_rope_parameters (line 567) | def compute_default_rope_parameters( method forward (line 598) | def forward(self, x, position_ids): class PeAudioEncoder (line 617) | class PeAudioEncoder(PeAudioPreTrainedModel): method __init__ (line 622) | def __init__(self, config: PeAudioEncoderConfig): method forward (line 639) | def forward( class PeAudioOutput (line 680) | class PeAudioOutput(ModelOutput): method to_tuple (line 688) | def to_tuple(self) -> tuple[Any]: class PeAudioModel (line 694) | class PeAudioModel(PeAudioPreTrainedModel): method __init__ (line 695) | def __init__(self, config: PeAudioConfig): method get_text_audio_embeds (line 708) | def get_text_audio_embeds(self, input_ids, attention_mask=None): method get_audio_embeds (line 718) | def get_audio_embeds(self, input_values, padding_mask=None): method forward (line 728) | def forward( class PeAudioFrameLevelModel (line 773) | class PeAudioFrameLevelModel(PeAudioModel): method get_audio_embeds (line 774) | def get_audio_embeds(self, input_values, padding_mask=None): method forward (line 785) | def forward( FILE: src/transformers/models/pe_audio/modular_pe_audio.py class PeAudioDacEncoderBlock (line 38) | class PeAudioDacEncoderBlock(DacEncoderBlock): method __init__ (line 39) | def __init__(self, config: PreTrainedConfig, stride: int = 1, stride_i... class PeAudioDacEncoder (line 43) | class PeAudioDacEncoder(DacEncoder): method __init__ (line 44) | def __init__(self, config: PreTrainedConfig): class PeAudioEncoderEmbedder (line 48) | class PeAudioEncoderEmbedder(nn.Module): method __init__ (line 49) | def __init__(self, config: PeAudioEncoderConfig): method forward (line 56) | def forward( class PeAudioContrastiveHead (line 74) | class PeAudioContrastiveHead(PeAudioVideoContrastiveHead): ... class PeAudioPreTrainedModel (line 77) | class PeAudioPreTrainedModel(PeAudioVideoPreTrainedModel): method _init_weights (line 81) | def _init_weights(self, module): class PeAudioEncoderOutput (line 100) | class PeAudioEncoderOutput(BaseModelOutputWithPooling): class PeAudioEncoder (line 111) | class PeAudioEncoder(PeAudioVideoEncoder): method forward (line 117) | def forward( class PeAudioOutput (line 158) | class PeAudioOutput(ModelOutput): method to_tuple (line 166) | def to_tuple(self) -> tuple[Any]: class PeAudioModel (line 172) | class PeAudioModel(PeAudioPreTrainedModel): method __init__ (line 173) | def __init__(self, config: PeAudioConfig): method get_text_audio_embeds (line 186) | def get_text_audio_embeds(self, input_ids, attention_mask=None): method get_audio_embeds (line 196) | def get_audio_embeds(self, input_values, padding_mask=None): method forward (line 206) | def forward( class PeAudioFrameLevelModel (line 251) | class PeAudioFrameLevelModel(PeAudioModel): method get_audio_embeds (line 252) | def get_audio_embeds(self, input_values, padding_mask=None): method forward (line 263) | def forward( FILE: src/transformers/models/pe_audio/processing_pe_audio.py class PeAudioProcessor (line 17) | class PeAudioProcessor(ProcessorMixin): FILE: src/transformers/models/pe_audio_video/configuration_pe_audio_video.py class PeAudioVideoEncoderConfig (line 26) | class PeAudioVideoEncoderConfig(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): class PeAudioVideoConfig (line 89) | class PeAudioVideoConfig(PretrainedConfig): method __post_init__ (line 121) | def __post_init__(self, **kwargs): method audio_config (line 138) | def audio_config(self): method video_config (line 145) | def video_config(self): FILE: src/transformers/models/pe_audio_video/convert_pe_audio_video_to_hf.py function convert_key (line 61) | def convert_key(key, mapping): function permute (line 67) | def permute(w, n_heads, dim1, dim2): FILE: src/transformers/models/pe_audio_video/modeling_pe_audio_video.py class PeAudioVideoMaskedGroupNorm (line 44) | class PeAudioVideoMaskedGroupNorm(nn.GroupNorm): method forward (line 45) | def forward(self, x, padding_mask=None): class PeAudioVideoConvBlock1d (line 68) | class PeAudioVideoConvBlock1d(nn.Module): method __init__ (line 69) | def __init__(self, config): method forward (line 80) | def forward(self, x, padding_mask=None): class PeAudioVideoResnetBlock1d (line 86) | class PeAudioVideoResnetBlock1d(nn.Module): method __init__ (line 87) | def __init__(self, config): method forward (line 92) | def forward(self, hidden_states, padding_mask=None): class PeAudioVideoEncoderPatchEmbedder (line 115) | class PeAudioVideoEncoderPatchEmbedder(nn.Module): method __init__ (line 116) | def __init__(self, config): method forward (line 121) | def forward(self, inputs_embeds, padding_mask=None): class PeAudioVideoContrastiveHead (line 136) | class PeAudioVideoContrastiveHead(nn.Module): method __init__ (line 137) | def __init__( method forward (line 146) | def forward(self, x: torch.Tensor) -> torch.FloatTensor: class PeAudioVideoEncoderEmbedder (line 150) | class PeAudioVideoEncoderEmbedder(nn.Module): method __init__ (line 151) | def __init__(self, config: PeAudioVideoEncoderConfig): method _align_video_hidden_state (line 165) | def _align_video_hidden_state( method forward (line 218) | def forward( function repeat_kv (line 247) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 259) | def eager_attention_forward( function stack_freqs (line 284) | def stack_freqs(cos: torch.Tensor, sin: torch.Tensor): function apply_rotary_pos_emb (line 292) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class PeAudioVideoEncoderAttention (line 301) | class PeAudioVideoEncoderAttention(nn.Module): method __init__ (line 304) | def __init__(self, config, layer_idx): method forward (line 334) | def forward( class PeAudioVideoEncoderMLP (line 371) | class PeAudioVideoEncoderMLP(nn.Module): method __init__ (line 372) | def __init__(self, config): method forward (line 382) | def forward(self, x): class PeAudioVideoEncoderLayer (line 387) | class PeAudioVideoEncoderLayer(GradientCheckpointingLayer): method __init__ (line 388) | def __init__(self, config, layer_idx): method forward (line 398) | def forward( class PeAudioVideoEncoderRMSNorm (line 431) | class PeAudioVideoEncoderRMSNorm(nn.Module): method __init__ (line 432) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 440) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 447) | def extra_repr(self): class PeAudioVideoEncoderRotaryEmbedding (line 451) | class PeAudioVideoEncoderRotaryEmbedding(nn.Module): method __init__ (line 454) | def __init__(self, config: PeAudioVideoEncoderConfig, device=None): method compute_default_rope_parameters (line 471) | def compute_default_rope_parameters( method forward (line 502) | def forward(self, x, position_ids): class PeAudioVideoPreTrainedModel (line 517) | class PeAudioVideoPreTrainedModel(PreTrainedModel): method _init_weights (line 534) | def _init_weights(self, module): class PeAudioVideoEncoderOutput (line 554) | class PeAudioVideoEncoderOutput(BaseModelOutputWithPooling): class PeAudioVideoEncoder (line 564) | class PeAudioVideoEncoder(PeAudioVideoPreTrainedModel): method __init__ (line 569) | def __init__(self, config: PeAudioVideoEncoderConfig): method forward (line 586) | def forward( class PeAudioVideoOutput (line 638) | class PeAudioVideoOutput(ModelOutput): method to_tuple (line 672) | def to_tuple(self) -> tuple[Any]: class AudioVideoEmbeddings (line 677) | class AudioVideoEmbeddings(ModelOutput): class PeAudioVideoModel (line 683) | class PeAudioVideoModel(PeAudioVideoPreTrainedModel): method __init__ (line 691) | def __init__(self, config: PeAudioVideoConfig): method _contrastive_loss (line 722) | def _contrastive_loss(self, logits: torch.Tensor) -> torch.Tensor: method get_text_audio_embeds (line 727) | def get_text_audio_embeds(self, input_ids, attention_mask=None): method get_text_video_embeds (line 730) | def get_text_video_embeds(self, input_ids, attention_mask=None): method get_text_audio_video_embeds (line 733) | def get_text_audio_video_embeds(self, input_ids, attention_mask=None): method get_audio_embeds (line 742) | def get_audio_embeds(self, input_values, padding_mask=None): method get_video_embeds (line 745) | def get_video_embeds(self, pixel_values_videos, padding_mask_videos=No... method get_audio_video_embeds (line 748) | def get_audio_video_embeds( method get_audio_plus_text_embeds (line 777) | def get_audio_plus_text_embeds( method get_video_plus_text_embeds (line 799) | def get_video_plus_text_embeds( method forward (line 822) | def forward( FILE: src/transformers/models/pe_audio_video/modular_pe_audio_video.py class PeAudioVideoMaskedGroupNorm (line 34) | class PeAudioVideoMaskedGroupNorm(nn.GroupNorm): method forward (line 35) | def forward(self, x, padding_mask=None): class PeAudioVideoConvBlock1d (line 58) | class PeAudioVideoConvBlock1d(nn.Module): method __init__ (line 59) | def __init__(self, config): method forward (line 70) | def forward(self, x, padding_mask=None): class PeAudioVideoResnetBlock1d (line 76) | class PeAudioVideoResnetBlock1d(nn.Module): method __init__ (line 77) | def __init__(self, config): method forward (line 82) | def forward(self, hidden_states, padding_mask=None): class PeAudioVideoEncoderPatchEmbedder (line 105) | class PeAudioVideoEncoderPatchEmbedder(nn.Module): method __init__ (line 106) | def __init__(self, config): method forward (line 111) | def forward(self, inputs_embeds, padding_mask=None): class PeAudioVideoContrastiveHead (line 126) | class PeAudioVideoContrastiveHead(nn.Module): method __init__ (line 127) | def __init__( method forward (line 136) | def forward(self, x: torch.Tensor) -> torch.FloatTensor: class PeAudioVideoEncoderEmbedder (line 140) | class PeAudioVideoEncoderEmbedder(nn.Module): method __init__ (line 141) | def __init__(self, config: PeAudioVideoEncoderConfig): method _align_video_hidden_state (line 155) | def _align_video_hidden_state( method forward (line 208) | def forward( class PeAudioVideoEncoderAttention (line 237) | class PeAudioVideoEncoderAttention(Qwen3Attention): method __init__ (line 238) | def __init__(self, config, layer_idx): method forward (line 243) | def forward( class PeAudioVideoEncoderLayer (line 280) | class PeAudioVideoEncoderLayer(Qwen3DecoderLayer): method __init__ (line 281) | def __init__(self, config, layer_idx): class PeAudioVideoEncoderRMSNorm (line 286) | class PeAudioVideoEncoderRMSNorm(Qwen3RMSNorm): ... function stack_freqs (line 289) | def stack_freqs(cos: torch.Tensor, sin: torch.Tensor): function apply_rotary_pos_emb (line 297) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class PeAudioVideoEncoderRotaryEmbedding (line 305) | class PeAudioVideoEncoderRotaryEmbedding(Qwen3RotaryEmbedding): ... class PeAudioVideoPreTrainedModel (line 309) | class PeAudioVideoPreTrainedModel(PreTrainedModel): method _init_weights (line 326) | def _init_weights(self, module): class PeAudioVideoEncoderOutput (line 346) | class PeAudioVideoEncoderOutput(BaseModelOutputWithPooling): class PeAudioVideoEncoder (line 356) | class PeAudioVideoEncoder(PeAudioVideoPreTrainedModel): method __init__ (line 361) | def __init__(self, config: PeAudioVideoEncoderConfig): method forward (line 378) | def forward( class PeAudioVideoOutput (line 430) | class PeAudioVideoOutput(ModelOutput): method to_tuple (line 464) | def to_tuple(self) -> tuple[Any]: class AudioVideoEmbeddings (line 469) | class AudioVideoEmbeddings(ModelOutput): class PeAudioVideoModel (line 475) | class PeAudioVideoModel(PeAudioVideoPreTrainedModel): method __init__ (line 483) | def __init__(self, config: PeAudioVideoConfig): method _contrastive_loss (line 514) | def _contrastive_loss(self, logits: torch.Tensor) -> torch.Tensor: method get_text_audio_embeds (line 519) | def get_text_audio_embeds(self, input_ids, attention_mask=None): method get_text_video_embeds (line 522) | def get_text_video_embeds(self, input_ids, attention_mask=None): method get_text_audio_video_embeds (line 525) | def get_text_audio_video_embeds(self, input_ids, attention_mask=None): method get_audio_embeds (line 534) | def get_audio_embeds(self, input_values, padding_mask=None): method get_video_embeds (line 537) | def get_video_embeds(self, pixel_values_videos, padding_mask_videos=No... method get_audio_video_embeds (line 540) | def get_audio_video_embeds( method get_audio_plus_text_embeds (line 569) | def get_audio_plus_text_embeds( method get_video_plus_text_embeds (line 591) | def get_video_plus_text_embeds( method forward (line 614) | def forward( FILE: src/transformers/models/pe_audio_video/processing_pe_audio_video.py class PeAudioVideoProcessor (line 17) | class PeAudioVideoProcessor(ProcessorMixin): FILE: src/transformers/models/pe_video/configuration_pe_video.py class PeVideoEncoderConfig (line 27) | class PeVideoEncoderConfig(PreTrainedConfig): method __post_init__ (line 71) | def __post_init__(self, **kwargs): class PeVideoConfig (line 91) | class PeVideoConfig(PretrainedConfig): method __post_init__ (line 124) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pe_video/modeling_pe_video.py class PeVideoOutput (line 48) | class PeVideoOutput(ModelOutput): method to_tuple (line 56) | def to_tuple(self) -> tuple[Any]: class PeVideoContrastiveHead (line 62) | class PeVideoContrastiveHead(nn.Module): method __init__ (line 63) | def __init__( method forward (line 72) | def forward(self, x: torch.Tensor) -> torch.FloatTensor: class PeVideoMaskedGroupNorm (line 76) | class PeVideoMaskedGroupNorm(nn.GroupNorm): method forward (line 77) | def forward(self, x, padding_mask=None): class PeVideoConvBlock1d (line 100) | class PeVideoConvBlock1d(nn.Module): method __init__ (line 101) | def __init__(self, config): method forward (line 112) | def forward(self, x, padding_mask=None): class PeVideoResnetBlock1d (line 118) | class PeVideoResnetBlock1d(nn.Module): method __init__ (line 119) | def __init__(self, config): method forward (line 124) | def forward(self, hidden_states, padding_mask=None): class PeVideoEncoderPatchEmbedder (line 147) | class PeVideoEncoderPatchEmbedder(nn.Module): method __init__ (line 148) | def __init__(self, config): method forward (line 153) | def forward(self, inputs_embeds, padding_mask=None): class PeVideoEncoderEmbedder (line 168) | class PeVideoEncoderEmbedder(nn.Module): method __init__ (line 169) | def __init__(self, config: PeVideoEncoderConfig): method forward (line 175) | def forward( function repeat_kv (line 194) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 206) | def eager_attention_forward( function stack_freqs (line 231) | def stack_freqs(cos: torch.Tensor, sin: torch.Tensor): function apply_rotary_pos_emb (line 239) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class PeVideoEncoderRMSNorm (line 248) | class PeVideoEncoderRMSNorm(nn.Module): method __init__ (line 249) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 257) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 264) | def extra_repr(self): class PeVideoEncoderAttention (line 269) | class PeVideoEncoderAttention(nn.Module): method __init__ (line 272) | def __init__(self, config, layer_idx): method forward (line 302) | def forward( class PeVideoEncoderMLP (line 339) | class PeVideoEncoderMLP(nn.Module): method __init__ (line 340) | def __init__(self, config): method forward (line 350) | def forward(self, x): class PeVideoEncoderLayer (line 355) | class PeVideoEncoderLayer(GradientCheckpointingLayer): method __init__ (line 356) | def __init__(self, config, layer_idx): method forward (line 366) | def forward( class PeVideoPreTrainedModel (line 399) | class PeVideoPreTrainedModel(PreTrainedModel): method _init_weights (line 417) | def _init_weights(self, module): class PeVideoEncoderRotaryEmbedding (line 431) | class PeVideoEncoderRotaryEmbedding(nn.Module): method __init__ (line 434) | def __init__(self, config: PeVideoEncoderConfig, device=None): method compute_default_rope_parameters (line 451) | def compute_default_rope_parameters( method forward (line 482) | def forward(self, x, position_ids): class PeVideoEncoder (line 501) | class PeVideoEncoder(PeVideoPreTrainedModel): method __init__ (line 506) | def __init__(self, config: PeVideoEncoderConfig): method forward (line 523) | def forward( class PeVideoModel (line 560) | class PeVideoModel(PeVideoPreTrainedModel): method __init__ (line 563) | def __init__(self, config: PeVideoConfig): method forward (line 611) | def forward( FILE: src/transformers/models/pe_video/modular_pe_video.py class PeVideoOutput (line 40) | class PeVideoOutput(ModelOutput): method to_tuple (line 48) | def to_tuple(self) -> tuple[Any]: class PeVideoContrastiveHead (line 54) | class PeVideoContrastiveHead(PeAudioVideoContrastiveHead): ... class PeVideoEncoderPatchEmbedder (line 57) | class PeVideoEncoderPatchEmbedder(PeAudioVideoEncoderPatchEmbedder): ... class PeVideoEncoderEmbedder (line 60) | class PeVideoEncoderEmbedder(nn.Module): method __init__ (line 61) | def __init__(self, config: PeVideoEncoderConfig): method forward (line 67) | def forward( class PeVideoPreTrainedModel (line 86) | class PeVideoPreTrainedModel(PeAudioVideoPreTrainedModel): class PeVideoEncoder (line 96) | class PeVideoEncoder(PeAudioVideoEncoder): method __init__ (line 100) | def __init__(self, config: PeVideoEncoderConfig): method forward (line 107) | def forward( class PeVideoModel (line 144) | class PeVideoModel(PeVideoPreTrainedModel): method __init__ (line 147) | def __init__(self, config: PeVideoConfig): method forward (line 195) | def forward( FILE: src/transformers/models/pe_video/processing_pe_video.py class PeVideoProcessor (line 4) | class PeVideoProcessor(ProcessorMixin): FILE: src/transformers/models/pe_video/video_processing_pe_video.py class PeVideoVideoProcessor (line 24) | class PeVideoVideoProcessor(BaseVideoProcessor): method sample_frames (line 27) | def sample_frames( method _preprocess (line 43) | def _preprocess( FILE: src/transformers/models/pegasus/configuration_pegasus.py class PegasusConfig (line 24) | class PegasusConfig(PreTrainedConfig): FILE: src/transformers/models/pegasus/convert_pegasus_tf_to_pytorch.py function rename_state_dict_key (line 46) | def rename_state_dict_key(k): function convert_pegasus (line 55) | def convert_pegasus(tf_weights: dict, cfg_updates: dict) -> PegasusForCo... function get_tf_weights_as_numpy (line 86) | def get_tf_weights_as_numpy(path="./ckpt/aeslc/model.ckpt-32000") -> dict: function convert_pegasus_ckpt_to_pytorch (line 99) | def convert_pegasus_ckpt_to_pytorch(ckpt_path: str, save_dir: str): FILE: src/transformers/models/pegasus/modeling_pegasus.py function shift_tokens_right (line 57) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class PegasusSinusoidalPositionalEmbedding (line 74) | class PegasusSinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 77) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method create_weight (line 80) | def create_weight(self): method forward (line 96) | def forward( function eager_attention_forward (line 109) | def eager_attention_forward( class PegasusAttention (line 138) | class PegasusAttention(nn.Module): method __init__ (line 141) | def __init__( method forward (line 180) | def forward( class PegasusEncoderLayer (line 257) | class PegasusEncoderLayer(GradientCheckpointingLayer): method __init__ (line 258) | def __init__(self, config: PegasusConfig): method forward (line 276) | def forward( class PegasusDecoderLayer (line 314) | class PegasusDecoderLayer(GradientCheckpointingLayer): method __init__ (line 315) | def __init__(self, config: PegasusConfig, layer_idx: int | None = None): method forward (line 346) | def forward( class PegasusPreTrainedModel (line 408) | class PegasusPreTrainedModel(PreTrainedModel): method _init_weights (line 418) | def _init_weights(self, module): class PegasusEncoder (line 426) | class PegasusEncoder(PegasusPreTrainedModel): method __init__ (line 441) | def __init__(self, config: PegasusConfig): method resize_position_embeddings (line 466) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 490) | def get_position_embeddings(self) -> nn.Embedding: method forward (line 499) | def forward( class PegasusDecoder (line 547) | class PegasusDecoder(PegasusPreTrainedModel): method __init__ (line 562) | def __init__(self, config: PegasusConfig): method resize_position_embeddings (line 584) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 608) | def get_position_embeddings(self) -> nn.Embedding: method forward (line 617) | def forward( class PegasusModel (line 704) | class PegasusModel(PegasusPreTrainedModel): method __init__ (line 710) | def __init__(self, config: PegasusConfig): method get_input_embeddings (line 722) | def get_input_embeddings(self): method set_input_embeddings (line 725) | def set_input_embeddings(self, value): method resize_position_embeddings (line 730) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 747) | def get_position_embeddings(self) -> tuple[nn.Embedding]: method forward (line 755) | def forward( class PegasusForConditionalGeneration (line 845) | class PegasusForConditionalGeneration(PegasusPreTrainedModel, Generation... method __init__ (line 852) | def __init__(self, config: PegasusConfig): method resize_token_embeddings (line 861) | def resize_token_embeddings( method _resize_final_logits_bias (line 868) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method resize_position_embeddings (line 877) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 894) | def get_position_embeddings(self) -> tuple[nn.Embedding]: method forward (line 902) | def forward( method prepare_decoder_input_ids_from_labels (line 997) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class PegasusDecoderWrapper (line 1002) | class PegasusDecoderWrapper(PegasusPreTrainedModel): method __init__ (line 1008) | def __init__(self, config): method forward (line 1013) | def forward(self, *args, **kwargs): class PegasusForCausalLM (line 1017) | class PegasusForCausalLM(PegasusPreTrainedModel, GenerationMixin): method __init__ (line 1022) | def __init__(self, config): method get_input_embeddings (line 1034) | def get_input_embeddings(self): method set_input_embeddings (line 1037) | def set_input_embeddings(self, value): method get_position_embeddings (line 1040) | def get_position_embeddings(self) -> nn.Embedding: method resize_position_embeddings (line 1046) | def resize_position_embeddings(self, new_num_position_embeddings: int): method forward (line 1065) | def forward( FILE: src/transformers/models/pegasus/tokenization_pegasus.py class PegasusTokenizer (line 28) | class PegasusTokenizer(TokenizersBackend): method __init__ (line 80) | def __init__( FILE: src/transformers/models/pegasus_x/configuration_pegasus_x.py class PegasusXConfig (line 24) | class PegasusXConfig(PreTrainedConfig): FILE: src/transformers/models/pegasus_x/modeling_pegasus_x.py class DimensionInfo (line 50) | class DimensionInfo: function shift_tokens_right (line 65) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class PegasusXScaledWordEmbedding (line 82) | class PegasusXScaledWordEmbedding(nn.Embedding): method __init__ (line 87) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 91) | def forward(self, input_ids: torch.Tensor): class PegasusXSinusoidalPositionalEmbedding (line 95) | class PegasusXSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 98) | def __init__(self, embed_dim, max_scale: int = 10000.0): method forward (line 105) | def forward( function eager_attention_forward (line 127) | def eager_attention_forward( class PegasusXAttention (line 156) | class PegasusXAttention(nn.Module): method __init__ (line 159) | def __init__( method forward (line 198) | def forward( class PegasusXGlobalLocalAttention (line 274) | class PegasusXGlobalLocalAttention(nn.Module): method __init__ (line 277) | def __init__( method _shape (line 305) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 308) | def forward( method compute_global_attention_representations (line 398) | def compute_global_attention_representations( method compute_local_attention_representations (line 441) | def compute_local_attention_representations( class PegasusXEncoderLayer (line 505) | class PegasusXEncoderLayer(GradientCheckpointingLayer): method __init__ (line 506) | def __init__(self, stagger_blocks_this_layer: bool, config: PegasusXCo... method forward (line 526) | def forward( method pad_local_tokens (line 594) | def pad_local_tokens(cls, hidden_states, attention_mask, block_size): method unpad_local_tokens (line 610) | def unpad_local_tokens(cls, padded_hidden_states, block_size): class PegasusXDecoderLayer (line 616) | class PegasusXDecoderLayer(GradientCheckpointingLayer): method __init__ (line 617) | def __init__(self, config: PegasusXConfig, layer_idx: int | None = None): method forward (line 649) | def forward( class PegasusXPreTrainedModel (line 712) | class PegasusXPreTrainedModel(PreTrainedModel): class PegasusXEncoder (line 724) | class PegasusXEncoder(PegasusXPreTrainedModel): method __init__ (line 736) | def __init__(self, config: PegasusXConfig): method resize_position_embeddings (line 767) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 786) | def get_position_embeddings(self) -> nn.Embedding: method forward (line 794) | def forward( class PegasusXDecoder (line 905) | class PegasusXDecoder(PegasusXPreTrainedModel): method __init__ (line 920) | def __init__(self, config: PegasusXConfig): method forward (line 942) | def forward( class PegasusXModel (line 1077) | class PegasusXModel(PegasusXPreTrainedModel): method __init__ (line 1083) | def __init__(self, config: PegasusXConfig): method get_input_embeddings (line 1099) | def get_input_embeddings(self): method set_input_embeddings (line 1102) | def set_input_embeddings(self, value): method resize_position_embeddings (line 1107) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 1124) | def get_position_embeddings(self) -> tuple[nn.Embedding]: method forward (line 1132) | def forward( class PegasusXForConditionalGeneration (line 1220) | class PegasusXForConditionalGeneration(PegasusXPreTrainedModel, Generati... method __init__ (line 1226) | def __init__(self, config: PegasusXConfig): method resize_position_embeddings (line 1234) | def resize_position_embeddings(self, new_num_position_embeddings: int): method get_position_embeddings (line 1251) | def get_position_embeddings(self) -> tuple[nn.Embedding]: method forward (line 1259) | def forward( method prepare_decoder_input_ids_from_labels (line 1333) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class PegasusXDecoderWrapper (line 1338) | class PegasusXDecoderWrapper(PegasusXPreTrainedModel): method __init__ (line 1344) | def __init__(self, config): method forward (line 1349) | def forward(self, *args, **kwargs): FILE: src/transformers/models/perceiver/configuration_perceiver.py class PerceiverConfig (line 24) | class PerceiverConfig(PreTrainedConfig): FILE: src/transformers/models/perceiver/convert_perceiver_haiku_to_pytorch.py function prepare_img (line 50) | def prepare_img(): function rename_keys (line 58) | def rename_keys(state_dict, architecture): function convert_perceiver_checkpoint (line 267) | def convert_perceiver_checkpoint(pickle_file, pytorch_dump_folder_path, ... FILE: src/transformers/models/perceiver/image_processing_perceiver.py class PerceiverImageProcessor (line 33) | class PerceiverImageProcessor(TorchvisionBackend): method __init__ (line 46) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method center_crop (line 49) | def center_crop( method _preprocess (line 76) | def _preprocess( FILE: src/transformers/models/perceiver/image_processing_pil_perceiver.py class PerceiverImageProcessorPil (line 31) | class PerceiverImageProcessorPil(PilBackend): method __init__ (line 44) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method center_crop (line 47) | def center_crop( method _preprocess (line 74) | def _preprocess( FILE: src/transformers/models/perceiver/modeling_perceiver.py class PerceiverModelOutput (line 52) | class PerceiverModelOutput(ModelOutput): class PerceiverDecoderOutput (line 71) | class PerceiverDecoderOutput(ModelOutput): class PerceiverMaskedLMOutput (line 87) | class PerceiverMaskedLMOutput(ModelOutput): class PerceiverClassifierOutput (line 109) | class PerceiverClassifierOutput(ModelOutput): class PerceiverEmbeddings (line 124) | class PerceiverEmbeddings(nn.Module): method __init__ (line 127) | def __init__(self, config): method forward (line 131) | def forward(self, batch_size: int): class PerceiverSelfAttention (line 135) | class PerceiverSelfAttention(nn.Module): method __init__ (line 138) | def __init__( method transpose_for_scores (line 179) | def transpose_for_scores(self, x, channels_per_head): method forward (line 184) | def forward( class PerceiverSelfOutput (line 245) | class PerceiverSelfOutput(nn.Module): method __init__ (line 246) | def __init__(self, config, input_channels, output_channels): method forward (line 250) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PerceiverAttention (line 255) | class PerceiverAttention(nn.Module): method __init__ (line 258) | def __init__( method forward (line 305) | def forward( class PerceiverMLP (line 334) | class PerceiverMLP(nn.Module): method __init__ (line 337) | def __init__(self, config, input_size, widening_factor): method forward (line 346) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PerceiverLayer (line 353) | class PerceiverLayer(nn.Module): method __init__ (line 354) | def __init__( method forward (line 382) | def forward( method feed_forward_chunk (line 411) | def feed_forward_chunk(self, attention_output): class PerceiverEncoder (line 417) | class PerceiverEncoder(nn.Module): method __init__ (line 420) | def __init__(self, config, kv_dim=None): method forward (line 467) | def forward( class PerceiverPreTrainedModel (line 528) | class PerceiverPreTrainedModel(PreTrainedModel): method _init_weights (line 535) | def _init_weights(self, module): class PerceiverModel (line 575) | class PerceiverModel(PerceiverPreTrainedModel): method __init__ (line 576) | def __init__( method get_input_embeddings (line 605) | def get_input_embeddings(self): method set_input_embeddings (line 608) | def set_input_embeddings(self, value): method forward (line 612) | def forward( class PerceiverForMaskedLM (line 817) | class PerceiverForMaskedLM(PerceiverPreTrainedModel): method __init__ (line 818) | def __init__(self, config: PerceiverConfig): method forward (line 850) | def forward( class PerceiverForSequenceClassification (line 954) | class PerceiverForSequenceClassification(PerceiverPreTrainedModel): method __init__ (line 955) | def __init__(self, config): method forward (line 976) | def forward( class PerceiverForImageClassificationLearned (line 1076) | class PerceiverForImageClassificationLearned(PerceiverPreTrainedModel): method __init__ (line 1077) | def __init__(self, config): method forward (line 1108) | def forward( class PerceiverForImageClassificationFourier (line 1201) | class PerceiverForImageClassificationFourier(PerceiverPreTrainedModel): method __init__ (line 1202) | def __init__(self, config): method forward (line 1234) | def forward( class PerceiverForImageClassificationConvProcessing (line 1324) | class PerceiverForImageClassificationConvProcessing(PerceiverPreTrainedM... method __init__ (line 1325) | def __init__(self, config): method forward (line 1358) | def forward( class PerceiverForOpticalFlow (line 1448) | class PerceiverForOpticalFlow(PerceiverPreTrainedModel): method __init__ (line 1449) | def __init__(self, config): method forward (line 1499) | def forward( class PerceiverForMultimodalAutoencoding (line 1590) | class PerceiverForMultimodalAutoencoding(PerceiverPreTrainedModel): method __init__ (line 1591) | def __init__(self, config: PerceiverConfig): method forward (line 1707) | def forward( function build_position_encoding (line 1799) | def build_position_encoding( class PerceiverAbstractDecoder (line 1836) | class PerceiverAbstractDecoder(nn.Module, metaclass=abc.ABCMeta): method decoder_query (line 1840) | def decoder_query(self, inputs, modality_sizes=None, inputs_without_po... method num_query_channels (line 1845) | def num_query_channels(self): method forward (line 1849) | def forward(self, query, z, query_mask=None): class PerceiverProjectionDecoder (line 1853) | class PerceiverProjectionDecoder(PerceiverAbstractDecoder): method __init__ (line 1862) | def __init__(self, config): method decoder_query (line 1866) | def decoder_query(self, inputs, modality_sizes=None, inputs_without_po... method forward (line 1869) | def forward( class PerceiverBasicDecoder (line 1879) | class PerceiverBasicDecoder(PerceiverAbstractDecoder): method __init__ (line 1915) | def __init__( method num_query_channels (line 1973) | def num_query_channels(self) -> int: method decoder_query (line 1986) | def decoder_query(self, inputs, modality_sizes=None, inputs_without_po... method forward (line 2034) | def forward( class PerceiverClassificationDecoder (line 2064) | class PerceiverClassificationDecoder(PerceiverAbstractDecoder): method __init__ (line 2075) | def __init__(self, config, **decoder_kwargs): method num_query_channels (line 2087) | def num_query_channels(self) -> int: method decoder_query (line 2090) | def decoder_query(self, inputs, modality_sizes=None, inputs_without_po... method forward (line 2095) | def forward( class PerceiverOpticalFlowDecoder (line 2110) | class PerceiverOpticalFlowDecoder(PerceiverAbstractDecoder): method __init__ (line 2113) | def __init__(self, config, output_image_shape, output_num_channels=2, ... method num_query_channels (line 2122) | def num_query_channels(self) -> int: method decoder_query (line 2125) | def decoder_query(self, inputs, modality_sizes=None, inputs_without_po... method forward (line 2130) | def forward( class PerceiverBasicVideoAutoencodingDecoder (line 2145) | class PerceiverBasicVideoAutoencodingDecoder(PerceiverAbstractDecoder): method __init__ (line 2159) | def __init__( method num_query_channels (line 2177) | def num_query_channels(self) -> int: method decoder_query (line 2180) | def decoder_query(self, inputs, modality_sizes=None, inputs_without_po... method forward (line 2188) | def forward( function restructure (line 2198) | def restructure(modality_sizes: ModalitySizeType, inputs: torch.Tensor) ... class PerceiverMultimodalDecoder (line 2222) | class PerceiverMultimodalDecoder(PerceiverAbstractDecoder): method __init__ (line 2248) | def __init__( method num_query_channels (line 2280) | def num_query_channels(self) -> int: method decoder_query (line 2285) | def decoder_query(self, inputs, modality_sizes, inputs_without_pos=Non... method forward (line 2319) | def forward( function space_to_depth (line 2333) | def space_to_depth(frames: torch.Tensor, temporal_block_size: int = 1, s... class Conv2dSamePadding (line 2391) | class Conv2dSamePadding(nn.Conv2d): method __init__ (line 2397) | def __init__(self, *args, **kwargs): method forward (line 2403) | def forward(self, input): class Conv2DDownsample (line 2407) | class Conv2DDownsample(nn.Module): method __init__ (line 2410) | def __init__( method forward (line 2437) | def forward(self, inputs: torch.Tensor) -> torch.Tensor: function generate_fourier_features (line 2445) | def generate_fourier_features(pos, num_bands, max_resolution=(224, 224),... function build_linear_positions (line 2497) | def build_linear_positions(index_dims, output_range=(-1.0, 1.0)): class PerceiverAbstractPositionEncoding (line 2520) | class PerceiverAbstractPositionEncoding(nn.Module, metaclass=abc.ABCMeta): method num_dimensions (line 2525) | def num_dimensions(self) -> int: method output_size (line 2529) | def output_size(self, *args, **kwargs) -> int: method forward (line 2533) | def forward(self, batch_size, pos): class PerceiverTrainablePositionEncoding (line 2537) | class PerceiverTrainablePositionEncoding(PerceiverAbstractPositionEncodi... method __init__ (line 2540) | def __init__(self, index_dims, num_channels=128): method num_dimensions (line 2548) | def num_dimensions(self) -> int: method output_size (line 2553) | def output_size(self, *args, **kwargs) -> int: method interpolate_pos_encoding (line 2556) | def interpolate_pos_encoding(self, position_embeddings: torch.Tensor, ... method forward (line 2577) | def forward( function _check_or_build_spatial_positions (line 2591) | def _check_or_build_spatial_positions(pos, index_dims, batch_size): class PerceiverFourierPositionEncoding (line 2621) | class PerceiverFourierPositionEncoding(PerceiverAbstractPositionEncoding): method __init__ (line 2624) | def __init__(self, num_bands, max_resolution, concat_pos=True, sine_on... method num_dimensions (line 2632) | def num_dimensions(self) -> int: method output_size (line 2635) | def output_size(self): method forward (line 2646) | def forward( class AbstractPreprocessor (line 2665) | class AbstractPreprocessor(nn.Module): method num_channels (line 2667) | def num_channels(self) -> int: class PerceiverTextPreprocessor (line 2672) | class PerceiverTextPreprocessor(AbstractPreprocessor): method __init__ (line 2683) | def __init__(self, config: PerceiverConfig) -> None: method num_channels (line 2690) | def num_channels(self) -> int: method forward (line 2693) | def forward( class PerceiverEmbeddingDecoder (line 2709) | class PerceiverEmbeddingDecoder(nn.Module): method __init__ (line 2718) | def __init__(self, config: PerceiverConfig) -> None: method forward (line 2724) | def forward(self, hidden_states: torch.Tensor, embedding_layer: torch.... class PerceiverMultimodalPostprocessor (line 2733) | class PerceiverMultimodalPostprocessor(nn.Module): method __init__ (line 2746) | def __init__(self, modalities: Mapping[str, PostprocessorType], input_... method forward (line 2751) | def forward( class PerceiverClassificationPostprocessor (line 2767) | class PerceiverClassificationPostprocessor(nn.Module): method __init__ (line 2778) | def __init__(self, config: PerceiverConfig, in_channels: int) -> None: method forward (line 2782) | def forward(self, inputs, pos: torch.Tensor | None = None, modality_si... class PerceiverAudioPostprocessor (line 2787) | class PerceiverAudioPostprocessor(nn.Module): method __init__ (line 2800) | def __init__(self, config: PerceiverConfig, in_channels: int, postproc... method forward (line 2809) | def forward(self, inputs: torch.Tensor, pos: torch.Tensor | None = Non... class PerceiverProjectionPostprocessor (line 2814) | class PerceiverProjectionPostprocessor(nn.Module): method __init__ (line 2826) | def __init__(self, in_channels: int, out_channels: int) -> None: method forward (line 2830) | def forward(self, inputs: torch.Tensor, pos: torch.Tensor | None = Non... class PerceiverImagePreprocessor (line 2835) | class PerceiverImagePreprocessor(AbstractPreprocessor): method __init__ (line 2872) | def __init__( method num_channels (line 2947) | def num_channels(self) -> int: method _build_network_inputs (line 2979) | def _build_network_inputs( method forward (line 3017) | def forward( class PerceiverOneHotPreprocessor (line 3073) | class PerceiverOneHotPreprocessor(AbstractPreprocessor): method __init__ (line 3082) | def __init__(self, config: PerceiverConfig) -> None: method num_channels (line 3087) | def num_channels(self) -> int: method forward (line 3090) | def forward(self, inputs: torch.Tensor, pos: torch.Tensor | None = Non... class PerceiverAudioPreprocessor (line 3099) | class PerceiverAudioPreprocessor(AbstractPreprocessor): method __init__ (line 3122) | def __init__( method num_channels (line 3156) | def num_channels(self) -> int: method _build_network_inputs (line 3166) | def _build_network_inputs(self, inputs): method forward (line 3187) | def forward( class PerceiverMultimodalPreprocessor (line 3202) | class PerceiverMultimodalPreprocessor(AbstractPreprocessor): method __init__ (line 3219) | def __init__( method num_channels (line 3240) | def num_channels(self) -> int: method forward (line 3245) | def forward( FILE: src/transformers/models/perceiver/tokenization_perceiver.py class PerceiverTokenizer (line 23) | class PerceiverTokenizer(PreTrainedTokenizer): method __init__ (line 56) | def __init__( method get_vocab (line 97) | def get_vocab(self) -> dict[str, int]: method vocab_size (line 106) | def vocab_size(self): method get_special_tokens_mask (line 109) | def get_special_tokens_mask( method build_inputs_with_special_tokens (line 137) | def build_inputs_with_special_tokens( method _tokenize (line 161) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 166) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 174) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 180) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 193) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/perception_lm/configuration_perception_lm.py class PerceptionLMConfig (line 25) | class PerceptionLMConfig(PreTrainedConfig): method __post_init__ (line 43) | def __post_init__(self, **kwargs): FILE: src/transformers/models/perception_lm/convert_perception_lm_weights_to_hf.py function compute_intermediate_size (line 171) | def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256): function read_json (line 175) | def read_json(path): function write_json (line 180) | def write_json(text, path): function write_weights (line 185) | def write_weights(state_dict, index_dict, param_count, filename): function write_model (line 194) | def write_model( class Llama3Converter (line 433) | class Llama3Converter(TikTokenConverter): method __init__ (line 434) | def __init__( method update_post_processor (line 469) | def update_post_processor(self, tokenizer): function write_tokenizer (line 487) | def write_tokenizer( function main (line 548) | def main(): FILE: src/transformers/models/perception_lm/image_processing_perception_lm.py class PerceptionLMImageProcessorKwargs (line 35) | class PerceptionLMImageProcessorKwargs(ImagesKwargs, total=False): class PerceptionLMImageProcessor (line 52) | class PerceptionLMImageProcessor(TorchvisionBackend): method __init__ (line 67) | def __init__(self, **kwargs: Unpack[PerceptionLMImageProcessorKwargs])... method preprocess (line 71) | def preprocess(self, images: ImageInput, **kwargs: Unpack[PerceptionLM... method _factors (line 75) | def _factors(n: int): method _find_supported_aspect_ratios (line 84) | def _find_supported_aspect_ratios(self): method _get_image_height_width (line 115) | def _get_image_height_width( method _fit_image_to_canvas (line 146) | def _fit_image_to_canvas(self, img_width: int, img_height: int, tile_s... method _find_closest_aspect_ratio (line 196) | def _find_closest_aspect_ratio(self, img_width: int, img_height: int, ... method _split (line 221) | def _split(self, image: torch.Tensor, ncw: int, nch: int) -> torch.Ten... method resize (line 231) | def resize( method _preprocess (line 255) | def _preprocess( FILE: src/transformers/models/perception_lm/modeling_perception_lm.py class PerceptionLMAdaptiveAvgPooling (line 37) | class PerceptionLMAdaptiveAvgPooling(nn.Module): method __init__ (line 38) | def __init__(self, pooling_ratio=2): method forward (line 42) | def forward(self, hidden_states): class PerceptionLMMultiModalProjector (line 56) | class PerceptionLMMultiModalProjector(nn.Module): method __init__ (line 57) | def __init__(self, config: PerceptionLMConfig): method forward (line 78) | def forward(self, features): class PerceptionLMPreTrainedModel (line 89) | class PerceptionLMPreTrainedModel(PreTrainedModel): class PerceptionLMModelOutputWithPast (line 110) | class PerceptionLMModelOutputWithPast(BaseModelOutputWithPast): class PerceptionLMCausalLMOutputWithPast (line 136) | class PerceptionLMCausalLMOutputWithPast(ModelOutput): class PerceptionLMModel (line 166) | class PerceptionLMModel(PerceptionLMPreTrainedModel): method __init__ (line 167) | def __init__(self, config: PerceptionLMConfig): method get_input_embeddings (line 174) | def get_input_embeddings(self): method set_input_embeddings (line 177) | def set_input_embeddings(self, value): method get_image_features (line 184) | def get_image_features( method get_placeholder_mask (line 198) | def get_placeholder_mask( method forward (line 241) | def forward( class PerceptionLMForConditionalGeneration (line 303) | class PerceptionLMForConditionalGeneration(PerceptionLMPreTrainedModel, ... method __init__ (line 306) | def __init__(self, config: PerceptionLMConfig): method get_input_embeddings (line 312) | def get_input_embeddings(self): method set_input_embeddings (line 315) | def set_input_embeddings(self, value): method get_output_embeddings (line 318) | def get_output_embeddings(self) -> nn.Module: method forward (line 323) | def forward( method prepare_inputs_for_generation (line 422) | def prepare_inputs_for_generation( FILE: src/transformers/models/perception_lm/modular_perception_lm.py class PerceptionLMAdaptiveAvgPooling (line 45) | class PerceptionLMAdaptiveAvgPooling(nn.Module): method __init__ (line 46) | def __init__(self, pooling_ratio=2): method forward (line 50) | def forward(self, hidden_states): class PerceptionLMMultiModalProjector (line 64) | class PerceptionLMMultiModalProjector(nn.Module): method __init__ (line 65) | def __init__(self, config: PerceptionLMConfig): method forward (line 86) | def forward(self, features): class PerceptionLMPreTrainedModel (line 96) | class PerceptionLMPreTrainedModel(LlavaPreTrainedModel): class PerceptionLMModelOutputWithPast (line 100) | class PerceptionLMModelOutputWithPast(LlavaModelOutputWithPast): class PerceptionLMCausalLMOutputWithPast (line 118) | class PerceptionLMCausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class PerceptionLMModel (line 141) | class PerceptionLMModel(LlavaModel): method __init__ (line 142) | def __init__(self, config: PerceptionLMConfig): method get_image_features (line 152) | def get_image_features( method get_placeholder_mask (line 166) | def get_placeholder_mask( method forward (line 209) | def forward( class PerceptionLMForConditionalGeneration (line 271) | class PerceptionLMForConditionalGeneration(LlavaForConditionalGeneration): method prepare_inputs_for_generation (line 272) | def prepare_inputs_for_generation( method forward (line 307) | def forward( method get_image_features (line 406) | def get_image_features(self, **kwargs): FILE: src/transformers/models/perception_lm/processing_perception_lm.py class PerceptionLMProcessorKwargs (line 30) | class PerceptionLMProcessorKwargs(ProcessingKwargs, total=False): class PerceptionLMProcessor (line 40) | class PerceptionLMProcessor(ProcessorMixin): method __init__ (line 41) | def __init__( method __call__ (line 66) | def __call__( method _expand_media_tokens (line 128) | def _expand_media_tokens(self, sample, media_token: str, media_iter: I... method _get_num_multimodal_tokens (line 150) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): FILE: src/transformers/models/perception_lm/video_processing_perception_lm.py class PerceptionLMVideoProcessor (line 19) | class PerceptionLMVideoProcessor(BaseVideoProcessor): FILE: src/transformers/models/persimmon/configuration_persimmon.py class PersimmonConfig (line 25) | class PersimmonConfig(PreTrainedConfig): method __post_init__ (line 61) | def __post_init__(self, **kwargs): FILE: src/transformers/models/persimmon/convert_persimmon_weights_to_hf.py function rename_state_dict (line 69) | def rename_state_dict(state_dict): function convert_persimmon_checkpoint (line 81) | def convert_persimmon_checkpoint(pytorch_dump_folder_path, ada_lib_path,... function main (line 96) | def main(): FILE: src/transformers/models/persimmon/modeling_persimmon.py class PersimmonRotaryEmbedding (line 57) | class PersimmonRotaryEmbedding(nn.Module): method __init__ (line 60) | def __init__(self, config: PersimmonConfig, device=None): method compute_default_rope_parameters (line 78) | def compute_default_rope_parameters( method forward (line 111) | def forward(self, x, position_ids): function rotate_half (line 126) | def rotate_half(x): function apply_rotary_pos_emb (line 134) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class PersimmonMLP (line 160) | class PersimmonMLP(nn.Module): method __init__ (line 161) | def __init__(self, config): method forward (line 167) | def forward(self, hidden_states): function eager_attention_forward (line 174) | def eager_attention_forward( class PersimmonAttention (line 196) | class PersimmonAttention(nn.Module): method __init__ (line 199) | def __init__(self, config: PersimmonConfig, layer_idx: int | None = No... method _split_heads (line 236) | def _split_heads(self, fused_qkv: torch.Tensor) -> tuple[torch.Tensor,... method forward (line 252) | def forward( class PersimmonDecoderLayer (line 320) | class PersimmonDecoderLayer(GradientCheckpointingLayer): method __init__ (line 321) | def __init__(self, config: PersimmonConfig, layer_idx: int): method forward (line 330) | def forward( class PersimmonPreTrainedModel (line 368) | class PersimmonPreTrainedModel(PreTrainedModel): class PersimmonModel (line 385) | class PersimmonModel(PersimmonPreTrainedModel): method __init__ (line 393) | def __init__(self, config: PersimmonConfig): method forward (line 411) | def forward( class PersimmonForCausalLM (line 465) | class PersimmonForCausalLM(PersimmonPreTrainedModel, GenerationMixin): method __init__ (line 469) | def __init__(self, config): method forward (line 480) | def forward( class PersimmonForSequenceClassification (line 541) | class PersimmonForSequenceClassification(GenericForSequenceClassificatio... class PersimmonForTokenClassification (line 544) | class PersimmonForTokenClassification(GenericForTokenClassification, Per... FILE: src/transformers/models/phi/configuration_phi.py class PhiConfig (line 26) | class PhiConfig(PreTrainedConfig): method __post_init__ (line 84) | def __post_init__(self, **kwargs): FILE: src/transformers/models/phi/convert_phi_weights_to_hf.py function convert_weights (line 58) | def convert_weights(original_weights, mapping, config): function _download (line 93) | def _download(url: str, root: str): function convert_phi_weights (line 104) | def convert_phi_weights( FILE: src/transformers/models/phi/modeling_phi.py class PhiRotaryEmbedding (line 33) | class PhiRotaryEmbedding(nn.Module): method __init__ (line 36) | def __init__(self, config: PhiConfig, device=None): method compute_default_rope_parameters (line 53) | def compute_default_rope_parameters( method forward (line 86) | def forward(self, x, position_ids): function rotate_half (line 100) | def rotate_half(x): function apply_rotary_pos_emb (line 108) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 133) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 145) | def eager_attention_forward( class PhiAttention (line 171) | class PhiAttention(nn.Module): method __init__ (line 174) | def __init__(self, config: PhiConfig, layer_idx: int): method forward (line 197) | def forward( class PhiMLP (line 256) | class PhiMLP(nn.Module): method __init__ (line 257) | def __init__(self, config): method forward (line 264) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PhiDecoderLayer (line 271) | class PhiDecoderLayer(GradientCheckpointingLayer): method __init__ (line 272) | def __init__(self, config: PhiConfig, layer_idx: int): method forward (line 279) | def forward( class PhiPreTrainedModel (line 311) | class PhiPreTrainedModel(PreTrainedModel): class PhiModel (line 330) | class PhiModel(PhiPreTrainedModel): method __init__ (line 331) | def __init__(self, config: PhiConfig): method forward (line 351) | def forward( class PhiForCausalLM (line 407) | class PhiForCausalLM(PhiPreTrainedModel, GenerationMixin): method __init__ (line 412) | def __init__(self, config): method forward (line 423) | def forward( class PhiForSequenceClassification (line 480) | class PhiForSequenceClassification(GenericForSequenceClassification, Phi... class PhiForTokenClassification (line 484) | class PhiForTokenClassification(GenericForTokenClassification, PhiPreTra... FILE: src/transformers/models/phi/modular_phi.py class PhiRotaryEmbedding (line 39) | class PhiRotaryEmbedding(LlamaRotaryEmbedding): method compute_default_rope_parameters (line 41) | def compute_default_rope_parameters( class PhiAttention (line 73) | class PhiAttention(LlamaAttention): method __init__ (line 74) | def __init__(self, config: PhiConfig, layer_idx: int): method forward (line 91) | def forward( class PhiMLP (line 150) | class PhiMLP(CLIPMLP): class PhiDecoderLayer (line 154) | class PhiDecoderLayer(GradientCheckpointingLayer): method __init__ (line 155) | def __init__(self, config: PhiConfig, layer_idx: int): method forward (line 162) | def forward( class PhiPreTrainedModel (line 193) | class PhiPreTrainedModel(LlamaPreTrainedModel): class PhiModel (line 200) | class PhiModel(LlamaModel): method __init__ (line 201) | def __init__(self, config: PhiConfig): method forward (line 213) | def forward( class PhiForCausalLM (line 268) | class PhiForCausalLM(LlamaForCausalLM): method __init__ (line 269) | def __init__(self, config): class PhiForSequenceClassification (line 274) | class PhiForSequenceClassification(LlamaForSequenceClassification): class PhiForTokenClassification (line 278) | class PhiForTokenClassification(LlamaForTokenClassification): FILE: src/transformers/models/phi3/configuration_phi3.py class Phi3Config (line 26) | class Phi3Config(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 89) | def convert_rope_params_to_dict( method validate_rope (line 107) | def validate_rope(self): FILE: src/transformers/models/phi3/modeling_phi3.py class Phi3MLP (line 49) | class Phi3MLP(nn.Module): method __init__ (line 50) | def __init__(self, config): method forward (line 58) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class Phi3RotaryEmbedding (line 67) | class Phi3RotaryEmbedding(nn.Module): method __init__ (line 70) | def __init__(self, config: Phi3Config, device=None): method compute_default_rope_parameters (line 87) | def compute_default_rope_parameters( method forward (line 120) | def forward(self, x, position_ids): function rotate_half (line 134) | def rotate_half(x): function repeat_kv (line 141) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 153) | def eager_attention_forward( function apply_rotary_pos_emb (line 178) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Phi3Attention (line 208) | class Phi3Attention(nn.Module): method __init__ (line 211) | def __init__(self, config: Phi3Config, layer_idx: int | None = None): method forward (line 226) | def forward( class Phi3RMSNorm (line 275) | class Phi3RMSNorm(nn.Module): method __init__ (line 276) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 284) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 291) | def extra_repr(self): class Phi3DecoderLayer (line 295) | class Phi3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 296) | def __init__(self, config: Phi3Config, layer_idx: int): method forward (line 307) | def forward( class Phi3PreTrainedModel (line 339) | class Phi3PreTrainedModel(PreTrainedModel): class Phi3Model (line 359) | class Phi3Model(Phi3PreTrainedModel): method __init__ (line 360) | def __init__(self, config: Phi3Config): method forward (line 379) | def forward( class Phi3ForCausalLM (line 433) | class Phi3ForCausalLM(Phi3PreTrainedModel, GenerationMixin): method __init__ (line 438) | def __init__(self, config): method forward (line 449) | def forward( method prepare_inputs_for_generation (line 505) | def prepare_inputs_for_generation( class Phi3ForSequenceClassification (line 543) | class Phi3ForSequenceClassification(GenericForSequenceClassification, Ph... class Phi3ForTokenClassification (line 547) | class Phi3ForTokenClassification(GenericForTokenClassification, Phi3PreT... FILE: src/transformers/models/phi3/modular_phi3.py class Phi3MLP (line 48) | class Phi3MLP(nn.Module): method __init__ (line 49) | def __init__(self, config): method forward (line 57) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: class Phi3RotaryEmbedding (line 66) | class Phi3RotaryEmbedding(PhiRotaryEmbedding): function apply_rotary_pos_emb (line 70) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Phi3Attention (line 100) | class Phi3Attention(nn.Module): method __init__ (line 103) | def __init__(self, config: Phi3Config, layer_idx: int | None = None): method forward (line 118) | def forward( class Phi3DecoderLayer (line 166) | class Phi3DecoderLayer(MistralDecoderLayer): method __init__ (line 167) | def __init__(self, config: Phi3Config, layer_idx: int): method forward (line 175) | def forward( class Phi3PreTrainedModel (line 206) | class Phi3PreTrainedModel(MistralPreTrainedModel): class Phi3ForCausalLM (line 210) | class Phi3ForCausalLM(MistralForCausalLM): method prepare_inputs_for_generation (line 211) | def prepare_inputs_for_generation( class Phi3ForSequenceClassification (line 250) | class Phi3ForSequenceClassification(MistralForSequenceClassification): class Phi3ForTokenClassification (line 254) | class Phi3ForTokenClassification(MistralForTokenClassification): FILE: src/transformers/models/phi4_multimodal/configuration_phi4_multimodal.py class Phi4MultimodalVisionConfig (line 32) | class Phi4MultimodalVisionConfig(PreTrainedConfig): class Phi4MultimodalAudioConfig (line 68) | class Phi4MultimodalAudioConfig(PreTrainedConfig): method __post_init__ (line 145) | def __post_init__(self, **kwargs): method validate_architecture (line 152) | def validate_architecture(self): class Phi4MultimodalConfig (line 160) | class Phi4MultimodalConfig(PreTrainedConfig): method __post_init__ (line 221) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 237) | def convert_rope_params_to_dict( method validate_rope (line 255) | def validate_rope(self): FILE: src/transformers/models/phi4_multimodal/convert_phi4_multimodal_weights_to_hf.py function map_old_key_to_new (line 59) | def map_old_key_to_new(old_key): function convert_state_dict (line 78) | def convert_state_dict(original_state_dict: dict): function convert_config (line 88) | def convert_config(original_config: dict): function read_json (line 138) | def read_json(path): function convert_and_write_model (line 143) | def convert_and_write_model(input_dir: str, output_dir: str): function convert_and_save_processor (line 169) | def convert_and_save_processor(input_dir: str, output_dir: str): function extract_adapters_data (line 216) | def extract_adapters_data(input_dir: str, output_dir: str): function main (line 252) | def main(): FILE: src/transformers/models/phi4_multimodal/feature_extraction_phi4_multimodal.py class Phi4MultimodalFeatureExtractor (line 34) | class Phi4MultimodalFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 37) | def __init__( method __call__ (line 74) | def __call__( method _torch_extract_fbank_features (line 203) | def _torch_extract_fbank_features( method _compute_audio_embed_size (line 269) | def _compute_audio_embed_size(self, audio_frames): FILE: src/transformers/models/phi4_multimodal/image_processing_phi4_multimodal.py class Phi4MultimodalImageProcessorKwargs (line 31) | class Phi4MultimodalImageProcessorKwargs(ImagesKwargs, total=False): class Phi4MultimodalImageProcessor (line 44) | class Phi4MultimodalImageProcessor(TorchvisionBackend): method __init__ (line 58) | def __init__(self, **kwargs: Unpack[Phi4MultimodalImageProcessorKwargs]): method preprocess (line 62) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Phi4Multimod... method find_closest_aspect_ratio (line 65) | def find_closest_aspect_ratio(self, aspect_ratio, target_ratios, width... method dynamic_preprocess (line 80) | def dynamic_preprocess(self, image, image_size, patch_size, mask_size,... method pad_to_max_num_crops (line 140) | def pad_to_max_num_crops(self, images, max_crops=5): method pad_mask_to_max_num_crops (line 150) | def pad_mask_to_max_num_crops(self, masks, max_crops=5): method _preprocess (line 157) | def _preprocess( FILE: src/transformers/models/phi4_multimodal/modeling_phi4_multimodal.py class Phi4MultimodalVisionMLP (line 53) | class Phi4MultimodalVisionMLP(nn.Module): method __init__ (line 54) | def __init__(self, config): method forward (line 61) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function simple_eager_attention_forward (line 68) | def simple_eager_attention_forward( class Phi4MultimodalVisionAttention (line 90) | class Phi4MultimodalVisionAttention(nn.Module): method __init__ (line 91) | def __init__(self, config: Phi4MultimodalVisionConfig): method forward (line 106) | def forward( class Phi4MultimodalVisionEncoderLayer (line 140) | class Phi4MultimodalVisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 141) | def __init__(self, config: Phi4MultimodalVisionConfig): method forward (line 150) | def forward( class Phi4MultimodalVisionEncoder (line 174) | class Phi4MultimodalVisionEncoder(nn.Module): method __init__ (line 183) | def __init__(self, config: Phi4MultimodalVisionConfig): method forward (line 193) | def forward( class Phi4MultimodalVisionPreTrainedModel (line 211) | class Phi4MultimodalVisionPreTrainedModel(PreTrainedModel): method _init_weights (line 229) | def _init_weights(self, module): class Phi4MultimodalVisionEmbeddings (line 267) | class Phi4MultimodalVisionEmbeddings(nn.Module): method __init__ (line 268) | def __init__(self, config: Phi4MultimodalVisionConfig): method interpolate_pos_encoding (line 283) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 321) | def forward(self, pixel_values: torch.FloatTensor, patch_attention_mas... class Phi4MultimodalVisionMultiheadAttentionPoolingHead (line 367) | class Phi4MultimodalVisionMultiheadAttentionPoolingHead(nn.Module): method __init__ (line 370) | def __init__(self, config: Phi4MultimodalVisionConfig): method forward (line 378) | def forward(self, hidden_state, attention_mask): class Phi4MultimodalVisionModel (line 393) | class Phi4MultimodalVisionModel(Phi4MultimodalVisionPreTrainedModel): method __init__ (line 397) | def __init__(self, config: Phi4MultimodalVisionConfig): method get_input_embeddings (line 409) | def get_input_embeddings(self) -> nn.Module: method forward (line 414) | def forward( class Phi4MultimodalImageEmbedding (line 461) | class Phi4MultimodalImageEmbedding(nn.Module): method __init__ (line 464) | def __init__(self, config: Phi4MultimodalConfig): method get_img_features (line 485) | def get_img_features(self, img_embeds: torch.FloatTensor, attention_ma... method forward (line 505) | def forward( class Phi4MultimodalAudioMLP (line 597) | class Phi4MultimodalAudioMLP(nn.Module): method __init__ (line 598) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 606) | def forward(self, hidden_states): class Phi4MultimodalAudioAttention (line 618) | class Phi4MultimodalAudioAttention(nn.Module): method __init__ (line 619) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 632) | def forward( class Phi4MultimodalAudioDepthWiseSeparableConv1d (line 665) | class Phi4MultimodalAudioDepthWiseSeparableConv1d(nn.Module): method __init__ (line 666) | def __init__(self, config: Phi4MultimodalAudioConfig, padding: int = 0): method forward (line 680) | def forward(self, hidden_states): class Phi4MultimodalAudioGluPointWiseConv (line 684) | class Phi4MultimodalAudioGluPointWiseConv(nn.Module): method __init__ (line 685) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 695) | def forward(self, hidden_states): class Phi4MultimodalAudioConvModule (line 705) | class Phi4MultimodalAudioConvModule(nn.Module): method __init__ (line 706) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 718) | def forward(self, hidden_states: torch.Tensor): class Phi4MultimodalAudioConformerEncoderLayer (line 731) | class Phi4MultimodalAudioConformerEncoderLayer(nn.Module): method __init__ (line 732) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 742) | def forward( class Phi4MultimodalAudioNemoConvSubsampling (line 759) | class Phi4MultimodalAudioNemoConvSubsampling(torch.nn.Module): method __init__ (line 760) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 784) | def forward(self, hidden_states: torch.Tensor, mask: torch.Tensor | No... class Phi4MultimodalAudioRelativeAttentionBias (line 804) | class Phi4MultimodalAudioRelativeAttentionBias(nn.Module): method __init__ (line 805) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 815) | def forward(self, x): class Phi4MultimodalAudioMeanVarianceNormLayer (line 837) | class Phi4MultimodalAudioMeanVarianceNormLayer(nn.Module): method __init__ (line 838) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 843) | def forward(self, x): class Phi4MultimodalAudioPreTrainedModel (line 848) | class Phi4MultimodalAudioPreTrainedModel(PreTrainedModel): method _init_weights (line 858) | def _init_weights(self, module): function unfold_tensor (line 868) | def unfold_tensor(tensor, max_seq_len): function adaptive_enc_mask (line 887) | def adaptive_enc_mask(x_len, chunk_start_idx, left_window=0, right_windo... class Phi4MultimodalAudioModel (line 919) | class Phi4MultimodalAudioModel(Phi4MultimodalAudioPreTrainedModel): method __init__ (line 920) | def __init__(self, config: Phi4MultimodalAudioConfig): method _streaming_mask (line 935) | def _streaming_mask(self, seq_len, batch_size, chunk_size, left_chunk): method forward_embeddings (line 955) | def forward_embeddings(self, hidden_states, masks): method calculate_hs_mask (line 980) | def calculate_hs_mask(self, hidden_states, device, mask): method forward (line 999) | def forward(self, hidden_states: torch.Tensor, mask: torch.Tensor | No... class Phi4MultimodalAudioEmbedding (line 1051) | class Phi4MultimodalAudioEmbedding(nn.Module): method __init__ (line 1052) | def __init__(self, config: Phi4MultimodalConfig): method forward (line 1068) | def forward( class Phi4MultimodalRMSNorm (line 1112) | class Phi4MultimodalRMSNorm(nn.Module): method __init__ (line 1113) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 1121) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 1128) | def extra_repr(self): class Phi4MultimodalMLP (line 1132) | class Phi4MultimodalMLP(nn.Module): method __init__ (line 1133) | def __init__(self, config): method forward (line 1141) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: function rotate_half (line 1150) | def rotate_half(x): function repeat_kv (line 1157) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 1169) | def eager_attention_forward( function apply_rotary_pos_emb (line 1194) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Phi4MultimodalAttention (line 1224) | class Phi4MultimodalAttention(nn.Module): method __init__ (line 1227) | def __init__(self, config: Phi4MultimodalConfig, layer_idx: int | None... method forward (line 1242) | def forward( class Phi4MultimodalDecoderLayer (line 1290) | class Phi4MultimodalDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1291) | def __init__(self, config: Phi4MultimodalConfig, layer_idx: int): method forward (line 1302) | def forward( class Phi4MultimodalFeatureEmbedding (line 1333) | class Phi4MultimodalFeatureEmbedding(nn.Module): method __init__ (line 1336) | def __init__(self, config: Phi4MultimodalConfig) -> None: method forward (line 1344) | def forward( class Phi4MultimodalPreTrainedModel (line 1392) | class Phi4MultimodalPreTrainedModel(PreTrainedModel): method _init_weights (line 1412) | def _init_weights(self, module): class Phi4MultimodalRotaryEmbedding (line 1419) | class Phi4MultimodalRotaryEmbedding(nn.Module): method __init__ (line 1422) | def __init__(self, config: Phi4MultimodalConfig, device=None): method compute_default_rope_parameters (line 1439) | def compute_default_rope_parameters( method forward (line 1472) | def forward(self, x, position_ids): class Phi4MultimodalModel (line 1487) | class Phi4MultimodalModel(Phi4MultimodalPreTrainedModel): method __init__ (line 1488) | def __init__(self, config: Phi4MultimodalConfig): method forward (line 1511) | def forward( class Phi4MultimodalForCausalLM (line 1597) | class Phi4MultimodalForCausalLM(Phi4MultimodalPreTrainedModel, Generatio... method __init__ (line 1602) | def __init__(self, config): method forward (line 1613) | def forward( method prepare_inputs_for_generation (line 1698) | def prepare_inputs_for_generation( FILE: src/transformers/models/phi4_multimodal/modular_phi4_multimodal.py class Phi4MultimodalVisionConfig (line 69) | class Phi4MultimodalVisionConfig(SiglipVisionConfig): class Phi4MultimodalAudioConfig (line 100) | class Phi4MultimodalAudioConfig(PreTrainedConfig): method __post_init__ (line 177) | def __post_init__(self, **kwargs): method validate_architecture (line 184) | def validate_architecture(self): class Phi4MultimodalConfig (line 192) | class Phi4MultimodalConfig(Phi3Config): method __post_init__ (line 225) | def __post_init__(self, **kwargs): class Phi4MultimodalVisionMLP (line 239) | class Phi4MultimodalVisionMLP(SiglipMLP): function simple_eager_attention_forward (line 243) | def simple_eager_attention_forward( class Phi4MultimodalVisionAttention (line 265) | class Phi4MultimodalVisionAttention(nn.Module): method __init__ (line 266) | def __init__(self, config: Phi4MultimodalVisionConfig): method forward (line 281) | def forward( class Phi4MultimodalVisionEncoderLayer (line 315) | class Phi4MultimodalVisionEncoderLayer(SiglipEncoderLayer): method __init__ (line 316) | def __init__(self, config: Phi4MultimodalVisionConfig): class Phi4MultimodalVisionEncoder (line 322) | class Phi4MultimodalVisionEncoder(SiglipEncoder): method __init__ (line 323) | def __init__(self, config: Phi4MultimodalVisionConfig): class Phi4MultimodalVisionPreTrainedModel (line 330) | class Phi4MultimodalVisionPreTrainedModel(SiglipPreTrainedModel): method _init_weights (line 347) | def _init_weights(self, module): class Phi4MultimodalVisionEmbeddings (line 385) | class Phi4MultimodalVisionEmbeddings(SiglipVisionEmbeddings): method __init__ (line 386) | def __init__(self, config: Phi4MultimodalVisionConfig): method forward (line 401) | def forward(self, pixel_values: torch.FloatTensor, patch_attention_mas... class Phi4MultimodalVisionMultiheadAttentionPoolingHead (line 447) | class Phi4MultimodalVisionMultiheadAttentionPoolingHead(SiglipMultiheadA... method __init__ (line 448) | def __init__(self, config: Phi4MultimodalVisionConfig): method forward (line 452) | def forward(self, hidden_state, attention_mask): class Phi4MultimodalVisionModel (line 467) | class Phi4MultimodalVisionModel(Phi4MultimodalVisionPreTrainedModel): method __init__ (line 471) | def __init__(self, config: Phi4MultimodalVisionConfig): method get_input_embeddings (line 483) | def get_input_embeddings(self) -> nn.Module: method forward (line 488) | def forward( class Phi4MultimodalImageEmbedding (line 535) | class Phi4MultimodalImageEmbedding(nn.Module): method __init__ (line 538) | def __init__(self, config: Phi4MultimodalConfig): method get_img_features (line 559) | def get_img_features(self, img_embeds: torch.FloatTensor, attention_ma... method forward (line 579) | def forward( class Phi4MultimodalAudioMLP (line 671) | class Phi4MultimodalAudioMLP(nn.Module): method __init__ (line 672) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 680) | def forward(self, hidden_states): class Phi4MultimodalAudioAttention (line 692) | class Phi4MultimodalAudioAttention(nn.Module): method __init__ (line 693) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 706) | def forward( class Phi4MultimodalAudioDepthWiseSeparableConv1d (line 739) | class Phi4MultimodalAudioDepthWiseSeparableConv1d(nn.Module): method __init__ (line 740) | def __init__(self, config: Phi4MultimodalAudioConfig, padding: int = 0): method forward (line 754) | def forward(self, hidden_states): class Phi4MultimodalAudioGluPointWiseConv (line 758) | class Phi4MultimodalAudioGluPointWiseConv(nn.Module): method __init__ (line 759) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 769) | def forward(self, hidden_states): class Phi4MultimodalAudioConvModule (line 779) | class Phi4MultimodalAudioConvModule(nn.Module): method __init__ (line 780) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 792) | def forward(self, hidden_states: torch.Tensor): class Phi4MultimodalAudioConformerEncoderLayer (line 805) | class Phi4MultimodalAudioConformerEncoderLayer(nn.Module): method __init__ (line 806) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 816) | def forward( class Phi4MultimodalAudioNemoConvSubsampling (line 833) | class Phi4MultimodalAudioNemoConvSubsampling(torch.nn.Module): method __init__ (line 834) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 858) | def forward(self, hidden_states: torch.Tensor, mask: torch.Tensor | No... class Phi4MultimodalAudioRelativeAttentionBias (line 878) | class Phi4MultimodalAudioRelativeAttentionBias(nn.Module): method __init__ (line 879) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 889) | def forward(self, x): class Phi4MultimodalAudioMeanVarianceNormLayer (line 911) | class Phi4MultimodalAudioMeanVarianceNormLayer(nn.Module): method __init__ (line 912) | def __init__(self, config: Phi4MultimodalAudioConfig): method forward (line 917) | def forward(self, x): class Phi4MultimodalAudioPreTrainedModel (line 922) | class Phi4MultimodalAudioPreTrainedModel(PreTrainedModel): method _init_weights (line 932) | def _init_weights(self, module): class Phi4MultimodalAudioModel (line 942) | class Phi4MultimodalAudioModel(Phi4MultimodalAudioPreTrainedModel): method __init__ (line 943) | def __init__(self, config: Phi4MultimodalAudioConfig): method _streaming_mask (line 958) | def _streaming_mask(self, seq_len, batch_size, chunk_size, left_chunk): method forward_embeddings (line 978) | def forward_embeddings(self, hidden_states, masks): method calculate_hs_mask (line 1003) | def calculate_hs_mask(self, hidden_states, device, mask): method forward (line 1022) | def forward(self, hidden_states: torch.Tensor, mask: torch.Tensor | No... function unfold_tensor (line 1074) | def unfold_tensor(tensor, max_seq_len): function adaptive_enc_mask (line 1093) | def adaptive_enc_mask(x_len, chunk_start_idx, left_window=0, right_windo... class Phi4MultimodalAudioEmbedding (line 1125) | class Phi4MultimodalAudioEmbedding(nn.Module): method __init__ (line 1126) | def __init__(self, config: Phi4MultimodalConfig): method forward (line 1142) | def forward( class Phi4MultimodalRMSNorm (line 1188) | class Phi4MultimodalRMSNorm(Phi3RMSNorm): class Phi4MultimodalDecoderLayer (line 1192) | class Phi4MultimodalDecoderLayer(Phi3DecoderLayer): class Phi4MultimodalFeatureEmbedding (line 1196) | class Phi4MultimodalFeatureEmbedding(nn.Module): method __init__ (line 1199) | def __init__(self, config: Phi4MultimodalConfig) -> None: method forward (line 1207) | def forward( class Phi4MultimodalPreTrainedModel (line 1254) | class Phi4MultimodalPreTrainedModel(Phi3PreTrainedModel): method _init_weights (line 1258) | def _init_weights(self, module): class Phi4MultimodalModel (line 1265) | class Phi4MultimodalModel(Phi3Model): method __init__ (line 1266) | def __init__(self, config: Phi4MultimodalConfig): method forward (line 1287) | def forward( class Phi4MultimodalForCausalLM (line 1372) | class Phi4MultimodalForCausalLM(Phi3ForCausalLM): method __init__ (line 1375) | def __init__(self, config): method forward (line 1386) | def forward( method prepare_inputs_for_generation (line 1471) | def prepare_inputs_for_generation( FILE: src/transformers/models/phi4_multimodal/processing_phi4_multimodal.py class Phi4MultimodalProcessorKwargs (line 32) | class Phi4MultimodalProcessorKwargs(ProcessingKwargs, total=False): class Phi4MultimodalProcessor (line 41) | class Phi4MultimodalProcessor(ProcessorMixin): method __init__ (line 42) | def __init__( method __call__ (line 56) | def __call__( FILE: src/transformers/models/phimoe/configuration_phimoe.py class PhimoeConfig (line 26) | class PhimoeConfig(PreTrainedConfig): method __post_init__ (line 78) | def __post_init__(self, **kwargs): method validate_rope (line 83) | def validate_rope(self): FILE: src/transformers/models/phimoe/modeling_phimoe.py class PhimoeRotaryEmbedding (line 45) | class PhimoeRotaryEmbedding(nn.Module): method __init__ (line 48) | def __init__(self, config: PhimoeConfig, device=None): method compute_default_rope_parameters (line 65) | def compute_default_rope_parameters( method forward (line 96) | def forward(self, x, position_ids=None, layer_type=None): function rotate_half (line 124) | def rotate_half(x): function apply_rotary_pos_emb (line 132) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 157) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 169) | def eager_attention_forward( class PhimoeAttention (line 195) | class PhimoeAttention(nn.Module): method __init__ (line 198) | def __init__(self, config: PhimoeConfig, layer_idx: int): method forward (line 221) | def forward( class PhimoeMultiplier (line 262) | class PhimoeMultiplier(torch.autograd.Function): method forward (line 264) | def forward( method backward (line 290) | def backward( class PhimoeExperts (line 325) | class PhimoeExperts(nn.Module): method __init__ (line 328) | def __init__(self, config: PhimoeConfig): method forward (line 337) | def forward( function sparsemixer (line 364) | def sparsemixer(scores, jitter_eps, training, top_k=2): class PhimoeTopKRouter (line 487) | class PhimoeTopKRouter(nn.Linear): method __init__ (line 488) | def __init__(self, config: PhimoeConfig): method forward (line 494) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class PhimoeSparseMoeBlock (line 506) | class PhimoeSparseMoeBlock(nn.Module): method __init__ (line 518) | def __init__(self, config): method forward (line 528) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PhimoeDecoderLayer (line 542) | class PhimoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 543) | def __init__(self, config: PhimoeConfig, layer_idx: int): method forward (line 557) | def forward( class PhimoePreTrainedModel (line 585) | class PhimoePreTrainedModel(PreTrainedModel): method _init_weights (line 604) | def _init_weights(self, module): class PhimoeModel (line 615) | class PhimoeModel(PhimoePreTrainedModel): method __init__ (line 616) | def __init__(self, config: PhimoeConfig): method forward (line 635) | def forward( function load_balancing_loss_func (line 690) | def load_balancing_loss_func( class PhimoeForCausalLM (line 773) | class PhimoeForCausalLM(PhimoePreTrainedModel, GenerationMixin): method __init__ (line 778) | def __init__(self, config): method forward (line 792) | def forward( method prepare_inputs_for_generation (line 875) | def prepare_inputs_for_generation( class PhimoeForSequenceClassification (line 913) | class PhimoeForSequenceClassification(GenericForSequenceClassification, ... FILE: src/transformers/models/phimoe/modular_phimoe.py class PhimoeRotaryEmbedding (line 40) | class PhimoeRotaryEmbedding(MixtralRotaryEmbedding): method __init__ (line 41) | def __init__(self, config: PhimoeConfig, device=None): method forward (line 57) | def forward(self, x, position_ids=None, layer_type=None): class PhimoeAttention (line 85) | class PhimoeAttention(LlamaAttention): class PhimoeMultiplier (line 89) | class PhimoeMultiplier(torch.autograd.Function): method forward (line 91) | def forward( method backward (line 117) | def backward( function sparsemixer (line 151) | def sparsemixer(scores, jitter_eps, training, top_k=2): class PhimoeExperts (line 274) | class PhimoeExperts(MixtralExperts): class PhimoeTopKRouter (line 278) | class PhimoeTopKRouter(nn.Linear): method __init__ (line 279) | def __init__(self, config: PhimoeConfig): method forward (line 285) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class PhimoeSparseMoeBlock (line 297) | class PhimoeSparseMoeBlock(nn.Module): method __init__ (line 309) | def __init__(self, config): method forward (line 319) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PhimoeDecoderLayer (line 333) | class PhimoeDecoderLayer(MixtralDecoderLayer): method __init__ (line 334) | def __init__(self, config: PhimoeConfig, layer_idx: int): class PhimoePreTrainedModel (line 344) | class PhimoePreTrainedModel(MixtralPreTrainedModel): class PhimoeModel (line 352) | class PhimoeModel(MixtralModel): method __init__ (line 353) | def __init__(self, config: PhimoeConfig): class PhimoeForCausalLM (line 358) | class PhimoeForCausalLM(MixtralForCausalLM): method __init__ (line 359) | def __init__(self, config): method prepare_inputs_for_generation (line 364) | def prepare_inputs_for_generation( class PhimoeForSequenceClassification (line 402) | class PhimoeForSequenceClassification(GenericForSequenceClassification, ... FILE: src/transformers/models/phobert/tokenization_phobert.py function get_pairs (line 33) | def get_pairs(word): class PhobertTokenizer (line 49) | class PhobertTokenizer(PreTrainedTokenizer): method __init__ (line 100) | def __init__( method build_inputs_with_special_tokens (line 144) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 170) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 198) | def create_token_type_ids_from_sequences( method vocab_size (line 223) | def vocab_size(self): method get_vocab (line 226) | def get_vocab(self): method bpe (line 229) | def bpe(self, token): method _tokenize (line 273) | def _tokenize(self, text): method _convert_token_to_id (line 283) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 287) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 291) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 296) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method add_from_file (line 325) | def add_from_file(self, f): FILE: src/transformers/models/pi0/configuration_pi0.py class PI0Config (line 29) | class PI0Config(PreTrainedConfig): method __post_init__ (line 84) | def __post_init__(self, **kwargs): method validate_architecture (line 134) | def validate_architecture(self): FILE: src/transformers/models/pi0/image_processing_pi0.py class PI0ImageProcessor (line 26) | class PI0ImageProcessor(TorchvisionBackend): FILE: src/transformers/models/pi0/modeling_pi0.py class PI0TimestepEmbeddings (line 39) | class PI0TimestepEmbeddings(nn.Module): method __init__ (line 40) | def __init__(self, config): method compute_freqs (line 47) | def compute_freqs(config): method forward (line 53) | def forward(self, time): class PI0ActionTimeEmbedding (line 62) | class PI0ActionTimeEmbedding(nn.Module): method __init__ (line 63) | def __init__(self, config): method forward (line 71) | def forward(self, state, noise, timestep): class PI0PreTrainedModel (line 85) | class PI0PreTrainedModel(PreTrainedModel): method _init_weights (line 98) | def _init_weights(self, module): function blockwise_bidirectional_mask (line 104) | def blockwise_bidirectional_mask(block_boundaries: torch.Tensor) -> Call... class PI0Model (line 114) | class PI0Model(PI0PreTrainedModel): method __init__ (line 115) | def __init__(self, config: PI0Config): method get_input_embeddings (line 121) | def get_input_embeddings(self): method set_input_embeddings (line 124) | def set_input_embeddings(self, value): method embed_prefix (line 127) | def embed_prefix(self, input_ids, pixel_values, pixel_attention_mask, ... method forward (line 154) | def forward( class PI0ForConditionalGeneration (line 226) | class PI0ForConditionalGeneration(PI0PreTrainedModel): method __init__ (line 231) | def __init__(self, config: PI0Config): method forward (line 241) | def forward( method sample_actions (line 328) | def sample_actions( FILE: src/transformers/models/pi0/modular_pi0.py class PI0ImageProcessor (line 47) | class PI0ImageProcessor(SiglipImageProcessor): class PI0ProcessorKwargs (line 53) | class PI0ProcessorKwargs(ProcessingKwargs, total=False): class PI0Processor (line 66) | class PI0Processor(PaligemmaProcessor): method __init__ (line 67) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 82) | def __call__( method model_input_names (line 172) | def model_input_names(self): class PI0Config (line 178) | class PI0Config(PreTrainedConfig): method __post_init__ (line 233) | def __post_init__(self, **kwargs): method validate_architecture (line 283) | def validate_architecture(self): function blockwise_bidirectional_mask (line 289) | def blockwise_bidirectional_mask(block_boundaries: torch.Tensor) -> Call... class PI0TimestepEmbeddings (line 298) | class PI0TimestepEmbeddings(nn.Module): method __init__ (line 299) | def __init__(self, config): method compute_freqs (line 306) | def compute_freqs(config): method forward (line 312) | def forward(self, time): class PI0ActionTimeEmbedding (line 321) | class PI0ActionTimeEmbedding(nn.Module): method __init__ (line 322) | def __init__(self, config): method forward (line 330) | def forward(self, state, noise, timestep): class PI0PreTrainedModel (line 344) | class PI0PreTrainedModel(PreTrainedModel): method _init_weights (line 357) | def _init_weights(self, module): class PI0Model (line 364) | class PI0Model(PI0PreTrainedModel): method __init__ (line 365) | def __init__(self, config: PI0Config): method get_input_embeddings (line 371) | def get_input_embeddings(self): method set_input_embeddings (line 374) | def set_input_embeddings(self, value): method embed_prefix (line 377) | def embed_prefix(self, input_ids, pixel_values, pixel_attention_mask, ... method forward (line 404) | def forward( class PI0ForConditionalGeneration (line 476) | class PI0ForConditionalGeneration(PI0PreTrainedModel): method __init__ (line 481) | def __init__(self, config: PI0Config): method forward (line 491) | def forward( method sample_actions (line 578) | def sample_actions( FILE: src/transformers/models/pi0/processing_pi0.py class PI0ProcessorKwargs (line 36) | class PI0ProcessorKwargs(ProcessingKwargs, total=False): class PI0Processor (line 53) | class PI0Processor(ProcessorMixin): method __init__ (line 54) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 89) | def __call__( method _get_num_multimodal_tokens (line 178) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 197) | def model_input_names(self): FILE: src/transformers/models/pix2struct/configuration_pix2struct.py class Pix2StructTextConfig (line 27) | class Pix2StructTextConfig(PreTrainedConfig): class Pix2StructVisionConfig (line 87) | class Pix2StructVisionConfig(PreTrainedConfig): class Pix2StructConfig (line 142) | class Pix2StructConfig(PreTrainedConfig): method __post_init__ (line 181) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pix2struct/convert_pix2struct_original_pytorch_to_hf.py function get_flax_param (line 33) | def get_flax_param(t5x_checkpoint_path): function rename_and_convert_flax_params (line 39) | def rename_and_convert_flax_params(flax_dict): function convert_pix2struct_original_pytorch_checkpoint_to_hf (line 104) | def convert_pix2struct_original_pytorch_checkpoint_to_hf( FILE: src/transformers/models/pix2struct/image_processing_pil_pix2struct.py class Pix2StructImageProcessorKwargs (line 41) | class Pix2StructImageProcessorKwargs(ImagesKwargs, total=False): function render_text (line 62) | def render_text( function torch_extract_patches (line 138) | def torch_extract_patches(image_tensor, patch_height, patch_width): class Pix2StructImageProcessorPil (line 163) | class Pix2StructImageProcessorPil(PilBackend): method _standardize_kwargs (line 173) | def _standardize_kwargs(self, patch_size: dict[str, int] | SizeDict | ... method _validate_preprocess_kwargs (line 185) | def _validate_preprocess_kwargs(self, **kwargs): method render_header (line 193) | def render_header( method normalize (line 236) | def normalize(self, image: np.ndarray) -> np.ndarray: method extract_flattened_patches (line 257) | def extract_flattened_patches(self, image: np.ndarray, max_patches: in... method preprocess (line 322) | def preprocess( method _preprocess_image_like_inputs (line 334) | def _preprocess_image_like_inputs( method _preprocess (line 370) | def _preprocess( FILE: src/transformers/models/pix2struct/image_processing_pix2struct.py class Pix2StructImageProcessorKwargs (line 37) | class Pix2StructImageProcessorKwargs(ImagesKwargs, total=False): function render_text (line 57) | def render_text( function torch_extract_patches (line 129) | def torch_extract_patches(image_tensor, patch_height, patch_width): class Pix2StructImageProcessor (line 151) | class Pix2StructImageProcessor(TorchvisionBackend): method _standardize_kwargs (line 161) | def _standardize_kwargs( method _validate_preprocess_kwargs (line 177) | def _validate_preprocess_kwargs(self, **kwargs): method render_header (line 185) | def render_header( method normalize (line 241) | def normalize(self, images: "torch.Tensor") -> "torch.Tensor": method extract_flattened_patches (line 262) | def extract_flattened_patches( method preprocess (line 332) | def preprocess( method _preprocess_image_like_inputs (line 344) | def _preprocess_image_like_inputs( method _preprocess (line 384) | def _preprocess( FILE: src/transformers/models/pix2struct/modeling_pix2struct.py class Pix2StructLayerNorm (line 51) | class Pix2StructLayerNorm(nn.Module): method __init__ (line 52) | def __init__(self, hidden_size, eps=1e-6): method forward (line 60) | def forward(self, hidden_states): class Pix2StructVisionEmbeddings (line 89) | class Pix2StructVisionEmbeddings(nn.Module): method __init__ (line 96) | def __init__(self, config: Pix2StructConfig) -> None: method forward (line 105) | def forward(self, flattened_patches: torch.Tensor) -> torch.Tensor: class Pix2StructVisionAttention (line 125) | class Pix2StructVisionAttention(nn.Module): method __init__ (line 126) | def __init__(self, config): method forward (line 141) | def forward( class Pix2StructVisionMlp (line 216) | class Pix2StructVisionMlp(nn.Module): method __init__ (line 217) | def __init__(self, config: Pix2StructVisionConfig): method forward (line 225) | def forward(self, hidden_states): class Pix2StructVisionLayer (line 245) | class Pix2StructVisionLayer(GradientCheckpointingLayer): method __init__ (line 246) | def __init__(self, config: Pix2StructConfig) -> None: method forward (line 255) | def forward( class Pix2StructVisionEncoder (line 286) | class Pix2StructVisionEncoder(nn.Module): method __init__ (line 287) | def __init__(self, config: Pix2StructVisionConfig) -> None: method forward (line 293) | def forward( class Pix2StructPreTrainedModel (line 328) | class Pix2StructPreTrainedModel(PreTrainedModel): method dummy_inputs (line 335) | def dummy_inputs(self): method _init_weights (line 346) | def _init_weights(self, module): method _shift_right (line 422) | def _shift_right(self, input_ids): class Pix2StructVisionModel (line 445) | class Pix2StructVisionModel(Pix2StructPreTrainedModel): method __init__ (line 452) | def __init__(self, config: Pix2StructVisionConfig): method get_input_embeddings (line 464) | def get_input_embeddings(self): method forward (line 468) | def forward( class Pix2StructTextDenseGatedActDense (line 544) | class Pix2StructTextDenseGatedActDense(nn.Module): method __init__ (line 545) | def __init__(self, config: Pix2StructTextConfig): method forward (line 553) | def forward(self, hidden_states): class Pix2StructTextLayerFF (line 573) | class Pix2StructTextLayerFF(nn.Module): method __init__ (line 574) | def __init__(self, config: Pix2StructTextConfig): method forward (line 582) | def forward(self, hidden_states): class Pix2StructTextAttention (line 589) | class Pix2StructTextAttention(nn.Module): method __init__ (line 590) | def __init__(self, config: Pix2StructTextConfig, has_relative_attentio... method _relative_position_bucket (line 620) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 668) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 686) | def forward( class Pix2StructTextLayerSelfAttention (line 781) | class Pix2StructTextLayerSelfAttention(nn.Module): method __init__ (line 782) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 790) | def forward( class Pix2StructTextLayerCrossAttention (line 815) | class Pix2StructTextLayerCrossAttention(nn.Module): method __init__ (line 816) | def __init__(self, config, layer_idx: int | None = None): method forward (line 822) | def forward( class Pix2StructTextBlock (line 846) | class Pix2StructTextBlock(GradientCheckpointingLayer): method __init__ (line 847) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 863) | def forward( class Pix2StructTextModel (line 931) | class Pix2StructTextModel(Pix2StructPreTrainedModel): method __init__ (line 938) | def __init__(self, config): method set_input_embeddings (line 957) | def set_input_embeddings(self, new_embeddings): method forward (line 961) | def forward( class Pix2StructForConditionalGeneration (line 1152) | class Pix2StructForConditionalGeneration(Pix2StructPreTrainedModel, Gene... method __init__ (line 1156) | def __init__(self, config: Pix2StructConfig): method get_input_embeddings (line 1167) | def get_input_embeddings(self): method set_input_embeddings (line 1170) | def set_input_embeddings(self, new_embeddings): method get_output_embeddings (line 1173) | def get_output_embeddings(self) -> nn.Module: method set_output_embeddings (line 1176) | def set_output_embeddings(self, new_embeddings): method forward (line 1180) | def forward( FILE: src/transformers/models/pix2struct/processing_pix2struct.py class Pix2StructProcessorKwargs (line 24) | class Pix2StructProcessorKwargs(ProcessingKwargs, total=False): class Pix2StructProcessor (line 47) | class Pix2StructProcessor(ProcessorMixin): method __init__ (line 48) | def __init__(self, image_processor, tokenizer): method __call__ (line 53) | def __call__( method model_input_names (line 103) | def model_input_names(self): FILE: src/transformers/models/pixio/configuration_pixio.py class PixioConfig (line 29) | class PixioConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pixio/convert_pixio_to_pytorch.py function get_pixio_config (line 36) | def get_pixio_config(model_name): function create_rename_keys (line 75) | def create_rename_keys(config): function rename_key (line 108) | def rename_key(dct, old, new): function read_in_q_k_v (line 114) | def read_in_q_k_v(state_dict, config): function prepare_img (line 133) | def prepare_img(): function convert_pixio_checkpoint (line 141) | def convert_pixio_checkpoint(model_name, checkpoint_path, pytorch_dump_f... FILE: src/transformers/models/pixio/modeling_pixio.py class PixioPatchEmbeddings (line 40) | class PixioPatchEmbeddings(nn.Module): method __init__ (line 47) | def __init__(self, config: PixioConfig): method forward (line 62) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... class PixioEmbeddings (line 79) | class PixioEmbeddings(nn.Module): method __init__ (line 84) | def __init__(self, config: PixioConfig) -> None: method interpolate_pos_encoding (line 97) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 135) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 150) | def eager_attention_forward( class PixioSelfAttention (line 178) | class PixioSelfAttention(nn.Module): method __init__ (line 179) | def __init__(self, config: PixioConfig): method forward (line 199) | def forward( class PixioSelfOutput (line 233) | class PixioSelfOutput(nn.Module): method __init__ (line 239) | def __init__(self, config: PixioConfig): method forward (line 244) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class PixioAttention (line 250) | class PixioAttention(nn.Module): method __init__ (line 251) | def __init__(self, config: PixioConfig): method forward (line 256) | def forward( function drop_path (line 266) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class PixioDropPath (line 281) | class PixioDropPath(nn.Module): method __init__ (line 284) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 288) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 291) | def extra_repr(self) -> str: class PixioMLP (line 295) | class PixioMLP(nn.Module): method __init__ (line 296) | def __init__(self, config) -> None: method forward (line 307) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class PixioLayer (line 314) | class PixioLayer(GradientCheckpointingLayer): method __init__ (line 315) | def __init__(self, config: PixioConfig) -> None: method forward (line 325) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class PixioPreTrainedModel (line 340) | class PixioPreTrainedModel(PreTrainedModel): method _init_weights (line 357) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm): class PixioEncoder (line 373) | class PixioEncoder(PixioPreTrainedModel): method __init__ (line 374) | def __init__(self, config: PixioConfig): method forward (line 382) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class PixioModel (line 390) | class PixioModel(PixioPreTrainedModel): method __init__ (line 391) | def __init__(self, config: PixioConfig): method get_input_embeddings (line 402) | def get_input_embeddings(self) -> PixioPatchEmbeddings: method forward (line 407) | def forward( class PixioBackbone (line 435) | class PixioBackbone(BackboneMixin, PixioPreTrainedModel): method __init__ (line 436) | def __init__(self, config): method get_input_embeddings (line 448) | def get_input_embeddings(self) -> PixioPatchEmbeddings: method forward (line 454) | def forward(self, pixel_values: torch.Tensor, **kwargs: Unpack[Transfo... FILE: src/transformers/models/pixio/modular_pixio.py class PixioConfig (line 37) | class PixioConfig(Dinov2Config): class PixioPatchEmbeddings (line 77) | class PixioPatchEmbeddings(ViTPatchEmbeddings): class PixioEmbeddings (line 81) | class PixioEmbeddings(nn.Module): method __init__ (line 86) | def __init__(self, config: PixioConfig) -> None: method interpolate_pos_encoding (line 99) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 137) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class PixioSelfAttention (line 152) | class PixioSelfAttention(ViTSelfAttention): class PixioAttention (line 156) | class PixioAttention(ViTAttention): method __init__ (line 157) | def __init__(self, config: PixioConfig): class PixioDropPath (line 162) | class PixioDropPath(Dinov2DropPath): class PixioMLP (line 166) | class PixioMLP(Dinov2MLP): class PixioLayer (line 170) | class PixioLayer(GradientCheckpointingLayer): method __init__ (line 171) | def __init__(self, config: PixioConfig) -> None: method forward (line 181) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class PixioPreTrainedModel (line 195) | class PixioPreTrainedModel(ViTPreTrainedModel): class PixioEncoder (line 202) | class PixioEncoder(PixioPreTrainedModel): method __init__ (line 203) | def __init__(self, config: PixioConfig): method forward (line 211) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class PixioModel (line 219) | class PixioModel(PixioPreTrainedModel): method __init__ (line 220) | def __init__(self, config: PixioConfig): method get_input_embeddings (line 231) | def get_input_embeddings(self) -> PixioPatchEmbeddings: method forward (line 236) | def forward( class PixioBackbone (line 264) | class PixioBackbone(Dinov2Backbone): method forward (line 265) | def forward(self, pixel_values: torch.Tensor, **kwargs: Unpack[Transfo... FILE: src/transformers/models/pixtral/configuration_pixtral.py class PixtralVisionConfig (line 24) | class PixtralVisionConfig(PreTrainedConfig): method __post_init__ (line 55) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pixtral/convert_pixtral_weights_to_hf.py function convert_mistral_tokenizer (line 86) | def convert_mistral_tokenizer(model_file): function permute_for_rope (line 100) | def permute_for_rope(value, n_heads, config): function convert_dictionary (line 106) | def convert_dictionary(original_state_dict, vision_config, text_config): function convert_mistral_model (line 144) | def convert_mistral_model(input_dir, output_dir): function main (line 212) | def main(): FILE: src/transformers/models/pixtral/image_processing_pil_pixtral.py class PixtralImageProcessorKwargs (line 35) | class PixtralImageProcessorKwargs(ImagesKwargs, total=False): function _num_image_tokens (line 45) | def _num_image_tokens(image_size: tuple[int, int], patch_size: tuple[int... function get_resize_output_image_size (line 66) | def get_resize_output_image_size( class PixtralImageProcessorPil (line 107) | class PixtralImageProcessorPil(PilBackend): method __init__ (line 122) | def __init__(self, **kwargs: Unpack[PixtralImageProcessorKwargs]): method preprocess (line 126) | def preprocess(self, images: ImageInput, **kwargs: Unpack[PixtralImage... method resize (line 129) | def resize( method _pad_for_batching (line 160) | def _pad_for_batching( method _preprocess (line 181) | def _preprocess( FILE: src/transformers/models/pixtral/image_processing_pixtral.py function _num_image_tokens (line 29) | def _num_image_tokens(image_size: tuple[int, int], patch_size: tuple[int... function get_resize_output_image_size (line 49) | def get_resize_output_image_size( class PixtralImageProcessorKwargs (line 89) | class PixtralImageProcessorKwargs(ImagesKwargs, total=False): class PixtralImageProcessor (line 99) | class PixtralImageProcessor(TorchvisionBackend): method __init__ (line 114) | def __init__(self, **kwargs: Unpack[PixtralImageProcessorKwargs]): method preprocess (line 118) | def preprocess(self, images: ImageInput, **kwargs: Unpack[PixtralImage... method resize (line 121) | def resize( method _pad_for_batching (line 160) | def _pad_for_batching( method _preprocess (line 184) | def _preprocess( FILE: src/transformers/models/pixtral/modeling_pixtral.py function position_ids_in_meshgrid (line 37) | def position_ids_in_meshgrid(patch_embeds_list, max_width): class PixtralRotaryEmbedding (line 48) | class PixtralRotaryEmbedding(nn.Module): method __init__ (line 62) | def __init__(self, config: PixtralVisionConfig, device=None, layer_typ... method compute_default_rope_parameters (line 79) | def compute_default_rope_parameters( method forward (line 125) | def forward(self, x, position_ids): function rotate_half (line 137) | def rotate_half(x): function apply_rotary_pos_emb (line 144) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function eager_attention_forward (line 170) | def eager_attention_forward( class PixtralAttention (line 193) | class PixtralAttention(nn.Module): method __init__ (line 198) | def __init__(self, config): method forward (line 216) | def forward( class PixtralMLP (line 260) | class PixtralMLP(nn.Module): method __init__ (line 261) | def __init__(self, config): method forward (line 271) | def forward(self, x): class PixtralRMSNorm (line 277) | class PixtralRMSNorm(nn.Module): method __init__ (line 278) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 286) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 293) | def extra_repr(self): class PixtralAttentionLayer (line 297) | class PixtralAttentionLayer(GradientCheckpointingLayer): method __init__ (line 298) | def __init__(self, config): method forward (line 305) | def forward( class PixtralTransformer (line 338) | class PixtralTransformer(nn.Module): method __init__ (line 339) | def __init__(self, config): method forward (line 347) | def forward( class PixtralPreTrainedModel (line 379) | class PixtralPreTrainedModel(PreTrainedModel): function generate_block_attention_mask (line 396) | def generate_block_attention_mask(patch_embeds_list, tensor): class PixtralVisionModel (line 413) | class PixtralVisionModel(PixtralPreTrainedModel): method __init__ (line 416) | def __init__(self, config): method get_input_embeddings (line 433) | def get_input_embeddings(self): method forward (line 439) | def forward( FILE: src/transformers/models/pixtral/processing_pixtral.py class PixtralProcessorKwargs (line 40) | class PixtralProcessorKwargs(ProcessingKwargs, total=False): function is_url (line 53) | def is_url(val) -> bool: function is_image_or_image_url (line 58) | def is_image_or_image_url(elem): class PixtralProcessor (line 64) | class PixtralProcessor(ProcessorMixin): method __init__ (line 65) | def __init__( method __call__ (line 103) | def __call__( method _get_num_multimodal_tokens (line 178) | def _get_num_multimodal_tokens(self, image_sizes=None, **kwargs): method model_input_names (line 215) | def model_input_names(self): FILE: src/transformers/models/plbart/configuration_plbart.py class PLBartConfig (line 24) | class PLBartConfig(PreTrainedConfig): FILE: src/transformers/models/plbart/convert_plbart_original_checkpoint_to_torch.py function remove_ignore_keys_ (line 23) | def remove_ignore_keys_(state_dict): function make_linear_from_emb (line 36) | def make_linear_from_emb(emb): function convert_fairseq_plbart_checkpoint_from_disk (line 43) | def convert_fairseq_plbart_checkpoint_from_disk( FILE: src/transformers/models/plbart/modeling_plbart.py class PLBartScaledWordEmbedding (line 61) | class PLBartScaledWordEmbedding(nn.Embedding): method __init__ (line 66) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 70) | def forward(self, input_ids: torch.Tensor): class PLBartPreTrainedModel (line 75) | class PLBartPreTrainedModel(PreTrainedModel): method _init_weights (line 84) | def _init_weights(self, module): class PLBartLearnedPositionalEmbedding (line 90) | class PLBartLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 95) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 101) | def forward( function eager_attention_forward (line 117) | def eager_attention_forward( class PLBartAttention (line 145) | class PLBartAttention(nn.Module): method __init__ (line 148) | def __init__( method forward (line 187) | def forward( class PLBartEncoderLayer (line 263) | class PLBartEncoderLayer(GradientCheckpointingLayer): method __init__ (line 264) | def __init__(self, config: PLBartConfig, layer_idx: int | None = None): method forward (line 283) | def forward( class PLBartEncoder (line 314) | class PLBartEncoder(PLBartPreTrainedModel): method __init__ (line 329) | def __init__(self, config: PLBartConfig): method forward (line 358) | def forward( class PLBartDecoderLayer (line 403) | class PLBartDecoderLayer(GradientCheckpointingLayer): method __init__ (line 404) | def __init__(self, config: PLBartConfig, layer_idx: int | None = None): method forward (line 435) | def forward( class PLBartDecoder (line 485) | class PLBartDecoder(PLBartPreTrainedModel): method __init__ (line 500) | def __init__(self, config: PLBartConfig): method forward (line 527) | def forward( function shift_tokens_right (line 612) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int): class PLBartModel (line 633) | class PLBartModel(PLBartPreTrainedModel): method __init__ (line 639) | def __init__(self, config: PLBartConfig): method get_input_embeddings (line 651) | def get_input_embeddings(self): method set_input_embeddings (line 654) | def set_input_embeddings(self, value): method forward (line 662) | def forward( class PLBartForConditionalGeneration (line 744) | class PLBartForConditionalGeneration(PLBartPreTrainedModel, GenerationMi... method __init__ (line 751) | def __init__(self, config: PLBartConfig): method resize_token_embeddings (line 759) | def resize_token_embeddings( method _resize_final_logits_bias (line 766) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 778) | def forward( method prepare_decoder_input_ids_from_labels (line 875) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class PLBartClassificationHead (line 879) | class PLBartClassificationHead(nn.Module): method __init__ (line 882) | def __init__( method forward (line 894) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PLBartForSequenceClassification (line 909) | class PLBartForSequenceClassification(PLBartPreTrainedModel): method __init__ (line 910) | def __init__(self, config: PLBartConfig, **kwargs): method forward (line 925) | def forward( class PLBartDecoderWrapper (line 1032) | class PLBartDecoderWrapper(PLBartPreTrainedModel): method __init__ (line 1038) | def __init__(self, config): method forward (line 1043) | def forward(self, *args, **kwargs): class PLBartForCausalLM (line 1052) | class PLBartForCausalLM(PLBartPreTrainedModel, GenerationMixin): method __init__ (line 1057) | def __init__(self, config): method get_input_embeddings (line 1068) | def get_input_embeddings(self): method set_input_embeddings (line 1071) | def set_input_embeddings(self, value): method forward (line 1076) | def forward( FILE: src/transformers/models/plbart/modular_plbart.py class PLBartScaledWordEmbedding (line 47) | class PLBartScaledWordEmbedding(BartScaledWordEmbedding): class PLBartPreTrainedModel (line 52) | class PLBartPreTrainedModel(PreTrainedModel): method _init_weights (line 61) | def _init_weights(self, module): class PLBartEncoder (line 67) | class PLBartEncoder(BartEncoder): class PLBartDecoder (line 71) | class PLBartDecoder(BartDecoder): class PLBartModel (line 76) | class PLBartModel(PLBartPreTrainedModel): method __init__ (line 82) | def __init__(self, config: PLBartConfig): method get_input_embeddings (line 94) | def get_input_embeddings(self): method set_input_embeddings (line 97) | def set_input_embeddings(self, value): method forward (line 105) | def forward( class PLBartForConditionalGeneration (line 187) | class PLBartForConditionalGeneration(PLBartPreTrainedModel, GenerationMi... method __init__ (line 194) | def __init__(self, config: PLBartConfig): method resize_token_embeddings (line 202) | def resize_token_embeddings( method _resize_final_logits_bias (line 209) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method forward (line 221) | def forward( method prepare_decoder_input_ids_from_labels (line 318) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class PLBartClassificationHead (line 322) | class PLBartClassificationHead(BartClassificationHead): class PLBartForSequenceClassification (line 326) | class PLBartForSequenceClassification(BigBirdPegasusForSequenceClassific... method forward (line 327) | def forward(**super_kwargs): class PLBartForCausalLM (line 356) | class PLBartForCausalLM(BartForCausalLM): method forward (line 359) | def forward(**super_kwargs): FILE: src/transformers/models/plbart/tokenization_plbart.py class PLBartTokenizer (line 48) | class PLBartTokenizer(SentencePieceBackend): method __init__ (line 116) | def __init__( method vocab_size (line 234) | def vocab_size(self): method get_vocab (line 242) | def get_vocab(self): method src_lang (line 256) | def src_lang(self) -> str: method src_lang (line 260) | def src_lang(self, new_src_lang: str) -> None: method _build_translation_inputs (line 265) | def _build_translation_inputs( method _convert_token_to_id (line 278) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 287) | def _convert_id_to_token(self, index): method prepare_seq2seq_batch (line 293) | def prepare_seq2seq_batch( method _switch_to_input_mode (line 305) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 308) | def _switch_to_target_mode(self): method set_src_lang_special_tokens (line 311) | def set_src_lang_special_tokens(self, src_lang) -> None: method set_tgt_lang_special_tokens (line 321) | def set_tgt_lang_special_tokens(self, lang: str) -> None: method _convert_lang_code_special_format (line 332) | def _convert_lang_code_special_format(self, lang: str) -> str: method decode (line 337) | def decode(self, token_ids, skip_special_tokens=False, clean_up_tokeni... FILE: src/transformers/models/poolformer/configuration_poolformer.py class PoolFormerConfig (line 24) | class PoolFormerConfig(PreTrainedConfig): FILE: src/transformers/models/poolformer/convert_poolformer_original_to_pytorch.py function replace_key_with_offset (line 35) | def replace_key_with_offset(key, offset, original_name, new_name): function rename_keys (line 49) | def rename_keys(state_dict): function prepare_img (line 85) | def prepare_img(): function convert_poolformer_checkpoint (line 93) | def convert_poolformer_checkpoint(model_name, checkpoint_path, pytorch_d... FILE: src/transformers/models/poolformer/image_processing_pil_poolformer.py class PoolFormerImageProcessorKwargs (line 33) | class PoolFormerImageProcessorKwargs(ImagesKwargs, total=False): class PoolFormerImageProcessorPil (line 43) | class PoolFormerImageProcessorPil(PilBackend): method __init__ (line 61) | def __init__(self, **kwargs: Unpack[PoolFormerImageProcessorKwargs]): method resize (line 64) | def resize( method _preprocess (line 95) | def _preprocess( FILE: src/transformers/models/poolformer/image_processing_poolformer.py class PoolFormerImageProcessorKwargs (line 33) | class PoolFormerImageProcessorKwargs(ImagesKwargs, total=False): class PoolFormerImageProcessor (line 43) | class PoolFormerImageProcessor(TorchvisionBackend): method __init__ (line 61) | def __init__(self, **kwargs: Unpack[PoolFormerImageProcessorKwargs]): method resize (line 64) | def resize( method _preprocess (line 89) | def _preprocess( FILE: src/transformers/models/poolformer/modeling_poolformer.py function drop_path (line 33) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class PoolFormerDropPath (line 49) | class PoolFormerDropPath(nn.Module): method __init__ (line 52) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 56) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 59) | def extra_repr(self) -> str: class PoolFormerEmbeddings (line 63) | class PoolFormerEmbeddings(nn.Module): method __init__ (line 68) | def __init__(self, hidden_size, num_channels, patch_size, stride, padd... method forward (line 77) | def forward(self, pixel_values): class PoolFormerGroupNorm (line 83) | class PoolFormerGroupNorm(nn.GroupNorm): method __init__ (line 88) | def __init__(self, num_channels, **kwargs): class PoolFormerPooling (line 92) | class PoolFormerPooling(nn.Module): method __init__ (line 93) | def __init__(self, pool_size): method forward (line 97) | def forward(self, hidden_states): class PoolFormerOutput (line 101) | class PoolFormerOutput(nn.Module): method __init__ (line 102) | def __init__(self, config, dropout_prob, hidden_size, intermediate_size): method forward (line 112) | def forward(self, hidden_states): class PoolFormerLayer (line 122) | class PoolFormerLayer(nn.Module): method __init__ (line 125) | def __init__(self, config, num_channels, pool_size, hidden_size, inter... method forward (line 143) | def forward(self, hidden_states): class PoolFormerEncoder (line 173) | class PoolFormerEncoder(nn.Module): method __init__ (line 174) | def __init__(self, config): method forward (line 217) | def forward(self, pixel_values, output_hidden_states=False, return_dic... class PoolFormerPreTrainedModel (line 240) | class PoolFormerPreTrainedModel(PreTrainedModel): method _init_weights (line 248) | def _init_weights(self, module): class PoolFormerModel (line 258) | class PoolFormerModel(PoolFormerPreTrainedModel): method __init__ (line 259) | def __init__(self, config): method get_input_embeddings (line 268) | def get_input_embeddings(self): method set_input_embeddings (line 272) | def set_input_embeddings(self, value): method forward (line 276) | def forward( class PoolFormerFinalPooler (line 307) | class PoolFormerFinalPooler(nn.Module): method __init__ (line 308) | def __init__(self, config): method forward (line 312) | def forward(self, hidden_states): class PoolFormerForImageClassification (line 322) | class PoolFormerForImageClassification(PoolFormerPreTrainedModel): method __init__ (line 323) | def __init__(self, config): method get_input_embeddings (line 338) | def get_input_embeddings(self): method set_input_embeddings (line 341) | def set_input_embeddings(self, value): method forward (line 345) | def forward( FILE: src/transformers/models/pop2piano/configuration_pop2piano.py class Pop2PianoConfig (line 24) | class Pop2PianoConfig(PreTrainedConfig): method __post_init__ (line 64) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pop2piano/convert_pop2piano_weights_to_hf.py function tokenize (line 156) | def tokenize(idx, token_type, n_special=4, n_note=128, n_velocity=2): function detokenize (line 170) | def detokenize(idx, n_special=4, n_note=128, n_velocity=2, time_idx_offs... FILE: src/transformers/models/pop2piano/feature_extraction_pop2piano.py class Pop2PianoFeatureExtractor (line 49) | class Pop2PianoFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 81) | def __init__( method mel_spectrogram (line 115) | def mel_spectrogram(self, sequence: np.ndarray): method extract_rhythm (line 140) | def extract_rhythm(self, audio: np.ndarray): method interpolate_beat_times (line 156) | def interpolate_beat_times( method preprocess_mel (line 186) | def preprocess_mel(self, audio: np.ndarray, beatstep: np.ndarray): method _pad (line 234) | def _pad(self, features: np.ndarray, add_zero_line=True): method pad (line 277) | def pad( method __call__ (line 341) | def __call__( FILE: src/transformers/models/pop2piano/modeling_pop2piano.py class Pop2PianoLayerNorm (line 55) | class Pop2PianoLayerNorm(nn.Module): method __init__ (line 56) | def __init__(self, hidden_size, eps=1e-6): method forward (line 64) | def forward(self, hidden_states): class Pop2PianoDenseActDense (line 85) | class Pop2PianoDenseActDense(nn.Module): method __init__ (line 86) | def __init__(self, config: Pop2PianoConfig): method forward (line 93) | def forward(self, hidden_states): class Pop2PianoDenseGatedActDense (line 108) | class Pop2PianoDenseGatedActDense(nn.Module): method __init__ (line 109) | def __init__(self, config: Pop2PianoConfig): method forward (line 117) | def forward(self, hidden_states): class Pop2PianoLayerFF (line 138) | class Pop2PianoLayerFF(nn.Module): method __init__ (line 139) | def __init__(self, config: Pop2PianoConfig): method forward (line 149) | def forward(self, hidden_states): class Pop2PianoAttention (line 157) | class Pop2PianoAttention(nn.Module): method __init__ (line 158) | def __init__( method _relative_position_bucket (line 193) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 240) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 257) | def forward( class Pop2PianoLayerSelfAttention (line 352) | class Pop2PianoLayerSelfAttention(nn.Module): method __init__ (line 353) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 361) | def forward( class Pop2PianoLayerCrossAttention (line 386) | class Pop2PianoLayerCrossAttention(nn.Module): method __init__ (line 387) | def __init__(self, config, layer_idx: int | None = None): method forward (line 393) | def forward( class Pop2PianoBlock (line 418) | class Pop2PianoBlock(GradientCheckpointingLayer): method __init__ (line 419) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 433) | def forward( class Pop2PianoPreTrainedModel (line 511) | class Pop2PianoPreTrainedModel(PreTrainedModel): method _init_weights (line 522) | def _init_weights(self, module): method _shift_right (line 561) | def _shift_right(self, input_ids): class Pop2PianoStack (line 582) | class Pop2PianoStack(Pop2PianoPreTrainedModel): method __init__ (line 584) | def __init__(self, config): method set_input_embeddings (line 604) | def set_input_embeddings(self, new_embeddings): method forward (line 607) | def forward( class Pop2PianoConcatEmbeddingToMel (line 768) | class Pop2PianoConcatEmbeddingToMel(nn.Module): method __init__ (line 771) | def __init__(self, config): method forward (line 775) | def forward(self, feature, index_value, embedding_offset): class Pop2PianoForConditionalGeneration (line 787) | class Pop2PianoForConditionalGeneration(Pop2PianoPreTrainedModel, Genera... method __init__ (line 793) | def __init__(self, config: Pop2PianoConfig): method get_input_embeddings (line 818) | def get_input_embeddings(self): method set_input_embeddings (line 821) | def set_input_embeddings(self, new_embeddings): method get_mel_conditioner_outputs (line 826) | def get_mel_conditioner_outputs( method forward (line 876) | def forward( method generate (line 990) | def generate( method prepare_decoder_input_ids_from_labels (line 1079) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): FILE: src/transformers/models/pop2piano/processing_pop2piano.py class Pop2PianoProcessor (line 29) | class Pop2PianoProcessor(ProcessorMixin): method __init__ (line 30) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 34) | def __call__( method batch_decode (line 98) | def batch_decode( method save_pretrained (line 114) | def save_pretrained(self, save_directory, **kwargs): method from_pretrained (line 121) | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): FILE: src/transformers/models/pop2piano/tokenization_pop2piano.py function token_time_to_note (line 38) | def token_time_to_note(number, cutoff_time_idx, current_idx): function token_note_to_note (line 46) | def token_note_to_note(number, current_velocity, default_velocity, note_... class Pop2PianoTokenizer (line 62) | class Pop2PianoTokenizer(PreTrainedTokenizer): method __init__ (line 91) | def __init__( method vocab_size (line 126) | def vocab_size(self): method get_vocab (line 130) | def get_vocab(self): method _convert_id_to_token (line 134) | def _convert_id_to_token(self, token_id: int) -> list: method _convert_token_to_id (line 152) | def _convert_token_to_id(self, token, token_type="TOKEN_TIME") -> int: method relative_batch_tokens_ids_to_notes (line 168) | def relative_batch_tokens_ids_to_notes( method relative_batch_tokens_ids_to_midi (line 212) | def relative_batch_tokens_ids_to_midi( method relative_tokens_ids_to_notes (line 248) | def relative_tokens_ids_to_notes(self, tokens: np.ndarray, start_idx: ... method notes_to_midi (line 308) | def notes_to_midi(self, notes: np.ndarray, beatstep: np.ndarray, offse... method save_vocabulary (line 340) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method encode_plus (line 363) | def encode_plus( method batch_encode_plus (line 434) | def batch_encode_plus( method __call__ (line 473) | def __call__( method batch_decode (line 592) | def batch_decode( FILE: src/transformers/models/pp_chart2table/configuration_pp_chart2table.py class PPChart2TableVisionConfig (line 30) | class PPChart2TableVisionConfig(PreTrainedConfig): class PPChart2TableConfig (line 68) | class PPChart2TableConfig(PreTrainedConfig): method __post_init__ (line 97) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pp_chart2table/image_processing_pil_pp_chart2table.py class PPChart2TableImageProcessorPil (line 26) | class PPChart2TableImageProcessorPil(PilBackend): FILE: src/transformers/models/pp_chart2table/image_processing_pp_chart2table.py class PPChart2TableImageProcessor (line 26) | class PPChart2TableImageProcessor(TorchvisionBackend): FILE: src/transformers/models/pp_chart2table/modular_pp_chart2table.py class PPChart2TableConfig (line 31) | class PPChart2TableConfig(GotOcr2Config): class PPChart2TableImageProcessor (line 52) | class PPChart2TableImageProcessor(TorchvisionBackend): class PPChart2TableImageProcessorPil (line 63) | class PPChart2TableImageProcessorPil(PilBackend): class PPChart2TableProcessor (line 74) | class PPChart2TableProcessor(ProcessorMixin): method __init__ (line 75) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 78) | def __call__( FILE: src/transformers/models/pp_chart2table/processing_pp_chart2table.py class PPChart2TableProcessor (line 30) | class PPChart2TableProcessor(ProcessorMixin): method __init__ (line 31) | def __init__(self, image_processor=None, tokenizer=None, chat_template... method __call__ (line 34) | def __call__( FILE: src/transformers/models/pp_doclayout_v2/configuration_pp_doclayout_v2.py class PPDocLayoutV2ReadingOrderConfig (line 31) | class PPDocLayoutV2ReadingOrderConfig(PreTrainedConfig): class PPDocLayoutV2Config (line 107) | class PPDocLayoutV2Config(PreTrainedConfig): method __post_init__ (line 235) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pp_doclayout_v2/image_processing_pp_doclayout_v2.py class PPDocLayoutV2ImageProcessor (line 34) | class PPDocLayoutV2ImageProcessor(TorchvisionBackend): method _preprocess (line 44) | def _preprocess( method _get_order_seqs (line 91) | def _get_order_seqs(self, order_logits): method extract_custom_vertices (line 122) | def extract_custom_vertices(self): method post_process_object_detection (line 125) | def post_process_object_detection( FILE: src/transformers/models/pp_doclayout_v2/modeling_pp_doclayout_v2.py class PPDocLayoutV2GlobalPointer (line 55) | class PPDocLayoutV2GlobalPointer(nn.Module): method __init__ (line 56) | def __init__(self, config): method forward (line 62) | def forward(self, inputs): class PPDocLayoutV2PositionRelationEmbedding (line 75) | class PPDocLayoutV2PositionRelationEmbedding(nn.Module): method __init__ (line 78) | def __init__(self, config, device=None): method compute_default_rope_parameters (line 90) | def compute_default_rope_parameters( method box_relative_encoding (line 120) | def box_relative_encoding( method get_position_embedding (line 135) | def get_position_embedding(self, x: torch.Tensor, scale: float = 100.0): method forward (line 141) | def forward(self, source_boxes: torch.Tensor, target_boxes: torch.Tens... class PPDocLayoutV2ReadingOrderSelfAttention (line 152) | class PPDocLayoutV2ReadingOrderSelfAttention(nn.Module): method __init__ (line 153) | def __init__(self, config): method cogview_attention (line 173) | def cogview_attention(self, attention_scores, alpha=32): method forward (line 185) | def forward( class PPDocLayoutV2ReadingOrderSelfOutput (line 239) | class PPDocLayoutV2ReadingOrderSelfOutput(nn.Module): method __init__ (line 240) | def __init__(self, config): method forward (line 246) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class PPDocLayoutV2ReadingOrderIntermediate (line 253) | class PPDocLayoutV2ReadingOrderIntermediate(nn.Module): method __init__ (line 254) | def __init__(self, config): method forward (line 262) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPDocLayoutV2ReadingOrderOutput (line 268) | class PPDocLayoutV2ReadingOrderOutput(nn.Module): method __init__ (line 269) | def __init__(self, config): method forward (line 275) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class PPDocLayoutV2ReadingOrderAttention (line 282) | class PPDocLayoutV2ReadingOrderAttention(nn.Module): method __init__ (line 283) | def __init__(self, config): method forward (line 288) | def forward( class PPDocLayoutV2ReadingOrderLayer (line 308) | class PPDocLayoutV2ReadingOrderLayer(GradientCheckpointingLayer): method __init__ (line 309) | def __init__(self, config): method forward (line 317) | def forward( method feed_forward_chunk (line 339) | def feed_forward_chunk(self, attention_output): class PPDocLayoutV2ReadingOrderEncoder (line 345) | class PPDocLayoutV2ReadingOrderEncoder(nn.Module): method __init__ (line 346) | def __init__(self, config): method relative_position_bucket (line 367) | def relative_position_bucket(self, relative_position, bidirectional=Tr... method _cal_1d_pos_emb (line 390) | def _cal_1d_pos_emb(self, position_ids): method _cal_2d_pos_emb (line 407) | def _cal_2d_pos_emb(self, bbox): method forward (line 427) | def forward( class PPDocLayoutV2TextEmbeddings (line 452) | class PPDocLayoutV2TextEmbeddings(nn.Module): method __init__ (line 457) | def __init__(self, config): method calculate_spatial_position_embeddings (line 481) | def calculate_spatial_position_embeddings(self, bbox): method create_position_ids_from_input_ids (line 507) | def create_position_ids_from_input_ids(self, input_ids, padding_idx): method create_position_ids_from_inputs_embeds (line 517) | def create_position_ids_from_inputs_embeds(self, inputs_embeds): method forward (line 529) | def forward( class MultiScaleDeformableAttention (line 571) | class MultiScaleDeformableAttention(nn.Module): method forward (line 572) | def forward( class PPDocLayoutV2MultiscaleDeformableAttention (line 625) | class PPDocLayoutV2MultiscaleDeformableAttention(nn.Module): method __init__ (line 630) | def __init__(self, config: PPDocLayoutV2Config, num_heads: int, n_poin... method forward (line 662) | def forward( class PPDocLayoutV2PreTrainedModel (line 733) | class PPDocLayoutV2PreTrainedModel(PreTrainedModel): method _init_weights (line 745) | def _init_weights(self, module): class PPDocLayoutV2ReadingOrder (line 824) | class PPDocLayoutV2ReadingOrder(PPDocLayoutV2PreTrainedModel): method __init__ (line 831) | def __init__(self, config): method forward (line 843) | def forward(self, boxes, labels=None, mask=None, **kwargs: Unpack[Tran... class PPDocLayoutV2ForObjectDetectionOutput (line 907) | class PPDocLayoutV2ForObjectDetectionOutput(ModelOutput): class PPDocLayoutV2ModelOutput (line 975) | class PPDocLayoutV2ModelOutput(ModelOutput): class PPDocLayoutV2MLPPredictionHead (line 1027) | class PPDocLayoutV2MLPPredictionHead(nn.Module): method __init__ (line 1034) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 1040) | def forward(self, x): class PPDocLayoutV2DecoderOutput (line 1055) | class PPDocLayoutV2DecoderOutput(ModelOutput): class PPDocLayoutV2MLP (line 1084) | class PPDocLayoutV2MLP(nn.Module): method __init__ (line 1085) | def __init__( method forward (line 1095) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPDocLayoutV2FrozenBatchNorm2d (line 1103) | class PPDocLayoutV2FrozenBatchNorm2d(nn.Module): method __init__ (line 1111) | def __init__(self, n): method _load_from_state_dict (line 1118) | def _load_from_state_dict( method forward (line 1129) | def forward(self, x): function eager_attention_forward (line 1142) | def eager_attention_forward( class PPDocLayoutV2SelfAttention (line 1170) | class PPDocLayoutV2SelfAttention(nn.Module): method __init__ (line 1177) | def __init__( method forward (line 1197) | def forward( function replace_batch_norm (line 1236) | def replace_batch_norm(model): class PPDocLayoutV2ConvEncoder (line 1260) | class PPDocLayoutV2ConvEncoder(nn.Module): method __init__ (line 1268) | def __init__(self, config): method forward (line 1280) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class PPDocLayoutV2ConvNormLayer (line 1292) | class PPDocLayoutV2ConvNormLayer(nn.Module): method __init__ (line 1293) | def __init__(self, config, in_channels, out_channels, kernel_size, str... method forward (line 1306) | def forward(self, hidden_state): class PPDocLayoutV2EncoderLayer (line 1313) | class PPDocLayoutV2EncoderLayer(nn.Module): method __init__ (line 1314) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 1333) | def forward( class PPDocLayoutV2RepVggBlock (line 1384) | class PPDocLayoutV2RepVggBlock(nn.Module): method __init__ (line 1389) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 1398) | def forward(self, x): class PPDocLayoutV2CSPRepLayer (line 1403) | class PPDocLayoutV2CSPRepLayer(nn.Module): method __init__ (line 1408) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 1425) | def forward(self, hidden_state): class PPDocLayoutV2DecoderLayer (line 1432) | class PPDocLayoutV2DecoderLayer(nn.Module): method __init__ (line 1433) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 1460) | def forward( class PPDocLayoutV2SinePositionEmbedding (line 1533) | class PPDocLayoutV2SinePositionEmbedding(nn.Module): method __init__ (line 1538) | def __init__(self, embed_dim: int = 256, temperature: int = 10000): method forward (line 1544) | def forward( class PPDocLayoutV2AIFILayer (line 1572) | class PPDocLayoutV2AIFILayer(nn.Module): method __init__ (line 1577) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 1589) | def forward( class PPDocLayoutV2HybridEncoder (line 1629) | class PPDocLayoutV2HybridEncoder(PPDocLayoutV2PreTrainedModel): method __init__ (line 1644) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 1697) | def forward( function inverse_sigmoid (line 1743) | def inverse_sigmoid(x, eps=1e-5): class PPDocLayoutV2Decoder (line 1750) | class PPDocLayoutV2Decoder(PPDocLayoutV2PreTrainedModel): method __init__ (line 1757) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 1773) | def forward( function get_contrastive_denoising_training_group (line 1859) | def get_contrastive_denoising_training_group( class PPDocLayoutV2Model (line 1987) | class PPDocLayoutV2Model(PPDocLayoutV2PreTrainedModel): method __init__ (line 1988) | def __init__(self, config: PPDocLayoutV2Config): method freeze_backbone (line 2062) | def freeze_backbone(self): method unfreeze_backbone (line 2066) | def unfreeze_backbone(self): method generate_anchors (line 2071) | def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device... method forward (line 2101) | def forward( class PPDocLayoutV2ForObjectDetection (line 2303) | class PPDocLayoutV2ForObjectDetection(PPDocLayoutV2PreTrainedModel): method __init__ (line 2309) | def __init__(self, config: PPDocLayoutV2Config): method _set_aux_loss (line 2326) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 2331) | def forward( FILE: src/transformers/models/pp_doclayout_v2/modular_pp_doclayout_v2.py class PPDocLayoutV2ReadingOrderConfig (line 63) | class PPDocLayoutV2ReadingOrderConfig(PreTrainedConfig): class PPDocLayoutV2Config (line 139) | class PPDocLayoutV2Config(PreTrainedConfig): method __post_init__ (line 267) | def __post_init__(self, **kwargs): class PPDocLayoutV2ImageProcessor (line 298) | class PPDocLayoutV2ImageProcessor(PPDocLayoutV3ImageProcessor): method extract_custom_vertices (line 299) | def extract_custom_vertices(self): method _mask2polygon (line 302) | def _mask2polygon(self): method _extract_polygon_points_by_masks (line 305) | def _extract_polygon_points_by_masks(self): method post_process_object_detection (line 308) | def post_process_object_detection( class PPDocLayoutV2GlobalPointer (line 376) | class PPDocLayoutV2GlobalPointer(PPDocLayoutV3GlobalPointer): method __init__ (line 377) | def __init__(self, config): class PPDocLayoutV2PositionRelationEmbedding (line 382) | class PPDocLayoutV2PositionRelationEmbedding(nn.Module): method __init__ (line 385) | def __init__(self, config, device=None): method compute_default_rope_parameters (line 397) | def compute_default_rope_parameters( method box_relative_encoding (line 427) | def box_relative_encoding( method get_position_embedding (line 442) | def get_position_embedding(self, x: torch.Tensor, scale: float = 100.0): method forward (line 448) | def forward(self, source_boxes: torch.Tensor, target_boxes: torch.Tens... class PPDocLayoutV2ReadingOrderSelfAttention (line 459) | class PPDocLayoutV2ReadingOrderSelfAttention(LayoutLMv3SelfAttention): method forward (line 460) | def forward( class PPDocLayoutV2ReadingOrderSelfOutput (line 514) | class PPDocLayoutV2ReadingOrderSelfOutput(LayoutLMv3SelfOutput): method __init__ (line 515) | def __init__(self, config): method forward (line 520) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class PPDocLayoutV2ReadingOrderIntermediate (line 527) | class PPDocLayoutV2ReadingOrderIntermediate(LayoutLMv3Intermediate): class PPDocLayoutV2ReadingOrderOutput (line 531) | class PPDocLayoutV2ReadingOrderOutput(LayoutLMv3Output): method __init__ (line 532) | def __init__(self, config): method forward (line 537) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class PPDocLayoutV2ReadingOrderAttention (line 544) | class PPDocLayoutV2ReadingOrderAttention(LayoutLMv3Attention): method __init__ (line 545) | def __init__(self, config): class PPDocLayoutV2ReadingOrderLayer (line 551) | class PPDocLayoutV2ReadingOrderLayer(LayoutLMv3Layer): method __init__ (line 552) | def __init__(self, config): class PPDocLayoutV2ReadingOrderEncoder (line 559) | class PPDocLayoutV2ReadingOrderEncoder(LayoutLMv3Encoder): method __init__ (line 560) | def __init__(self, config): method _cal_2d_pos_emb (line 565) | def _cal_2d_pos_emb(self, bbox): class PPDocLayoutV2TextEmbeddings (line 586) | class PPDocLayoutV2TextEmbeddings(LayoutLMv3TextEmbeddings): method __init__ (line 587) | def __init__(self, config): method forward (line 595) | def forward( class PPDocLayoutV2PreTrainedModel (line 637) | class PPDocLayoutV2PreTrainedModel(RTDetrPreTrainedModel): method _init_weights (line 639) | def _init_weights(self, module): class PPDocLayoutV2ReadingOrder (line 660) | class PPDocLayoutV2ReadingOrder(PPDocLayoutV2PreTrainedModel): method __init__ (line 667) | def __init__(self, config): method forward (line 679) | def forward(self, boxes, labels=None, mask=None, **kwargs: Unpack[Tran... class PPDocLayoutV2ForObjectDetectionOutput (line 743) | class PPDocLayoutV2ForObjectDetectionOutput(ModelOutput): class PPDocLayoutV2ModelOutput (line 811) | class PPDocLayoutV2ModelOutput(RTDetrModelOutput): class PPDocLayoutV2MLPPredictionHead (line 815) | class PPDocLayoutV2MLPPredictionHead(RTDetrMLPPredictionHead): class PPDocLayoutV2Model (line 824) | class PPDocLayoutV2Model(RTDetrModel): method __init__ (line 825) | def __init__(self, config: PPDocLayoutV2Config): class PPDocLayoutV2ForObjectDetection (line 836) | class PPDocLayoutV2ForObjectDetection(RTDetrForObjectDetection): method __init__ (line 839) | def __init__(self, config: PPDocLayoutV2Config): method forward (line 850) | def forward( FILE: src/transformers/models/pp_doclayout_v3/configuration_pp_doclayout_v3.py class PPDocLayoutV3Config (line 31) | class PPDocLayoutV3Config(PreTrainedConfig): method __post_init__ (line 167) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pp_doclayout_v3/image_processing_pp_doclayout_v3.py class PPDocLayoutV3ImageProcessor (line 39) | class PPDocLayoutV3ImageProcessor(TorchvisionBackend): method _preprocess (line 49) | def _preprocess( method _get_order_seqs (line 96) | def _get_order_seqs(self, order_logits): method extract_custom_vertices (line 127) | def extract_custom_vertices(self, polygon, sharp_angle_thresh=45): method _mask2polygon (line 156) | def _mask2polygon(self, mask, epsilon_ratio=0.004): method _extract_polygon_points_by_masks (line 180) | def _extract_polygon_points_by_masks(self, boxes, masks, scale_ratio): method post_process_object_detection (line 220) | def post_process_object_detection( FILE: src/transformers/models/pp_doclayout_v3/modeling_pp_doclayout_v3.py class PPDocLayoutV3GlobalPointer (line 52) | class PPDocLayoutV3GlobalPointer(nn.Module): method __init__ (line 53) | def __init__(self, config): method forward (line 59) | def forward(self, inputs): class MultiScaleDeformableAttention (line 73) | class MultiScaleDeformableAttention(nn.Module): method forward (line 74) | def forward( class PPDocLayoutV3MultiscaleDeformableAttention (line 127) | class PPDocLayoutV3MultiscaleDeformableAttention(nn.Module): method __init__ (line 132) | def __init__(self, config: PPDocLayoutV3Config, num_heads: int, n_poin... method forward (line 164) | def forward( class PPDocLayoutV3PreTrainedModel (line 235) | class PPDocLayoutV3PreTrainedModel(PreTrainedModel): method _init_weights (line 247) | def _init_weights(self, module): class PPDocLayoutV3DecoderOutput (line 300) | class PPDocLayoutV3DecoderOutput(ModelOutput): class PPDocLayoutV3ModelOutput (line 342) | class PPDocLayoutV3ModelOutput(ModelOutput): class PPDocLayoutV3MLPPredictionHead (line 401) | class PPDocLayoutV3MLPPredictionHead(nn.Module): method __init__ (line 408) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 414) | def forward(self, x): class PPDocLayoutV3ConvLayer (line 420) | class PPDocLayoutV3ConvLayer(nn.Module): method __init__ (line 421) | def __init__( method forward (line 431) | def forward(self, input: Tensor) -> Tensor: class PPDocLayoutV3ScaleHead (line 438) | class PPDocLayoutV3ScaleHead(nn.Module): method __init__ (line 439) | def __init__(self, in_channels, feature_channels, fpn_stride, base_str... method forward (line 449) | def forward(self, x): class PPDocLayoutV3MaskFeatFPN (line 455) | class PPDocLayoutV3MaskFeatFPN(nn.Module): method __init__ (line 456) | def __init__( method forward (line 491) | def forward(self, inputs): class PPDocLayoutV3EncoderMaskOutput (line 506) | class PPDocLayoutV3EncoderMaskOutput(nn.Module): method __init__ (line 507) | def __init__(self, in_channels, num_prototypes): method forward (line 512) | def forward(self, x): class PPDocLayoutV3MLP (line 518) | class PPDocLayoutV3MLP(nn.Module): method __init__ (line 519) | def __init__( method forward (line 529) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 537) | def eager_attention_forward( class PPDocLayoutV3SelfAttention (line 565) | class PPDocLayoutV3SelfAttention(nn.Module): method __init__ (line 572) | def __init__( method forward (line 592) | def forward( class PPDocLayoutV3ConvNormLayer (line 631) | class PPDocLayoutV3ConvNormLayer(nn.Module): method __init__ (line 632) | def __init__(self, config, in_channels, out_channels, kernel_size, str... method forward (line 645) | def forward(self, hidden_state): class PPDocLayoutV3EncoderLayer (line 652) | class PPDocLayoutV3EncoderLayer(nn.Module): method __init__ (line 653) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 672) | def forward( class PPDocLayoutV3RepVggBlock (line 723) | class PPDocLayoutV3RepVggBlock(nn.Module): method __init__ (line 728) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 737) | def forward(self, x): class PPDocLayoutV3CSPRepLayer (line 742) | class PPDocLayoutV3CSPRepLayer(nn.Module): method __init__ (line 747) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 764) | def forward(self, hidden_state): class PPDocLayoutV3SinePositionEmbedding (line 771) | class PPDocLayoutV3SinePositionEmbedding(nn.Module): method __init__ (line 776) | def __init__(self, embed_dim: int = 256, temperature: int = 10000): method forward (line 782) | def forward( class PPDocLayoutV3AIFILayer (line 810) | class PPDocLayoutV3AIFILayer(nn.Module): method __init__ (line 815) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 827) | def forward( class PPDocLayoutV3HybridEncoder (line 867) | class PPDocLayoutV3HybridEncoder(PPDocLayoutV3PreTrainedModel): method __init__ (line 879) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 945) | def forward( class PPDocLayoutV3DecoderLayer (line 1000) | class PPDocLayoutV3DecoderLayer(nn.Module): method __init__ (line 1001) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 1028) | def forward( function inverse_sigmoid (line 1101) | def inverse_sigmoid(x, eps=1e-5): class PPDocLayoutV3Decoder (line 1108) | class PPDocLayoutV3Decoder(PPDocLayoutV3PreTrainedModel): method __init__ (line 1120) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 1138) | def forward( class PPDocLayoutV3FrozenBatchNorm2d (line 1251) | class PPDocLayoutV3FrozenBatchNorm2d(nn.Module): method __init__ (line 1259) | def __init__(self, n): method _load_from_state_dict (line 1266) | def _load_from_state_dict( method forward (line 1277) | def forward(self, x): function replace_batch_norm (line 1290) | def replace_batch_norm(model): class PPDocLayoutV3ConvEncoder (line 1314) | class PPDocLayoutV3ConvEncoder(nn.Module): method __init__ (line 1322) | def __init__(self, config): method forward (line 1334) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): function get_contrastive_denoising_training_group (line 1346) | def get_contrastive_denoising_training_group( function mask_to_box_coordinate (line 1469) | def mask_to_box_coordinate(mask, dtype): class PPDocLayoutV3Model (line 1521) | class PPDocLayoutV3Model(PPDocLayoutV3PreTrainedModel): method __init__ (line 1527) | def __init__(self, config: PPDocLayoutV3Config): method freeze_backbone (line 1612) | def freeze_backbone(self): method unfreeze_backbone (line 1616) | def unfreeze_backbone(self): method generate_anchors (line 1621) | def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device... method forward (line 1651) | def forward( class PPDocLayoutV3HybridEncoderOutput (line 1865) | class PPDocLayoutV3HybridEncoderOutput(BaseModelOutput): class PPDocLayoutV3ForObjectDetectionOutput (line 1876) | class PPDocLayoutV3ForObjectDetectionOutput(ModelOutput): class PPDocLayoutV3ForObjectDetection (line 1947) | class PPDocLayoutV3ForObjectDetection(PPDocLayoutV3PreTrainedModel): method __init__ (line 1953) | def __init__(self, config: PPDocLayoutV3Config): method _set_aux_loss (line 1962) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 1967) | def forward( FILE: src/transformers/models/pp_doclayout_v3/modular_pp_doclayout_v3.py class PPDocLayoutV3Config (line 72) | class PPDocLayoutV3Config(PreTrainedConfig): method __post_init__ (line 208) | def __post_init__(self, **kwargs): class PPDocLayoutV3ImageProcessor (line 234) | class PPDocLayoutV3ImageProcessor(TorchvisionBackend): method _preprocess (line 244) | def _preprocess( method _get_order_seqs (line 291) | def _get_order_seqs(self, order_logits): method extract_custom_vertices (line 322) | def extract_custom_vertices(self, polygon, sharp_angle_thresh=45): method _mask2polygon (line 351) | def _mask2polygon(self, mask, epsilon_ratio=0.004): method _extract_polygon_points_by_masks (line 375) | def _extract_polygon_points_by_masks(self, boxes, masks, scale_ratio): method post_process_object_detection (line 415) | def post_process_object_detection( class PPDocLayoutV3GlobalPointer (line 495) | class PPDocLayoutV3GlobalPointer(nn.Module): method __init__ (line 496) | def __init__(self, config): method forward (line 502) | def forward(self, inputs): class PPDocLayoutV3MultiscaleDeformableAttention (line 515) | class PPDocLayoutV3MultiscaleDeformableAttention(RTDetrMultiscaleDeforma... class PPDocLayoutV3PreTrainedModel (line 520) | class PPDocLayoutV3PreTrainedModel(RTDetrPreTrainedModel): method _init_weights (line 522) | def _init_weights(self, module): function mask_to_box_coordinate (line 574) | def mask_to_box_coordinate(mask, dtype): class PPDocLayoutV3DecoderOutput (line 622) | class PPDocLayoutV3DecoderOutput(RTDetrDecoderOutput): class PPDocLayoutV3ModelOutput (line 654) | class PPDocLayoutV3ModelOutput(RTDetrModelOutput): class PPDocLayoutV3MLPPredictionHead (line 694) | class PPDocLayoutV3MLPPredictionHead(RTDetrMLPPredictionHead): class PPDocLayoutV3ConvLayer (line 698) | class PPDocLayoutV3ConvLayer(ResNetConvLayer): class PPDocLayoutV3ScaleHead (line 702) | class PPDocLayoutV3ScaleHead(nn.Module): method __init__ (line 703) | def __init__(self, in_channels, feature_channels, fpn_stride, base_str... method forward (line 713) | def forward(self, x): class PPDocLayoutV3MaskFeatFPN (line 719) | class PPDocLayoutV3MaskFeatFPN(nn.Module): method __init__ (line 720) | def __init__( method forward (line 755) | def forward(self, inputs): class PPDocLayoutV3EncoderMaskOutput (line 770) | class PPDocLayoutV3EncoderMaskOutput(nn.Module): method __init__ (line 771) | def __init__(self, in_channels, num_prototypes): method forward (line 776) | def forward(self, x): class PPDocLayoutV3HybridEncoder (line 782) | class PPDocLayoutV3HybridEncoder(RTDetrHybridEncoder): method __init__ (line 789) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 805) | def forward( class PPDocLayoutV3Decoder (line 860) | class PPDocLayoutV3Decoder(RTDetrDecoder): method __init__ (line 866) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 871) | def forward( class PPDocLayoutV3Model (line 989) | class PPDocLayoutV3Model(RTDetrModel): method __init__ (line 995) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 1017) | def forward( class PPDocLayoutV3HybridEncoderOutput (line 1231) | class PPDocLayoutV3HybridEncoderOutput(BaseModelOutput): class PPDocLayoutV3ForObjectDetectionOutput (line 1242) | class PPDocLayoutV3ForObjectDetectionOutput(ModelOutput): class PPDocLayoutV3ForObjectDetection (line 1313) | class PPDocLayoutV3ForObjectDetection(RTDetrForObjectDetection, PPDocLay... method __init__ (line 1316) | def __init__(self, config: PPDocLayoutV3Config): method forward (line 1330) | def forward( FILE: src/transformers/models/pp_lcnet/configuration_pp_lcnet.py class PPLCNetConfig (line 30) | class PPLCNetConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 68) | def __post_init__(self, **kwargs): method validate_architecture (line 102) | def validate_architecture(self): FILE: src/transformers/models/pp_lcnet/image_processing_pp_lcnet.py class PPLCNetImageProcessorKwargs (line 36) | class PPLCNetImageProcessorKwargs(ImagesKwargs, total=False): class PPLCNetImageProcessor (line 50) | class PPLCNetImageProcessor(TorchvisionBackend): method _preprocess (line 64) | def _preprocess( method get_image_size (line 116) | def get_image_size( FILE: src/transformers/models/pp_lcnet/modeling_pp_lcnet.py class PPLCNetConvLayer (line 38) | class PPLCNetConvLayer(nn.Module): method __init__ (line 39) | def __init__( method forward (line 61) | def forward(self, input: Tensor) -> Tensor: class PPLCNetDepthwiseSeparableConvLayer (line 68) | class PPLCNetDepthwiseSeparableConvLayer(GradientCheckpointingLayer): method __init__ (line 75) | def __init__( method forward (line 104) | def forward(self, hidden_state): class PPLCNetSqueezeExcitationModule (line 112) | class PPLCNetSqueezeExcitationModule(nn.Module): method __init__ (line 118) | def __init__(self, channel, reduction=4): method forward (line 139) | def forward(self, hidden_state): function make_divisible (line 149) | def make_divisible(value: int, divisor: int = 8, min_value: int | None =... class PPLCNetBlock (line 162) | class PPLCNetBlock(nn.Module): method __init__ (line 163) | def __init__(self, config, stage_index): method forward (line 184) | def forward(self, hidden_states): class PPLCNetPreTrainedModel (line 191) | class PPLCNetPreTrainedModel(PreTrainedModel): class PPLCNetEncoder (line 209) | class PPLCNetEncoder(PPLCNetPreTrainedModel): method __init__ (line 210) | def __init__(self, config: PPLCNetConfig): method forward (line 232) | def forward(self, pixel_values: torch.Tensor, **kwargs) -> BaseModelOu... class PPLCNetBackbone (line 245) | class PPLCNetBackbone(BackboneMixin, PPLCNetPreTrainedModel): method __init__ (line 248) | def __init__(self, config: PPLCNetConfig): method forward (line 261) | def forward( class PPLCNetForImageClassification (line 299) | class PPLCNetForImageClassification(PPLCNetPreTrainedModel): method __init__ (line 302) | def __init__(self, config: PPLCNetConfig): method forward (line 328) | def forward( FILE: src/transformers/models/pp_lcnet/modular_pp_lcnet.py class PPLCNetConfig (line 50) | class PPLCNetConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 88) | def __post_init__(self, **kwargs): method validate_architecture (line 122) | def validate_architecture(self): class PPLCNetImageProcessorKwargs (line 128) | class PPLCNetImageProcessorKwargs(ImagesKwargs, total=False): class PPLCNetImageProcessor (line 142) | class PPLCNetImageProcessor(TorchvisionBackend): method _preprocess (line 156) | def _preprocess( method get_image_size (line 208) | def get_image_size( class PPLCNetConvLayer (line 225) | class PPLCNetConvLayer(ResNetConvLayer): method __init__ (line 226) | def __init__( class PPLCNetDepthwiseSeparableConvLayer (line 247) | class PPLCNetDepthwiseSeparableConvLayer(GradientCheckpointingLayer): method __init__ (line 254) | def __init__( method forward (line 283) | def forward(self, hidden_state): class PPLCNetSqueezeExcitationModule (line 291) | class PPLCNetSqueezeExcitationModule(nn.Module): method __init__ (line 297) | def __init__(self, channel, reduction=4): method forward (line 318) | def forward(self, hidden_state): class PPLCNetBlock (line 328) | class PPLCNetBlock(nn.Module): method __init__ (line 329) | def __init__(self, config, stage_index): method forward (line 350) | def forward(self, hidden_states): class PPLCNetPreTrainedModel (line 357) | class PPLCNetPreTrainedModel(PreTrainedModel): class PPLCNetEncoder (line 375) | class PPLCNetEncoder(PPLCNetPreTrainedModel): method __init__ (line 376) | def __init__(self, config: PPLCNetConfig): method forward (line 398) | def forward(self, pixel_values: torch.Tensor, **kwargs) -> BaseModelOu... class PPLCNetBackbone (line 411) | class PPLCNetBackbone(BackboneMixin, PPLCNetPreTrainedModel): method __init__ (line 414) | def __init__(self, config: PPLCNetConfig): method forward (line 427) | def forward( class PPLCNetForImageClassification (line 465) | class PPLCNetForImageClassification(PPLCNetPreTrainedModel): method __init__ (line 468) | def __init__(self, config: PPLCNetConfig): method forward (line 494) | def forward( FILE: src/transformers/models/pp_lcnet_v3/configuration_pp_lcnet_v3.py class PPLCNetV3Config (line 31) | class PPLCNetV3Config(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 70) | def __post_init__(self, **kwargs): method validate_architecture (line 102) | def validate_architecture(self): FILE: src/transformers/models/pp_lcnet_v3/modeling_pp_lcnet_v3.py class PPLCNetV3ConvLayer (line 38) | class PPLCNetV3ConvLayer(nn.Module): method __init__ (line 39) | def __init__( method forward (line 61) | def forward(self, input: Tensor) -> Tensor: class PPLCNetV3LearnableAffineBlock (line 68) | class PPLCNetV3LearnableAffineBlock(nn.Module): method __init__ (line 69) | def __init__(self, scale_value: float = 1.0, bias_value: float = 0.0): method forward (line 74) | def forward(self, hidden_state: Tensor) -> Tensor: class PPLCNetV3ActLearnableAffineBlock (line 79) | class PPLCNetV3ActLearnableAffineBlock(nn.Module): method __init__ (line 84) | def __init__(self, activation="hardswish"): method forward (line 89) | def forward(self, hidden_state: torch.Tensor): class PPLCNetV3LearnableRepLayer (line 93) | class PPLCNetV3LearnableRepLayer(nn.Module): method __init__ (line 100) | def __init__( method forward (line 146) | def forward(self, hidden_state: torch.Tensor): class PPLCNetV3SqueezeExcitationModule (line 166) | class PPLCNetV3SqueezeExcitationModule(nn.Module): method __init__ (line 172) | def __init__(self, channel, reduction=4): method forward (line 193) | def forward(self, hidden_state): class PPLCNetV3DepthwiseSeparableConvLayer (line 203) | class PPLCNetV3DepthwiseSeparableConvLayer(GradientCheckpointingLayer): method __init__ (line 210) | def __init__( method forward (line 243) | def forward(self, hidden_state): function make_divisible (line 251) | def make_divisible(value: int, divisor: int = 8, min_value: int | None =... class PPLCNetV3Block (line 264) | class PPLCNetV3Block(nn.Module): method __init__ (line 265) | def __init__(self, config, stage_index): method forward (line 286) | def forward(self, hidden_states): class PPLCNetV3PreTrainedModel (line 293) | class PPLCNetV3PreTrainedModel(PreTrainedModel): method _init_weights (line 311) | def _init_weights(self, module): class PPLCNetV3Backbone (line 323) | class PPLCNetV3Backbone(BackboneMixin, PPLCNetV3PreTrainedModel): method __init__ (line 326) | def __init__(self, config: PPLCNetV3Config): method forward (line 339) | def forward( class PPLCNetV3Encoder (line 376) | class PPLCNetV3Encoder(PPLCNetV3PreTrainedModel): method __init__ (line 377) | def __init__(self, config: PPLCNetV3Config): method forward (line 399) | def forward(self, pixel_values: torch.Tensor, **kwargs) -> BaseModelOu... FILE: src/transformers/models/pp_lcnet_v3/modular_pp_lcnet_v3.py class PPLCNetV3Config (line 40) | class PPLCNetV3Config(PPLCNetConfig): method __post_init__ (line 71) | def __post_init__(self, **kwargs): class PPLCNetV3ConvLayer (line 104) | class PPLCNetV3ConvLayer(PPLCNetConvLayer): class PPLCNetV3LearnableAffineBlock (line 108) | class PPLCNetV3LearnableAffineBlock(HGNetV2LearnableAffineBlock): class PPLCNetV3ActLearnableAffineBlock (line 112) | class PPLCNetV3ActLearnableAffineBlock(nn.Module): method __init__ (line 117) | def __init__(self, activation="hardswish"): method forward (line 122) | def forward(self, hidden_state: torch.Tensor): class PPLCNetV3LearnableRepLayer (line 126) | class PPLCNetV3LearnableRepLayer(nn.Module): method __init__ (line 133) | def __init__( method forward (line 179) | def forward(self, hidden_state: torch.Tensor): class PPLCNetV3DepthwiseSeparableConvLayer (line 199) | class PPLCNetV3DepthwiseSeparableConvLayer(PPLCNetDepthwiseSeparableConv... method __init__ (line 206) | def __init__( class PPLCNetV3PreTrainedModel (line 235) | class PPLCNetV3PreTrainedModel(PPLCNetPreTrainedModel): method _init_weights (line 237) | def _init_weights(self, module): class PPLCNetV3Backbone (line 244) | class PPLCNetV3Backbone(PPLCNetBackbone): class PPLCNetV3Encoder (line 248) | class PPLCNetV3Encoder(PPLCNetEncoder): method __init__ (line 249) | def __init__(self, config: PPLCNetV3Config): FILE: src/transformers/models/pp_ocrv5_mobile_det/configuration_pp_ocrv5_mobile_det.py class PPOCRV5MobileDetConfig (line 32) | class PPOCRV5MobileDetConfig(PreTrainedConfig): method __post_init__ (line 61) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pp_ocrv5_mobile_det/modeling_pp_ocrv5_mobile_det.py class PPOCRV5MobileDetPreTrainedModel (line 38) | class PPOCRV5MobileDetPreTrainedModel(PreTrainedModel): class PPOCRV5MobileDetSqueezeExcitationModule (line 51) | class PPOCRV5MobileDetSqueezeExcitationModule(nn.Module): method __init__ (line 57) | def __init__(self, in_channels, reduction, activation="relu"): method forward (line 77) | def forward(self, hidden_states): class PPOCRV5MobileDetResidualSqueezeExcitationLayer (line 85) | class PPOCRV5MobileDetResidualSqueezeExcitationLayer(nn.Module): method __init__ (line 91) | def __init__(self, in_channels, out_channels, kernel_size, reduction): method forward (line 102) | def forward(self, hidden_states): class PPOCRV5MobileDetNeck (line 109) | class PPOCRV5MobileDetNeck(nn.Module): method __init__ (line 116) | def __init__(self, config: PPOCRV5MobileDetConfig): method forward (line 137) | def forward(self, feature_maps): class PPOCRV5MobileDetConvBatchnormLayer (line 163) | class PPOCRV5MobileDetConvBatchnormLayer(nn.Module): method __init__ (line 168) | def __init__( method forward (line 202) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPOCRV5MobileDetHead (line 209) | class PPOCRV5MobileDetHead(nn.Module): method __init__ (line 215) | def __init__( method forward (line 244) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class PPOCRV5MobileDetModel (line 258) | class PPOCRV5MobileDetModel(PPOCRV5MobileDetPreTrainedModel): method __init__ (line 259) | def __init__(self, config: PPOCRV5MobileDetConfig): method forward (line 275) | def forward( class PPOCRV5MobileDetForObjectDetection (line 296) | class PPOCRV5MobileDetForObjectDetection(PPOCRV5MobileDetPreTrainedModel): method __init__ (line 299) | def __init__(self, config: PPOCRV5MobileDetConfig): method forward (line 306) | def forward( FILE: src/transformers/models/pp_ocrv5_mobile_det/modular_pp_ocrv5_mobile_det.py class PPOCRV5MobileDetConfig (line 46) | class PPOCRV5MobileDetConfig(PreTrainedConfig): method __post_init__ (line 75) | def __post_init__(self, **kwargs): class PPOCRV5MobileDetPreTrainedModel (line 91) | class PPOCRV5MobileDetPreTrainedModel(PPOCRV5ServerDetPreTrainedModel): class PPOCRV5MobileDetSqueezeExcitationModule (line 95) | class PPOCRV5MobileDetSqueezeExcitationModule(nn.Module): method __init__ (line 101) | def __init__(self, in_channels, reduction, activation="relu"): method forward (line 121) | def forward(self, hidden_states): class PPOCRV5MobileDetResidualSqueezeExcitationLayer (line 129) | class PPOCRV5MobileDetResidualSqueezeExcitationLayer(nn.Module): method __init__ (line 135) | def __init__(self, in_channels, out_channels, kernel_size, reduction): method forward (line 146) | def forward(self, hidden_states): class PPOCRV5MobileDetNeck (line 153) | class PPOCRV5MobileDetNeck(nn.Module): method __init__ (line 160) | def __init__(self, config: PPOCRV5MobileDetConfig): method forward (line 181) | def forward(self, feature_maps): class PPOCRV5MobileDetHead (line 207) | class PPOCRV5MobileDetHead(PPOCRV5ServerDetSegmentationHead): method forward (line 209) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class PPOCRV5MobileDetModel (line 223) | class PPOCRV5MobileDetModel(PPOCRV5MobileDetPreTrainedModel): method __init__ (line 224) | def __init__(self, config: PPOCRV5MobileDetConfig): method forward (line 240) | def forward( class PPOCRV5MobileDetForObjectDetection (line 261) | class PPOCRV5MobileDetForObjectDetection(PPOCRV5ServerDetForObjectDetect... FILE: src/transformers/models/pp_ocrv5_mobile_rec/configuration_pp_ocrv5_mobile_rec.py class PPOCRV5MobileRecConfig (line 32) | class PPOCRV5MobileRecConfig(PreTrainedConfig): method __post_init__ (line 53) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pp_ocrv5_mobile_rec/modeling_pp_ocrv5_mobile_rec.py class PPOCRV5MobileRecAttention (line 42) | class PPOCRV5MobileRecAttention(nn.Module): method __init__ (line 45) | def __init__(self, config): method _shape (line 76) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 79) | def forward( class PPOCRV5MobileRecMLP (line 117) | class PPOCRV5MobileRecMLP(nn.Module): method __init__ (line 118) | def __init__(self, config, in_features, hidden_features=None, out_feat... method forward (line 127) | def forward(self, hidden_state): class PPOCRV5MobileRecBlock (line 136) | class PPOCRV5MobileRecBlock(GradientCheckpointingLayer): method __init__ (line 137) | def __init__(self, config): method forward (line 149) | def forward( function eager_attention_forward (line 174) | def eager_attention_forward( class PPOCRV5MobileRecConvLayer (line 197) | class PPOCRV5MobileRecConvLayer(nn.Module): method __init__ (line 198) | def __init__( method forward (line 218) | def forward(self, input: Tensor) -> Tensor: class PPOCRV5MobileRecPreTrainedModel (line 226) | class PPOCRV5MobileRecPreTrainedModel(PreTrainedModel): function make_divisible (line 245) | def make_divisible(value: int, divisor: int = 8, min_value: int | None =... class PPOCRV5MobileRecEncoderWithSVTR (line 258) | class PPOCRV5MobileRecEncoderWithSVTR(PPOCRV5MobileRecPreTrainedModel): method __init__ (line 264) | def __init__( method forward (line 301) | def forward(self, hidden_states: torch.FloatTensor, **kwargs: Unpack[T... class PPOCRV5MobileRecModel (line 323) | class PPOCRV5MobileRecModel(PPOCRV5MobileRecPreTrainedModel): method __init__ (line 324) | def __init__(self, config: PPOCRV5MobileRecConfig): method forward (line 333) | def forward( class PPOCRV5MobileRecHead (line 348) | class PPOCRV5MobileRecHead(nn.Module): method __init__ (line 349) | def __init__(self, config): method forward (line 355) | def forward(self, hidden_states: torch.FloatTensor, **kwargs: Unpack[T... class PPOCRV5MobileRecForTextRecognitionOutput (line 365) | class PPOCRV5MobileRecForTextRecognitionOutput(BaseModelOutputWithNoAtte... class PPOCRV5MobileRecForTextRecognition (line 375) | class PPOCRV5MobileRecForTextRecognition(PPOCRV5MobileRecPreTrainedModel): method __init__ (line 378) | def __init__(self, config: PPOCRV5MobileRecConfig): method forward (line 387) | def forward( FILE: src/transformers/models/pp_ocrv5_mobile_rec/modular_pp_ocrv5_mobile_rec.py class PPOCRV5MobileRecConfig (line 37) | class PPOCRV5MobileRecConfig(PPOCRV5ServerRecConfig): method __post_init__ (line 38) | def __post_init__(self, **kwargs): class PPOCRV5MobileRecEncoderWithSVTR (line 55) | class PPOCRV5MobileRecEncoderWithSVTR(PPOCRV5ServerRecEncoderWithSVTR): method __init__ (line 56) | def __init__( class PPOCRV5MobileRecModel (line 68) | class PPOCRV5MobileRecModel(PPOCRV5ServerRecModel): class PPOCRV5MobileRecForTextRecognition (line 73) | class PPOCRV5MobileRecForTextRecognition(PPOCRV5ServerRecForTextRecognit... FILE: src/transformers/models/pp_ocrv5_server_det/configuration_pp_ocrv5_server_det.py class PPOCRV5ServerDetConfig (line 31) | class PPOCRV5ServerDetConfig(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pp_ocrv5_server_det/image_processing_pp_ocrv5_server_det.py class PPOCRV5ServerDetImageProcessorKwargs (line 41) | class PPOCRV5ServerDetImageProcessorKwargs(ImagesKwargs, total=False): class PPOCRV5ServerDetImageProcessor (line 58) | class PPOCRV5ServerDetImageProcessor(TorchvisionBackend): method _preprocess (line 71) | def _preprocess( method _unclip (line 130) | def _unclip(self, contour_box, unclip_ratio): method _get_mini_boxes (line 188) | def _get_mini_boxes(self, contour): method _get_box_score (line 221) | def _get_box_score(self, bitmap: np.ndarray, polygon_bounding_box: np.... method _boxes_from_bitmap (line 246) | def _boxes_from_bitmap( method get_image_size (line 311) | def get_image_size( method post_process_object_detection (line 373) | def post_process_object_detection( FILE: src/transformers/models/pp_ocrv5_server_det/modeling_pp_ocrv5_server_det.py class PPOCRV5ServerDetIntraclassBlock (line 34) | class PPOCRV5ServerDetIntraclassBlock(nn.Module): method __init__ (line 41) | def __init__( method forward (line 92) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPOCRV5ServerDetNeck (line 117) | class PPOCRV5ServerDetNeck(nn.Module): method __init__ (line 124) | def __init__(self, config): method forward (line 183) | def forward(self, backbone_stage_feature_maps: list[torch.Tensor], **k... class PPOCRV5ServerDetConvBatchnormLayer (line 233) | class PPOCRV5ServerDetConvBatchnormLayer(nn.Module): method __init__ (line 238) | def __init__( method forward (line 272) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPOCRV5ServerDetSegmentationHead (line 279) | class PPOCRV5ServerDetSegmentationHead(nn.Module): method __init__ (line 285) | def __init__( method forward (line 314) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class PPOCRV5ServerDetLocalModule (line 323) | class PPOCRV5ServerDetLocalModule(nn.Module): method __init__ (line 329) | def __init__(self, in_channels: int, out_channels: int, hidden_act: str): method forward (line 347) | def forward(self, hidden_states: torch.Tensor, init_map: torch.Tensor)... class PPOCRV5ServerDetHead (line 355) | class PPOCRV5ServerDetHead(nn.Module): method __init__ (line 361) | def __init__(self, config: PPOCRV5ServerDetConfig): method forward (line 370) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPOCRV5ServerDetPreTrainedModel (line 380) | class PPOCRV5ServerDetPreTrainedModel(PreTrainedModel): class PPOCRV5ServerDetModel (line 394) | class PPOCRV5ServerDetModel(PPOCRV5ServerDetPreTrainedModel): method __init__ (line 395) | def __init__(self, config: PPOCRV5ServerDetConfig): method forward (line 403) | def forward( class PPOCRV5ServerDetForObjectDetection (line 424) | class PPOCRV5ServerDetForObjectDetection(PPOCRV5ServerDetPreTrainedModel): method __init__ (line 427) | def __init__(self, config: PPOCRV5ServerDetConfig): method forward (line 434) | def forward( FILE: src/transformers/models/pp_ocrv5_server_det/modular_pp_ocrv5_server_det.py class PPOCRV5ServerDetConfig (line 56) | class PPOCRV5ServerDetConfig(PreTrainedConfig): method __post_init__ (line 91) | def __post_init__(self, **kwargs): class PPOCRV5ServerDetImageProcessorKwargs (line 112) | class PPOCRV5ServerDetImageProcessorKwargs(ImagesKwargs, total=False): class PPOCRV5ServerDetImageProcessor (line 129) | class PPOCRV5ServerDetImageProcessor(TorchvisionBackend): method _preprocess (line 142) | def _preprocess( method _unclip (line 201) | def _unclip(self, contour_box, unclip_ratio): method _get_mini_boxes (line 259) | def _get_mini_boxes(self, contour): method _get_box_score (line 292) | def _get_box_score(self, bitmap: np.ndarray, polygon_bounding_box: np.... method _boxes_from_bitmap (line 317) | def _boxes_from_bitmap( method get_image_size (line 382) | def get_image_size( method post_process_object_detection (line 444) | def post_process_object_detection( class PPOCRV5ServerDetIntraclassBlock (line 497) | class PPOCRV5ServerDetIntraclassBlock(nn.Module): method __init__ (line 504) | def __init__( method forward (line 555) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPOCRV5ServerDetNeck (line 580) | class PPOCRV5ServerDetNeck(nn.Module): method __init__ (line 587) | def __init__(self, config): method forward (line 646) | def forward(self, backbone_stage_feature_maps: list[torch.Tensor], **k... class PPOCRV5ServerDetConvBatchnormLayer (line 696) | class PPOCRV5ServerDetConvBatchnormLayer(nn.Module): method __init__ (line 701) | def __init__( method forward (line 735) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPOCRV5ServerDetSegmentationHead (line 742) | class PPOCRV5ServerDetSegmentationHead(nn.Module): method __init__ (line 748) | def __init__( method forward (line 777) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class PPOCRV5ServerDetLocalModule (line 786) | class PPOCRV5ServerDetLocalModule(nn.Module): method __init__ (line 792) | def __init__(self, in_channels: int, out_channels: int, hidden_act: str): method forward (line 810) | def forward(self, hidden_states: torch.Tensor, init_map: torch.Tensor)... class PPOCRV5ServerDetHead (line 818) | class PPOCRV5ServerDetHead(nn.Module): method __init__ (line 824) | def __init__(self, config: PPOCRV5ServerDetConfig): method forward (line 833) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PPOCRV5ServerDetPreTrainedModel (line 843) | class PPOCRV5ServerDetPreTrainedModel(PreTrainedModel): class PPOCRV5ServerDetModel (line 857) | class PPOCRV5ServerDetModel(PPOCRV5ServerDetPreTrainedModel): method __init__ (line 858) | def __init__(self, config: PPOCRV5ServerDetConfig): method forward (line 866) | def forward( class PPOCRV5ServerDetForObjectDetection (line 887) | class PPOCRV5ServerDetForObjectDetection(PPOCRV5ServerDetPreTrainedModel): method __init__ (line 890) | def __init__(self, config: PPOCRV5ServerDetConfig): method forward (line 897) | def forward( FILE: src/transformers/models/pp_ocrv5_server_rec/configuration_pp_ocrv5_server_rec.py class PPOCRV5ServerRecConfig (line 31) | class PPOCRV5ServerRecConfig(PreTrainedConfig): method __post_init__ (line 52) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pp_ocrv5_server_rec/image_processing_pp_ocrv5_server_rec.py class PPOCRV5ServerRecImageProcessorKwargs (line 36) | class PPOCRV5ServerRecImageProcessorKwargs(ImagesKwargs, total=False): class PPOCRV5ServerRecImageProcessor (line 49) | class PPOCRV5ServerRecImageProcessor(TorchvisionBackend): method _preprocess (line 64) | def _preprocess( method get_target_size (line 116) | def get_target_size(self, shape_list: list[torch.Size]): method post_process_text_recognition (line 143) | def post_process_text_recognition( FILE: src/transformers/models/pp_ocrv5_server_rec/modeling_pp_ocrv5_server_rec.py class PPOCRV5ServerRecBlock (line 41) | class PPOCRV5ServerRecBlock(GradientCheckpointingLayer): method __init__ (line 42) | def __init__(self, config): method forward (line 54) | def forward( function eager_attention_forward (line 79) | def eager_attention_forward( class PPOCRV5ServerRecAttention (line 102) | class PPOCRV5ServerRecAttention(nn.Module): method __init__ (line 105) | def __init__(self, config): method _shape (line 136) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 139) | def forward( class PPOCRV5ServerRecConvLayer (line 177) | class PPOCRV5ServerRecConvLayer(nn.Module): method __init__ (line 178) | def __init__( method forward (line 198) | def forward(self, input: Tensor) -> Tensor: class PPOCRV5ServerRecPreTrainedModel (line 206) | class PPOCRV5ServerRecPreTrainedModel(PreTrainedModel): class PPOCRV5ServerRecHead (line 225) | class PPOCRV5ServerRecHead(nn.Module): method __init__ (line 226) | def __init__(self, config): method forward (line 232) | def forward(self, hidden_states: torch.FloatTensor, **kwargs: Unpack[T... class PPOCRV5ServerRecMLP (line 240) | class PPOCRV5ServerRecMLP(nn.Module): method __init__ (line 241) | def __init__(self, config, in_features, hidden_features=None, out_feat... method forward (line 250) | def forward(self, hidden_state): class PPOCRV5ServerRecEncoderWithSVTR (line 259) | class PPOCRV5ServerRecEncoderWithSVTR(PPOCRV5ServerRecPreTrainedModel): method __init__ (line 265) | def __init__( method forward (line 299) | def forward(self, hidden_states: torch.FloatTensor, **kwargs: Unpack[T... class PPOCRV5ServerRecModel (line 321) | class PPOCRV5ServerRecModel(PPOCRV5ServerRecPreTrainedModel): method __init__ (line 322) | def __init__(self, config: PPOCRV5ServerRecConfig): method forward (line 331) | def forward( class PPOCRV5ServerRecForTextRecognitionOutput (line 348) | class PPOCRV5ServerRecForTextRecognitionOutput(BaseModelOutputWithNoAtte... class PPOCRV5ServerRecForTextRecognition (line 358) | class PPOCRV5ServerRecForTextRecognition(PPOCRV5ServerRecPreTrainedModel): method __init__ (line 361) | def __init__(self, config: PPOCRV5ServerRecConfig): method forward (line 370) | def forward( FILE: src/transformers/models/pp_ocrv5_server_rec/modular_pp_ocrv5_server_rec.py class PPOCRV5ServerRecConfig (line 61) | class PPOCRV5ServerRecConfig(PreTrainedConfig): method __post_init__ (line 82) | def __post_init__(self, **kwargs): class PPOCRV5ServerRecImageProcessorKwargs (line 105) | class PPOCRV5ServerRecImageProcessorKwargs(ImagesKwargs, total=False): class PPOCRV5ServerRecImageProcessor (line 118) | class PPOCRV5ServerRecImageProcessor(TorchvisionBackend): method _preprocess (line 133) | def _preprocess( method get_target_size (line 185) | def get_target_size(self, shape_list: list[torch.Size]): method post_process_text_recognition (line 212) | def post_process_text_recognition( class PPOCRV5ServerRecBlock (line 257) | class PPOCRV5ServerRecBlock(CLIPEncoderLayer): method __init__ (line 258) | def __init__(self, config): method forward (line 266) | def forward( class PPOCRV5ServerRecAttention (line 275) | class PPOCRV5ServerRecAttention(Blip2Attention): method forward (line 276) | def forward( class PPOCRV5ServerRecConvLayer (line 285) | class PPOCRV5ServerRecConvLayer(ResNetConvLayer): method __init__ (line 286) | def __init__( class PPOCRV5ServerRecPreTrainedModel (line 305) | class PPOCRV5ServerRecPreTrainedModel(PaddleOCRVLPreTrainedModel): method _init_weights (line 313) | def _init_weights(self, module): class PPOCRV5ServerRecHead (line 317) | class PPOCRV5ServerRecHead(nn.Module): method __init__ (line 318) | def __init__(self, config): method forward (line 324) | def forward(self, hidden_states: torch.FloatTensor, **kwargs: Unpack[T... class PPOCRV5ServerRecMLP (line 332) | class PPOCRV5ServerRecMLP(FocalNetMlp): class PPOCRV5ServerRecEncoderWithSVTR (line 336) | class PPOCRV5ServerRecEncoderWithSVTR(PPOCRV5ServerRecPreTrainedModel): method __init__ (line 342) | def __init__( method forward (line 376) | def forward(self, hidden_states: torch.FloatTensor, **kwargs: Unpack[T... class PPOCRV5ServerRecModel (line 398) | class PPOCRV5ServerRecModel(PPOCRV5ServerRecPreTrainedModel): method __init__ (line 399) | def __init__(self, config: PPOCRV5ServerRecConfig): method forward (line 408) | def forward( class PPOCRV5ServerRecForTextRecognitionOutput (line 425) | class PPOCRV5ServerRecForTextRecognitionOutput(BaseModelOutputWithNoAtte... class PPOCRV5ServerRecForTextRecognition (line 435) | class PPOCRV5ServerRecForTextRecognition(PPOCRV5ServerRecPreTrainedModel): method __init__ (line 438) | def __init__(self, config: PPOCRV5ServerRecConfig): method forward (line 447) | def forward( FILE: src/transformers/models/prompt_depth_anything/configuration_prompt_depth_anything.py class PromptDepthAnythingConfig (line 30) | class PromptDepthAnythingConfig(PreTrainedConfig): method __post_init__ (line 80) | def __post_init__(self, **kwargs): method validate_architecture (line 97) | def validate_architecture(self): FILE: src/transformers/models/prompt_depth_anything/convert_prompt_depth_anything_to_hf.py function get_dpt_config (line 40) | def get_dpt_config(model_name): function transform_qkv_weights (line 81) | def transform_qkv_weights(key, value, config): function convert_old_keys_to_new_keys (line 133) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function convert_dpt_checkpoint (line 154) | def convert_dpt_checkpoint(model_name, pytorch_dump_folder_path, push_to... FILE: src/transformers/models/prompt_depth_anything/image_processing_pil_prompt_depth_anything.py function _constrain_to_multiple_of (line 43) | def _constrain_to_multiple_of(val, multiple, min_val=0, max_val=None): function _get_resize_output_image_size (line 56) | def _get_resize_output_image_size( class PromptDepthAnythingImageProcessorKwargs (line 83) | class PromptDepthAnythingImageProcessorKwargs(ImagesKwargs, total=False): class PromptDepthAnythingImageProcessorPil (line 102) | class PromptDepthAnythingImageProcessorPil(PilBackend): method __init__ (line 119) | def __init__(self, **kwargs: Unpack[PromptDepthAnythingImageProcessorK... method preprocess (line 123) | def preprocess( method resize_with_aspect_ratio (line 135) | def resize_with_aspect_ratio( method pad_image (line 160) | def pad_image(self, image: np.ndarray, size_divisor: int) -> np.ndarray: method _preprocess_image_like_inputs (line 191) | def _preprocess_image_like_inputs( method _preprocess (line 251) | def _preprocess( method post_process_depth_estimation (line 293) | def post_process_depth_estimation( FILE: src/transformers/models/prompt_depth_anything/image_processing_prompt_depth_anything.py class PromptDepthAnythingImageProcessorKwargs (line 45) | class PromptDepthAnythingImageProcessorKwargs(ImagesKwargs, total=False): function _constrain_to_multiple_of (line 63) | def _constrain_to_multiple_of(val, multiple, min_val=0, max_val=None): function _get_resize_output_image_size (line 76) | def _get_resize_output_image_size( class PromptDepthAnythingImageProcessor (line 106) | class PromptDepthAnythingImageProcessor(TorchvisionBackend): method __init__ (line 123) | def __init__(self, **kwargs: Unpack[PromptDepthAnythingImageProcessorK... method preprocess (line 127) | def preprocess( method resize_with_aspect_ratio (line 139) | def resize_with_aspect_ratio( method pad_image (line 169) | def pad_image( method _preprocess_image_like_inputs (line 200) | def _preprocess_image_like_inputs( method _preprocess (line 260) | def _preprocess( method post_process_depth_estimation (line 315) | def post_process_depth_estimation( FILE: src/transformers/models/prompt_depth_anything/modeling_prompt_depth_anything.py class PromptDepthAnythingLayer (line 33) | class PromptDepthAnythingLayer(nn.Module): method __init__ (line 34) | def __init__(self, config: PromptDepthAnythingConfig): method forward (line 65) | def forward(self, prompt_depth: torch.Tensor) -> torch.Tensor: class PromptDepthAnythingPreActResidualLayer (line 74) | class PromptDepthAnythingPreActResidualLayer(nn.Module): method __init__ (line 83) | def __init__(self, config): method forward (line 106) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class PromptDepthAnythingFeatureFusionLayer (line 116) | class PromptDepthAnythingFeatureFusionLayer(nn.Module): method __init__ (line 124) | def __init__(self, config: PromptDepthAnythingConfig): method forward (line 133) | def forward(self, hidden_state, residual=None, size=None, prompt_depth... class PromptDepthAnythingFeatureFusionStage (line 163) | class PromptDepthAnythingFeatureFusionStage(nn.Module): method __init__ (line 164) | def __init__(self, config: PromptDepthAnythingConfig): method forward (line 170) | def forward(self, hidden_states, size=None, prompt_depth=None): class PromptDepthAnythingDepthEstimationHead (line 191) | class PromptDepthAnythingDepthEstimationHead(nn.Module): method __init__ (line 199) | def __init__(self, config): method forward (line 218) | def forward(self, hidden_states: list[torch.Tensor], patch_height: int... class PromptDepthAnythingPreTrainedModel (line 242) | class PromptDepthAnythingPreTrainedModel(PreTrainedModel): class PromptDepthAnythingReassembleLayer (line 250) | class PromptDepthAnythingReassembleLayer(nn.Module): method __init__ (line 251) | def __init__(self, config: PromptDepthAnythingConfig, channels: int, f... method forward (line 265) | def forward(self, hidden_state): class PromptDepthAnythingReassembleStage (line 272) | class PromptDepthAnythingReassembleStage(nn.Module): method __init__ (line 287) | def __init__(self, config): method forward (line 295) | def forward(self, hidden_states: list[torch.Tensor], patch_height=None... class PromptDepthAnythingNeck (line 315) | class PromptDepthAnythingNeck(nn.Module): method __init__ (line 327) | def __init__(self, config): method forward (line 340) | def forward( class PromptDepthAnythingForDepthEstimation (line 374) | class PromptDepthAnythingForDepthEstimation(PromptDepthAnythingPreTraine... method __init__ (line 377) | def __init__(self, config): method forward (line 390) | def forward( FILE: src/transformers/models/prompt_depth_anything/modular_prompt_depth_anything.py class PromptDepthAnythingConfig (line 34) | class PromptDepthAnythingConfig(DepthAnythingConfig): class PromptDepthAnythingLayer (line 38) | class PromptDepthAnythingLayer(nn.Module): method __init__ (line 39) | def __init__(self, config: PromptDepthAnythingConfig): method forward (line 70) | def forward(self, prompt_depth: torch.Tensor) -> torch.Tensor: class PromptDepthAnythingFeatureFusionLayer (line 79) | class PromptDepthAnythingFeatureFusionLayer(DepthAnythingFeatureFusionLa... method __init__ (line 80) | def __init__(self, config: PromptDepthAnythingConfig): method forward (line 84) | def forward(self, hidden_state, residual=None, size=None, prompt_depth... class PromptDepthAnythingFeatureFusionStage (line 114) | class PromptDepthAnythingFeatureFusionStage(DepthAnythingFeatureFusionSt... method forward (line 115) | def forward(self, hidden_states, size=None, prompt_depth=None): class PromptDepthAnythingDepthEstimationHead (line 136) | class PromptDepthAnythingDepthEstimationHead(DepthAnythingDepthEstimatio... method forward (line 137) | def forward(self, hidden_states: list[torch.Tensor], patch_height: int... class PromptDepthAnythingPreTrainedModel (line 161) | class PromptDepthAnythingPreTrainedModel(PreTrainedModel): class PromptDepthAnythingReassembleLayer (line 169) | class PromptDepthAnythingReassembleLayer(nn.Module): method __init__ (line 170) | def __init__(self, config: PromptDepthAnythingConfig, channels: int, f... method forward (line 184) | def forward(self, hidden_state): class PromptDepthAnythingReassembleStage (line 191) | class PromptDepthAnythingReassembleStage(DepthAnythingReassembleStage): class PromptDepthAnythingNeck (line 195) | class PromptDepthAnythingNeck(DepthAnythingNeck): method forward (line 196) | def forward( class PromptDepthAnythingForDepthEstimation (line 230) | class PromptDepthAnythingForDepthEstimation(DepthAnythingForDepthEstimat... method forward (line 234) | def forward( FILE: src/transformers/models/prophetnet/configuration_prophetnet.py class ProphetNetConfig (line 24) | class ProphetNetConfig(PreTrainedConfig): method num_hidden_layers (line 78) | def num_hidden_layers(self) -> int: method num_hidden_layers (line 82) | def num_hidden_layers(self, value): FILE: src/transformers/models/prophetnet/convert_prophetnet_original_pytorch_checkpoint_to_pytorch.py function convert_prophetnet_checkpoint_to_pytorch (line 36) | def convert_prophetnet_checkpoint_to_pytorch(prophetnet_checkpoint_path:... FILE: src/transformers/models/prophetnet/modeling_prophetnet.py function softmax (line 37) | def softmax(hidden_state, dim, onnx_trace=False): function ngram_attention_bias (line 44) | def ngram_attention_bias(sequence_length, ngram, device, dtype): function compute_relative_buckets (line 61) | def compute_relative_buckets(num_buckets, max_distance, relative_positio... function compute_all_stream_relative_buckets (line 88) | def compute_all_stream_relative_buckets(num_buckets, max_distance, posit... class ProphetNetSeq2SeqLMOutput (line 117) | class ProphetNetSeq2SeqLMOutput(ModelOutput): class ProphetNetSeq2SeqModelOutput (line 169) | class ProphetNetSeq2SeqModelOutput(ModelOutput): class ProphetNetDecoderModelOutput (line 218) | class ProphetNetDecoderModelOutput(ModelOutput): class ProphetNetDecoderLMOutput (line 262) | class ProphetNetDecoderLMOutput(ModelOutput): class ProphetNetPreTrainedModel (line 309) | class ProphetNetPreTrainedModel(PreTrainedModel): method _shift_right (line 314) | def _shift_right(self, input_ids): class ProphetNetPositionalEmbeddings (line 337) | class ProphetNetPositionalEmbeddings(nn.Embedding): method __init__ (line 344) | def __init__(self, config: ProphetNetConfig) -> None: method forward (line 348) | def forward(self, inputs_shape, device, attention_mask=None, past_key_... method _forward (line 376) | def _forward(self, position_ids): class ProphetNetAttention (line 380) | class ProphetNetAttention(nn.Module): method __init__ (line 383) | def __init__(self, config: ProphetNetConfig, num_attn_heads: int, laye... method forward (line 404) | def forward( class ProphetNetFeedForward (line 498) | class ProphetNetFeedForward(nn.Module): method __init__ (line 503) | def __init__(self, config: ProphetNetConfig, ffn_dim: int): method forward (line 511) | def forward(self, hidden_states): class ProphetNetNgramSelfAttention (line 521) | class ProphetNetNgramSelfAttention(nn.Module): method __init__ (line 522) | def __init__(self, config: ProphetNetConfig, layer_idx=None): method _shape (line 552) | def _shape(self, tensor, seq_len, batch_size): method prepare_for_onnx_export_ (line 555) | def prepare_for_onnx_export_(self): method forward (line 558) | def forward( method get_main_relative_pos_embeddings (line 721) | def get_main_relative_pos_embeddings( method get_predict_relative_pos_embeddings (line 766) | def get_predict_relative_pos_embeddings( class ProphetNetEncoderLayer (line 826) | class ProphetNetEncoderLayer(GradientCheckpointingLayer): method __init__ (line 831) | def __init__(self, config: ProphetNetConfig): method forward (line 841) | def forward( class ProphetNetDecoderLayer (line 867) | class ProphetNetDecoderLayer(GradientCheckpointingLayer): method __init__ (line 872) | def __init__(self, config: ProphetNetConfig, layer_idx=None): method forward (line 887) | def forward( class ProphetNetEncoder (line 943) | class ProphetNetEncoder(ProphetNetPreTrainedModel): method __init__ (line 944) | def __init__(self, config: ProphetNetConfig): method get_input_embeddings (line 957) | def get_input_embeddings(self): method set_input_embeddings (line 960) | def set_input_embeddings(self, value): method forward (line 964) | def forward( class ProphetNetDecoder (line 1050) | class ProphetNetDecoder(ProphetNetPreTrainedModel): method __init__ (line 1051) | def __init__(self, config: ProphetNetConfig): method get_input_embeddings (line 1073) | def get_input_embeddings(self): method set_input_embeddings (line 1076) | def set_input_embeddings(self, value): method forward (line 1080) | def forward( method compute_buffered_relative_buckets (line 1267) | def compute_buffered_relative_buckets(self, position_ids): method prepare_attention_mask (line 1289) | def prepare_attention_mask(self, hidden_states, attention_mask): method prepare_predict_attention_mask (line 1313) | def prepare_predict_attention_mask(self, hidden_states, attention_mask): class ProphetNetModel (line 1350) | class ProphetNetModel(ProphetNetPreTrainedModel): method __init__ (line 1356) | def __init__(self, config: ProphetNetConfig): method get_input_embeddings (line 1371) | def get_input_embeddings(self): method set_input_embeddings (line 1374) | def set_input_embeddings(self, value): method forward (line 1380) | def forward( class ProphetNetForConditionalGeneration (line 1482) | class ProphetNetForConditionalGeneration(ProphetNetPreTrainedModel, Gene... method __init__ (line 1487) | def __init__(self, config: ProphetNetConfig): method get_input_embeddings (line 1498) | def get_input_embeddings(self): method forward (line 1502) | def forward( method _compute_loss (line 1613) | def _compute_loss(self, logits, labels, ignore_index=-100): method prepare_decoder_input_ids_from_labels (line 1641) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method get_encoder (line 1644) | def get_encoder(self, modality=None): class ProphetNetForCausalLM (line 1656) | class ProphetNetForCausalLM(ProphetNetPreTrainedModel, GenerationMixin): method __init__ (line 1662) | def __init__(self, config: ProphetNetConfig): method get_input_embeddings (line 1678) | def get_input_embeddings(self): method set_input_embeddings (line 1681) | def set_input_embeddings(self, value): method forward (line 1685) | def forward( method _compute_loss (line 1787) | def _compute_loss(self, logits, labels, ignore_index=-100): class ProphetNetDecoderWrapper (line 1816) | class ProphetNetDecoderWrapper(ProphetNetPreTrainedModel): method __init__ (line 1826) | def __init__(self, config: ProphetNetConfig): method forward (line 1835) | def forward(self, *args, **kwargs): FILE: src/transformers/models/prophetnet/tokenization_prophetnet.py function whitespace_tokenize (line 29) | def whitespace_tokenize(text): class BasicTokenizer (line 38) | class BasicTokenizer: method __init__ (line 61) | def __init__( method tokenize (line 77) | def tokenize(self, text, never_split=None): method _run_strip_accents (line 115) | def _run_strip_accents(self, text): method _run_split_on_punc (line 126) | def _run_split_on_punc(self, text, never_split=None): method _tokenize_chinese_chars (line 148) | def _tokenize_chinese_chars(self, text): method _is_chinese_char (line 161) | def _is_chinese_char(self, cp): method _clean_text (line 185) | def _clean_text(self, text): class WordpieceTokenizer (line 199) | class WordpieceTokenizer: method __init__ (line 202) | def __init__(self, vocab, unk_token, max_input_chars_per_word=100): method tokenize (line 207) | def tokenize(self, text): function load_vocab (line 256) | def load_vocab(vocab_file): class ProphetNetTokenizer (line 267) | class ProphetNetTokenizer(PreTrainedTokenizer): method __init__ (line 319) | def __init__( method vocab_size (line 368) | def vocab_size(self): method get_vocab (line 371) | def get_vocab(self): method _tokenize (line 374) | def _tokenize(self, text): method _convert_token_to_id (line 387) | def _convert_token_to_id(self, token: str): method _convert_id_to_token (line 391) | def _convert_id_to_token(self, index: int): method convert_tokens_to_string (line 395) | def convert_tokens_to_string(self, tokens: str): method get_special_tokens_mask (line 400) | def get_special_tokens_mask( method save_vocabulary (line 430) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method build_inputs_with_special_tokens (line 450) | def build_inputs_with_special_tokens( FILE: src/transformers/models/pvt/configuration_pvt.py class PvtConfig (line 26) | class PvtConfig(PreTrainedConfig): FILE: src/transformers/models/pvt/convert_pvt_to_pytorch.py function create_rename_keys (line 35) | def create_rename_keys(config): function read_in_k_v (line 120) | def read_in_k_v(state_dict, config): function rename_key (line 137) | def rename_key(dct, old, new): function prepare_img (line 143) | def prepare_img(): function convert_pvt_checkpoint (line 151) | def convert_pvt_checkpoint(pvt_size, pvt_checkpoint, pytorch_dump_folder... FILE: src/transformers/models/pvt/image_processing_pil_pvt.py class PvtImageProcessorPil (line 22) | class PvtImageProcessorPil(PilBackend): FILE: src/transformers/models/pvt/image_processing_pvt.py class PvtImageProcessor (line 22) | class PvtImageProcessor(TorchvisionBackend): FILE: src/transformers/models/pvt/modeling_pvt.py function drop_path (line 38) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class PvtDropPath (line 54) | class PvtDropPath(nn.Module): method __init__ (line 57) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 61) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 64) | def extra_repr(self) -> str: class PvtPatchEmbeddings (line 68) | class PvtPatchEmbeddings(nn.Module): method __init__ (line 75) | def __init__( method interpolate_pos_encoding (line 103) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 114) | def forward(self, pixel_values: torch.Tensor) -> tuple[torch.Tensor, i... class PvtSelfOutput (line 136) | class PvtSelfOutput(nn.Module): method __init__ (line 137) | def __init__(self, config: PvtConfig, hidden_size: int): method forward (line 142) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PvtEfficientSelfAttention (line 148) | class PvtEfficientSelfAttention(nn.Module): method __init__ (line 151) | def __init__( method transpose_for_scores (line 180) | def transpose_for_scores(self, hidden_states: int) -> torch.Tensor: method forward (line 185) | def forward( class PvtAttention (line 230) | class PvtAttention(nn.Module): method __init__ (line 231) | def __init__( method forward (line 243) | def forward( class PvtFFN (line 253) | class PvtFFN(nn.Module): method __init__ (line 254) | def __init__( method forward (line 271) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PvtLayer (line 280) | class PvtLayer(nn.Module): method __init__ (line 281) | def __init__( method forward (line 303) | def forward(self, hidden_states: torch.Tensor, height: int, width: int... class PvtEncoder (line 326) | class PvtEncoder(nn.Module): method __init__ (line 327) | def __init__(self, config: PvtConfig): method forward (line 377) | def forward( class PvtPreTrainedModel (line 416) | class PvtPreTrainedModel(PreTrainedModel): method _init_weights (line 424) | def _init_weights(self, module: nn.Module) -> None: class PvtModel (line 441) | class PvtModel(PvtPreTrainedModel): method __init__ (line 442) | def __init__(self, config: PvtConfig): method forward (line 453) | def forward( class PvtForImageClassification (line 491) | class PvtForImageClassification(PvtPreTrainedModel): method __init__ (line 492) | def __init__(self, config: PvtConfig) -> None: method forward (line 507) | def forward( FILE: src/transformers/models/pvt_v2/configuration_pvt_v2.py class PvtV2Config (line 27) | class PvtV2Config(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 84) | def __post_init__(self, **kwargs): FILE: src/transformers/models/pvt_v2/convert_pvt_v2_to_pytorch.py function create_rename_keys (line 35) | def create_rename_keys(config): function read_in_k_v (line 150) | def read_in_k_v(state_dict, config): function rename_key (line 171) | def rename_key(dct, old, new): function prepare_img (line 177) | def prepare_img(): function convert_pvt_v2_checkpoint (line 185) | def convert_pvt_v2_checkpoint(pvt_v2_size, pvt_v2_checkpoint, pytorch_du... FILE: src/transformers/models/pvt_v2/modeling_pvt_v2.py function drop_path (line 38) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class PvtV2DropPath (line 54) | class PvtV2DropPath(nn.Module): method __init__ (line 57) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 61) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 64) | def extra_repr(self) -> str: class PvtV2OverlapPatchEmbeddings (line 68) | class PvtV2OverlapPatchEmbeddings(nn.Module): method __init__ (line 71) | def __init__(self, config: PvtV2Config, layer_idx: int): method forward (line 88) | def forward(self, pixel_values): class PvtV2DepthWiseConv (line 96) | class PvtV2DepthWiseConv(nn.Module): method __init__ (line 103) | def __init__(self, config: PvtV2Config, dim: int = 768): method forward (line 107) | def forward(self, hidden_states, height, width): class PvtV2SelfAttention (line 116) | class PvtV2SelfAttention(nn.Module): method __init__ (line 119) | def __init__(self, config: PvtV2Config, hidden_size: int, num_attentio... method transpose_for_scores (line 154) | def transpose_for_scores(self, hidden_states) -> torch.Tensor: method forward (line 159) | def forward( class PvtV2ConvFeedForwardNetwork (line 205) | class PvtV2ConvFeedForwardNetwork(nn.Module): method __init__ (line 206) | def __init__( method forward (line 225) | def forward(self, hidden_states: torch.Tensor, height, width) -> torch... class PvtV2BlockLayer (line 236) | class PvtV2BlockLayer(nn.Module): method __init__ (line 237) | def __init__(self, config: PvtV2Config, layer_idx: int, drop_path: flo... method forward (line 255) | def forward(self, hidden_states: torch.Tensor, height: int, width: int... class PvtV2EncoderLayer (line 278) | class PvtV2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 279) | def __init__(self, config: PvtV2Config, layer_idx: int): method forward (line 302) | def forward(self, hidden_states, output_attentions): class PvtV2Encoder (line 323) | class PvtV2Encoder(nn.Module): method __init__ (line 324) | def __init__(self, config: PvtV2Config): method forward (line 332) | def forward( class PvtV2PreTrainedModel (line 364) | class PvtV2PreTrainedModel(PreTrainedModel): method _init_weights (line 372) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class PvtV2Model (line 390) | class PvtV2Model(PvtV2PreTrainedModel): method __init__ (line 391) | def __init__(self, config: PvtV2Config): method forward (line 402) | def forward( class PvtV2ForImageClassification (line 440) | class PvtV2ForImageClassification(PvtV2PreTrainedModel): method __init__ (line 441) | def __init__(self, config: PvtV2Config) -> None: method forward (line 456) | def forward( class PvtV2Backbone (line 514) | class PvtV2Backbone(BackboneMixin, PvtV2Model): method __init__ (line 515) | def __init__(self, config: PvtV2Config): method forward (line 522) | def forward( FILE: src/transformers/models/qwen2/configuration_qwen2.py class Qwen2Config (line 25) | class Qwen2Config(PreTrainedConfig): method __post_init__ (line 83) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen2/modeling_qwen2.py class Qwen2MLP (line 35) | class Qwen2MLP(nn.Module): method __init__ (line 36) | def __init__(self, config): method forward (line 46) | def forward(self, x): class Qwen2RotaryEmbedding (line 51) | class Qwen2RotaryEmbedding(nn.Module): method __init__ (line 54) | def __init__(self, config: Qwen2Config, device=None): method compute_default_rope_parameters (line 71) | def compute_default_rope_parameters( method forward (line 102) | def forward(self, x, position_ids): function rotate_half (line 116) | def rotate_half(x): function apply_rotary_pos_emb (line 124) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 149) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 161) | def eager_attention_forward( class Qwen2Attention (line 187) | class Qwen2Attention(nn.Module): method __init__ (line 190) | def __init__(self, config: Qwen2Config, layer_idx: int): method forward (line 206) | def forward( class Qwen2RMSNorm (line 249) | class Qwen2RMSNorm(nn.Module): method __init__ (line 250) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 258) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 265) | def extra_repr(self): class Qwen2DecoderLayer (line 269) | class Qwen2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 270) | def __init__(self, config: Qwen2Config, layer_idx: int): method forward (line 280) | def forward( class Qwen2PreTrainedModel (line 313) | class Qwen2PreTrainedModel(PreTrainedModel): class Qwen2Model (line 332) | class Qwen2Model(Qwen2PreTrainedModel): method __init__ (line 333) | def __init__(self, config: Qwen2Config): method forward (line 353) | def forward( class Qwen2ForCausalLM (line 417) | class Qwen2ForCausalLM(Qwen2PreTrainedModel, GenerationMixin): method __init__ (line 422) | def __init__(self, config): method forward (line 433) | def forward( class Qwen2ForSequenceClassification (line 490) | class Qwen2ForSequenceClassification(GenericForSequenceClassification, Q... class Qwen2ForTokenClassification (line 494) | class Qwen2ForTokenClassification(GenericForTokenClassification, Qwen2Pr... class Qwen2ForQuestionAnswering (line 498) | class Qwen2ForQuestionAnswering(GenericForQuestionAnswering, Qwen2PreTra... FILE: src/transformers/models/qwen2/modular_qwen2.py class Qwen2MLP (line 37) | class Qwen2MLP(LlamaMLP): method __init__ (line 38) | def __init__(self, config): class Qwen2RotaryEmbedding (line 45) | class Qwen2RotaryEmbedding(Gemma2RotaryEmbedding): class Qwen2Attention (line 49) | class Qwen2Attention(LlamaAttention): method __init__ (line 50) | def __init__(self, config: Qwen2Config, layer_idx: int): method forward (line 59) | def forward( class Qwen2DecoderLayer (line 101) | class Qwen2DecoderLayer(LlamaDecoderLayer): class Qwen2PreTrainedModel (line 105) | class Qwen2PreTrainedModel(LlamaPreTrainedModel): class Qwen2Model (line 109) | class Qwen2Model(MistralModel): method __init__ (line 110) | def __init__(self, config: Qwen2Config): method forward (line 117) | def forward( class Qwen2ForCausalLM (line 180) | class Qwen2ForCausalLM(LlamaForCausalLM): class Qwen2ForSequenceClassification (line 184) | class Qwen2ForSequenceClassification(LlamaForSequenceClassification): class Qwen2ForTokenClassification (line 188) | class Qwen2ForTokenClassification(LlamaForTokenClassification): class Qwen2ForQuestionAnswering (line 192) | class Qwen2ForQuestionAnswering(LlamaForQuestionAnswering): FILE: src/transformers/models/qwen2/tokenization_qwen2.py class Qwen2Tokenizer (line 36) | class Qwen2Tokenizer(TokenizersBackend): method __init__ (line 41) | def __init__( FILE: src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py class Qwen2_5OmniVisionEncoderConfig (line 33) | class Qwen2_5OmniVisionEncoderConfig(PreTrainedConfig): class Qwen2_5OmniAudioEncoderConfig (line 77) | class Qwen2_5OmniAudioEncoderConfig(PreTrainedConfig): class Qwen2_5OmniTextConfig (line 123) | class Qwen2_5OmniTextConfig(PreTrainedConfig): method __post_init__ (line 189) | def __post_init__(self, **kwargs): class Qwen2_5OmniThinkerConfig (line 207) | class Qwen2_5OmniThinkerConfig(PreTrainedConfig): method __post_init__ (line 270) | def __post_init__(self, **kwargs): class Qwen2_5OmniTalkerConfig (line 291) | class Qwen2_5OmniTalkerConfig(PreTrainedConfig): method __post_init__ (line 385) | def __post_init__(self, **kwargs): class Qwen2_5OmniDiTConfig (line 404) | class Qwen2_5OmniDiTConfig(PreTrainedConfig): class Qwen2_5OmniBigVGANConfig (line 469) | class Qwen2_5OmniBigVGANConfig(PreTrainedConfig): class Qwen2_5OmniToken2WavConfig (line 497) | class Qwen2_5OmniToken2WavConfig(PreTrainedConfig): method __post_init__ (line 543) | def __post_init__(self, **kwargs): class Qwen2_5OmniConfig (line 559) | class Qwen2_5OmniConfig(PreTrainedConfig): method __post_init__ (line 612) | def __post_init__(self, **kwargs): method get_text_config (line 633) | def get_text_config(self, *args, **kwargs): FILE: src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py function kaiser_sinc_filter1d (line 73) | def kaiser_sinc_filter1d(cutoff, half_width, kernel_size): class Qwen2_5OmniPreTrainedModel (line 120) | class Qwen2_5OmniPreTrainedModel(PreTrainedModel): method _init_weights (line 132) | def _init_weights(self, module): class Qwen2_5OmniPreTrainedModelForConditionalGeneration (line 150) | class Qwen2_5OmniPreTrainedModelForConditionalGeneration(Qwen2_5OmniPreT... method get_llm_pos_ids_for_vision (line 153) | def get_llm_pos_ids_for_vision( method get_chunked_index (line 173) | def get_chunked_index( method get_rope_index (line 210) | def get_rope_index( class Qwen2_5OmniThinkerCausalLMOutputWithPast (line 511) | class Qwen2_5OmniThinkerCausalLMOutputWithPast(ModelOutput): function repeat_kv (line 534) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 546) | def eager_attention_forward( class Qwen2_5OmniAudioAttention (line 571) | class Qwen2_5OmniAudioAttention(nn.Module): method __init__ (line 574) | def __init__( method forward (line 601) | def forward( class Qwen2_5OmniAudioEncoderLayer (line 647) | class Qwen2_5OmniAudioEncoderLayer(GradientCheckpointingLayer): method __init__ (line 648) | def __init__(self, config: Qwen2_5OmniAudioEncoderConfig): method forward (line 660) | def forward( class SinusoidsPositionEmbedding (line 698) | class SinusoidsPositionEmbedding(nn.Module): method __init__ (line 699) | def __init__(self, length, channels, max_timescale=10000): method forward (line 715) | def forward(self, seqlen: int): class Qwen2_5OmniAudioEncoder (line 725) | class Qwen2_5OmniAudioEncoder(Qwen2_5OmniPreTrainedModel): method __init__ (line 736) | def __init__(self, config: Qwen2_5OmniAudioEncoderConfig): method _freeze_parameters (line 757) | def _freeze_parameters(self): method get_input_embeddings (line 762) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 765) | def set_input_embeddings(self, value: nn.Module): method _prepare_attention_mask (line 768) | def _prepare_attention_mask(self, inputs_tensor: torch.Tensor, cu_seql... method forward (line 790) | def forward(self, input_features, feature_lens=None, aftercnn_lens=Non... method padded_and_mask_function (line 842) | def padded_and_mask_function(self, tensor_list, tensor_len, padding_va... method _get_feat_extract_output_lengths (line 881) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... function rotate_half (line 890) | def rotate_half(x): function apply_rotary_pos_emb_vision (line 897) | def apply_rotary_pos_emb_vision(tensor: torch.Tensor, freqs: torch.Tenso... class Qwen2_5OmniVisionAttention (line 909) | class Qwen2_5OmniVisionAttention(nn.Module): method __init__ (line 910) | def __init__(self, config: Qwen2_5OmniVisionEncoderConfig = None) -> N... method forward (line 925) | def forward( class Qwen2_5OmniRMSNorm (line 994) | class Qwen2_5OmniRMSNorm(nn.Module): method __init__ (line 995) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 1003) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 1010) | def extra_repr(self): class Qwen2_5OmniMLP (line 1014) | class Qwen2_5OmniMLP(nn.Module): method __init__ (line 1015) | def __init__(self, config, bias: bool = False): method forward (line 1024) | def forward(self, hidden_state): class Qwen2_5OmniVisionBlock (line 1028) | class Qwen2_5OmniVisionBlock(GradientCheckpointingLayer): method __init__ (line 1029) | def __init__(self, config: Qwen2_5OmniVisionEncoderConfig) -> None: method forward (line 1037) | def forward( class Qwen2_5_VisionRotaryEmbedding (line 1060) | class Qwen2_5_VisionRotaryEmbedding(nn.Module): method __init__ (line 1063) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 1070) | def forward(self, seqlen: int) -> torch.Tensor: class Qwen2_5_VisionPatchEmbed (line 1076) | class Qwen2_5_VisionPatchEmbed(nn.Module): method __init__ (line 1077) | def __init__( method forward (line 1093) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Qwen2_5OmniPatchMerger (line 1102) | class Qwen2_5OmniPatchMerger(nn.Module): method __init__ (line 1103) | def __init__(self, dim: int, context_dim: int, spatial_merge_size: int... method forward (line 1113) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Qwen2_5OmniVisionEncoder (line 1118) | class Qwen2_5OmniVisionEncoder(Qwen2_5OmniPreTrainedModel): method __init__ (line 1128) | def __init__(self, config: Qwen2_5OmniVisionEncoderConfig, *inputs, **... method rot_pos_emb (line 1155) | def rot_pos_emb(self, grid_thw): method get_window_index (line 1184) | def get_window_index(self, grid_thw): method forward (line 1228) | def forward( class Qwen2_5OmniRotaryEmbedding (line 1294) | class Qwen2_5OmniRotaryEmbedding(nn.Module): method __init__ (line 1297) | def __init__(self, config: Qwen2_5OmniThinkerConfig, device=None): method compute_default_rope_parameters (line 1314) | def compute_default_rope_parameters( method forward (line 1344) | def forward(self, x, position_ids): function apply_multimodal_rotary_pos_emb (line 1360) | def apply_multimodal_rotary_pos_emb(q, k, cos, sin, mrope_section, unsqu... class Qwen2_5OmniAttention (line 1405) | class Qwen2_5OmniAttention(nn.Module): method __init__ (line 1411) | def __init__(self, config: Qwen2_5OmniConfig, layer_idx: int | None = ... method forward (line 1439) | def forward( class Qwen2MLP (line 1490) | class Qwen2MLP(nn.Module): method __init__ (line 1491) | def __init__(self, config, bias: bool = False): method forward (line 1500) | def forward(self, hidden_state): class Qwen2_5OmniDecoderLayer (line 1504) | class Qwen2_5OmniDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1505) | def __init__(self, config: Qwen2_5OmniTextConfig, layer_idx: int): method forward (line 1520) | def forward( class Qwen2_5OmniThinkerTextModel (line 1573) | class Qwen2_5OmniThinkerTextModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 1582) | def __init__(self, config: Qwen2_5OmniTextConfig): method forward (line 1603) | def forward( class Qwen2_5OmniThinkerForConditionalGeneration (line 1693) | class Qwen2_5OmniThinkerForConditionalGeneration(Qwen2_5OmniPreTrainedMo... method __init__ (line 1699) | def __init__(self, config: Qwen2_5OmniThinkerConfig): method get_input_embeddings (line 1710) | def get_input_embeddings(self): method set_input_embeddings (line 1713) | def set_input_embeddings(self, value): method get_video_features (line 1718) | def get_video_features( method get_image_features (line 1735) | def get_image_features( method get_audio_features (line 1752) | def get_audio_features( method get_placeholder_mask (line 1789) | def get_placeholder_mask( method forward (line 1841) | def forward( method prepare_inputs_for_generation (line 2006) | def prepare_inputs_for_generation( class Qwen2_5OmniTalkerCausalLMOutputWithPast (line 2065) | class Qwen2_5OmniTalkerCausalLMOutputWithPast(ModelOutput): class Qwen2_5OmniTalkerModel (line 2093) | class Qwen2_5OmniTalkerModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 2103) | def __init__(self, config: Qwen2_5OmniTalkerConfig): method forward (line 2123) | def forward( class Qwen2_5OmniTalkerForConditionalGeneration (line 2208) | class Qwen2_5OmniTalkerForConditionalGeneration(Qwen2_5OmniPreTrainedMod... method __init__ (line 2213) | def __init__(self, config: Qwen2_5OmniTalkerConfig): method get_input_embeddings (line 2236) | def get_input_embeddings(self): method set_input_embeddings (line 2239) | def set_input_embeddings(self, value): method forward (line 2244) | def forward( method prepare_inputs_for_generation (line 2376) | def prepare_inputs_for_generation( method _update_model_kwargs_for_generation (line 2417) | def _update_model_kwargs_for_generation( class Qwen2_5OmniDiTRotaryEmbedding (line 2434) | class Qwen2_5OmniDiTRotaryEmbedding(nn.Module): method __init__ (line 2437) | def __init__(self, config: Qwen2_5OmniDiTConfig, device=None): method compute_default_rope_parameters (line 2454) | def compute_default_rope_parameters( method forward (line 2485) | def forward(self, x, position_ids): class TimeDelayNetBlock (line 2499) | class TimeDelayNetBlock(nn.Module): method __init__ (line 2500) | def __init__( method forward (line 2518) | def forward(self, hidden_states: torch.Tensor): class Res2NetBlock (line 2522) | class Res2NetBlock(torch.nn.Module): method __init__ (line 2523) | def __init__(self, in_channels, out_channels, scale=8, kernel_size=3, ... method forward (line 2542) | def forward(self, hidden_states): class SqueezeExcitationBlock (line 2556) | class SqueezeExcitationBlock(nn.Module): method __init__ (line 2557) | def __init__(self, in_channels, se_channels, out_channels): method forward (line 2577) | def forward(self, hidden_states): class AttentiveStatisticsPooling (line 2586) | class AttentiveStatisticsPooling(nn.Module): method __init__ (line 2591) | def __init__(self, channels, attention_channels=128): method _length_to_mask (line 2605) | def _length_to_mask(self, length, max_len=None, dtype=None, device=None): method _compute_statistics (line 2636) | def _compute_statistics(self, x, m, dim=2): method forward (line 2641) | def forward(self, hidden_states): class SqueezeExcitationRes2NetBlock (line 2675) | class SqueezeExcitationRes2NetBlock(nn.Module): method __init__ (line 2680) | def __init__( method forward (line 2706) | def forward(self, hidden_state): class ECAPA_TimeDelayNet (line 2717) | class ECAPA_TimeDelayNet(torch.nn.Module): method __init__ (line 2723) | def __init__(self, config: Qwen2_5OmniDiTConfig): method forward (line 2778) | def forward(self, hidden_states): class DiTInputEmbedding (line 2801) | class DiTInputEmbedding(nn.Module): method __init__ (line 2802) | def __init__(self, config: Qwen2_5OmniDiTConfig): method forward (line 2810) | def forward( class DiTCodecEmbedding (line 2835) | class DiTCodecEmbedding(nn.Module): method __init__ (line 2836) | def __init__(self, codec_num_embeds, codec_dim, repeats): method forward (line 2841) | def forward(self, code, drop_code=False): class Qwen2_5_OmniAdaLayerNormZero (line 2852) | class Qwen2_5_OmniAdaLayerNormZero(nn.Module): method __init__ (line 2853) | def __init__(self, dim): method forward (line 2861) | def forward(self, hidden_states, emb=None): class Qwen2_5_OmniAdaLayerNormZero_Final (line 2871) | class Qwen2_5_OmniAdaLayerNormZero_Final(nn.Module): method __init__ (line 2872) | def __init__(self, dim): method forward (line 2880) | def forward(self, hidden_states, emb): class DiTMLP (line 2889) | class DiTMLP(nn.Module): method __init__ (line 2890) | def __init__(self, dim, mult=4, dropout=0.0): method forward (line 2903) | def forward(self, hidden_states): function apply_rotary_pos_emb (line 2910) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class DiTAttention (line 2943) | class DiTAttention(nn.Module): method __init__ (line 2944) | def __init__(self, config: Qwen2_5OmniDiTConfig): method forward (line 2960) | def forward( class SinusPositionEmbedding (line 3007) | class SinusPositionEmbedding(nn.Module): method __init__ (line 3008) | def __init__(self, dim): method forward (line 3012) | def forward(self, hidden_states, scale=1000): class DiTTimestepEmbedding (line 3022) | class DiTTimestepEmbedding(nn.Module): method __init__ (line 3023) | def __init__(self, dim, freq_embed_dim=256): method forward (line 3028) | def forward(self, timestep): class DiTDecoderLayer (line 3036) | class DiTDecoderLayer(nn.Module): method __init__ (line 3037) | def __init__(self, config: Qwen2_5OmniDiTConfig, look_ahead_block=0, l... method forward (line 3047) | def forward( class SnakeBeta (line 3071) | class SnakeBeta(nn.Module): method __init__ (line 3085) | def __init__(self, in_features, alpha=1.0): method forward (line 3095) | def forward(self, hidden_states): class UpSample1d (line 3112) | class UpSample1d(nn.Module): method __init__ (line 3113) | def __init__(self, ratio=2, kernel_size=None): method forward (line 3125) | def forward(self, hidden_states): class DownSample1d (line 3137) | class DownSample1d(nn.Module): method __init__ (line 3138) | def __init__(self, ratio=2, kernel_size=None): method forward (line 3158) | def forward(self, hidden_states): class TorchActivation1d (line 3165) | class TorchActivation1d(nn.Module): method __init__ (line 3166) | def __init__( method forward (line 3181) | def forward(self, hidden_states): class AMPBlock (line 3189) | class AMPBlock(torch.nn.Module): method __init__ (line 3190) | def __init__( method _get_padding (line 3262) | def _get_padding(self, kernel_size, dilation=1): method forward (line 3265) | def forward(self, hidden_states): class Qwen2_5OmniToken2WavBigVGANModel (line 3283) | class Qwen2_5OmniToken2WavBigVGANModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 3287) | def __init__(self, config: Qwen2_5OmniBigVGANConfig): method normalize_spectrogram (line 3328) | def normalize_spectrogram(self, spectrogram, max_value, min_db): method amplitude_to_db (line 3331) | def amplitude_to_db(self, amplitude, min_db_level): method process_mel_spectrogram (line 3337) | def process_mel_spectrogram(self, mel_spectrogram): method forward (line 3342) | def forward(self, mel_spectrogram, **kwargs): class RungeKutta4ODESolver (line 3360) | class RungeKutta4ODESolver: method __init__ (line 3361) | def __init__(self, function, initial_value): method _rk4_step (line 3368) | def _rk4_step(self, function, time_start, time_step, time_end, value_s... method _compute_step (line 3375) | def _compute_step(self, function, time_start, time_step, time_end, val... method _linear_interpolation (line 3381) | def _linear_interpolation(self, time_start, time_end, value_start, val... method integrate (line 3389) | def integrate(self, time_points): class Qwen2_5OmniToken2WavDiTModel (line 3421) | class Qwen2_5OmniToken2WavDiTModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 3426) | def __init__(self, config: Qwen2_5OmniDiTConfig): method _create_block_diff (line 3457) | def _create_block_diff(self, hidden_states): method forward (line 3467) | def forward( method sample (line 3519) | def sample( class Qwen2_5OmniToken2WavModel (line 3592) | class Qwen2_5OmniToken2WavModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 3598) | def __init__(self, config: Qwen2_5OmniToken2WavConfig): method forward (line 3621) | def forward( class Qwen2_5OmniForConditionalGeneration (line 3663) | class Qwen2_5OmniForConditionalGeneration(Qwen2_5OmniPreTrainedModel, Ge... method __init__ (line 3671) | def __init__(self, config): method enable_talker (line 3682) | def enable_talker(self): method load_speakers (line 3688) | def load_speakers(self, path): method disable_talker (line 3694) | def disable_talker(self): method from_pretrained (line 3702) | def from_pretrained( method generate (line 3751) | def generate( FILE: src/transformers/models/qwen2_5_omni/modular_qwen2_5_omni.py class Qwen2_5OmniVisionEncoderConfig (line 71) | class Qwen2_5OmniVisionEncoderConfig(Qwen2_5_VLVisionConfig): class Qwen2_5OmniAudioEncoderConfig (line 102) | class Qwen2_5OmniAudioEncoderConfig(Qwen2AudioEncoderConfig): class Qwen2_5OmniTextConfig (line 135) | class Qwen2_5OmniTextConfig(PreTrainedConfig): method __post_init__ (line 201) | def __post_init__(self, **kwargs): class Qwen2_5OmniThinkerConfig (line 219) | class Qwen2_5OmniThinkerConfig(PreTrainedConfig): method __post_init__ (line 282) | def __post_init__(self, **kwargs): class Qwen2_5OmniTalkerConfig (line 303) | class Qwen2_5OmniTalkerConfig(PreTrainedConfig): method __post_init__ (line 397) | def __post_init__(self, **kwargs): class Qwen2_5OmniDiTConfig (line 416) | class Qwen2_5OmniDiTConfig(PreTrainedConfig): class Qwen2_5OmniBigVGANConfig (line 481) | class Qwen2_5OmniBigVGANConfig(PreTrainedConfig): class Qwen2_5OmniToken2WavConfig (line 509) | class Qwen2_5OmniToken2WavConfig(PreTrainedConfig): method __post_init__ (line 555) | def __post_init__(self, **kwargs): class Qwen2_5OmniConfig (line 571) | class Qwen2_5OmniConfig(PreTrainedConfig): method __post_init__ (line 624) | def __post_init__(self, **kwargs): method get_text_config (line 645) | def get_text_config(self, *args, **kwargs): class Qwen2_5OmniPreTrainedModel (line 660) | class Qwen2_5OmniPreTrainedModel(Qwen2_5_VLPreTrainedModel): method _init_weights (line 665) | def _init_weights(self, module): class Qwen2_5OmniPreTrainedModelForConditionalGeneration (line 683) | class Qwen2_5OmniPreTrainedModelForConditionalGeneration(Qwen2_5OmniPreT... method get_llm_pos_ids_for_vision (line 686) | def get_llm_pos_ids_for_vision( method get_chunked_index (line 706) | def get_chunked_index( method get_rope_index (line 743) | def get_rope_index( class Qwen2_5OmniThinkerCausalLMOutputWithPast (line 1044) | class Qwen2_5OmniThinkerCausalLMOutputWithPast(ModelOutput): class Qwen2_5OmniAudioAttention (line 1067) | class Qwen2_5OmniAudioAttention(nn.Module): method __init__ (line 1070) | def __init__( method forward (line 1097) | def forward( class Qwen2_5OmniAudioEncoderLayer (line 1143) | class Qwen2_5OmniAudioEncoderLayer(Qwen2AudioEncoderLayer): method __init__ (line 1144) | def __init__(self, config: Qwen2_5OmniAudioEncoderConfig): method forward (line 1148) | def forward( class SinusoidsPositionEmbedding (line 1180) | class SinusoidsPositionEmbedding(nn.Module): method __init__ (line 1181) | def __init__(self, length, channels, max_timescale=10000): method forward (line 1197) | def forward(self, seqlen: int): class Qwen2_5OmniAudioEncoder (line 1207) | class Qwen2_5OmniAudioEncoder(Qwen2_5OmniPreTrainedModel): method __init__ (line 1218) | def __init__(self, config: Qwen2_5OmniAudioEncoderConfig): method _freeze_parameters (line 1239) | def _freeze_parameters(self): method get_input_embeddings (line 1244) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1247) | def set_input_embeddings(self, value: nn.Module): method _prepare_attention_mask (line 1250) | def _prepare_attention_mask(self, inputs_tensor: torch.Tensor, cu_seql... method forward (line 1272) | def forward(self, input_features, feature_lens=None, aftercnn_lens=Non... method padded_and_mask_function (line 1324) | def padded_and_mask_function(self, tensor_list, tensor_len, padding_va... method _get_feat_extract_output_lengths (line 1363) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... function apply_rotary_pos_emb_vision (line 1372) | def apply_rotary_pos_emb_vision(tensor: torch.Tensor, freqs: torch.Tenso... class Qwen2_5OmniVisionAttention (line 1384) | class Qwen2_5OmniVisionAttention(nn.Module): method __init__ (line 1385) | def __init__(self, config: Qwen2_5OmniVisionEncoderConfig = None) -> N... method forward (line 1400) | def forward( class Qwen2_5OmniVisionBlock (line 1468) | class Qwen2_5OmniVisionBlock(Qwen2_5_VLVisionBlock): method __init__ (line 1469) | def __init__(self, config: Qwen2_5OmniVisionEncoderConfig) -> None: method forward (line 1473) | def forward( class Qwen2_5_VisionRotaryEmbedding (line 1490) | class Qwen2_5_VisionRotaryEmbedding(Qwen2_5_VisionRotaryEmbedding): class Qwen2_5OmniVisionEncoder (line 1494) | class Qwen2_5OmniVisionEncoder(Qwen2_5_VisionTransformerPretrainedModel): method __init__ (line 1504) | def __init__(self, config: Qwen2_5OmniVisionEncoderConfig, *inputs, **... method forward (line 1510) | def forward( class Qwen2_5OmniRotaryEmbedding (line 1576) | class Qwen2_5OmniRotaryEmbedding(Qwen2VLRotaryEmbedding): method __init__ (line 1577) | def __init__(self, config: Qwen2_5OmniThinkerConfig, device=None): class Qwen2_5OmniAttention (line 1583) | class Qwen2_5OmniAttention(Qwen2_5_VLAttention): method __init__ (line 1584) | def __init__(self, config: Qwen2_5OmniConfig, layer_idx: int | None = ... class Qwen2MLP (line 1613) | class Qwen2MLP(Qwen2_5_VLMLP): class Qwen2_5OmniThinkerTextModel (line 1617) | class Qwen2_5OmniThinkerTextModel(Qwen2_5_VLTextModel): method __init__ (line 1621) | def __init__(self, config: Qwen2_5OmniTextConfig): class Qwen2_5OmniThinkerForConditionalGeneration (line 1630) | class Qwen2_5OmniThinkerForConditionalGeneration(Qwen2_5OmniPreTrainedMo... method __init__ (line 1636) | def __init__(self, config: Qwen2_5OmniThinkerConfig): method get_input_embeddings (line 1647) | def get_input_embeddings(self): method set_input_embeddings (line 1650) | def set_input_embeddings(self, value): method get_video_features (line 1655) | def get_video_features( method get_image_features (line 1672) | def get_image_features( method get_audio_features (line 1689) | def get_audio_features( method get_placeholder_mask (line 1726) | def get_placeholder_mask( method forward (line 1778) | def forward( method prepare_inputs_for_generation (line 1943) | def prepare_inputs_for_generation( class Qwen2_5OmniTalkerCausalLMOutputWithPast (line 2002) | class Qwen2_5OmniTalkerCausalLMOutputWithPast(ModelOutput): class Qwen2_5OmniTalkerModel (line 2029) | class Qwen2_5OmniTalkerModel(Qwen2_5_VLTextModel): method __init__ (line 2035) | def __init__(self, config: Qwen2_5OmniTalkerConfig): class Qwen2_5OmniTalkerForConditionalGeneration (line 2040) | class Qwen2_5OmniTalkerForConditionalGeneration(Qwen2_5OmniPreTrainedMod... method __init__ (line 2045) | def __init__(self, config: Qwen2_5OmniTalkerConfig): method get_input_embeddings (line 2068) | def get_input_embeddings(self): method set_input_embeddings (line 2071) | def set_input_embeddings(self, value): method forward (line 2076) | def forward( method prepare_inputs_for_generation (line 2208) | def prepare_inputs_for_generation( method _update_model_kwargs_for_generation (line 2249) | def _update_model_kwargs_for_generation( class Qwen2_5OmniDiTRotaryEmbedding (line 2271) | class Qwen2_5OmniDiTRotaryEmbedding(LlamaRotaryEmbedding): method __init__ (line 2272) | def __init__(self, config: Qwen2_5OmniDiTConfig, device=None): method compute_default_rope_parameters (line 2276) | def compute_default_rope_parameters( function apply_rotary_pos_emb (line 2289) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class TimeDelayNetBlock (line 2322) | class TimeDelayNetBlock(nn.Module): method __init__ (line 2323) | def __init__( method forward (line 2341) | def forward(self, hidden_states: torch.Tensor): class Res2NetBlock (line 2345) | class Res2NetBlock(torch.nn.Module): method __init__ (line 2346) | def __init__(self, in_channels, out_channels, scale=8, kernel_size=3, ... method forward (line 2365) | def forward(self, hidden_states): class SqueezeExcitationBlock (line 2379) | class SqueezeExcitationBlock(nn.Module): method __init__ (line 2380) | def __init__(self, in_channels, se_channels, out_channels): method forward (line 2400) | def forward(self, hidden_states): class AttentiveStatisticsPooling (line 2409) | class AttentiveStatisticsPooling(nn.Module): method __init__ (line 2414) | def __init__(self, channels, attention_channels=128): method _length_to_mask (line 2428) | def _length_to_mask(self, length, max_len=None, dtype=None, device=None): method _compute_statistics (line 2459) | def _compute_statistics(self, x, m, dim=2): method forward (line 2464) | def forward(self, hidden_states): class SqueezeExcitationRes2NetBlock (line 2498) | class SqueezeExcitationRes2NetBlock(nn.Module): method __init__ (line 2503) | def __init__( method forward (line 2529) | def forward(self, hidden_state): class ECAPA_TimeDelayNet (line 2540) | class ECAPA_TimeDelayNet(torch.nn.Module): method __init__ (line 2546) | def __init__(self, config: Qwen2_5OmniDiTConfig): method forward (line 2601) | def forward(self, hidden_states): class DiTInputEmbedding (line 2624) | class DiTInputEmbedding(nn.Module): method __init__ (line 2625) | def __init__(self, config: Qwen2_5OmniDiTConfig): method forward (line 2633) | def forward( class DiTCodecEmbedding (line 2658) | class DiTCodecEmbedding(nn.Module): method __init__ (line 2659) | def __init__(self, codec_num_embeds, codec_dim, repeats): method forward (line 2664) | def forward(self, code, drop_code=False): class Qwen2_5_OmniAdaLayerNormZero (line 2675) | class Qwen2_5_OmniAdaLayerNormZero(nn.Module): method __init__ (line 2676) | def __init__(self, dim): method forward (line 2684) | def forward(self, hidden_states, emb=None): class Qwen2_5_OmniAdaLayerNormZero_Final (line 2694) | class Qwen2_5_OmniAdaLayerNormZero_Final(nn.Module): method __init__ (line 2695) | def __init__(self, dim): method forward (line 2703) | def forward(self, hidden_states, emb): class DiTMLP (line 2712) | class DiTMLP(nn.Module): method __init__ (line 2713) | def __init__(self, dim, mult=4, dropout=0.0): method forward (line 2726) | def forward(self, hidden_states): class DiTAttention (line 2732) | class DiTAttention(nn.Module): method __init__ (line 2733) | def __init__(self, config: Qwen2_5OmniDiTConfig): method forward (line 2749) | def forward( class SinusPositionEmbedding (line 2796) | class SinusPositionEmbedding(nn.Module): method __init__ (line 2797) | def __init__(self, dim): method forward (line 2801) | def forward(self, hidden_states, scale=1000): class DiTTimestepEmbedding (line 2811) | class DiTTimestepEmbedding(nn.Module): method __init__ (line 2812) | def __init__(self, dim, freq_embed_dim=256): method forward (line 2817) | def forward(self, timestep): class DiTDecoderLayer (line 2825) | class DiTDecoderLayer(nn.Module): method __init__ (line 2826) | def __init__(self, config: Qwen2_5OmniDiTConfig, look_ahead_block=0, l... method forward (line 2836) | def forward( class SnakeBeta (line 2860) | class SnakeBeta(nn.Module): method __init__ (line 2874) | def __init__(self, in_features, alpha=1.0): method forward (line 2884) | def forward(self, hidden_states): function kaiser_sinc_filter1d (line 2901) | def kaiser_sinc_filter1d(cutoff, half_width, kernel_size): class UpSample1d (line 2947) | class UpSample1d(nn.Module): method __init__ (line 2948) | def __init__(self, ratio=2, kernel_size=None): method forward (line 2960) | def forward(self, hidden_states): class DownSample1d (line 2972) | class DownSample1d(nn.Module): method __init__ (line 2973) | def __init__(self, ratio=2, kernel_size=None): method forward (line 2993) | def forward(self, hidden_states): class TorchActivation1d (line 3000) | class TorchActivation1d(nn.Module): method __init__ (line 3001) | def __init__( method forward (line 3016) | def forward(self, hidden_states): class AMPBlock (line 3024) | class AMPBlock(torch.nn.Module): method __init__ (line 3025) | def __init__( method _get_padding (line 3097) | def _get_padding(self, kernel_size, dilation=1): method forward (line 3100) | def forward(self, hidden_states): class Qwen2_5OmniToken2WavBigVGANModel (line 3118) | class Qwen2_5OmniToken2WavBigVGANModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 3122) | def __init__(self, config: Qwen2_5OmniBigVGANConfig): method normalize_spectrogram (line 3163) | def normalize_spectrogram(self, spectrogram, max_value, min_db): method amplitude_to_db (line 3166) | def amplitude_to_db(self, amplitude, min_db_level): method process_mel_spectrogram (line 3172) | def process_mel_spectrogram(self, mel_spectrogram): method forward (line 3177) | def forward(self, mel_spectrogram, **kwargs): class RungeKutta4ODESolver (line 3195) | class RungeKutta4ODESolver: method __init__ (line 3196) | def __init__(self, function, initial_value): method _rk4_step (line 3203) | def _rk4_step(self, function, time_start, time_step, time_end, value_s... method _compute_step (line 3210) | def _compute_step(self, function, time_start, time_step, time_end, val... method _linear_interpolation (line 3216) | def _linear_interpolation(self, time_start, time_end, value_start, val... method integrate (line 3224) | def integrate(self, time_points): class Qwen2_5OmniToken2WavDiTModel (line 3256) | class Qwen2_5OmniToken2WavDiTModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 3261) | def __init__(self, config: Qwen2_5OmniDiTConfig): method _create_block_diff (line 3292) | def _create_block_diff(self, hidden_states): method forward (line 3302) | def forward( method sample (line 3354) | def sample( class Qwen2_5OmniToken2WavModel (line 3427) | class Qwen2_5OmniToken2WavModel(Qwen2_5OmniPreTrainedModel): method __init__ (line 3433) | def __init__(self, config: Qwen2_5OmniToken2WavConfig): method forward (line 3456) | def forward( class Qwen2_5OmniForConditionalGeneration (line 3498) | class Qwen2_5OmniForConditionalGeneration(Qwen2_5OmniPreTrainedModel, Ge... method __init__ (line 3506) | def __init__(self, config): method enable_talker (line 3517) | def enable_talker(self): method load_speakers (line 3523) | def load_speakers(self, path): method disable_talker (line 3529) | def disable_talker(self): method from_pretrained (line 3537) | def from_pretrained( method generate (line 3586) | def generate( FILE: src/transformers/models/qwen2_5_omni/processing_qwen2_5_omni.py class Qwen2_5_OmniVideosKwargs (line 34) | class Qwen2_5_OmniVideosKwargs(VideosKwargs, total=False): class Qwen2_5OmniProcessorKwargs (line 80) | class Qwen2_5OmniProcessorKwargs(ProcessingKwargs, total=False): class Qwen2_5OmniProcessor (line 106) | class Qwen2_5OmniProcessor(ProcessorMixin): method __init__ (line 107) | def __init__( method __call__ (line 120) | def __call__( method replace_multimodal_special_tokens (line 200) | def replace_multimodal_special_tokens( method get_chunked_index (line 271) | def get_chunked_index(self, token_indices: np.ndarray, tokens_per_chun... method apply_chat_template (line 304) | def apply_chat_template(self, conversations, chat_template=None, **kwa... method post_process_image_text_to_text (line 325) | def post_process_image_text_to_text(self, generated_outputs, skip_spec... method post_process_multimodal_output (line 343) | def post_process_multimodal_output( method model_input_names (line 380) | def model_input_names(self): FILE: src/transformers/models/qwen2_5_vl/configuration_qwen2_5_vl.py class Qwen2_5_VLVisionConfig (line 36) | class Qwen2_5_VLVisionConfig(PreTrainedConfig): class Qwen2_5_VLTextConfig (line 69) | class Qwen2_5_VLTextConfig(PreTrainedConfig): method __post_init__ (line 127) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 144) | def convert_rope_params_to_dict(self, **kwargs): class Qwen2_5_VLConfig (line 159) | class Qwen2_5_VLConfig(PreTrainedConfig): method __post_init__ (line 188) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py class Qwen2_5_VLRMSNorm (line 57) | class Qwen2_5_VLRMSNorm(nn.Module): method __init__ (line 58) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 66) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 73) | def extra_repr(self): class Qwen2_5_VLMLP (line 77) | class Qwen2_5_VLMLP(nn.Module): method __init__ (line 78) | def __init__(self, config, bias: bool = False): method forward (line 87) | def forward(self, hidden_state): class Qwen2_5_VisionPatchEmbed (line 91) | class Qwen2_5_VisionPatchEmbed(nn.Module): method __init__ (line 92) | def __init__( method forward (line 108) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Qwen2_5_VisionRotaryEmbedding (line 117) | class Qwen2_5_VisionRotaryEmbedding(nn.Module): method __init__ (line 120) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 127) | def forward(self, seqlen: int) -> torch.Tensor: class Qwen2_5_VLPatchMerger (line 133) | class Qwen2_5_VLPatchMerger(nn.Module): method __init__ (line 134) | def __init__(self, dim: int, context_dim: int, spatial_merge_size: int... method forward (line 144) | def forward(self, x: torch.Tensor) -> torch.Tensor: function rotate_half (line 149) | def rotate_half(x): function apply_rotary_pos_emb_vision (line 156) | def apply_rotary_pos_emb_vision( function repeat_kv (line 170) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 182) | def eager_attention_forward( class Qwen2_5_VLVisionAttention (line 207) | class Qwen2_5_VLVisionAttention(nn.Module): method __init__ (line 208) | def __init__(self, config: Qwen2_5_VLVisionConfig) -> None: method forward (line 221) | def forward( class Qwen2_5_VLVisionBlock (line 290) | class Qwen2_5_VLVisionBlock(GradientCheckpointingLayer): method __init__ (line 291) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 299) | def forward( class Qwen2_5_VLPreTrainedModel (line 325) | class Qwen2_5_VLPreTrainedModel(PreTrainedModel): method _init_weights (line 338) | def _init_weights(self, module): class Qwen2_5_VisionTransformerPretrainedModel (line 345) | class Qwen2_5_VisionTransformerPretrainedModel(Qwen2_5_VLPreTrainedModel): method __init__ (line 354) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 382) | def rot_pos_emb(self, grid_thw): method get_window_index (line 411) | def get_window_index(self, grid_thw): method forward (line 455) | def forward( class Qwen2_5_VLModelOutputWithPast (line 527) | class Qwen2_5_VLModelOutputWithPast(ModelOutput): class Qwen2_5_VLRotaryEmbedding (line 545) | class Qwen2_5_VLRotaryEmbedding(nn.Module): method __init__ (line 548) | def __init__(self, config: Qwen2_5_VLConfig, device=None): method compute_default_rope_parameters (line 565) | def compute_default_rope_parameters( method forward (line 595) | def forward(self, x, position_ids): class Qwen2MLP (line 611) | class Qwen2MLP(nn.Module): method __init__ (line 612) | def __init__(self, config): method forward (line 622) | def forward(self, x): function apply_multimodal_rotary_pos_emb (line 627) | def apply_multimodal_rotary_pos_emb(q, k, cos, sin, mrope_section, unsqu... class Qwen2_5_VLAttention (line 672) | class Qwen2_5_VLAttention(nn.Module): method __init__ (line 678) | def __init__(self, config: Qwen2_5_VLTextConfig, layer_idx: int | None... method forward (line 711) | def forward( class Qwen2_5_VLDecoderLayer (line 762) | class Qwen2_5_VLDecoderLayer(GradientCheckpointingLayer): method __init__ (line 763) | def __init__(self, config: Qwen2_5_VLTextConfig, layer_idx: int): method forward (line 778) | def forward( class Qwen2_5_VLTextModel (line 831) | class Qwen2_5_VLTextModel(Qwen2_5_VLPreTrainedModel): method __init__ (line 839) | def __init__(self, config: Qwen2_5_VLTextConfig): method forward (line 860) | def forward( class Qwen2_5_VLModel (line 946) | class Qwen2_5_VLModel(Qwen2_5_VLPreTrainedModel): method __init__ (line 953) | def __init__(self, config): method get_input_embeddings (line 962) | def get_input_embeddings(self): method set_input_embeddings (line 965) | def set_input_embeddings(self, value): method get_vision_position_ids (line 968) | def get_vision_position_ids( method get_rope_index (line 1024) | def get_rope_index( method get_video_features (line 1137) | def get_video_features( method get_image_features (line 1159) | def get_image_features( method get_placeholder_mask (line 1179) | def get_placeholder_mask( method compute_3d_position_ids (line 1220) | def compute_3d_position_ids( method forward (line 1270) | def forward( class Qwen2_5_VLCausalLMOutputWithPast (line 1354) | class Qwen2_5_VLCausalLMOutputWithPast(ModelOutput): class Qwen2_5_VLForConditionalGeneration (line 1377) | class Qwen2_5_VLForConditionalGeneration(Qwen2_5_VLPreTrainedModel, Gene... method __init__ (line 1382) | def __init__(self, config): method get_input_embeddings (line 1389) | def get_input_embeddings(self): method set_input_embeddings (line 1392) | def set_input_embeddings(self, value): method get_video_features (line 1396) | def get_video_features( method get_image_features (line 1413) | def get_image_features( method forward (line 1429) | def forward( method prepare_inputs_for_generation (line 1536) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1576) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1614) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1665) | def _expand_inputs_for_generation( FILE: src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py class Qwen2_5_VLVisionConfig (line 65) | class Qwen2_5_VLVisionConfig(PreTrainedConfig): class Qwen2_5_VLTextConfig (line 96) | class Qwen2_5_VLTextConfig(Qwen2VLTextConfig): class Qwen2_5_VLConfig (line 100) | class Qwen2_5_VLConfig(Qwen2VLConfig): class Qwen2_5_VLRMSNorm (line 104) | class Qwen2_5_VLRMSNorm(LlamaRMSNorm): class Qwen2_5_VLMLP (line 108) | class Qwen2_5_VLMLP(nn.Module): method __init__ (line 109) | def __init__(self, config, bias: bool = False): method forward (line 118) | def forward(self, hidden_state): class Qwen2_5_VisionPatchEmbed (line 122) | class Qwen2_5_VisionPatchEmbed(PatchEmbed): class Qwen2_5_VisionRotaryEmbedding (line 126) | class Qwen2_5_VisionRotaryEmbedding(VisionRotaryEmbedding): class Qwen2_5_VLPatchMerger (line 130) | class Qwen2_5_VLPatchMerger(PatchMerger): method __init__ (line 131) | def __init__(self, dim: int, context_dim: int, spatial_merge_size: int... class Qwen2_5_VLVisionAttention (line 136) | class Qwen2_5_VLVisionAttention(VisionAttention): method __init__ (line 137) | def __init__(self, config: Qwen2_5_VLVisionConfig) -> None: class Qwen2_5_VLVisionBlock (line 142) | class Qwen2_5_VLVisionBlock(GradientCheckpointingLayer): method __init__ (line 143) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 151) | def forward( class Qwen2_5_VLPreTrainedModel (line 176) | class Qwen2_5_VLPreTrainedModel(Qwen2VLPreTrainedModel): method _init_weights (line 177) | def _init_weights(self, module): class Qwen2_5_VisionTransformerPretrainedModel (line 184) | class Qwen2_5_VisionTransformerPretrainedModel(Qwen2_5_VLPreTrainedModel): method __init__ (line 193) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 221) | def rot_pos_emb(self, grid_thw): method get_window_index (line 250) | def get_window_index(self, grid_thw): method forward (line 294) | def forward( class Qwen2_5_VLModelOutputWithPast (line 360) | class Qwen2_5_VLModelOutputWithPast(Qwen2VLModelOutputWithPast): class Qwen2_5_VLModel (line 364) | class Qwen2_5_VLModel(Qwen2VLModel): method __init__ (line 371) | def __init__(self, config): method get_rope_index (line 375) | def get_rope_index( method compute_3d_position_ids (line 486) | def compute_3d_position_ids( method forward (line 536) | def forward( class Qwen2_5_VLCausalLMOutputWithPast (line 614) | class Qwen2_5_VLCausalLMOutputWithPast(Qwen2VLCausalLMOutputWithPast): class Qwen2_5_VLForConditionalGeneration (line 618) | class Qwen2_5_VLForConditionalGeneration(Qwen2VLForConditionalGeneration): method forward (line 624) | def forward( method prepare_inputs_for_generation (line 731) | def prepare_inputs_for_generation( class Qwen2_5_VLProcessorKwargs (line 772) | class Qwen2_5_VLProcessorKwargs(ProcessingKwargs, total=False): class Qwen2_5_VLProcessor (line 782) | class Qwen2_5_VLProcessor(Qwen2VLProcessor): method model_input_names (line 784) | def model_input_names(self): method __call__ (line 793) | def __call__( method _get_num_multimodal_tokens (line 880) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... FILE: src/transformers/models/qwen2_5_vl/processing_qwen2_5_vl.py class Qwen2_5_VLProcessorKwargs (line 33) | class Qwen2_5_VLProcessorKwargs(ProcessingKwargs, total=False): class Qwen2_5_VLProcessor (line 44) | class Qwen2_5_VLProcessor(ProcessorMixin): method __init__ (line 45) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 61) | def __call__( method _get_num_multimodal_tokens (line 148) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... method post_process_image_text_to_text (line 186) | def post_process_image_text_to_text( method model_input_names (line 214) | def model_input_names(self): FILE: src/transformers/models/qwen2_audio/configuration_qwen2_audio.py class Qwen2AudioEncoderConfig (line 24) | class Qwen2AudioEncoderConfig(PreTrainedConfig): class Qwen2AudioConfig (line 64) | class Qwen2AudioConfig(PreTrainedConfig): method __post_init__ (line 97) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen2_audio/modeling_qwen2_audio.py class Qwen2AudioCausalLMOutputWithPast (line 47) | class Qwen2AudioCausalLMOutputWithPast(ModelOutput): function eager_attention_forward (line 75) | def eager_attention_forward( class Qwen2AudioAttention (line 101) | class Qwen2AudioAttention(nn.Module): method __init__ (line 105) | def __init__( method _shape (line 145) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 148) | def forward( class Qwen2AudioEncoderLayer (line 191) | class Qwen2AudioEncoderLayer(GradientCheckpointingLayer): method __init__ (line 192) | def __init__(self, config: Qwen2AudioConfig): method forward (line 210) | def forward( class Qwen2AudioPreTrainedModel (line 248) | class Qwen2AudioPreTrainedModel(PreTrainedModel): class Qwen2AudioEncoder (line 265) | class Qwen2AudioEncoder(Qwen2AudioPreTrainedModel): method __init__ (line 281) | def __init__(self, config: Qwen2AudioEncoderConfig): method _freeze_parameters (line 306) | def _freeze_parameters(self): method get_input_embeddings (line 311) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 314) | def set_input_embeddings(self, value: nn.Module): method forward (line 319) | def forward( method _get_feat_extract_output_lengths (line 376) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class Qwen2AudioMultiModalProjector (line 385) | class Qwen2AudioMultiModalProjector(nn.Module): method __init__ (line 386) | def __init__(self, config: Qwen2AudioConfig): method forward (line 390) | def forward(self, audio_features): class Qwen2AudioForConditionalGeneration (line 400) | class Qwen2AudioForConditionalGeneration(Qwen2AudioPreTrainedModel, Gene... method __init__ (line 401) | def __init__(self, config: Qwen2AudioConfig): method padding_side (line 416) | def padding_side(self): method padding_side (line 420) | def padding_side(self, padding_side: str): method get_input_embeddings (line 425) | def get_input_embeddings(self): method set_input_embeddings (line 428) | def set_input_embeddings(self, value): method get_output_embeddings (line 431) | def get_output_embeddings(self): method set_output_embeddings (line 434) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 437) | def set_decoder(self, decoder): method get_decoder (line 440) | def get_decoder(self): method _merge_input_ids_with_audio_features (line 443) | def _merge_input_ids_with_audio_features( method forward (line 642) | def forward( method prepare_inputs_for_generation (line 797) | def prepare_inputs_for_generation(self, *args, **kwargs): FILE: src/transformers/models/qwen2_audio/processing_qwen2_audio.py class Qwen2AudioProcessorKwargs (line 26) | class Qwen2AudioProcessorKwargs(ProcessingKwargs, total=False): class Qwen2AudioProcessor (line 36) | class Qwen2AudioProcessor(ProcessorMixin): method __init__ (line 37) | def __init__( method __call__ (line 63) | def __call__( method model_input_names (line 145) | def model_input_names(self): method default_chat_template (line 152) | def default_chat_template(self): FILE: src/transformers/models/qwen2_moe/configuration_qwen2_moe.py class Qwen2MoeConfig (line 25) | class Qwen2MoeConfig(PreTrainedConfig): method __post_init__ (line 103) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen2_moe/modeling_qwen2_moe.py class Qwen2MoeRMSNorm (line 61) | class Qwen2MoeRMSNorm(nn.Module): method __init__ (line 62) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 70) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 77) | def extra_repr(self): class Qwen2MoeRotaryEmbedding (line 81) | class Qwen2MoeRotaryEmbedding(nn.Module): method __init__ (line 84) | def __init__(self, config: Qwen2MoeConfig, device=None): method compute_default_rope_parameters (line 101) | def compute_default_rope_parameters( method forward (line 132) | def forward(self, x, position_ids): class Qwen2MoeMLP (line 146) | class Qwen2MoeMLP(nn.Module): method __init__ (line 147) | def __init__(self, config, intermediate_size=None): method forward (line 157) | def forward(self, x): function rotate_half (line 162) | def rotate_half(x): function apply_rotary_pos_emb (line 170) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 195) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 207) | def eager_attention_forward( class Qwen2MoeAttention (line 233) | class Qwen2MoeAttention(nn.Module): method __init__ (line 236) | def __init__(self, config: Qwen2MoeConfig, layer_idx: int): method forward (line 253) | def forward( class Qwen2MoeExperts (line 295) | class Qwen2MoeExperts(nn.Module): method __init__ (line 298) | def __init__(self, config): method forward (line 307) | def forward( class Qwen2MoeTopKRouter (line 334) | class Qwen2MoeTopKRouter(nn.Module): method __init__ (line 335) | def __init__(self, config): method forward (line 343) | def forward(self, hidden_states): class Qwen2MoeSparseMoeBlock (line 355) | class Qwen2MoeSparseMoeBlock(nn.Module): method __init__ (line 356) | def __init__(self, config): method forward (line 363) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen2MoeDecoderLayer (line 377) | class Qwen2MoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 378) | def __init__(self, config: Qwen2MoeConfig, layer_idx: int): method forward (line 391) | def forward( class Qwen2MoePreTrainedModel (line 424) | class Qwen2MoePreTrainedModel(PreTrainedModel): method _init_weights (line 443) | def _init_weights(self, module): class Qwen2MoeModel (line 454) | class Qwen2MoeModel(Qwen2MoePreTrainedModel): method __init__ (line 455) | def __init__(self, config: Qwen2MoeConfig): method forward (line 474) | def forward( function load_balancing_loss_func (line 535) | def load_balancing_loss_func( class Qwen2MoeForCausalLM (line 618) | class Qwen2MoeForCausalLM(Qwen2MoePreTrainedModel, GenerationMixin): method __init__ (line 623) | def __init__(self, config): method forward (line 637) | def forward( class Qwen2MoeForSequenceClassification (line 720) | class Qwen2MoeForSequenceClassification(GenericForSequenceClassification... class Qwen2MoeForTokenClassification (line 723) | class Qwen2MoeForTokenClassification(GenericForTokenClassification, Qwen... class Qwen2MoeForQuestionAnswering (line 726) | class Qwen2MoeForQuestionAnswering(GenericForQuestionAnswering, Qwen2Moe... FILE: src/transformers/models/qwen2_moe/modular_qwen2_moe.py class Qwen2MoeRMSNorm (line 51) | class Qwen2MoeRMSNorm(LlamaRMSNorm): class Qwen2MoeRotaryEmbedding (line 55) | class Qwen2MoeRotaryEmbedding(Gemma2RotaryEmbedding): class Qwen2MoeMLP (line 59) | class Qwen2MoeMLP(GemmaMLP): method __init__ (line 60) | def __init__(self, config, intermediate_size=None): class Qwen2MoeAttention (line 71) | class Qwen2MoeAttention(LlamaAttention): method __init__ (line 72) | def __init__(self, config: Qwen2MoeConfig, layer_idx: int): class Qwen2MoeExperts (line 83) | class Qwen2MoeExperts(MixtralExperts): method __init__ (line 84) | def __init__(self, config): class Qwen2MoeTopKRouter (line 90) | class Qwen2MoeTopKRouter(nn.Module): method __init__ (line 91) | def __init__(self, config): method forward (line 99) | def forward(self, hidden_states): class Qwen2MoeSparseMoeBlock (line 111) | class Qwen2MoeSparseMoeBlock(nn.Module): method __init__ (line 112) | def __init__(self, config): method forward (line 119) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen2MoeDecoderLayer (line 133) | class Qwen2MoeDecoderLayer(LlamaDecoderLayer): method __init__ (line 134) | def __init__(self, config: Qwen2MoeConfig, layer_idx: int): class Qwen2MoePreTrainedModel (line 149) | class Qwen2MoePreTrainedModel(MixtralPreTrainedModel): class Qwen2MoeModel (line 158) | class Qwen2MoeModel(MixtralModel): method __init__ (line 159) | def __init__(self, config: Qwen2MoeConfig): method forward (line 170) | def forward( class Qwen2MoeForCausalLM (line 231) | class Qwen2MoeForCausalLM(MixtralForCausalLM, GenerationMixin): method __init__ (line 236) | def __init__(self, config): class Qwen2MoeForSequenceClassification (line 242) | class Qwen2MoeForSequenceClassification(GenericForSequenceClassification... class Qwen2MoeForTokenClassification (line 245) | class Qwen2MoeForTokenClassification(GenericForTokenClassification, Qwen... class Qwen2MoeForQuestionAnswering (line 248) | class Qwen2MoeForQuestionAnswering(GenericForQuestionAnswering, Qwen2Moe... FILE: src/transformers/models/qwen2_vl/configuration_qwen2_vl.py class Qwen2VLVisionConfig (line 27) | class Qwen2VLVisionConfig(PreTrainedConfig): class Qwen2VLTextConfig (line 46) | class Qwen2VLTextConfig(PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 121) | def convert_rope_params_to_dict(self, **kwargs): class Qwen2VLConfig (line 136) | class Qwen2VLConfig(PreTrainedConfig): method __post_init__ (line 165) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen2_vl/image_processing_pil_qwen2_vl.py class Qwen2VLImageProcessorKwargs (line 35) | class Qwen2VLImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 57) | def smart_resize( class Qwen2VLImageProcessorPil (line 87) | class Qwen2VLImageProcessorPil(PilBackend): method __init__ (line 103) | def __init__(self, **kwargs: Unpack[Qwen2VLImageProcessorKwargs]): method _standardize_kwargs (line 120) | def _standardize_kwargs( method preprocess (line 136) | def preprocess( method _preprocess (line 143) | def _preprocess( method get_number_of_image_patches (line 226) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/qwen2_vl/image_processing_qwen2_vl.py class Qwen2VLImageProcessorKwargs (line 41) | class Qwen2VLImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 62) | def smart_resize( class Qwen2VLImageProcessor (line 92) | class Qwen2VLImageProcessor(TorchvisionBackend): method __init__ (line 108) | def __init__(self, **kwargs: Unpack[Qwen2VLImageProcessorKwargs]): method _standardize_kwargs (line 125) | def _standardize_kwargs( method preprocess (line 141) | def preprocess( method _preprocess (line 148) | def _preprocess( method get_number_of_image_patches (line 234) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/qwen2_vl/modeling_qwen2_vl.py class Qwen2VLModelOutputWithPast (line 68) | class Qwen2VLModelOutputWithPast(ModelOutput): class Qwen2VLCausalLMOutputWithPast (line 92) | class Qwen2VLCausalLMOutputWithPast(ModelOutput): class Qwen2VLRMSNorm (line 117) | class Qwen2VLRMSNorm(nn.Module): method __init__ (line 118) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 126) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 133) | def extra_repr(self): class Qwen2VLRotaryEmbedding (line 138) | class Qwen2VLRotaryEmbedding(nn.Module): method __init__ (line 141) | def __init__(self, config: Qwen2VLConfig, device=None): method compute_default_rope_parameters (line 158) | def compute_default_rope_parameters( method forward (line 188) | def forward(self, x, position_ids): function rotate_half (line 205) | def rotate_half(x): function apply_multimodal_rotary_pos_emb (line 212) | def apply_multimodal_rotary_pos_emb(q, k, cos, sin, mrope_section, unsqu... function apply_rotary_pos_emb_vision (line 257) | def apply_rotary_pos_emb_vision( class VisionRotaryEmbedding (line 271) | class VisionRotaryEmbedding(nn.Module): method __init__ (line 274) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 281) | def forward(self, seqlen: int) -> torch.Tensor: class PatchEmbed (line 287) | class PatchEmbed(nn.Module): method __init__ (line 288) | def __init__( method forward (line 304) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class PatchMerger (line 313) | class PatchMerger(nn.Module): method __init__ (line 314) | def __init__(self, dim: int, context_dim: int, spatial_merge_size: int... method forward (line 324) | def forward(self, x: torch.Tensor) -> torch.Tensor: class VisionMlp (line 329) | class VisionMlp(nn.Module): method __init__ (line 330) | def __init__(self, dim: int, hidden_dim: int, hidden_act: str) -> None: method forward (line 336) | def forward(self, x) -> torch.Tensor: function repeat_kv (line 341) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 353) | def eager_attention_forward( class VisionAttention (line 378) | class VisionAttention(nn.Module): method __init__ (line 379) | def __init__(self, config: Qwen2VLVisionConfig) -> None: method forward (line 392) | def forward( class Qwen2VLVisionBlock (line 461) | class Qwen2VLVisionBlock(GradientCheckpointingLayer): method __init__ (line 462) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 471) | def forward( class Qwen2MLP (line 491) | class Qwen2MLP(nn.Module): method __init__ (line 492) | def __init__(self, config): method forward (line 502) | def forward(self, x): class Qwen2VLAttention (line 507) | class Qwen2VLAttention(nn.Module): method __init__ (line 513) | def __init__(self, config: Qwen2VLTextConfig, layer_idx: int | None = ... method forward (line 546) | def forward( class Qwen2VLDecoderLayer (line 597) | class Qwen2VLDecoderLayer(GradientCheckpointingLayer): method __init__ (line 598) | def __init__(self, config: Qwen2VLTextConfig, layer_idx: int): method forward (line 613) | def forward( class Qwen2VLPreTrainedModel (line 666) | class Qwen2VLPreTrainedModel(PreTrainedModel): method _init_weights (line 679) | def _init_weights(self, module): class Qwen2VisionTransformerPretrainedModel (line 687) | class Qwen2VisionTransformerPretrainedModel(Qwen2VLPreTrainedModel): method __init__ (line 697) | def __init__(self, config) -> None: method get_dtype (line 719) | def get_dtype(self) -> torch.dtype: method get_device (line 722) | def get_device(self) -> torch.device: method rot_pos_emb (line 725) | def rot_pos_emb(self, grid_thw): method forward (line 757) | def forward( class Qwen2VLTextModel (line 799) | class Qwen2VLTextModel(Qwen2VLPreTrainedModel): method __init__ (line 807) | def __init__(self, config: Qwen2VLTextConfig): method forward (line 828) | def forward( class Qwen2VLModel (line 914) | class Qwen2VLModel(Qwen2VLPreTrainedModel): method __init__ (line 919) | def __init__(self, config: Qwen2VLConfig): method get_input_embeddings (line 928) | def get_input_embeddings(self): method set_input_embeddings (line 931) | def set_input_embeddings(self, value): method get_vision_position_ids (line 934) | def get_vision_position_ids( method get_rope_index (line 990) | def get_rope_index( method get_video_features (line 1096) | def get_video_features( method get_image_features (line 1118) | def get_image_features( method get_placeholder_mask (line 1138) | def get_placeholder_mask( method compute_3d_position_ids (line 1179) | def compute_3d_position_ids( method forward (line 1230) | def forward( class Qwen2VLForConditionalGeneration (line 1303) | class Qwen2VLForConditionalGeneration(Qwen2VLPreTrainedModel, Generation... method __init__ (line 1306) | def __init__(self, config): method get_input_embeddings (line 1313) | def get_input_embeddings(self): method set_input_embeddings (line 1316) | def set_input_embeddings(self, value): method get_video_features (line 1320) | def get_video_features( method get_image_features (line 1337) | def get_image_features( method forward (line 1353) | def forward( method prepare_inputs_for_generation (line 1455) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1493) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1531) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1582) | def _expand_inputs_for_generation( FILE: src/transformers/models/qwen2_vl/processing_qwen2_vl.py class Qwen2VLProcessorKwargs (line 34) | class Qwen2VLProcessorKwargs(ProcessingKwargs, total=False): class Qwen2VLProcessor (line 44) | class Qwen2VLProcessor(ProcessorMixin): method __init__ (line 45) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 61) | def __call__( method _get_num_multimodal_tokens (line 131) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... method post_process_image_text_to_text (line 169) | def post_process_image_text_to_text( method model_input_names (line 197) | def model_input_names(self): FILE: src/transformers/models/qwen2_vl/video_processing_qwen2_vl.py class Qwen2VLVideoProcessorInitKwargs (line 42) | class Qwen2VLVideoProcessorInitKwargs(VideosKwargs, total=False): class Qwen2VLVideoProcessor (line 72) | class Qwen2VLVideoProcessor(BaseVideoProcessor): method __init__ (line 90) | def __init__(self, **kwargs: Unpack[Qwen2VLVideoProcessorInitKwargs]): method _standardize_kwargs (line 107) | def _standardize_kwargs( method sample_frames (line 122) | def sample_frames( method _preprocess (line 192) | def _preprocess( method get_num_of_video_patches (line 287) | def get_num_of_video_patches(self, num_frames: int, height: int, width... FILE: src/transformers/models/qwen3/configuration_qwen3.py class Qwen3Config (line 25) | class Qwen3Config(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen3/modeling_qwen3.py class Qwen3RMSNorm (line 50) | class Qwen3RMSNorm(nn.Module): method __init__ (line 51) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 59) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self): class Qwen3MLP (line 70) | class Qwen3MLP(nn.Module): method __init__ (line 71) | def __init__(self, config): method forward (line 81) | def forward(self, x): class Qwen3RotaryEmbedding (line 86) | class Qwen3RotaryEmbedding(nn.Module): method __init__ (line 89) | def __init__(self, config: Qwen3Config, device=None): method compute_default_rope_parameters (line 106) | def compute_default_rope_parameters( method forward (line 137) | def forward(self, x, position_ids): 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, unsqueeze_dim=1): function repeat_kv (line 184) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 196) | def eager_attention_forward( class Qwen3Attention (line 222) | class Qwen3Attention(nn.Module): method __init__ (line 225) | def __init__(self, config: Qwen3Config, layer_idx: int): method forward (line 252) | def forward( class Qwen3DecoderLayer (line 294) | class Qwen3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 295) | def __init__(self, config: Qwen3Config, layer_idx: int): method forward (line 305) | def forward( class Qwen3PreTrainedModel (line 338) | class Qwen3PreTrainedModel(PreTrainedModel): class Qwen3Model (line 357) | class Qwen3Model(Qwen3PreTrainedModel): method __init__ (line 358) | def __init__(self, config: Qwen3Config): method forward (line 378) | def forward( class Qwen3ForCausalLM (line 442) | class Qwen3ForCausalLM(Qwen3PreTrainedModel, GenerationMixin): method __init__ (line 447) | def __init__(self, config): method forward (line 458) | def forward( class Qwen3ForSequenceClassification (line 520) | class Qwen3ForSequenceClassification(GenericForSequenceClassification, Q... class Qwen3ForTokenClassification (line 524) | class Qwen3ForTokenClassification(GenericForTokenClassification, Qwen3Pr... class Qwen3ForQuestionAnswering (line 528) | class Qwen3ForQuestionAnswering(GenericForQuestionAnswering, Qwen3PreTra... FILE: src/transformers/models/qwen3/modular_qwen3.py class Qwen3RMSNorm (line 48) | class Qwen3RMSNorm(Qwen2RMSNorm): class Qwen3MLP (line 52) | class Qwen3MLP(GemmaMLP): class Qwen3RotaryEmbedding (line 56) | class Qwen3RotaryEmbedding(Qwen2RotaryEmbedding): class Qwen3Attention (line 60) | class Qwen3Attention(LlamaAttention): method __init__ (line 61) | def __init__(self, config: Qwen3Config, layer_idx: int): method forward (line 68) | def forward( class Qwen3ForCausalLM (line 110) | class Qwen3ForCausalLM(Qwen2ForCausalLM): method forward (line 111) | def forward( class Qwen3ForSequenceClassification (line 140) | class Qwen3ForSequenceClassification(Qwen2ForSequenceClassification): class Qwen3ForTokenClassification (line 144) | class Qwen3ForTokenClassification(Qwen2ForTokenClassification): class Qwen3ForQuestionAnswering (line 148) | class Qwen3ForQuestionAnswering(Qwen2ForQuestionAnswering): FILE: src/transformers/models/qwen3_5/configuration_qwen3_5.py class Qwen3_5TextConfig (line 29) | class Qwen3_5TextConfig(PreTrainedConfig): method __post_init__ (line 104) | def __post_init__(self, **kwargs): class Qwen3_5VisionConfig (line 118) | class Qwen3_5VisionConfig(PreTrainedConfig): class Qwen3_5Config (line 145) | class Qwen3_5Config(PreTrainedConfig): method __post_init__ (line 175) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen3_5/modeling_qwen3_5.py class Qwen3_5VisionRotaryEmbedding (line 69) | class Qwen3_5VisionRotaryEmbedding(nn.Module): method __init__ (line 72) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 79) | def forward(self, seqlen: int) -> torch.Tensor: class Qwen3_5TextRotaryEmbedding (line 85) | class Qwen3_5TextRotaryEmbedding(nn.Module): method __init__ (line 88) | def __init__(self, config: Qwen3_5TextConfig, device=None): method compute_default_rope_parameters (line 106) | def compute_default_rope_parameters( method forward (line 139) | def forward(self, x, position_ids): method apply_interleaved_mrope (line 157) | def apply_interleaved_mrope(self, freqs, mrope_section): class Qwen3_5RMSNormGated (line 175) | class Qwen3_5RMSNormGated(nn.Module): method __init__ (line 176) | def __init__(self, hidden_size, eps=1e-6, **kwargs): method forward (line 181) | def forward(self, hidden_states, gate=None): function apply_mask_to_padding_states (line 193) | def apply_mask_to_padding_states(hidden_states, attention_mask): function torch_causal_conv1d_update (line 210) | def torch_causal_conv1d_update( function l2norm (line 228) | def l2norm(x: torch.FloatTensor, dim: int = -1, eps: float = 1e-6): function torch_chunk_gated_delta_rule (line 234) | def torch_chunk_gated_delta_rule( function torch_recurrent_gated_delta_rule (line 314) | def torch_recurrent_gated_delta_rule( class Qwen3_5GatedDeltaNet (line 356) | class Qwen3_5GatedDeltaNet(nn.Module): method __init__ (line 357) | def __init__(self, config: Qwen3_5Config, layer_idx: int): method forward (line 422) | def forward( function rotate_half (line 536) | def rotate_half(x): function apply_rotary_pos_emb (line 544) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 582) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 594) | def eager_attention_forward( class Qwen3_5Attention (line 620) | class Qwen3_5Attention(nn.Module): method __init__ (line 623) | def __init__(self, config: Qwen3_5Config, layer_idx: int): method forward (line 647) | def forward( class Qwen3_5MLP (line 695) | class Qwen3_5MLP(nn.Module): method __init__ (line 696) | def __init__(self, config: Qwen3_5Config, intermediate_size: int): method forward (line 706) | def forward(self, x): class Qwen3_5RMSNorm (line 711) | class Qwen3_5RMSNorm(nn.Module): method __init__ (line 712) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 717) | def _norm(self, x): method forward (line 720) | def forward(self, x): method extra_repr (line 727) | def extra_repr(self): class Qwen3_5DecoderLayer (line 731) | class Qwen3_5DecoderLayer(GradientCheckpointingLayer): method __init__ (line 732) | def __init__(self, config: Qwen3_5TextConfig, layer_idx: int): method forward (line 744) | def forward( class Qwen3_5PreTrainedModel (line 786) | class Qwen3_5PreTrainedModel(PreTrainedModel): method _init_weights (line 802) | def _init_weights(self, module): class Qwen3_5VisionMLP (line 815) | class Qwen3_5VisionMLP(nn.Module): method __init__ (line 816) | def __init__(self, config): method forward (line 824) | def forward(self, hidden_state): class Qwen3_5VisionPatchEmbed (line 828) | class Qwen3_5VisionPatchEmbed(nn.Module): method __init__ (line 829) | def __init__(self, config) -> None: method forward (line 839) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Qwen3_5VisionPatchMerger (line 848) | class Qwen3_5VisionPatchMerger(nn.Module): method __init__ (line 849) | def __init__(self, config: Qwen3_5VisionConfig, use_postshuffle_norm=F... method forward (line 858) | def forward(self, x: torch.Tensor) -> torch.Tensor: function apply_rotary_pos_emb_vision (line 864) | def apply_rotary_pos_emb_vision( class Qwen3_5VisionAttention (line 878) | class Qwen3_5VisionAttention(nn.Module): method __init__ (line 879) | def __init__(self, config: Qwen3_5VisionConfig) -> None: method forward (line 892) | def forward( class Qwen3_5VisionBlock (line 961) | class Qwen3_5VisionBlock(GradientCheckpointingLayer): method __init__ (line 962) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 970) | def forward( class Qwen3_5VisionModel (line 995) | class Qwen3_5VisionModel(Qwen3_5PreTrainedModel): method __init__ (line 1004) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 1030) | def rot_pos_emb(self, grid_thw: torch.Tensor) -> torch.Tensor: method fast_pos_embed_interpolate (line 1070) | def fast_pos_embed_interpolate(self, grid_thw): method forward (line 1135) | def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor,... class Qwen3_5ModelOutputWithPast (line 1191) | class Qwen3_5ModelOutputWithPast(ModelOutput): class Qwen3_5TextModel (line 1209) | class Qwen3_5TextModel(Qwen3_5PreTrainedModel): method __init__ (line 1212) | def __init__(self, config: Qwen3_5TextConfig): method forward (line 1227) | def forward( method _update_linear_attn_mask (line 1292) | def _update_linear_attn_mask(self, attention_mask, past_key_values): class Qwen3_5Model (line 1308) | class Qwen3_5Model(Qwen3_5PreTrainedModel): method __init__ (line 1315) | def __init__(self, config): method get_input_embeddings (line 1324) | def get_input_embeddings(self): method set_input_embeddings (line 1327) | def set_input_embeddings(self, value): method get_vision_position_ids (line 1330) | def get_vision_position_ids( method get_rope_index (line 1386) | def get_rope_index( method get_video_features (line 1481) | def get_video_features( method get_image_features (line 1498) | def get_image_features( method get_placeholder_mask (line 1521) | def get_placeholder_mask( method compute_3d_position_ids (line 1562) | def compute_3d_position_ids( method forward (line 1613) | def forward( class Qwen3_5ForCausalLM (line 1688) | class Qwen3_5ForCausalLM(Qwen3_5PreTrainedModel, GenerationMixin): method __init__ (line 1695) | def __init__(self, config): method forward (line 1706) | def forward( class Qwen3_5ForSequenceClassification (line 1768) | class Qwen3_5ForSequenceClassification(GenericForSequenceClassification,... class Qwen3_5CausalLMOutputWithPast (line 1778) | class Qwen3_5CausalLMOutputWithPast(ModelOutput): class Qwen3_5ForConditionalGeneration (line 1801) | class Qwen3_5ForConditionalGeneration(Qwen3_5PreTrainedModel, Generation... method __init__ (line 1807) | def __init__(self, config): method get_input_embeddings (line 1814) | def get_input_embeddings(self): method set_input_embeddings (line 1817) | def set_input_embeddings(self, value): method get_video_features (line 1821) | def get_video_features( method get_image_features (line 1838) | def get_image_features( method forward (line 1853) | def forward( method prepare_inputs_for_generation (line 1949) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1987) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 2025) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 2076) | def _expand_inputs_for_generation( FILE: src/transformers/models/qwen3_5/modular_qwen3_5.py class Qwen3_5TextConfig (line 60) | class Qwen3_5TextConfig(Qwen3NextConfig): method __post_init__ (line 119) | def __post_init__(self, **kwargs): class Qwen3_5VisionConfig (line 126) | class Qwen3_5VisionConfig(Qwen3VLVisionConfig): class Qwen3_5Config (line 139) | class Qwen3_5Config(Qwen3VLConfig): class Qwen3_5VisionRotaryEmbedding (line 162) | class Qwen3_5VisionRotaryEmbedding(Qwen3VLVisionRotaryEmbedding): class Qwen3_5TextRotaryEmbedding (line 166) | class Qwen3_5TextRotaryEmbedding(Qwen3VLTextRotaryEmbedding): method __init__ (line 167) | def __init__(self, config: Qwen3_5TextConfig, device=None): method compute_default_rope_parameters (line 171) | def compute_default_rope_parameters( class Qwen3_5GatedDeltaNet (line 190) | class Qwen3_5GatedDeltaNet(Qwen3NextGatedDeltaNet): method __init__ (line 191) | def __init__(self, config: Qwen3_5Config, layer_idx: int): method fix_query_key_value_ordering (line 204) | def fix_query_key_value_ordering(self): method forward (line 207) | def forward( class Qwen3_5Attention (line 321) | class Qwen3_5Attention(Qwen3NextAttention): class Qwen3_5MLP (line 325) | class Qwen3_5MLP(Qwen3NextMLP): method __init__ (line 326) | def __init__(self, config: Qwen3_5Config, intermediate_size: int): class Qwen3_5RMSNorm (line 331) | class Qwen3_5RMSNorm(Qwen3NextRMSNorm): class Qwen3_5DecoderLayer (line 335) | class Qwen3_5DecoderLayer(GradientCheckpointingLayer): method __init__ (line 336) | def __init__(self, config: Qwen3_5TextConfig, layer_idx: int): method forward (line 348) | def forward( class Qwen3_5PreTrainedModel (line 390) | class Qwen3_5PreTrainedModel(Qwen3NextPreTrainedModel): method _init_weights (line 399) | def _init_weights(self, module): class Qwen3_5VisionModel (line 412) | class Qwen3_5VisionModel(Qwen3VLVisionModel): method __init__ (line 416) | def __init__(self, config, *inputs, **kwargs) -> None: method forward (line 423) | def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor,... class Qwen3_5ModelOutputWithPast (line 473) | class Qwen3_5ModelOutputWithPast(Qwen3VLModelOutputWithPast): class Qwen3_5TextModel (line 477) | class Qwen3_5TextModel(Qwen3NextModel): method __init__ (line 480) | def __init__(self, config: Qwen3_5TextConfig): method forward (line 484) | def forward( class Qwen3_5Model (line 550) | class Qwen3_5Model(Qwen3VLModel): method get_video_features (line 553) | def get_video_features( method get_image_features (line 560) | def get_image_features( method forward (line 579) | def forward( class Qwen3_5ForCausalLM (line 653) | class Qwen3_5ForCausalLM(Qwen3ForCausalLM): method __init__ (line 657) | def __init__(self, config): class Qwen3_5ForSequenceClassification (line 662) | class Qwen3_5ForSequenceClassification(GenericForSequenceClassification,... class Qwen3_5ForConditionalGeneration (line 666) | class Qwen3_5ForConditionalGeneration(Qwen3VLForConditionalGeneration): method get_video_features (line 667) | def get_video_features( method get_image_features (line 673) | def get_image_features( FILE: src/transformers/models/qwen3_5/tokenization_qwen3_5.py class Qwen3_5Tokenizer (line 28) | class Qwen3_5Tokenizer(TokenizersBackend): method __init__ (line 32) | def __init__( FILE: src/transformers/models/qwen3_5_moe/configuration_qwen3_5_moe.py class Qwen3_5MoeTextConfig (line 29) | class Qwen3_5MoeTextConfig(PreTrainedConfig): method __post_init__ (line 112) | def __post_init__(self, **kwargs): class Qwen3_5MoeVisionConfig (line 126) | class Qwen3_5MoeVisionConfig(PreTrainedConfig): class Qwen3_5MoeConfig (line 153) | class Qwen3_5MoeConfig(PreTrainedConfig): method __post_init__ (line 183) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen3_5_moe/modeling_qwen3_5_moe.py class Qwen3_5MoeVisionRotaryEmbedding (line 70) | class Qwen3_5MoeVisionRotaryEmbedding(nn.Module): method __init__ (line 73) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 80) | def forward(self, seqlen: int) -> torch.Tensor: class Qwen3_5MoeTextRotaryEmbedding (line 86) | class Qwen3_5MoeTextRotaryEmbedding(nn.Module): method __init__ (line 89) | def __init__(self, config: Qwen3_5MoeTextConfig, device=None): method compute_default_rope_parameters (line 107) | def compute_default_rope_parameters( method forward (line 140) | def forward(self, x, position_ids): method apply_interleaved_mrope (line 158) | def apply_interleaved_mrope(self, freqs, mrope_section): class Qwen3_5MoeRMSNormGated (line 176) | class Qwen3_5MoeRMSNormGated(nn.Module): method __init__ (line 177) | def __init__(self, hidden_size, eps=1e-6, **kwargs): method forward (line 182) | def forward(self, hidden_states, gate=None): function apply_mask_to_padding_states (line 194) | def apply_mask_to_padding_states(hidden_states, attention_mask): function torch_causal_conv1d_update (line 211) | def torch_causal_conv1d_update( function l2norm (line 229) | def l2norm(x: torch.FloatTensor, dim: int = -1, eps: float = 1e-6): function torch_chunk_gated_delta_rule (line 235) | def torch_chunk_gated_delta_rule( function torch_recurrent_gated_delta_rule (line 315) | def torch_recurrent_gated_delta_rule( class Qwen3_5MoeGatedDeltaNet (line 357) | class Qwen3_5MoeGatedDeltaNet(nn.Module): method __init__ (line 358) | def __init__(self, config: Qwen3_5MoeConfig, layer_idx: int): method forward (line 423) | def forward( function rotate_half (line 537) | def rotate_half(x): function apply_rotary_pos_emb (line 545) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 583) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 595) | def eager_attention_forward( class Qwen3_5MoeAttention (line 621) | class Qwen3_5MoeAttention(nn.Module): method __init__ (line 624) | def __init__(self, config: Qwen3_5MoeConfig, layer_idx: int): method forward (line 650) | def forward( class Qwen3_5MoeMLP (line 698) | class Qwen3_5MoeMLP(nn.Module): method __init__ (line 699) | def __init__(self, config: Qwen3_5MoeConfig, intermediate_size: int): method forward (line 709) | def forward(self, x): class Qwen3_5MoeExperts (line 715) | class Qwen3_5MoeExperts(nn.Module): method __init__ (line 718) | def __init__(self, config): method forward (line 727) | def forward( class Qwen3_5MoeTopKRouter (line 754) | class Qwen3_5MoeTopKRouter(nn.Module): method __init__ (line 755) | def __init__(self, config): method forward (line 762) | def forward(self, hidden_states): class Qwen3_5MoeSparseMoeBlock (line 773) | class Qwen3_5MoeSparseMoeBlock(nn.Module): method __init__ (line 774) | def __init__(self, config): method forward (line 781) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen3_5MoeRMSNorm (line 795) | class Qwen3_5MoeRMSNorm(nn.Module): method __init__ (line 796) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 801) | def _norm(self, x): method forward (line 804) | def forward(self, x): method extra_repr (line 811) | def extra_repr(self): class Qwen3_5MoeDecoderLayer (line 815) | class Qwen3_5MoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 816) | def __init__(self, config: Qwen3_5MoeTextConfig, layer_idx: int): method forward (line 828) | def forward( class Qwen3_5MoePreTrainedModel (line 873) | class Qwen3_5MoePreTrainedModel(PreTrainedModel): method _init_weights (line 890) | def _init_weights(self, module): class Qwen3_5MoeVisionMLP (line 908) | class Qwen3_5MoeVisionMLP(nn.Module): method __init__ (line 909) | def __init__(self, config): method forward (line 917) | def forward(self, hidden_state): class Qwen3_5MoeVisionPatchEmbed (line 921) | class Qwen3_5MoeVisionPatchEmbed(nn.Module): method __init__ (line 922) | def __init__(self, config) -> None: method forward (line 932) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Qwen3_5MoeVisionPatchMerger (line 941) | class Qwen3_5MoeVisionPatchMerger(nn.Module): method __init__ (line 942) | def __init__(self, config: Qwen3_5MoeVisionConfig, use_postshuffle_nor... method forward (line 951) | def forward(self, x: torch.Tensor) -> torch.Tensor: function apply_rotary_pos_emb_vision (line 957) | def apply_rotary_pos_emb_vision( class Qwen3_5MoeVisionAttention (line 971) | class Qwen3_5MoeVisionAttention(nn.Module): method __init__ (line 972) | def __init__(self, config: Qwen3_5MoeVisionConfig) -> None: method forward (line 985) | def forward( class Qwen3_5MoeVisionBlock (line 1054) | class Qwen3_5MoeVisionBlock(GradientCheckpointingLayer): method __init__ (line 1055) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 1063) | def forward( class Qwen3_5MoeVisionModel (line 1088) | class Qwen3_5MoeVisionModel(Qwen3_5MoePreTrainedModel): method __init__ (line 1097) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 1123) | def rot_pos_emb(self, grid_thw: torch.Tensor) -> torch.Tensor: method fast_pos_embed_interpolate (line 1163) | def fast_pos_embed_interpolate(self, grid_thw): method forward (line 1228) | def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor,... class Qwen3_5MoeModelOutputWithPast (line 1284) | class Qwen3_5MoeModelOutputWithPast(ModelOutput): class Qwen3_5MoeCausalLMOutputWithPast (line 1309) | class Qwen3_5MoeCausalLMOutputWithPast(ModelOutput): class Qwen3_5MoeTextModel (line 1334) | class Qwen3_5MoeTextModel(Qwen3_5MoePreTrainedModel): method __init__ (line 1337) | def __init__(self, config: Qwen3_5MoeTextConfig): method forward (line 1352) | def forward( method _update_linear_attn_mask (line 1417) | def _update_linear_attn_mask(self, attention_mask, past_key_values): class Qwen3_5MoeModel (line 1433) | class Qwen3_5MoeModel(Qwen3_5MoePreTrainedModel): method __init__ (line 1440) | def __init__(self, config): method get_input_embeddings (line 1449) | def get_input_embeddings(self): method set_input_embeddings (line 1452) | def set_input_embeddings(self, value): method get_vision_position_ids (line 1455) | def get_vision_position_ids( method get_rope_index (line 1511) | def get_rope_index( method get_video_features (line 1606) | def get_video_features( method get_image_features (line 1623) | def get_image_features( method get_placeholder_mask (line 1646) | def get_placeholder_mask( method compute_3d_position_ids (line 1687) | def compute_3d_position_ids( method forward (line 1738) | def forward( function load_balancing_loss_func (line 1812) | def load_balancing_loss_func( class Qwen3_5MoeForCausalLM (line 1895) | class Qwen3_5MoeForCausalLM(Qwen3_5MoePreTrainedModel, GenerationMixin): method __init__ (line 1902) | def __init__(self, config): method forward (line 1916) | def forward( class Qwen3_5MoeForConditionalGeneration (line 1999) | class Qwen3_5MoeForConditionalGeneration(Qwen3_5MoePreTrainedModel, Gene... method __init__ (line 2005) | def __init__(self, config): method get_input_embeddings (line 2012) | def get_input_embeddings(self): method set_input_embeddings (line 2015) | def set_input_embeddings(self, value): method get_video_features (line 2019) | def get_video_features( method get_image_features (line 2036) | def get_image_features( method forward (line 2051) | def forward( method prepare_inputs_for_generation (line 2166) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 2204) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 2242) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 2293) | def _expand_inputs_for_generation( FILE: src/transformers/models/qwen3_5_moe/modular_qwen3_5_moe.py class Qwen3_5MoeTextConfig (line 58) | class Qwen3_5MoeTextConfig(Qwen3NextConfig): method __post_init__ (line 114) | def __post_init__(self, **kwargs): class Qwen3_5MoeVisionConfig (line 121) | class Qwen3_5MoeVisionConfig(Qwen3_5VisionConfig): class Qwen3_5MoeConfig (line 127) | class Qwen3_5MoeConfig(Qwen3VLConfig): class Qwen3_5MoeVisionRotaryEmbedding (line 150) | class Qwen3_5MoeVisionRotaryEmbedding(Qwen3_5VisionRotaryEmbedding): class Qwen3_5MoeTextRotaryEmbedding (line 154) | class Qwen3_5MoeTextRotaryEmbedding(Qwen3_5TextRotaryEmbedding): class Qwen3_5MoeGatedDeltaNet (line 158) | class Qwen3_5MoeGatedDeltaNet(Qwen3_5GatedDeltaNet): class Qwen3_5MoeAttention (line 162) | class Qwen3_5MoeAttention(Qwen3NextAttention): class Qwen3_5MoeMLP (line 166) | class Qwen3_5MoeMLP(Qwen3_5MLP): class Qwen3_5MoeExperts (line 170) | class Qwen3_5MoeExperts(Qwen3NextExperts): class Qwen3_5MoeTopKRouter (line 174) | class Qwen3_5MoeTopKRouter(Qwen3VLMoeTextTopKRouter): class Qwen3_5MoeSparseMoeBlock (line 178) | class Qwen3_5MoeSparseMoeBlock(Qwen3NextSparseMoeBlock): class Qwen3_5MoeRMSNorm (line 182) | class Qwen3_5MoeRMSNorm(Qwen3NextRMSNorm): class Qwen3_5MoeDecoderLayer (line 186) | class Qwen3_5MoeDecoderLayer(Qwen3NextDecoderLayer): method __init__ (line 187) | def __init__(self, config: Qwen3_5MoeTextConfig, layer_idx: int): class Qwen3_5MoePreTrainedModel (line 200) | class Qwen3_5MoePreTrainedModel(Qwen3NextPreTrainedModel): method _init_weights (line 203) | def _init_weights(self, module): class Qwen3_5MoeVisionModel (line 221) | class Qwen3_5MoeVisionModel(Qwen3_5VisionModel): class Qwen3_5MoeModelOutputWithPast (line 225) | class Qwen3_5MoeModelOutputWithPast(Qwen3VLMoeModelOutputWithPast): class Qwen3_5MoeCausalLMOutputWithPast (line 229) | class Qwen3_5MoeCausalLMOutputWithPast(Qwen3VLMoeCausalLMOutputWithPast): class Qwen3_5MoeTextModel (line 233) | class Qwen3_5MoeTextModel(Qwen3_5TextModel): class Qwen3_5MoeModel (line 237) | class Qwen3_5MoeModel(Qwen3_5Model): class Qwen3_5MoeForCausalLM (line 241) | class Qwen3_5MoeForCausalLM(Qwen3NextForCausalLM): method __init__ (line 245) | def __init__(self, config): class Qwen3_5MoeForConditionalGeneration (line 250) | class Qwen3_5MoeForConditionalGeneration(Qwen3VLMoeForConditionalGenerat... method forward (line 251) | def forward(self, **super_kwargs): method get_video_features (line 304) | def get_video_features( method get_image_features (line 310) | def get_image_features( FILE: src/transformers/models/qwen3_moe/configuration_qwen3_moe.py class Qwen3MoeConfig (line 25) | class Qwen3MoeConfig(PreTrainedConfig): method __post_init__ (line 105) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen3_moe/modeling_qwen3_moe.py function rotate_half (line 56) | def rotate_half(x): function apply_rotary_pos_emb (line 64) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 89) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 101) | def eager_attention_forward( class Qwen3MoeAttention (line 127) | class Qwen3MoeAttention(nn.Module): method __init__ (line 130) | def __init__(self, config: Qwen3MoeConfig, layer_idx: int): method forward (line 156) | def forward( class Qwen3MoeMLP (line 198) | class Qwen3MoeMLP(nn.Module): method __init__ (line 199) | def __init__(self, config, intermediate_size=None): method forward (line 209) | def forward(self, x): class Qwen3MoeExperts (line 215) | class Qwen3MoeExperts(nn.Module): method __init__ (line 218) | def __init__(self, config): method forward (line 227) | def forward( class Qwen3MoeTopKRouter (line 254) | class Qwen3MoeTopKRouter(nn.Module): method __init__ (line 255) | def __init__(self, config): method forward (line 263) | def forward(self, hidden_states): class Qwen3MoeSparseMoeBlock (line 275) | class Qwen3MoeSparseMoeBlock(nn.Module): method __init__ (line 276) | def __init__(self, config: Qwen3MoeConfig): method forward (line 281) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen3MoeRMSNorm (line 290) | class Qwen3MoeRMSNorm(nn.Module): method __init__ (line 291) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 299) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 306) | def extra_repr(self): class Qwen3MoeDecoderLayer (line 310) | class Qwen3MoeDecoderLayer(GradientCheckpointingLayer): method __init__ (line 311) | def __init__(self, config: Qwen3MoeConfig, layer_idx: int): method forward (line 324) | def forward( class Qwen3MoePreTrainedModel (line 357) | class Qwen3MoePreTrainedModel(PreTrainedModel): method _init_weights (line 376) | def _init_weights(self, module): class Qwen3MoeRotaryEmbedding (line 386) | class Qwen3MoeRotaryEmbedding(nn.Module): method __init__ (line 389) | def __init__(self, config: Qwen3MoeConfig, device=None): method compute_default_rope_parameters (line 406) | def compute_default_rope_parameters( method forward (line 437) | def forward(self, x, position_ids): class Qwen3MoeModel (line 452) | class Qwen3MoeModel(Qwen3MoePreTrainedModel): method __init__ (line 453) | def __init__(self, config: Qwen3MoeConfig): method forward (line 472) | def forward( function load_balancing_loss_func (line 527) | def load_balancing_loss_func( class Qwen3MoeForCausalLM (line 610) | class Qwen3MoeForCausalLM(Qwen3MoePreTrainedModel, GenerationMixin): method __init__ (line 615) | def __init__(self, config): method forward (line 629) | def forward( class Qwen3MoeForSequenceClassification (line 712) | class Qwen3MoeForSequenceClassification(GenericForSequenceClassification... class Qwen3MoeForTokenClassification (line 716) | class Qwen3MoeForTokenClassification(GenericForTokenClassification, Qwen... class Qwen3MoeForQuestionAnswering (line 720) | class Qwen3MoeForQuestionAnswering(GenericForQuestionAnswering, Qwen3Moe... FILE: src/transformers/models/qwen3_moe/modular_qwen3_moe.py class Qwen3MoeAttention (line 44) | class Qwen3MoeAttention(Qwen3Attention): # This is the main diff with q... method __init__ (line 45) | def __init__(self, config: Qwen3MoeConfig, layer_idx: int): class Qwen3MoeMLP (line 51) | class Qwen3MoeMLP(Qwen2MoeMLP): class Qwen3MoeExperts (line 55) | class Qwen3MoeExperts(Qwen2MoeExperts): class Qwen3MoeTopKRouter (line 59) | class Qwen3MoeTopKRouter(Qwen2MoeTopKRouter): class Qwen3MoeSparseMoeBlock (line 63) | class Qwen3MoeSparseMoeBlock(nn.Module): method __init__ (line 64) | def __init__(self, config: Qwen3MoeConfig): method forward (line 69) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen3MoeRMSNorm (line 77) | class Qwen3MoeRMSNorm(LlamaRMSNorm): class Qwen3MoeDecoderLayer (line 81) | class Qwen3MoeDecoderLayer(Qwen2MoeDecoderLayer): class Qwen3MoePreTrainedModel (line 85) | class Qwen3MoePreTrainedModel(MixtralPreTrainedModel): class Qwen3MoeModel (line 93) | class Qwen3MoeModel(MixtralModel): class Qwen3MoeForCausalLM (line 97) | class Qwen3MoeForCausalLM(MixtralForCausalLM): method __init__ (line 98) | def __init__(self, config): method forward (line 103) | def forward( class Qwen3MoeForSequenceClassification (line 186) | class Qwen3MoeForSequenceClassification(LlamaForSequenceClassification): class Qwen3MoeForTokenClassification (line 190) | class Qwen3MoeForTokenClassification(LlamaForTokenClassification): class Qwen3MoeForQuestionAnswering (line 194) | class Qwen3MoeForQuestionAnswering(LlamaForQuestionAnswering): FILE: src/transformers/models/qwen3_next/configuration_qwen3_next.py class Qwen3NextConfig (line 25) | class Qwen3NextConfig(PreTrainedConfig): method __post_init__ (line 119) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen3_next/modeling_qwen3_next.py class Qwen3NextRMSNormGated (line 67) | class Qwen3NextRMSNormGated(nn.Module): method __init__ (line 68) | def __init__(self, hidden_size, eps=1e-6, **kwargs): method forward (line 73) | def forward(self, hidden_states, gate=None): class Qwen3NextRotaryEmbedding (line 85) | class Qwen3NextRotaryEmbedding(nn.Module): method __init__ (line 88) | def __init__(self, config: Qwen3NextConfig, device=None): method compute_default_rope_parameters (line 105) | def compute_default_rope_parameters( method forward (line 138) | def forward(self, x, position_ids): class Qwen3NextRMSNorm (line 152) | class Qwen3NextRMSNorm(nn.Module): method __init__ (line 153) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 158) | def _norm(self, x): method forward (line 161) | def forward(self, x): method extra_repr (line 168) | def extra_repr(self): function rotate_half (line 172) | def rotate_half(x): function apply_rotary_pos_emb (line 180) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 218) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 230) | def eager_attention_forward( class Qwen3NextAttention (line 256) | class Qwen3NextAttention(nn.Module): method __init__ (line 259) | def __init__(self, config: Qwen3NextConfig, layer_idx: int): method forward (line 285) | def forward( function apply_mask_to_padding_states (line 333) | def apply_mask_to_padding_states(hidden_states, attention_mask): function torch_causal_conv1d_update (line 350) | def torch_causal_conv1d_update( function l2norm (line 368) | def l2norm(x: torch.FloatTensor, dim: int = -1, eps: float = 1e-6): function torch_chunk_gated_delta_rule (line 374) | def torch_chunk_gated_delta_rule( function torch_recurrent_gated_delta_rule (line 454) | def torch_recurrent_gated_delta_rule( class Qwen3NextGatedDeltaNet (line 496) | class Qwen3NextGatedDeltaNet(nn.Module): method __init__ (line 497) | def __init__(self, config: Qwen3NextConfig, layer_idx: int): method fix_query_key_value_ordering (line 563) | def fix_query_key_value_ordering(self, mixed_qkvz, mixed_ba): method forward (line 592) | def forward( class Qwen3NextMLP (line 705) | class Qwen3NextMLP(nn.Module): method __init__ (line 706) | def __init__(self, config, intermediate_size=None): method forward (line 716) | def forward(self, x): class Qwen3NextExperts (line 722) | class Qwen3NextExperts(nn.Module): method __init__ (line 725) | def __init__(self, config): method forward (line 734) | def forward( class Qwen3NextTopKRouter (line 761) | class Qwen3NextTopKRouter(nn.Module): method __init__ (line 762) | def __init__(self, config): method forward (line 770) | def forward(self, hidden_states): class Qwen3NextSparseMoeBlock (line 782) | class Qwen3NextSparseMoeBlock(nn.Module): method __init__ (line 783) | def __init__(self, config): method forward (line 790) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen3NextDecoderLayer (line 804) | class Qwen3NextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 805) | def __init__(self, config: Qwen3NextConfig, layer_idx: int): method forward (line 826) | def forward( class Qwen3NextPreTrainedModel (line 871) | class Qwen3NextPreTrainedModel(PreTrainedModel): method _init_weights (line 888) | def _init_weights(self, module): class Qwen3NextModel (line 903) | class Qwen3NextModel(Qwen3NextPreTrainedModel): method __init__ (line 904) | def __init__(self, config: Qwen3NextConfig): method forward (line 919) | def forward( method _update_linear_attn_mask (line 975) | def _update_linear_attn_mask(self, attention_mask, past_key_values): function load_balancing_loss_func (line 990) | def load_balancing_loss_func( class Qwen3NextForCausalLM (line 1073) | class Qwen3NextForCausalLM(Qwen3NextPreTrainedModel, GenerationMixin): method __init__ (line 1078) | def __init__(self, config): method forward (line 1092) | def forward( class Qwen3NextForSequenceClassification (line 1175) | class Qwen3NextForSequenceClassification(GenericForSequenceClassificatio... class Qwen3NextForTokenClassification (line 1179) | class Qwen3NextForTokenClassification(GenericForTokenClassification, Qwe... class Qwen3NextForQuestionAnswering (line 1183) | class Qwen3NextForQuestionAnswering(GenericForQuestionAnswering, Qwen3Ne... FILE: src/transformers/models/qwen3_next/modular_qwen3_next.py class Qwen3NextRMSNormGated (line 77) | class Qwen3NextRMSNormGated(nn.Module): method __init__ (line 78) | def __init__(self, hidden_size, eps=1e-6, **kwargs): method forward (line 83) | def forward(self, hidden_states, gate=None): class Qwen3NextRotaryEmbedding (line 95) | class Qwen3NextRotaryEmbedding(Gemma2RotaryEmbedding): method compute_default_rope_parameters (line 97) | def compute_default_rope_parameters( class Qwen3NextRMSNorm (line 129) | class Qwen3NextRMSNorm(Gemma3RMSNorm): class Qwen3NextAttention (line 133) | class Qwen3NextAttention(Qwen3MoeAttention): method __init__ (line 134) | def __init__(self, config: Qwen3NextConfig, layer_idx: int): method forward (line 141) | def forward( function torch_causal_conv1d_update (line 189) | def torch_causal_conv1d_update( function l2norm (line 207) | def l2norm(x: torch.FloatTensor, dim: int = -1, eps: float = 1e-6): function torch_chunk_gated_delta_rule (line 213) | def torch_chunk_gated_delta_rule( function torch_recurrent_gated_delta_rule (line 293) | def torch_recurrent_gated_delta_rule( class Qwen3NextGatedDeltaNet (line 335) | class Qwen3NextGatedDeltaNet(nn.Module): method __init__ (line 336) | def __init__(self, config: Qwen3NextConfig, layer_idx: int): method fix_query_key_value_ordering (line 402) | def fix_query_key_value_ordering(self, mixed_qkvz, mixed_ba): method forward (line 431) | def forward( class Qwen3NextMLP (line 544) | class Qwen3NextMLP(Qwen3MoeMLP): class Qwen3NextExperts (line 548) | class Qwen3NextExperts(Qwen2MoeExperts): class Qwen3NextTopKRouter (line 552) | class Qwen3NextTopKRouter(Qwen2MoeTopKRouter): class Qwen3NextSparseMoeBlock (line 556) | class Qwen3NextSparseMoeBlock(Qwen2MoeSparseMoeBlock): class Qwen3NextDecoderLayer (line 560) | class Qwen3NextDecoderLayer(Qwen3MoeDecoderLayer): method __init__ (line 561) | def __init__(self, config: Qwen3NextConfig, layer_idx: int): method forward (line 582) | def forward( class Qwen3NextPreTrainedModel (line 627) | class Qwen3NextPreTrainedModel(PreTrainedModel): method _init_weights (line 644) | def _init_weights(self, module): class Qwen3NextModel (line 659) | class Qwen3NextModel(Qwen3NextPreTrainedModel): method __init__ (line 660) | def __init__(self, config: Qwen3NextConfig): method forward (line 675) | def forward( method _update_linear_attn_mask (line 731) | def _update_linear_attn_mask(self, attention_mask, past_key_values): class Qwen3NextForCausalLM (line 746) | class Qwen3NextForCausalLM(MixtralForCausalLM): method __init__ (line 747) | def __init__(self, config): method forward (line 751) | def forward( class Qwen3NextForSequenceClassification (line 800) | class Qwen3NextForSequenceClassification(LlamaForSequenceClassification): class Qwen3NextForTokenClassification (line 804) | class Qwen3NextForTokenClassification(LlamaForTokenClassification): class Qwen3NextForQuestionAnswering (line 808) | class Qwen3NextForQuestionAnswering(LlamaForQuestionAnswering): FILE: src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py class Qwen3OmniMoeAudioEncoderConfig (line 33) | class Qwen3OmniMoeAudioEncoderConfig(PreTrainedConfig): class Qwen3OmniMoeVisionEncoderConfig (line 75) | class Qwen3OmniMoeVisionEncoderConfig(PreTrainedConfig): class Qwen3OmniMoeTextConfig (line 105) | class Qwen3OmniMoeTextConfig(PreTrainedConfig): method __post_init__ (line 177) | def __post_init__(self, **kwargs): class Qwen3OmniMoeThinkerConfig (line 185) | class Qwen3OmniMoeThinkerConfig(PreTrainedConfig): method __post_init__ (line 231) | def __post_init__(self, **kwargs): class Qwen3OmniMoeTalkerCodePredictorConfig (line 252) | class Qwen3OmniMoeTalkerCodePredictorConfig(PreTrainedConfig): method __post_init__ (line 303) | def __post_init__(self, **kwargs): class Qwen3OmniMoeTalkerTextConfig (line 320) | class Qwen3OmniMoeTalkerTextConfig(PreTrainedConfig): method __post_init__ (line 398) | def __post_init__(self, **kwargs): class Qwen3OmniMoeTalkerConfig (line 406) | class Qwen3OmniMoeTalkerConfig(PreTrainedConfig): method __post_init__ (line 481) | def __post_init__(self, **kwargs): class Qwen3OmniMoeCode2WavConfig (line 500) | class Qwen3OmniMoeCode2WavConfig(PreTrainedConfig): method layer_types (line 547) | def layer_types(self): class Qwen3OmniMoeConfig (line 556) | class Qwen3OmniMoeConfig(PreTrainedConfig): method __post_init__ (line 625) | def __post_init__(self, **kwargs): method get_text_config (line 649) | def get_text_config(self, decoder=False) -> "PreTrainedConfig": FILE: src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py class BaseModelOutputWithDeepstackFeatures (line 79) | class BaseModelOutputWithDeepstackFeatures(BaseModelOutputWithPooling): class SinusoidsPositionEmbedding (line 88) | class SinusoidsPositionEmbedding(nn.Module): method __init__ (line 89) | def __init__(self, length, channels, max_timescale=10000): method forward (line 105) | def forward(self, seqlen: int): class Qwen3OmniMoePreTrainedModel (line 110) | class Qwen3OmniMoePreTrainedModel(PreTrainedModel): method _init_weights (line 123) | def _init_weights(self, module): function _get_feat_extract_output_lengths (line 145) | def _get_feat_extract_output_lengths(input_lengths): class Qwen3OmniMoePreTrainedModelForConditionalGeneration (line 156) | class Qwen3OmniMoePreTrainedModelForConditionalGeneration(Qwen3OmniMoePr... method get_llm_pos_ids_for_vision (line 159) | def get_llm_pos_ids_for_vision( method get_chunked_index (line 179) | def get_chunked_index( method get_rope_index (line 216) | def get_rope_index( function repeat_kv (line 459) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 471) | def eager_attention_forward( class Qwen3OmniMoeAudioAttention (line 496) | class Qwen3OmniMoeAudioAttention(nn.Module): method __init__ (line 499) | def __init__(self, config): method forward (line 522) | def forward( class Qwen3OmniMoeAudioEncoderLayer (line 568) | class Qwen3OmniMoeAudioEncoderLayer(GradientCheckpointingLayer): method __init__ (line 569) | def __init__(self, config: Qwen3OmniMoeAudioEncoderConfig): method forward (line 581) | def forward( class Qwen3OmniMoeAudioEncoder (line 625) | class Qwen3OmniMoeAudioEncoder(Qwen3OmniMoePreTrainedModel): method __init__ (line 636) | def __init__(self, config: Qwen3OmniMoeAudioEncoderConfig): method _freeze_parameters (line 665) | def _freeze_parameters(self): method get_input_embeddings (line 670) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 673) | def set_input_embeddings(self, value): method _prepare_attention_mask (line 676) | def _prepare_attention_mask(self, inputs_tensor: torch.Tensor, cu_seql... method forward (line 698) | def forward( method padded_and_mask_function (line 768) | def padded_and_mask_function(self, tensor_list, tensor_len, padding_va... method _get_feat_extract_output_lengths (line 807) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... function rotate_half (line 816) | def rotate_half(x): function apply_rotary_pos_emb_vision (line 823) | def apply_rotary_pos_emb_vision( class Qwen3OmniMoeVisionAttention (line 837) | class Qwen3OmniMoeVisionAttention(nn.Module): method __init__ (line 838) | def __init__(self, config: Qwen3OmniMoeVisionEncoderConfig) -> None: method forward (line 851) | def forward( class Qwen3OmniMoeVisionPatchMerger (line 920) | class Qwen3OmniMoeVisionPatchMerger(nn.Module): method __init__ (line 921) | def __init__(self, config: Qwen3OmniMoeVisionEncoderConfig, use_postsh... method forward (line 934) | def forward(self, hidden: torch.Tensor) -> torch.Tensor: class Qwen3OmniMoeVisionRotaryEmbedding (line 943) | class Qwen3OmniMoeVisionRotaryEmbedding(nn.Module): method __init__ (line 946) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 953) | def forward(self, seqlen: int) -> torch.Tensor: class Qwen3OmniMoeTextTopKRouter (line 959) | class Qwen3OmniMoeTextTopKRouter(nn.Module): method __init__ (line 960) | def __init__(self, config): method forward (line 967) | def forward(self, hidden_states): class Qwen3OmniMoeVisionMLP (line 978) | class Qwen3OmniMoeVisionMLP(nn.Module): method __init__ (line 979) | def __init__(self, config): method forward (line 987) | def forward(self, hidden_state): class Qwen3OmniMoeVisionBlock (line 991) | class Qwen3OmniMoeVisionBlock(GradientCheckpointingLayer): method __init__ (line 992) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 1000) | def forward( class Qwen3OmniMoeVisionPatchEmbed (line 1025) | class Qwen3OmniMoeVisionPatchEmbed(nn.Module): method __init__ (line 1026) | def __init__(self, config) -> None: method forward (line 1036) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Qwen3OmniMoeVisionEncoder (line 1045) | class Qwen3OmniMoeVisionEncoder(Qwen3OmniMoePreTrainedModel): method __init__ (line 1055) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 1092) | def rot_pos_emb(self, grid_thw: torch.Tensor) -> torch.Tensor: method fast_pos_embed_interpolate (line 1132) | def fast_pos_embed_interpolate(self, grid_thw): method forward (line 1197) | def forward( method deepstack_merger_list (line 1256) | def deepstack_merger_list(self): class Qwen3OmniMoeThinkerTextRotaryEmbedding (line 1260) | class Qwen3OmniMoeThinkerTextRotaryEmbedding(nn.Module): method __init__ (line 1263) | def __init__(self, config: Qwen3OmniMoeTextConfig, device=None): method compute_default_rope_parameters (line 1282) | def compute_default_rope_parameters( method forward (line 1313) | def forward(self, x, position_ids): method apply_interleaved_mrope (line 1331) | def apply_interleaved_mrope(self, freqs, mrope_section): class Qwen3OmniMoeThinkerTextExperts (line 1350) | class Qwen3OmniMoeThinkerTextExperts(nn.Module): method __init__ (line 1355) | def __init__(self, config: Qwen3OmniMoeThinkerConfig): method forward (line 1364) | def forward( class Qwen3OmniMoeThinkerTextTopKRouter (line 1391) | class Qwen3OmniMoeThinkerTextTopKRouter(nn.Module): method __init__ (line 1392) | def __init__(self, config): method forward (line 1400) | def forward(self, hidden_states): class Qwen3OmniMoeThinkerTextSparseMoeBlock (line 1412) | class Qwen3OmniMoeThinkerTextSparseMoeBlock(nn.Module): method __init__ (line 1413) | def __init__(self, config: Qwen3OmniMoeThinkerConfig): method forward (line 1418) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen3OmniMoeThinkerTextRMSNorm (line 1427) | class Qwen3OmniMoeThinkerTextRMSNorm(nn.Module): method __init__ (line 1428) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 1436) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 1443) | def extra_repr(self): function apply_rotary_pos_emb (line 1448) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Qwen3OmniMoeThinkerTextAttention (line 1474) | class Qwen3OmniMoeThinkerTextAttention(nn.Module): method __init__ (line 1477) | def __init__(self, config, layer_idx): method forward (line 1507) | def forward( class Qwen3OmniMoeThinkerTextMLP (line 1549) | class Qwen3OmniMoeThinkerTextMLP(nn.Module): method __init__ (line 1550) | def __init__(self, config, intermediate_size=None): method forward (line 1560) | def forward(self, x): class Qwen3OmniMoeThinkerTextDecoderLayer (line 1565) | class Qwen3OmniMoeThinkerTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1566) | def __init__(self, config, layer_idx): method forward (line 1579) | def forward( class Qwen3OmniMoeThinkerTextPreTrainedModel (line 1612) | class Qwen3OmniMoeThinkerTextPreTrainedModel(PreTrainedModel): method _init_weights (line 1632) | def _init_weights(self, module): class Qwen3OmniMoeTextRMSNorm (line 1643) | class Qwen3OmniMoeTextRMSNorm(nn.Module): method __init__ (line 1644) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 1652) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 1659) | def extra_repr(self): class Qwen3OmniMoeThinkerTextModel (line 1669) | class Qwen3OmniMoeThinkerTextModel(Qwen3OmniMoePreTrainedModel): method __init__ (line 1680) | def __init__(self, config: Qwen3OmniMoeTextConfig): method forward (line 1699) | def forward( method _deepstack_process (line 1784) | def _deepstack_process( class Qwen3OmniMoeThinkerCausalLMOutputWithPast (line 1796) | class Qwen3OmniMoeThinkerCausalLMOutputWithPast(MoeCausalLMOutputWithPast): function load_balancing_loss_func (line 1806) | def load_balancing_loss_func( class Qwen3OmniMoeThinkerForConditionalGeneration (line 1893) | class Qwen3OmniMoeThinkerForConditionalGeneration( method __init__ (line 1906) | def __init__(self, config): method get_input_embeddings (line 1920) | def get_input_embeddings(self): method set_input_embeddings (line 1923) | def set_input_embeddings(self, value): method get_video_features (line 1928) | def get_video_features( method get_image_features (line 1945) | def get_image_features( method get_audio_features (line 1962) | def get_audio_features( method get_placeholder_mask (line 1993) | def get_placeholder_mask( method forward (line 2045) | def forward( method prepare_inputs_for_generation (line 2261) | def prepare_inputs_for_generation( class Qwen3OmniMoeTalkerResizeMLP (line 2309) | class Qwen3OmniMoeTalkerResizeMLP(nn.Module): method __init__ (line 2310) | def __init__(self, config: Qwen3OmniMoeTalkerConfig): method forward (line 2316) | def forward(self, hidden_state): class Qwen3OmniMoeTalkerCodePredictorOutputWithPast (line 2321) | class Qwen3OmniMoeTalkerCodePredictorOutputWithPast(CausalLMOutputWithPa... class Qwen3OmniMoeRMSNorm (line 2331) | class Qwen3OmniMoeRMSNorm(nn.Module): method __init__ (line 2332) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 2340) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 2347) | def extra_repr(self): class Qwen3OmniMoeTalkerCodePredictorAttention (line 2352) | class Qwen3OmniMoeTalkerCodePredictorAttention(nn.Module): method __init__ (line 2355) | def __init__(self, config: Qwen3OmniMoeConfig, layer_idx: int): method forward (line 2384) | def forward( class Qwen3OmniMoeMLP (line 2426) | class Qwen3OmniMoeMLP(nn.Module): method __init__ (line 2427) | def __init__(self, config): method forward (line 2437) | def forward(self, x): class Qwen3OmniMoeTalkerCodePredictorDecoderLayer (line 2442) | class Qwen3OmniMoeTalkerCodePredictorDecoderLayer(GradientCheckpointingL... method __init__ (line 2443) | def __init__(self, config, layer_idx): method forward (line 2452) | def forward( class Qwen3OmniMoeRotaryEmbedding (line 2484) | class Qwen3OmniMoeRotaryEmbedding(nn.Module): method __init__ (line 2487) | def __init__(self, config: Qwen3OmniMoeConfig, device=None): method compute_default_rope_parameters (line 2504) | def compute_default_rope_parameters( method forward (line 2535) | def forward(self, x, position_ids): class Qwen3OmniMoeTalkerCodePredictorModel (line 2550) | class Qwen3OmniMoeTalkerCodePredictorModel(Qwen3OmniMoePreTrainedModel): method __init__ (line 2558) | def __init__(self, config: Qwen3OmniMoeTalkerCodePredictorConfig): method forward (line 2582) | def forward( method get_input_embeddings (line 2640) | def get_input_embeddings(self): class Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration (line 2645) | class Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration(Qwen3... method __init__ (line 2656) | def __init__(self, config: Qwen3OmniMoeTalkerCodePredictorConfig): method forward (line 2669) | def forward( method get_input_embeddings (line 2720) | def get_input_embeddings(self): method _update_model_kwargs_for_generation (line 2723) | def _update_model_kwargs_for_generation(self, outputs, model_kwargs, i... class Qwen3OmniMoeTalkerOutputWithPast (line 2732) | class Qwen3OmniMoeTalkerOutputWithPast(MoeCausalLMOutputWithPast): class Qwen3OmniMoeTalkerRotaryEmbedding (line 2741) | class Qwen3OmniMoeTalkerRotaryEmbedding(Qwen3OmniMoeThinkerTextRotaryEmb... class Qwen3OmniMoeTalkerTextMLP (line 2745) | class Qwen3OmniMoeTalkerTextMLP(nn.Module): method __init__ (line 2746) | def __init__(self, config, intermediate_size=None): method forward (line 2756) | def forward(self, x): class Qwen3OmniMoeTalkerTextTopKRouter (line 2761) | class Qwen3OmniMoeTalkerTextTopKRouter(nn.Module): method __init__ (line 2762) | def __init__(self, config): method forward (line 2770) | def forward(self, hidden_states): class Qwen3OmniMoeTalkerTextExperts (line 2783) | class Qwen3OmniMoeTalkerTextExperts(nn.Module): method __init__ (line 2786) | def __init__(self, config): method forward (line 2795) | def forward( class Qwen3OmniMoeTalkerTextSparseMoeBlock (line 2822) | class Qwen3OmniMoeTalkerTextSparseMoeBlock(nn.Module): method __init__ (line 2823) | def __init__(self, config): method forward (line 2832) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class Qwen3OmniMoeTalkerDecoderLayer (line 2846) | class Qwen3OmniMoeTalkerDecoderLayer(GradientCheckpointingLayer): method __init__ (line 2847) | def __init__(self, config, layer_idx): method forward (line 2861) | def forward( class Qwen3OmniMoeTalkerModel (line 2899) | class Qwen3OmniMoeTalkerModel(Qwen3OmniMoePreTrainedModel): method __init__ (line 2911) | def __init__(self, config: Qwen3OmniMoeTalkerTextConfig): method forward (line 2929) | def forward( method _deepstack_process (line 3014) | def _deepstack_process( method get_input_embeddings (line 3024) | def get_input_embeddings(self): class Qwen3OmniMoeTalkerForConditionalGeneration (line 3029) | class Qwen3OmniMoeTalkerForConditionalGeneration(Qwen3OmniMoeThinkerText... method __init__ (line 3041) | def __init__(self, config: Qwen3OmniMoeTalkerConfig): method forward (line 3062) | def forward( method get_rope_index (line 3175) | def get_rope_index( method get_llm_pos_ids_for_vision (line 3196) | def get_llm_pos_ids_for_vision( method get_input_embeddings (line 3209) | def get_input_embeddings(self): method _update_model_kwargs_for_generation (line 3212) | def _update_model_kwargs_for_generation(self, outputs, model_kwargs, i... method prepare_inputs_for_generation (line 3220) | def prepare_inputs_for_generation( class Qwen3OmniMoeCausalConvNet (line 3283) | class Qwen3OmniMoeCausalConvNet(nn.Module): method __init__ (line 3284) | def __init__( method _get_extra_padding_for_conv1d (line 3307) | def _get_extra_padding_for_conv1d(self, hidden_state: torch.Tensor) ->... method forward (line 3313) | def forward(self, hidden_state): class Qwen3OmniMoeCausalTransConvNet (line 3319) | class Qwen3OmniMoeCausalTransConvNet(nn.Module): method __init__ (line 3320) | def __init__(self, in_channels, out_channels, kernel_size, stride=1): method forward (line 3328) | def forward(self, hidden_state): class Qwen3OmniMoeConvNeXtBlock (line 3334) | class Qwen3OmniMoeConvNeXtBlock(nn.Module): method __init__ (line 3335) | def __init__(self, dim: int): method forward (line 3350) | def forward(self, hidden_states): class Qwen3OmniMoeCode2WavAttention (line 3370) | class Qwen3OmniMoeCode2WavAttention(nn.Module): method __init__ (line 3373) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig, layer_idx): method forward (line 3400) | def forward( class Qwen3OmniMoeCode2WavMlp (line 3442) | class Qwen3OmniMoeCode2WavMlp(nn.Module): method __init__ (line 3443) | def __init__(self, config): method forward (line 3453) | def forward(self, x): class Qwen3OmniMoeCode2WavRMSNorm (line 3459) | class Qwen3OmniMoeCode2WavRMSNorm(nn.Module): method __init__ (line 3460) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 3468) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 3475) | def extra_repr(self): class Qwen3OmniMoeCode2WavLayerScale (line 3479) | class Qwen3OmniMoeCode2WavLayerScale(nn.Module): method __init__ (line 3484) | def __init__(self, config): method forward (line 3490) | def forward(self, x: torch.Tensor): class Qwen3OmniMoeCode2WavTransformerLayer (line 3494) | class Qwen3OmniMoeCode2WavTransformerLayer(GradientCheckpointingLayer): method __init__ (line 3495) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig, layer_idx): method forward (line 3506) | def forward( class Qwen3OmniMoeCode2WavTransformerModel (line 3557) | class Qwen3OmniMoeCode2WavTransformerModel(Qwen3OmniMoePreTrainedModel): method __init__ (line 3563) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig): method forward (line 3580) | def forward( class SnakeBeta (line 3645) | class SnakeBeta(nn.Module): method __init__ (line 3659) | def __init__(self, in_features, alpha=1.0): method forward (line 3669) | def forward(self, hidden_states): class Qwen3OmniMoeCode2WavDecoderResidualUnit (line 3686) | class Qwen3OmniMoeCode2WavDecoderResidualUnit(nn.Module): method __init__ (line 3687) | def __init__(self, dim: int = 16, dilation: int = 1): method forward (line 3695) | def forward(self, hidden_state): class Qwen3OmniMoeCode2WavDecoderBlock (line 3705) | class Qwen3OmniMoeCode2WavDecoderBlock(Qwen3OmniMoePreTrainedModel): method __init__ (line 3706) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig, layer_idx): method forward (line 3724) | def forward(self, hidden, **kwargs): class Qwen3OmniMoeCode2Wav (line 3730) | class Qwen3OmniMoeCode2Wav(Qwen3OmniMoePreTrainedModel): method __init__ (line 3733) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig): method forward (line 3766) | def forward(self, codes, **kwargs): method chunked_decode (line 3780) | def chunked_decode(self, codes, chunk_size=300, left_context_size=25): class Qwen3OmniMoeForConditionalGeneration (line 3793) | class Qwen3OmniMoeForConditionalGeneration(Qwen3OmniMoePreTrainedModel, ... method __init__ (line 3797) | def __init__(self, config: Qwen3OmniMoeConfig): method enable_talker (line 3806) | def enable_talker(self): method disable_talker (line 3810) | def disable_talker(self): method _get_talker_user_parts (line 3817) | def _get_talker_user_parts( method _get_talker_assistant_parts (line 3838) | def _get_talker_assistant_parts( method generate (line 3896) | def generate( FILE: src/transformers/models/qwen3_omni_moe/modular_qwen3_omni_moe.py class BaseModelOutputWithDeepstackFeatures (line 108) | class BaseModelOutputWithDeepstackFeatures(BaseModelOutputWithPooling): function _get_feat_extract_output_lengths (line 117) | def _get_feat_extract_output_lengths(input_lengths): class Qwen3OmniMoeAudioEncoderConfig (line 128) | class Qwen3OmniMoeAudioEncoderConfig(Qwen2_5OmniAudioEncoderConfig): class Qwen3OmniMoeVisionEncoderConfig (line 151) | class Qwen3OmniMoeVisionEncoderConfig(Qwen3VLMoeVisionConfig): class Qwen3OmniMoeTextConfig (line 157) | class Qwen3OmniMoeTextConfig(PreTrainedConfig): method __post_init__ (line 229) | def __post_init__(self, **kwargs): class Qwen3OmniMoeThinkerConfig (line 237) | class Qwen3OmniMoeThinkerConfig(Qwen2_5OmniThinkerConfig): class Qwen3OmniMoeTalkerCodePredictorConfig (line 276) | class Qwen3OmniMoeTalkerCodePredictorConfig(Qwen3Config): method __post_init__ (line 292) | def __post_init__(self, **kwargs): class Qwen3OmniMoeTalkerTextConfig (line 297) | class Qwen3OmniMoeTalkerTextConfig(Qwen3MoeConfig): method __post_init__ (line 308) | def __post_init__(self, **kwargs): class Qwen3OmniMoeTalkerConfig (line 315) | class Qwen3OmniMoeTalkerConfig(PreTrainedConfig): method __post_init__ (line 390) | def __post_init__(self, **kwargs): class Qwen3OmniMoeCode2WavConfig (line 409) | class Qwen3OmniMoeCode2WavConfig(PreTrainedConfig): method layer_types (line 456) | def layer_types(self): class Qwen3OmniMoeConfig (line 465) | class Qwen3OmniMoeConfig(PreTrainedConfig): method __post_init__ (line 534) | def __post_init__(self, **kwargs): method get_text_config (line 558) | def get_text_config(self, decoder=False) -> "PreTrainedConfig": class Qwen3OmniMoePreTrainedModel (line 573) | class Qwen3OmniMoePreTrainedModel(Qwen2_5OmniPreTrainedModel, PreTrained... method _init_weights (line 575) | def _init_weights(self, module): class Qwen3OmniMoePreTrainedModelForConditionalGeneration (line 597) | class Qwen3OmniMoePreTrainedModelForConditionalGeneration(Qwen2_5OmniPre... method get_llm_pos_ids_for_vision (line 598) | def get_llm_pos_ids_for_vision( method get_rope_index (line 618) | def get_rope_index( class Qwen3OmniMoeAudioAttention (line 861) | class Qwen3OmniMoeAudioAttention(Qwen2_5OmniAudioAttention): method __init__ (line 862) | def __init__(self, config): class Qwen3OmniMoeAudioEncoder (line 867) | class Qwen3OmniMoeAudioEncoder(Qwen2_5OmniAudioEncoder): method __init__ (line 868) | def __init__(self, config: Qwen3OmniMoeAudioEncoderConfig): method get_input_embeddings (line 889) | def get_input_embeddings(self): method set_input_embeddings (line 892) | def set_input_embeddings(self, value): method forward (line 895) | def forward( class Qwen3OmniMoeVisionAttention (line 960) | class Qwen3OmniMoeVisionAttention(Qwen3VLMoeVisionAttention): method __init__ (line 961) | def __init__(self, config: Qwen3OmniMoeVisionEncoderConfig): class Qwen3OmniMoeVisionPatchMerger (line 965) | class Qwen3OmniMoeVisionPatchMerger(nn.Module): method __init__ (line 966) | def __init__(self, config: Qwen3OmniMoeVisionEncoderConfig, use_postsh... method forward (line 979) | def forward(self, hidden: torch.Tensor) -> torch.Tensor: class Qwen3OmniMoeVisionRotaryEmbedding (line 988) | class Qwen3OmniMoeVisionRotaryEmbedding(Qwen3VLMoeVisionRotaryEmbedding): class Qwen3OmniMoeVisionEncoder (line 992) | class Qwen3OmniMoeVisionEncoder(Qwen3VLMoeVisionModel): method __init__ (line 996) | def __init__(self, config, *inputs, **kwargs): method deepstack_merger_list (line 1010) | def deepstack_merger_list(self): class Qwen3OmniMoeThinkerTextRotaryEmbedding (line 1014) | class Qwen3OmniMoeThinkerTextRotaryEmbedding(Qwen3VLMoeTextRotaryEmbeddi... class Qwen3OmniMoeThinkerTextExperts (line 1018) | class Qwen3OmniMoeThinkerTextExperts(Qwen3MoeExperts): method __init__ (line 1023) | def __init__(self, config: Qwen3OmniMoeThinkerConfig): class Qwen3OmniMoeThinkerTextTopKRouter (line 1027) | class Qwen3OmniMoeThinkerTextTopKRouter(Qwen3MoeTopKRouter): class Qwen3OmniMoeThinkerTextSparseMoeBlock (line 1031) | class Qwen3OmniMoeThinkerTextSparseMoeBlock(Qwen3MoeSparseMoeBlock): method __init__ (line 1032) | def __init__(self, config: Qwen3OmniMoeThinkerConfig): class Qwen3OmniMoeThinkerTextAttention (line 1036) | class Qwen3OmniMoeThinkerTextAttention(Qwen3MoeAttention): method __init__ (line 1037) | def __init__(self, config, layer_idx): class Qwen3OmniMoeThinkerTextDecoderLayer (line 1042) | class Qwen3OmniMoeThinkerTextDecoderLayer(Qwen3MoeDecoderLayer): method __init__ (line 1043) | def __init__(self, config, layer_idx): class Qwen3OmniMoeThinkerTextPreTrainedModel (line 1048) | class Qwen3OmniMoeThinkerTextPreTrainedModel(Qwen3MoePreTrainedModel): class Qwen3OmniMoeThinkerTextModel (line 1053) | class Qwen3OmniMoeThinkerTextModel(Qwen3VLMoeTextModel): method __init__ (line 1061) | def __init__(self, config: Qwen3OmniMoeTextConfig): class Qwen3OmniMoeThinkerCausalLMOutputWithPast (line 1070) | class Qwen3OmniMoeThinkerCausalLMOutputWithPast(MoeCausalLMOutputWithPast): class Qwen3OmniMoeThinkerForConditionalGeneration (line 1080) | class Qwen3OmniMoeThinkerForConditionalGeneration(Qwen2_5OmniThinkerForC... method __init__ (line 1087) | def __init__(self, config): method get_video_features (line 1095) | def get_video_features( method get_image_features (line 1112) | def get_image_features( method get_audio_features (line 1129) | def get_audio_features( method forward (line 1162) | def forward( class Qwen3OmniMoeTalkerResizeMLP (line 1324) | class Qwen3OmniMoeTalkerResizeMLP(nn.Module): method __init__ (line 1325) | def __init__(self, config: Qwen3OmniMoeTalkerConfig): method forward (line 1331) | def forward(self, hidden_state): class Qwen3OmniMoeTalkerCodePredictorOutputWithPast (line 1336) | class Qwen3OmniMoeTalkerCodePredictorOutputWithPast(CausalLMOutputWithPa... class Qwen3OmniMoeTalkerCodePredictorAttention (line 1345) | class Qwen3OmniMoeTalkerCodePredictorAttention(Qwen3Attention): class Qwen3OmniMoeTalkerCodePredictorDecoderLayer (line 1349) | class Qwen3OmniMoeTalkerCodePredictorDecoderLayer(Qwen3DecoderLayer): method __init__ (line 1350) | def __init__(self, config, layer_idx): class Qwen3OmniMoeRotaryEmbedding (line 1355) | class Qwen3OmniMoeRotaryEmbedding(Qwen3RotaryEmbedding): class Qwen3OmniMoeTalkerCodePredictorModel (line 1359) | class Qwen3OmniMoeTalkerCodePredictorModel(Qwen3Model): method __init__ (line 1367) | def __init__(self, config: Qwen3OmniMoeTalkerCodePredictorConfig): method get_input_embeddings (line 1380) | def get_input_embeddings(self): method forward (line 1386) | def forward( class Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration (line 1445) | class Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration(Qwen3... method __init__ (line 1453) | def __init__(self, config: Qwen3OmniMoeTalkerCodePredictorConfig): method get_input_embeddings (line 1460) | def get_input_embeddings(self): method forward (line 1463) | def forward( method _update_model_kwargs_for_generation (line 1514) | def _update_model_kwargs_for_generation(self, outputs, model_kwargs, i... class Qwen3OmniMoeTalkerOutputWithPast (line 1523) | class Qwen3OmniMoeTalkerOutputWithPast(MoeCausalLMOutputWithPast): class Qwen3OmniMoeTalkerRotaryEmbedding (line 1532) | class Qwen3OmniMoeTalkerRotaryEmbedding(Qwen3OmniMoeThinkerTextRotaryEmb... class Qwen3OmniMoeTalkerTextMLP (line 1536) | class Qwen3OmniMoeTalkerTextMLP(Qwen3MoeMLP): class Qwen3OmniMoeTalkerTextTopKRouter (line 1540) | class Qwen3OmniMoeTalkerTextTopKRouter(Qwen2MoeTopKRouter): class Qwen3OmniMoeTalkerTextSparseMoeBlock (line 1544) | class Qwen3OmniMoeTalkerTextSparseMoeBlock(Qwen2MoeSparseMoeBlock): class Qwen3OmniMoeTalkerDecoderLayer (line 1548) | class Qwen3OmniMoeTalkerDecoderLayer(Qwen3MoeDecoderLayer): method __init__ (line 1549) | def __init__(self, config, layer_idx): class Qwen3OmniMoeTalkerModel (line 1555) | class Qwen3OmniMoeTalkerModel(Qwen3VLMoeTextModel): method __init__ (line 1566) | def __init__(self, config: Qwen3OmniMoeTalkerTextConfig): method get_input_embeddings (line 1575) | def get_input_embeddings(self): class Qwen3OmniMoeTalkerForConditionalGeneration (line 1579) | class Qwen3OmniMoeTalkerForConditionalGeneration(Qwen3MoeForCausalLM): method __init__ (line 1591) | def __init__(self, config: Qwen3OmniMoeTalkerConfig): method get_rope_index (line 1609) | def get_rope_index( method get_llm_pos_ids_for_vision (line 1630) | def get_llm_pos_ids_for_vision( method get_input_embeddings (line 1643) | def get_input_embeddings(self): method forward (line 1646) | def forward( method _update_model_kwargs_for_generation (line 1758) | def _update_model_kwargs_for_generation(self, outputs, model_kwargs, i... method prepare_inputs_for_generation (line 1766) | def prepare_inputs_for_generation( class Qwen3OmniMoeCausalConvNet (line 1829) | class Qwen3OmniMoeCausalConvNet(nn.Module): method __init__ (line 1830) | def __init__( method _get_extra_padding_for_conv1d (line 1853) | def _get_extra_padding_for_conv1d(self, hidden_state: torch.Tensor) ->... method forward (line 1859) | def forward(self, hidden_state): class Qwen3OmniMoeCausalTransConvNet (line 1865) | class Qwen3OmniMoeCausalTransConvNet(nn.Module): method __init__ (line 1866) | def __init__(self, in_channels, out_channels, kernel_size, stride=1): method forward (line 1874) | def forward(self, hidden_state): class Qwen3OmniMoeConvNeXtBlock (line 1880) | class Qwen3OmniMoeConvNeXtBlock(nn.Module): method __init__ (line 1881) | def __init__(self, dim: int): method forward (line 1896) | def forward(self, hidden_states): class Qwen3OmniMoeCode2WavAttention (line 1915) | class Qwen3OmniMoeCode2WavAttention(Qwen3Attention): method __init__ (line 1916) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig, layer_idx): class Qwen3OmniMoeCode2WavMlp (line 1923) | class Qwen3OmniMoeCode2WavMlp(Qwen3MLP): class Qwen3OmniMoeCode2WavRMSNorm (line 1927) | class Qwen3OmniMoeCode2WavRMSNorm(Qwen3RMSNorm): class Qwen3OmniMoeCode2WavLayerScale (line 1931) | class Qwen3OmniMoeCode2WavLayerScale(MimiLayerScale): class Qwen3OmniMoeCode2WavTransformerLayer (line 1935) | class Qwen3OmniMoeCode2WavTransformerLayer(GradientCheckpointingLayer): method __init__ (line 1936) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig, layer_idx): method forward (line 1947) | def forward( class Qwen3OmniMoeCode2WavTransformerModel (line 1997) | class Qwen3OmniMoeCode2WavTransformerModel(Qwen3Model): method __init__ (line 2003) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig): method forward (line 2013) | def forward( class SnakeBeta (line 2036) | class SnakeBeta(SnakeBeta): class Qwen3OmniMoeCode2WavDecoderResidualUnit (line 2040) | class Qwen3OmniMoeCode2WavDecoderResidualUnit(nn.Module): method __init__ (line 2041) | def __init__(self, dim: int = 16, dilation: int = 1): method forward (line 2049) | def forward(self, hidden_state): class Qwen3OmniMoeCode2WavDecoderBlock (line 2059) | class Qwen3OmniMoeCode2WavDecoderBlock(Qwen3OmniMoePreTrainedModel): method __init__ (line 2060) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig, layer_idx): method forward (line 2078) | def forward(self, hidden, **kwargs): class Qwen3OmniMoeCode2Wav (line 2084) | class Qwen3OmniMoeCode2Wav(Qwen3OmniMoePreTrainedModel): method __init__ (line 2087) | def __init__(self, config: Qwen3OmniMoeCode2WavConfig): method forward (line 2120) | def forward(self, codes, **kwargs): method chunked_decode (line 2134) | def chunked_decode(self, codes, chunk_size=300, left_context_size=25): class Qwen3OmniMoeForConditionalGeneration (line 2147) | class Qwen3OmniMoeForConditionalGeneration(Qwen3OmniMoePreTrainedModel, ... method __init__ (line 2151) | def __init__(self, config: Qwen3OmniMoeConfig): method enable_talker (line 2160) | def enable_talker(self): method disable_talker (line 2164) | def disable_talker(self): method _get_talker_user_parts (line 2171) | def _get_talker_user_parts( method _get_talker_assistant_parts (line 2192) | def _get_talker_assistant_parts( method generate (line 2250) | def generate( class Qwen3OmniMoeProcessorKwargs (line 2435) | class Qwen3OmniMoeProcessorKwargs(Qwen2_5OmniProcessorKwargs): class Qwen3OmniMoeProcessor (line 2459) | class Qwen3OmniMoeProcessor(Qwen2_5OmniProcessor, ProcessorMixin): method replace_multimodal_special_tokens (line 2460) | def replace_multimodal_special_tokens( method __call__ (line 2538) | def __call__( method apply_chat_template (line 2615) | def apply_chat_template(self, conversations, chat_template=None, **kwa... FILE: src/transformers/models/qwen3_omni_moe/processing_qwen3_omni_moe.py class Qwen3OmniMoeVideosKwargs (line 36) | class Qwen3OmniMoeVideosKwargs(VideosKwargs, total=False): class Qwen3OmniMoeProcessorKwargs (line 82) | class Qwen3OmniMoeProcessorKwargs(ProcessingKwargs, total=False): function _get_feat_extract_output_lengths (line 107) | def _get_feat_extract_output_lengths(input_lengths): class Qwen3OmniMoeProcessor (line 119) | class Qwen3OmniMoeProcessor(ProcessorMixin): method __init__ (line 120) | def __init__( method __call__ (line 133) | def __call__( method replace_multimodal_special_tokens (line 210) | def replace_multimodal_special_tokens( method get_chunked_index (line 288) | def get_chunked_index(self, token_indices: np.ndarray, tokens_per_chun... method apply_chat_template (line 321) | def apply_chat_template(self, conversations, chat_template=None, **kwa... method post_process_image_text_to_text (line 324) | def post_process_image_text_to_text(self, generated_outputs, skip_spec... method post_process_multimodal_output (line 342) | def post_process_multimodal_output( method model_input_names (line 379) | def model_input_names(self): FILE: src/transformers/models/qwen3_vl/configuration_qwen3_vl.py class Qwen3VLVisionConfig (line 29) | class Qwen3VLVisionConfig(PreTrainedConfig): class Qwen3VLTextConfig (line 59) | class Qwen3VLTextConfig(PreTrainedConfig): method __post_init__ (line 98) | def __post_init__(self, **kwargs): class Qwen3VLConfig (line 107) | class Qwen3VLConfig(PreTrainedConfig): method __post_init__ (line 136) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen3_vl/modeling_qwen3_vl.py class BaseModelOutputWithDeepstackFeatures (line 50) | class BaseModelOutputWithDeepstackFeatures(BaseModelOutputWithPooling): class Qwen3VLVisionMLP (line 59) | class Qwen3VLVisionMLP(nn.Module): method __init__ (line 60) | def __init__(self, config): method forward (line 68) | def forward(self, hidden_state): class Qwen3VLVisionPatchEmbed (line 72) | class Qwen3VLVisionPatchEmbed(nn.Module): method __init__ (line 73) | def __init__(self, config) -> None: method forward (line 83) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Qwen3VLVisionRotaryEmbedding (line 92) | class Qwen3VLVisionRotaryEmbedding(nn.Module): method __init__ (line 95) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 102) | def forward(self, seqlen: int) -> torch.Tensor: class Qwen3VLVisionPatchMerger (line 108) | class Qwen3VLVisionPatchMerger(nn.Module): method __init__ (line 109) | def __init__(self, config: Qwen3VLVisionConfig, use_postshuffle_norm=F... method forward (line 118) | def forward(self, x: torch.Tensor) -> torch.Tensor: function rotate_half (line 124) | def rotate_half(x): function apply_rotary_pos_emb_vision (line 131) | def apply_rotary_pos_emb_vision( function repeat_kv (line 145) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 157) | def eager_attention_forward( class Qwen3VLVisionAttention (line 182) | class Qwen3VLVisionAttention(nn.Module): method __init__ (line 183) | def __init__(self, config: Qwen3VLVisionConfig) -> None: method forward (line 196) | def forward( class Qwen3VLVisionBlock (line 265) | class Qwen3VLVisionBlock(GradientCheckpointingLayer): method __init__ (line 266) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 274) | def forward( class Qwen3VLTextRotaryEmbedding (line 299) | class Qwen3VLTextRotaryEmbedding(nn.Module): method __init__ (line 302) | def __init__(self, config: Qwen3VLTextConfig, device=None): method compute_default_rope_parameters (line 321) | def compute_default_rope_parameters( method forward (line 352) | def forward(self, x, position_ids): method apply_interleaved_mrope (line 370) | def apply_interleaved_mrope(self, freqs, mrope_section): class Qwen3VLTextRMSNorm (line 389) | class Qwen3VLTextRMSNorm(nn.Module): method __init__ (line 390) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 398) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 405) | def extra_repr(self): function apply_rotary_pos_emb (line 410) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Qwen3VLTextAttention (line 436) | class Qwen3VLTextAttention(nn.Module): method __init__ (line 439) | def __init__(self, config: Qwen3VLTextConfig, layer_idx: int): method forward (line 467) | def forward( class Qwen3VLTextMLP (line 508) | class Qwen3VLTextMLP(nn.Module): method __init__ (line 509) | def __init__(self, config): method forward (line 519) | def forward(self, x): class Qwen3VLTextDecoderLayer (line 524) | class Qwen3VLTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 525) | def __init__(self, config: Qwen3VLTextConfig, layer_idx: int): method forward (line 535) | def forward( class Qwen3VLModelOutputWithPast (line 573) | class Qwen3VLModelOutputWithPast(ModelOutput): class Qwen3VLPreTrainedModel (line 592) | class Qwen3VLPreTrainedModel(PreTrainedModel): method _init_weights (line 609) | def _init_weights(self, module): class Qwen3VLVisionModel (line 616) | class Qwen3VLVisionModel(Qwen3VLPreTrainedModel): method __init__ (line 625) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 662) | def rot_pos_emb(self, grid_thw: torch.Tensor) -> torch.Tensor: method fast_pos_embed_interpolate (line 702) | def fast_pos_embed_interpolate(self, grid_thw): method forward (line 767) | def forward( class Qwen3VLTextModel (line 832) | class Qwen3VLTextModel(Qwen3VLPreTrainedModel): method __init__ (line 837) | def __init__(self, config: Qwen3VLTextConfig): method forward (line 856) | def forward( method _deepstack_process (line 941) | def _deepstack_process( class Qwen3VLModel (line 953) | class Qwen3VLModel(Qwen3VLPreTrainedModel): method __init__ (line 960) | def __init__(self, config): method get_input_embeddings (line 969) | def get_input_embeddings(self): method set_input_embeddings (line 972) | def set_input_embeddings(self, value): method get_vision_position_ids (line 975) | def get_vision_position_ids( method get_rope_index (line 1031) | def get_rope_index( method get_video_features (line 1126) | def get_video_features( method get_image_features (line 1143) | def get_image_features( method get_placeholder_mask (line 1166) | def get_placeholder_mask( method compute_3d_position_ids (line 1207) | def compute_3d_position_ids( method forward (line 1258) | def forward( class Qwen3VLCausalLMOutputWithPast (line 1369) | class Qwen3VLCausalLMOutputWithPast(ModelOutput): class Qwen3VLForConditionalGeneration (line 1392) | class Qwen3VLForConditionalGeneration(Qwen3VLPreTrainedModel, Generation... method __init__ (line 1398) | def __init__(self, config): method get_input_embeddings (line 1405) | def get_input_embeddings(self): method set_input_embeddings (line 1408) | def set_input_embeddings(self, value): method get_video_features (line 1412) | def get_video_features( method get_image_features (line 1429) | def get_image_features( method forward (line 1444) | def forward( method prepare_inputs_for_generation (line 1540) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1578) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1616) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1667) | def _expand_inputs_for_generation( FILE: src/transformers/models/qwen3_vl/modular_qwen3_vl.py class BaseModelOutputWithDeepstackFeatures (line 73) | class BaseModelOutputWithDeepstackFeatures(BaseModelOutputWithPooling): class Qwen3VLVisionConfig (line 84) | class Qwen3VLVisionConfig(PreTrainedConfig): class Qwen3VLTextConfig (line 114) | class Qwen3VLTextConfig(PreTrainedConfig): method __post_init__ (line 153) | def __post_init__(self, **kwargs): class Qwen3VLConfig (line 162) | class Qwen3VLConfig(PreTrainedConfig): method __post_init__ (line 191) | def __post_init__(self, **kwargs): class Qwen3VLVisionMLP (line 205) | class Qwen3VLVisionMLP(nn.Module): method __init__ (line 206) | def __init__(self, config): method forward (line 214) | def forward(self, hidden_state): class Qwen3VLVisionPatchEmbed (line 218) | class Qwen3VLVisionPatchEmbed(PatchEmbed): method __init__ (line 219) | def __init__(self, config) -> None: class Qwen3VLVisionRotaryEmbedding (line 230) | class Qwen3VLVisionRotaryEmbedding(VisionRotaryEmbedding): class Qwen3VLVisionPatchMerger (line 234) | class Qwen3VLVisionPatchMerger(nn.Module): method __init__ (line 235) | def __init__(self, config: Qwen3VLVisionConfig, use_postshuffle_norm=F... method forward (line 244) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Qwen3VLVisionAttention (line 250) | class Qwen3VLVisionAttention(VisionAttention): method __init__ (line 251) | def __init__(self, config: Qwen3VLVisionConfig) -> None: class Qwen3VLVisionBlock (line 256) | class Qwen3VLVisionBlock(Qwen2_5_VLVisionBlock): method __init__ (line 257) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: class Qwen3VLTextRotaryEmbedding (line 265) | class Qwen3VLTextRotaryEmbedding(LlamaRotaryEmbedding): method __init__ (line 268) | def __init__(self, config: Qwen3VLTextConfig, device=None): method apply_interleaved_mrope (line 273) | def apply_interleaved_mrope(self, freqs, mrope_section): method forward (line 292) | def forward(self, x, position_ids): class Qwen3VLTextAttention (line 311) | class Qwen3VLTextAttention(Qwen3Attention): method __init__ (line 312) | def __init__(self, config: Qwen3VLTextConfig, layer_idx: int): method forward (line 316) | def forward( class Qwen3VLTextDecoderLayer (line 357) | class Qwen3VLTextDecoderLayer(Qwen3DecoderLayer): method __init__ (line 358) | def __init__(self, config: Qwen3VLTextConfig, layer_idx: int): method forward (line 362) | def forward( class Qwen3VLModelOutputWithPast (line 383) | class Qwen3VLModelOutputWithPast(Qwen2VLModelOutputWithPast): class Qwen3VLPreTrainedModel (line 387) | class Qwen3VLPreTrainedModel(Qwen2VLPreTrainedModel): method _init_weights (line 395) | def _init_weights(self, module): class Qwen3VLVisionModel (line 402) | class Qwen3VLVisionModel(Qwen3VLPreTrainedModel): method __init__ (line 411) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 448) | def rot_pos_emb(self, grid_thw: torch.Tensor) -> torch.Tensor: method fast_pos_embed_interpolate (line 488) | def fast_pos_embed_interpolate(self, grid_thw): method forward (line 553) | def forward( class Qwen3VLTextModel (line 618) | class Qwen3VLTextModel(Qwen3VLPreTrainedModel, Qwen3Model): method __init__ (line 623) | def __init__(self, config: Qwen3VLTextConfig): method _deepstack_process (line 627) | def _deepstack_process( method forward (line 640) | def forward( class Qwen3VLModel (line 727) | class Qwen3VLModel(Qwen2VLModel): method __init__ (line 732) | def __init__(self, config): method get_rope_index (line 737) | def get_rope_index( method get_image_features (line 776) | def get_image_features( method get_video_features (line 801) | def get_video_features( method forward (line 818) | def forward( class Qwen3VLCausalLMOutputWithPast (line 923) | class Qwen3VLCausalLMOutputWithPast(Qwen2_5_VLCausalLMOutputWithPast): class Qwen3VLForConditionalGeneration (line 927) | class Qwen3VLForConditionalGeneration(Qwen2_5_VLForConditionalGeneration): method get_image_features (line 931) | def get_image_features(self, **super_kwargs) -> tuple | BaseModelOutpu... method get_video_features (line 935) | def get_video_features(self, **super_kwargs) -> tuple | BaseModelOutpu... method forward (line 939) | def forward( method prepare_inputs_for_generation (line 1035) | def prepare_inputs_for_generation( method _expand_inputs_for_generation (line 1073) | def _expand_inputs_for_generation( class Qwen3VLProcessorKwargs (line 1170) | class Qwen3VLProcessorKwargs(ProcessingKwargs, total=False): class Qwen3VLProcessor (line 1181) | class Qwen3VLProcessor(Qwen2VLProcessor): method __init__ (line 1182) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 1201) | def __call__( method _calculate_timestamps (line 1308) | def _calculate_timestamps(self, indices: list[int] | np.ndarray, video... FILE: src/transformers/models/qwen3_vl/processing_qwen3_vl.py class Qwen3VLProcessorKwargs (line 34) | class Qwen3VLProcessorKwargs(ProcessingKwargs, total=False): class Qwen3VLProcessor (line 46) | class Qwen3VLProcessor(ProcessorMixin): method __init__ (line 47) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 79) | def __call__( method _get_num_multimodal_tokens (line 186) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... method post_process_image_text_to_text (line 224) | def post_process_image_text_to_text( method model_input_names (line 252) | def model_input_names(self): method _calculate_timestamps (line 257) | def _calculate_timestamps(self, indices: list[int] | np.ndarray, video... FILE: src/transformers/models/qwen3_vl/video_processing_qwen3_vl.py function smart_resize (line 35) | def smart_resize( class Qwen3VLVideoProcessorInitKwargs (line 66) | class Qwen3VLVideoProcessorInitKwargs(VideosKwargs, total=False): class Qwen3VLVideoProcessor (line 86) | class Qwen3VLVideoProcessor(BaseVideoProcessor): method __init__ (line 105) | def __init__(self, **kwargs: Unpack[Qwen3VLVideoProcessorInitKwargs]): method _standardize_kwargs (line 108) | def _standardize_kwargs(self, **kwargs) -> dict: method sample_frames (line 119) | def sample_frames( method _preprocess (line 168) | def _preprocess( FILE: src/transformers/models/qwen3_vl_moe/configuration_qwen3_vl_moe.py class Qwen3VLMoeTextConfig (line 29) | class Qwen3VLMoeTextConfig(PreTrainedConfig): method __post_init__ (line 103) | def __post_init__(self, **kwargs): class Qwen3VLMoeVisionConfig (line 115) | class Qwen3VLMoeVisionConfig(PreTrainedConfig): class Qwen3VLMoeConfig (line 145) | class Qwen3VLMoeConfig(PreTrainedConfig): method __post_init__ (line 174) | def __post_init__(self, **kwargs): FILE: src/transformers/models/qwen3_vl_moe/modeling_qwen3_vl_moe.py class Qwen3VLMoeTextRMSNorm (line 54) | class Qwen3VLMoeTextRMSNorm(nn.Module): method __init__ (line 55) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 63) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 70) | def extra_repr(self): class Qwen3VLMoeTextExperts (line 75) | class Qwen3VLMoeTextExperts(nn.Module): method __init__ (line 78) | def __init__(self, config): method forward (line 87) | def forward( class Qwen3VLMoeTextTopKRouter (line 114) | class Qwen3VLMoeTextTopKRouter(nn.Module): method __init__ (line 115) | def __init__(self, config): method forward (line 122) | def forward(self, hidden_states): class Qwen3VLMoeTextSparseMoeBlock (line 133) | class Qwen3VLMoeTextSparseMoeBlock(nn.Module): method __init__ (line 134) | def __init__(self, config: Qwen3VLMoeTextConfig): method forward (line 139) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... function rotate_half (line 147) | def rotate_half(x): function repeat_kv (line 154) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 166) | def eager_attention_forward( function apply_rotary_pos_emb (line 192) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Qwen3VLMoeTextAttention (line 218) | class Qwen3VLMoeTextAttention(nn.Module): method __init__ (line 221) | def __init__(self, config: Qwen3VLMoeTextConfig, layer_idx: int): method forward (line 251) | def forward( class Qwen3VLMoeTextMLP (line 292) | class Qwen3VLMoeTextMLP(nn.Module): method __init__ (line 293) | def __init__(self, config, intermediate_size=None): method forward (line 303) | def forward(self, x): class Qwen3VLMoeTextDecoderLayer (line 308) | class Qwen3VLMoeTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 309) | def __init__(self, config: Qwen3VLMoeTextConfig, layer_idx: int): method forward (line 322) | def forward( class Qwen3VLMoePreTrainedModel (line 355) | class Qwen3VLMoePreTrainedModel(PreTrainedModel): method _init_weights (line 375) | def _init_weights(self, module): class Qwen3VLMoeVisionRotaryEmbedding (line 392) | class Qwen3VLMoeVisionRotaryEmbedding(nn.Module): method __init__ (line 395) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 402) | def forward(self, seqlen: int) -> torch.Tensor: function apply_rotary_pos_emb_vision (line 408) | def apply_rotary_pos_emb_vision( class Qwen3VLMoeVisionAttention (line 422) | class Qwen3VLMoeVisionAttention(nn.Module): method __init__ (line 423) | def __init__(self, config: Qwen3VLMoeVisionConfig) -> None: method forward (line 436) | def forward( class Qwen3VLMoeVisionMLP (line 505) | class Qwen3VLMoeVisionMLP(nn.Module): method __init__ (line 506) | def __init__(self, config): method forward (line 514) | def forward(self, hidden_state): class Qwen3VLMoeVisionBlock (line 518) | class Qwen3VLMoeVisionBlock(GradientCheckpointingLayer): method __init__ (line 519) | def __init__(self, config, attn_implementation: str = "sdpa") -> None: method forward (line 527) | def forward( class BaseModelOutputWithDeepstackFeatures (line 554) | class BaseModelOutputWithDeepstackFeatures(BaseModelOutputWithPooling): class Qwen3VLMoeVisionPatchEmbed (line 563) | class Qwen3VLMoeVisionPatchEmbed(nn.Module): method __init__ (line 564) | def __init__(self, config) -> None: method forward (line 574) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Qwen3VLMoeVisionPatchMerger (line 583) | class Qwen3VLMoeVisionPatchMerger(nn.Module): method __init__ (line 584) | def __init__(self, config: Qwen3VLMoeVisionConfig, use_postshuffle_nor... method forward (line 593) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Qwen3VLMoeVisionModel (line 599) | class Qwen3VLMoeVisionModel(Qwen3VLMoePreTrainedModel): method __init__ (line 609) | def __init__(self, config, *inputs, **kwargs) -> None: method rot_pos_emb (line 646) | def rot_pos_emb(self, grid_thw: torch.Tensor) -> torch.Tensor: method fast_pos_embed_interpolate (line 686) | def fast_pos_embed_interpolate(self, grid_thw): method forward (line 751) | def forward( class Qwen3VLMoeTextRotaryEmbedding (line 810) | class Qwen3VLMoeTextRotaryEmbedding(nn.Module): method __init__ (line 813) | def __init__(self, config: Qwen3VLMoeTextConfig, device=None): method compute_default_rope_parameters (line 832) | def compute_default_rope_parameters( method forward (line 863) | def forward(self, x, position_ids): method apply_interleaved_mrope (line 881) | def apply_interleaved_mrope(self, freqs, mrope_section): class Qwen3VLMoeTextModel (line 905) | class Qwen3VLMoeTextModel(Qwen3VLMoePreTrainedModel): method __init__ (line 910) | def __init__(self, config: Qwen3VLMoeTextConfig): method forward (line 929) | def forward( method _deepstack_process (line 1014) | def _deepstack_process( class Qwen3VLMoeModelOutputWithPast (line 1031) | class Qwen3VLMoeModelOutputWithPast(ModelOutput): class Qwen3VLMoeCausalLMOutputWithPast (line 1056) | class Qwen3VLMoeCausalLMOutputWithPast(ModelOutput): class Qwen3VLMoeModel (line 1082) | class Qwen3VLMoeModel(Qwen3VLMoePreTrainedModel): method __init__ (line 1089) | def __init__(self, config): method get_input_embeddings (line 1098) | def get_input_embeddings(self): method set_input_embeddings (line 1101) | def set_input_embeddings(self, value): method get_vision_position_ids (line 1104) | def get_vision_position_ids( method get_rope_index (line 1160) | def get_rope_index( method get_video_features (line 1255) | def get_video_features( method get_image_features (line 1272) | def get_image_features( method get_placeholder_mask (line 1295) | def get_placeholder_mask( method compute_3d_position_ids (line 1336) | def compute_3d_position_ids( method forward (line 1387) | def forward( function load_balancing_loss_func (line 1492) | def load_balancing_loss_func( class Qwen3VLMoeForConditionalGeneration (line 1574) | class Qwen3VLMoeForConditionalGeneration(Qwen3VLMoePreTrainedModel, Gene... method __init__ (line 1580) | def __init__(self, config): method get_input_embeddings (line 1587) | def get_input_embeddings(self): method set_input_embeddings (line 1590) | def set_input_embeddings(self, value): method get_video_features (line 1594) | def get_video_features( method get_image_features (line 1611) | def get_image_features( method forward (line 1626) | def forward( method prepare_inputs_for_generation (line 1742) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 1780) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method _get_image_nums_and_video_nums (line 1818) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1869) | def _expand_inputs_for_generation( FILE: src/transformers/models/qwen3_vl_moe/modular_qwen3_vl_moe.py class Qwen3VLMoeTextConfig (line 58) | class Qwen3VLMoeTextConfig(Qwen3MoeConfig): method __post_init__ (line 117) | def __post_init__(self, **kwargs): class Qwen3VLMoeVisionConfig (line 128) | class Qwen3VLMoeVisionConfig(Qwen3VLVisionConfig): class Qwen3VLMoeConfig (line 134) | class Qwen3VLMoeConfig(Qwen3VLConfig): class Qwen3VLMoeTextRMSNorm (line 154) | class Qwen3VLMoeTextRMSNorm(Qwen3MoeRMSNorm): class Qwen3VLMoeTextExperts (line 158) | class Qwen3VLMoeTextExperts(Qwen3MoeExperts): class Qwen3VLMoeTextTopKRouter (line 162) | class Qwen3VLMoeTextTopKRouter(nn.Module): method __init__ (line 163) | def __init__(self, config): method forward (line 170) | def forward(self, hidden_states): class Qwen3VLMoeTextSparseMoeBlock (line 181) | class Qwen3VLMoeTextSparseMoeBlock(Qwen3MoeSparseMoeBlock): class Qwen3VLMoeTextAttention (line 185) | class Qwen3VLMoeTextAttention(Qwen3VLTextAttention): class Qwen3VLMoeTextDecoderLayer (line 189) | class Qwen3VLMoeTextDecoderLayer(Qwen3MoeDecoderLayer): class Qwen3VLMoePreTrainedModel (line 193) | class Qwen3VLMoePreTrainedModel(Qwen3MoePreTrainedModel): method _init_weights (line 199) | def _init_weights(self, module): class Qwen3VLMoeVisionRotaryEmbedding (line 216) | class Qwen3VLMoeVisionRotaryEmbedding(Qwen3VLVisionRotaryEmbedding): class Qwen3VLMoeVisionAttention (line 220) | class Qwen3VLMoeVisionAttention(Qwen3VLVisionAttention): class Qwen3VLMoeVisionBlock (line 224) | class Qwen3VLMoeVisionBlock(Qwen3VLVisionBlock): class Qwen3VLMoeVisionModel (line 228) | class Qwen3VLMoeVisionModel(Qwen3VLVisionModel): class Qwen3VLMoeTextModel (line 236) | class Qwen3VLMoeTextModel(Qwen3VLTextModel): method forward (line 237) | def forward( class Qwen3VLMoeModelOutputWithPast (line 323) | class Qwen3VLMoeModelOutputWithPast(Qwen3VLModelOutputWithPast): class Qwen3VLMoeCausalLMOutputWithPast (line 327) | class Qwen3VLMoeCausalLMOutputWithPast(Qwen3VLCausalLMOutputWithPast): class Qwen3VLMoeForConditionalGeneration (line 332) | class Qwen3VLMoeForConditionalGeneration(Qwen3VLForConditionalGeneration): method forward (line 334) | def forward( FILE: src/transformers/models/rag/configuration_rag.py class RagConfig (line 25) | class RagConfig(PreTrainedConfig): method __post_init__ (line 109) | def __post_init__(self, **kwargs): method from_question_encoder_generator_configs (line 127) | def from_question_encoder_generator_configs( FILE: src/transformers/models/rag/modeling_rag.py class RetrievAugLMMarginOutput (line 42) | class RetrievAugLMMarginOutput(ModelOutput): class RetrievAugLMOutput (line 134) | class RetrievAugLMOutput(ModelOutput): class RagPreTrainedModel (line 231) | class RagPreTrainedModel(PreTrainedModel): method from_pretrained_question_encoder_generator (line 238) | def from_pretrained_question_encoder_generator( class RagModel (line 372) | class RagModel(RagPreTrainedModel): method __init__ (line 373) | def __init__( method forward (line 426) | def forward( class RagSequenceForGeneration (line 663) | class RagSequenceForGeneration(RagPreTrainedModel): method __init__ (line 664) | def __init__( method set_retriever (line 695) | def set_retriever(self, retriever: RagRetriever): method set_context_encoder_for_training (line 698) | def set_context_encoder_for_training(self, ctx_encoder: PreTrainedModel): method forward (line 703) | def forward( method retriever (line 864) | def retriever(self): method generator (line 868) | def generator(self): method question_encoder (line 872) | def question_encoder(self): method generate (line 876) | def generate( method get_nll (line 1026) | def get_nll( method _cat_and_pad (line 1086) | def _cat_and_pad(tensors, pad_token_id): class RagTokenForGeneration (line 1100) | class RagTokenForGeneration(RagPreTrainedModel, GenerationMixin): method __init__ (line 1101) | def __init__( method set_retriever (line 1133) | def set_retriever(self, retriever: RagRetriever): method set_context_encoder_for_training (line 1136) | def set_context_encoder_for_training(self, ctx_encoder: PreTrainedModel): method prepare_inputs_for_generation (line 1140) | def prepare_inputs_for_generation( method retriever (line 1170) | def retriever(self): method generator (line 1174) | def generator(self): method question_encoder (line 1178) | def question_encoder(self): method _reorder_cache (line 1182) | def _reorder_cache(past_key_values, beam_idx): method marginalize (line 1214) | def marginalize(self, seq_logits, doc_scores, n_docs=None): method forward (line 1226) | def forward( method generate (line 1399) | def generate( method _temporary_reorder_cache (line 1603) | def _temporary_reorder_cache(self, past_key_values, beam_idx): method get_input_embeddings (line 1610) | def get_input_embeddings(self): method get_output_embeddings (line 1613) | def get_output_embeddings(self): method set_output_embeddings (line 1616) | def set_output_embeddings(self, new_embeddings): method shift_tokens_right (line 1619) | def shift_tokens_right(self, input_ids, start_token_id=None): method get_nll (line 1628) | def get_nll(self, seq_logits, doc_scores, target, reduce_loss=False, e... FILE: src/transformers/models/rag/retrieval_rag.py class Index (line 43) | class Index: method get_doc_dicts (line 48) | def get_doc_dicts(self, doc_ids: np.ndarray) -> list[dict]: method get_top_docs (line 58) | def get_top_docs(self, question_hidden_states: np.ndarray, n_docs=5) -... method is_initialized (line 74) | def is_initialized(self): method init_index (line 80) | def init_index(self): class LegacyIndex (line 89) | class LegacyIndex(Index): method __init__ (line 104) | def __init__(self, vector_size, index_path): method _resolve_path (line 113) | def _resolve_path(self, index_path, filename): method _load_passages (line 131) | def _load_passages(self): method _deserialize_index (line 145) | def _deserialize_index(self): method is_initialized (line 163) | def is_initialized(self): method init_index (line 166) | def init_index(self): method get_doc_dicts (line 174) | def get_doc_dicts(self, doc_ids: np.ndarray): method get_top_docs (line 188) | def get_top_docs(self, question_hidden_states: np.ndarray, n_docs=5) -... class HFIndexBase (line 197) | class HFIndexBase(Index): method __init__ (line 198) | def __init__(self, vector_size, dataset, index_initialized=False): method _check_dataset_format (line 206) | def _check_dataset_format(self, with_index: bool): method init_index (line 221) | def init_index(self): method is_initialized (line 224) | def is_initialized(self): method get_doc_dicts (line 227) | def get_doc_dicts(self, doc_ids: np.ndarray) -> list[dict]: method get_top_docs (line 230) | def get_top_docs(self, question_hidden_states: np.ndarray, n_docs=5) -... class CanonicalHFIndex (line 240) | class CanonicalHFIndex(HFIndexBase): method __init__ (line 262) | def __init__( method init_index (line 291) | def init_index(self): class CustomHFIndex (line 310) | class CustomHFIndex(HFIndexBase): method __init__ (line 324) | def __init__(self, vector_size: int, dataset, index_path=None): method load_from_disk (line 330) | def load_from_disk(cls, vector_size, dataset_path, index_path): method init_index (line 340) | def init_index(self): class RagRetriever (line 347) | class RagRetriever: method __init__ (line 401) | def __init__(self, config, question_encoder_tokenizer, generator_token... method _build_index (line 420) | def _build_index(config): method from_pretrained (line 444) | def from_pretrained(cls, retriever_name_or_path, indexed_dataset=None,... method save_pretrained (line 462) | def save_pretrained(self, save_directory): method init_retrieval (line 482) | def init_retrieval(self): method postprocess_docs (line 490) | def postprocess_docs(self, docs, input_strings, prefix, n_docs, return... method _chunk_tensor (line 539) | def _chunk_tensor(self, t: Iterable, chunk_size: int) -> list[Iterable]: method _main_retrieve (line 542) | def _main_retrieve(self, question_hidden_states: np.ndarray, n_docs: i... method retrieve (line 559) | def retrieve(self, question_hidden_states: np.ndarray, n_docs: int) ->... method set_ctx_encoder_tokenizer (line 581) | def set_ctx_encoder_tokenizer(self, ctx_encoder_tokenizer: PreTrainedT... method __call__ (line 586) | def __call__( FILE: src/transformers/models/rag/tokenization_rag.py class RagTokenizer (line 25) | class RagTokenizer: method __init__ (line 26) | def __init__(self, question_encoder, generator): method save_pretrained (line 31) | def save_pretrained(self, save_directory): method from_pretrained (line 41) | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): method __call__ (line 58) | def __call__(self, *args, **kwargs): method batch_decode (line 61) | def batch_decode(self, *args, **kwargs): method decode (line 64) | def decode(self, *args, **kwargs): method _switch_to_input_mode (line 67) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 70) | def _switch_to_target_mode(self): FILE: src/transformers/models/recurrent_gemma/configuration_recurrent_gemma.py class RecurrentGemmaConfig (line 25) | class RecurrentGemmaConfig(PreTrainedConfig): method __post_init__ (line 82) | def __post_init__(self, **kwargs): method validate_architecture (line 93) | def validate_architecture(self): method layers_block_type (line 99) | def layers_block_type(self): FILE: src/transformers/models/recurrent_gemma/convert_recurrent_gemma_to_hf.py function write_model (line 71) | def write_model(save_path, input_base_path, config, push_to_hub=False, d... function write_tokenizer (line 143) | def write_tokenizer(input_tokenizer_path, save_path, push_to_hub=False): function main (line 154) | def main(): FILE: src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py class RecurrentGemmaRMSNorm (line 44) | class RecurrentGemmaRMSNorm(nn.Module): method __init__ (line 45) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 50) | def _norm(self, x): method forward (line 53) | def forward(self, x): method extra_repr (line 60) | def extra_repr(self): class RecurrentGemmaRotaryEmbedding (line 65) | class RecurrentGemmaRotaryEmbedding(nn.Module): method __init__ (line 69) | def __init__(self, config: RecurrentGemmaConfig, device=None): method compute_default_rope_parameters (line 87) | def compute_default_rope_parameters( method forward (line 120) | def forward(self, x, position_ids): function rotate_half (line 135) | def rotate_half(x): function apply_rotary_pos_emb (line 143) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 169) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class RecurrentGemmaSdpaAttention (line 181) | class RecurrentGemmaSdpaAttention(nn.Module): method __init__ (line 184) | def __init__(self, config: RecurrentGemmaConfig, layer_idx: int): method forward (line 202) | def forward( class SqrtBoundDerivative (line 250) | class SqrtBoundDerivative(torch.autograd.Function): method forward (line 254) | def forward(ctx, x: torch.Tensor) -> torch.Tensor: method backward (line 260) | def backward(ctx, grad_output: torch.Tensor) -> torch.Tensor: class RecurrentGemmaRglru (line 267) | class RecurrentGemmaRglru(nn.Module): method __init__ (line 270) | def __init__(self, config): method forward (line 287) | def forward( method _rnn_scan (line 328) | def _rnn_scan( class RecurrentGemmaRecurrentBlock (line 378) | class RecurrentGemmaRecurrentBlock(nn.Module): method __init__ (line 381) | def __init__(self, config: RecurrentGemmaConfig, layer_idx: int): method forward (line 401) | def forward( method _setup_cache (line 449) | def _setup_cache(self, batch, device, dtype): class RecurrentGemmaMlp (line 458) | class RecurrentGemmaMlp(nn.Module): method __init__ (line 459) | def __init__(self, config): method forward (line 469) | def forward(self, hidden_states): class RecurrentGemmaDecoderLayer (line 474) | class RecurrentGemmaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 477) | def __init__(self, config, layer_idx): method forward (line 484) | def forward( class RecurrentGemmaPreTrainedModel (line 515) | class RecurrentGemmaPreTrainedModel(PreTrainedModel): method _init_weights (line 525) | def _init_weights(self, module): method _setup_cache (line 578) | def _setup_cache(self, config, batch, device, dtype): function _get_seq_length (line 585) | def _get_seq_length(self, layer_idx: int = 0) -> int: function _get_mask_sizes (line 589) | def _get_mask_sizes(self, query_length: int, layer_idx: int) -> tuple[in... class RecurrentGemmaModel (line 594) | class RecurrentGemmaModel(RecurrentGemmaPreTrainedModel): method __init__ (line 595) | def __init__(self, config: RecurrentGemmaConfig): method forward (line 614) | def forward( class RecurrentGemmaForCausalLM (line 698) | class RecurrentGemmaForCausalLM(RecurrentGemmaPreTrainedModel, Generatio... method __init__ (line 701) | def __init__(self, config): method forward (line 712) | def forward( FILE: src/transformers/models/reformer/configuration_reformer.py class ReformerConfig (line 25) | class ReformerConfig(PreTrainedConfig): method __post_init__ (line 147) | def __post_init__(self, **kwargs): FILE: src/transformers/models/reformer/convert_reformer_trax_checkpoint_to_pytorch.py function set_param (line 33) | def set_param(torch_layer, weight, bias=None): function set_layer_weights_in_torch_lsh (line 42) | def set_layer_weights_in_torch_lsh(weights, torch_layer, hidden_size): function set_layer_weights_in_torch_local (line 62) | def set_layer_weights_in_torch_local(weights, torch_layer, hidden_size): function set_block_weights_in_torch (line 87) | def set_block_weights_in_torch(weights, torch_block, hidden_size): function set_model_weights_in_torch (line 140) | def set_model_weights_in_torch(weights, torch_model, hidden_size): function convert_trax_checkpoint_to_pytorch (line 187) | def convert_trax_checkpoint_to_pytorch(trax_model_pkl_path, config_file,... FILE: src/transformers/models/reformer/modeling_reformer.py class ReformerDynamicCache (line 64) | class ReformerDynamicCache: method __init__ (line 69) | def __init__(self, _distributed_cache_data: Iterable | None = None) ->... method __len__ (line 79) | def __len__(self): method update (line 86) | def update( method get_seq_length (line 131) | def get_seq_length(self, layer_idx: int | None = 0) -> int: method get_start_idx (line 134) | def get_start_idx(self) -> int: method reorder_cache (line 139) | def reorder_cache(self, beam_idx): function _stable_argsort (line 150) | def _stable_argsort(vector, dim): function _get_least_common_mult_chunk_len (line 159) | def _get_least_common_mult_chunk_len(config): function _get_min_chunk_len (line 175) | def _get_min_chunk_len(config): class AxialPositionEmbeddings (line 191) | class AxialPositionEmbeddings(nn.Module): method __init__ (line 196) | def __init__(self, config): method forward (line 221) | def forward(self, position_ids): class PositionEmbeddings (line 287) | class PositionEmbeddings(nn.Module): method __init__ (line 290) | def __init__(self, config): method forward (line 295) | def forward(self, position_ids): class ReformerEmbeddings (line 301) | class ReformerEmbeddings(nn.Module): method __init__ (line 304) | def __init__(self, config): method forward (line 314) | def forward(self, input_ids=None, position_ids=None, inputs_embeds=Non... class EfficientAttentionMixin (line 347) | class EfficientAttentionMixin: method _look_adjacent (line 352) | def _look_adjacent(self, vectors, num_chunks_before, num_chunks_after): method _split_hidden_size_dim (line 375) | def _split_hidden_size_dim(self, x, num_attn_heads, attn_head_size): method _merge_hidden_size_dims (line 383) | def _merge_hidden_size_dims(self, x, num_attn_heads, attn_head_size): method _split_seq_length_dim_to (line 390) | def _split_seq_length_dim_to(self, vectors, dim_factor_1, dim_factor_2... class LSHSelfAttention (line 405) | class LSHSelfAttention(nn.Module, EfficientAttentionMixin): method __init__ (line 406) | def __init__(self, config, layer_idx=None): method forward (line 437) | def forward( method _query_per_attn_head (line 672) | def _query_per_attn_head(self, hidden_states): method _value_per_attn_head (line 680) | def _value_per_attn_head(self, hidden_states): method _hash_vectors (line 688) | def _hash_vectors(self, vectors, num_hashes, attention_mask, increase_... method _get_sorted_bucket_idx_and_undo_sorted_bucket_idx (line 762) | def _get_sorted_bucket_idx_and_undo_sorted_bucket_idx(self, sequence_l... method _set_num_buckets (line 781) | def _set_num_buckets(self, sequence_length): method _attend (line 801) | def _attend( method _compute_attn_mask (line 908) | def _compute_attn_mask( method _get_relevant_hid_states_and_buckets (line 936) | def _get_relevant_hid_states_and_buckets( method _expand_to_indices_in_relevant_chunk (line 1022) | def _expand_to_indices_in_relevant_chunk(self, indices, sequence_length): method _len_and_dim_norm (line 1042) | def _len_and_dim_norm(self, vectors, sqrt_num): method _len_norm (line 1050) | def _len_norm(self, x, epsilon=1e-6): method _gather_by_expansion (line 1058) | def _gather_by_expansion(self, vectors, idxs, num_hashes): class ReverseSort (line 1067) | class ReverseSort(Function): method forward (line 1074) | def forward(ctx, out_vectors, logits, sorted_bucket_idx, undo_sorted_b... method backward (line 1086) | def backward(ctx, grad_out_vectors, grad_logits): class LocalSelfAttention (line 1099) | class LocalSelfAttention(nn.Module, EfficientAttentionMixin): method __init__ (line 1100) | def __init__(self, config, layer_idx=None): method forward (line 1126) | def forward( method _compute_attn_mask (line 1291) | def _compute_attn_mask( method _retrieve_relevant_hidden_states (line 1317) | def _retrieve_relevant_hidden_states(previous_hidden_states, chunk_len... class ReformerSelfOutput (line 1322) | class ReformerSelfOutput(nn.Module): method __init__ (line 1323) | def __init__(self, config): method forward (line 1330) | def forward(self, hidden_states): class ReformerAttention (line 1336) | class ReformerAttention(nn.Module): method __init__ (line 1337) | def __init__(self, config, layer_id=0): method forward (line 1361) | def forward( class ReformerFeedForwardDense (line 1423) | class ReformerFeedForwardDense(nn.Module): method __init__ (line 1424) | def __init__(self, config): method forward (line 1435) | def forward(self, hidden_states): class ReformerFeedForwardOutput (line 1442) | class ReformerFeedForwardOutput(nn.Module): method __init__ (line 1443) | def __init__(self, config): method forward (line 1449) | def forward(self, hidden_states): class ChunkReformerFeedForward (line 1455) | class ChunkReformerFeedForward(nn.Module): method __init__ (line 1456) | def __init__(self, config): method forward (line 1465) | def forward(self, attention_output): method forward_chunk (line 1473) | def forward_chunk(self, hidden_states): class ReformerLayer (line 1479) | class ReformerLayer(nn.Module): method __init__ (line 1480) | def __init__(self, config, layer_id=0): method _init_attention_seed (line 1490) | def _init_attention_seed(self): method _init_feed_forward_seed (line 1508) | def _init_feed_forward_seed(self): method forward (line 1525) | def forward( method backward_pass (line 1576) | def backward_pass( class _ReversibleFunction (line 1643) | class _ReversibleFunction(Function): method forward (line 1651) | def forward( method backward (line 1706) | def backward(ctx, grad_hidden_states): class ReformerEncoder (line 1750) | class ReformerEncoder(nn.Module): method __init__ (line 1751) | def __init__(self, config): method forward (line 1760) | def forward( class ReformerOnlyLMHead (line 1811) | class ReformerOnlyLMHead(nn.Module): method __init__ (line 1812) | def __init__(self, config): method forward (line 1821) | def forward(self, hidden_states): method forward_chunk (line 1824) | def forward_chunk(self, hidden_states): class ReformerPreTrainedModel (line 1830) | class ReformerPreTrainedModel(PreTrainedModel): method dummy_inputs (line 1835) | def dummy_inputs(self): method _init_weights (line 1845) | def _init_weights(self, module): class ReformerModelOutput (line 1867) | class ReformerModelOutput(ModelOutput): class ReformerModelWithLMHeadOutput (line 1895) | class ReformerModelWithLMHeadOutput(ModelOutput): class ReformerModel (line 1921) | class ReformerModel(ReformerPreTrainedModel): method __init__ (line 1922) | def __init__(self, config): method get_input_embeddings (line 1935) | def get_input_embeddings(self): method set_input_embeddings (line 1938) | def set_input_embeddings(self, value): method forward (line 1942) | def forward( method _pad_to_mult_of_chunk_length (line 2079) | def _pad_to_mult_of_chunk_length( class ReformerModelWithLMHead (line 2140) | class ReformerModelWithLMHead(ReformerPreTrainedModel, GenerationMixin): method __init__ (line 2141) | def __init__(self, config): method get_output_embeddings (line 2159) | def get_output_embeddings(self): method set_output_embeddings (line 2162) | def set_output_embeddings(self, new_embeddings): method forward (line 2167) | def forward( method _prepare_position_ids_for_generation (line 2246) | def _prepare_position_ids_for_generation(self, inputs_tensor, model_kw... method prepare_inputs_for_generation (line 2250) | def prepare_inputs_for_generation( class ReformerForMaskedLM (line 2278) | class ReformerForMaskedLM(ReformerPreTrainedModel): method __init__ (line 2279) | def __init__(self, config): method get_output_embeddings (line 2291) | def get_output_embeddings(self): method set_output_embeddings (line 2294) | def set_output_embeddings(self, new_embeddings): method forward (line 2299) | def forward( class ReformerForSequenceClassification (line 2416) | class ReformerForSequenceClassification(ReformerPreTrainedModel): method __init__ (line 2417) | def __init__(self, config): method forward (line 2431) | def forward( class ReformerClassificationHead (line 2544) | class ReformerClassificationHead(nn.Module): method __init__ (line 2547) | def __init__(self, config): method forward (line 2556) | def forward(self, hidden_states, **kwargs): class ReformerForQuestionAnswering (line 2567) | class ReformerForQuestionAnswering(ReformerPreTrainedModel): method __init__ (line 2568) | def __init__(self, config): method forward (line 2580) | def forward( FILE: src/transformers/models/reformer/tokenization_reformer.py class ReformerTokenizer (line 31) | class ReformerTokenizer(TokenizersBackend): method __init__ (line 70) | def __init__( FILE: src/transformers/models/regnet/configuration_regnet.py class RegNetConfig (line 24) | class RegNetConfig(PreTrainedConfig): method validate_architecture (line 60) | def validate_architecture(self): FILE: src/transformers/models/regnet/convert_regnet_seer_10b_to_pytorch.py class Tracker (line 45) | class Tracker: method _forward_hook (line 51) | def _forward_hook(self, m, inputs: Tensor, outputs: Tensor, name: str): method __call__ (line 57) | def __call__(self, x: Tensor): method parametrized (line 65) | def parametrized(self): class FakeRegNetVisslWrapper (line 70) | class FakeRegNetVisslWrapper(nn.Module): method __init__ (line 75) | def __init__(self, model: nn.Module): method forward (line 89) | def forward(self, x: Tensor): class FakeRegNetParams (line 97) | class FakeRegNetParams(RegNetParams): method get_expanded_params (line 103) | def get_expanded_params(self): function get_from_to_our_keys (line 107) | def get_from_to_our_keys(model_name: str) -> dict[str, str]: function convert_weights_and_push (line 160) | def convert_weights_and_push(save_directory: Path, model_name: str | Non... FILE: src/transformers/models/regnet/convert_regnet_to_pytorch.py class Tracker (line 40) | class Tracker: method _forward_hook (line 45) | def _forward_hook(self, m, inputs: Tensor, outputs: Tensor): method __call__ (line 50) | def __call__(self, x: Tensor): method parametrized (line 58) | def parametrized(self): class ModuleTransfer (line 64) | class ModuleTransfer: method __call__ (line 72) | def __call__(self, x: Tensor): class FakeRegNetVisslWrapper (line 95) | class FakeRegNetVisslWrapper(nn.Module): method __init__ (line 100) | def __init__(self, model: nn.Module): method forward (line 114) | def forward(self, x: Tensor): class NameToFromModelFuncMap (line 122) | class NameToFromModelFuncMap(dict): method convert_name_to_timm (line 127) | def convert_name_to_timm(self, x: str) -> str: method __getitem__ (line 131) | def __getitem__(self, x: str) -> Callable[[], tuple[nn.Module, dict]]: class NameToOurModelFuncMap (line 143) | class NameToOurModelFuncMap(dict): method __getitem__ (line 148) | def __getitem__(self, x: str) -> Callable[[], nn.Module]: function manually_copy_vissl_head (line 156) | def manually_copy_vissl_head(from_state_dict, to_state_dict, keys: list[... function convert_weight_and_push (line 163) | def convert_weight_and_push( function convert_weights_and_push (line 212) | def convert_weights_and_push(save_directory: Path, model_name: str | Non... FILE: src/transformers/models/regnet/modeling_regnet.py class RegNetConvLayer (line 36) | class RegNetConvLayer(nn.Module): method __init__ (line 37) | def __init__( method forward (line 59) | def forward(self, hidden_state): class RegNetEmbeddings (line 66) | class RegNetEmbeddings(nn.Module): method __init__ (line 71) | def __init__(self, config: RegNetConfig): method forward (line 78) | def forward(self, pixel_values): class RegNetShortCut (line 89) | class RegNetShortCut(nn.Module): method __init__ (line 95) | def __init__(self, in_channels: int, out_channels: int, stride: int = 2): method forward (line 100) | def forward(self, input: Tensor) -> Tensor: class RegNetSELayer (line 106) | class RegNetSELayer(nn.Module): method __init__ (line 111) | def __init__(self, in_channels: int, reduced_channels: int): method forward (line 122) | def forward(self, hidden_state): class RegNetXLayer (line 130) | class RegNetXLayer(nn.Module): method __init__ (line 135) | def __init__(self, config: RegNetConfig, in_channels: int, out_channel... method forward (line 149) | def forward(self, hidden_state): class RegNetYLayer (line 158) | class RegNetYLayer(nn.Module): method __init__ (line 163) | def __init__(self, config: RegNetConfig, in_channels: int, out_channel... method forward (line 178) | def forward(self, hidden_state): class RegNetStage (line 187) | class RegNetStage(nn.Module): method __init__ (line 192) | def __init__( method forward (line 215) | def forward(self, hidden_state): class RegNetEncoder (line 220) | class RegNetEncoder(nn.Module): method __init__ (line 221) | def __init__(self, config: RegNetConfig): method forward (line 238) | def forward( class RegNetPreTrainedModel (line 259) | class RegNetPreTrainedModel(PreTrainedModel): method _init_weights (line 266) | def _init_weights(self, module): class RegNetModel (line 287) | class RegNetModel(RegNetPreTrainedModel): method __init__ (line 288) | def __init__(self, config): method forward (line 298) | def forward( class RegNetForImageClassification (line 337) | class RegNetForImageClassification(RegNetPreTrainedModel): method __init__ (line 338) | def __init__(self, config): method forward (line 351) | def forward( FILE: src/transformers/models/rembert/configuration_rembert.py class RemBertConfig (line 24) | class RemBertConfig(PreTrainedConfig): FILE: src/transformers/models/rembert/convert_rembert_tf_checkpoint_to_pytorch.py function load_tf_weights_in_rembert (line 29) | def load_tf_weights_in_rembert(model, config, tf_checkpoint_path): function convert_rembert_tf_checkpoint_to_pytorch (line 112) | def convert_rembert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_co... FILE: src/transformers/models/rembert/modeling_rembert.py class RemBertEmbeddings (line 46) | class RemBertEmbeddings(nn.Module): method __init__ (line 49) | def __init__(self, config): method forward (line 65) | def forward( class RemBertPooler (line 99) | class RemBertPooler(nn.Module): method __init__ (line 100) | def __init__(self, config): method forward (line 105) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RemBertSelfAttention (line 114) | class RemBertSelfAttention(nn.Module): method __init__ (line 115) | def __init__(self, config, layer_idx=None): method forward (line 136) | def forward( class RemBertSelfOutput (line 214) | class RemBertSelfOutput(nn.Module): method __init__ (line 215) | def __init__(self, config): method forward (line 221) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RemBertAttention (line 228) | class RemBertAttention(nn.Module): method __init__ (line 229) | def __init__(self, config, layer_idx=None): method forward (line 234) | def forward( class RemBertIntermediate (line 256) | class RemBertIntermediate(nn.Module): method __init__ (line 257) | def __init__(self, config): method forward (line 265) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RemBertOutput (line 272) | class RemBertOutput(nn.Module): method __init__ (line 273) | def __init__(self, config): method forward (line 279) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RemBertLayer (line 286) | class RemBertLayer(GradientCheckpointingLayer): method __init__ (line 287) | def __init__(self, config, layer_idx=None): method forward (line 302) | def forward( method feed_forward_chunk (line 346) | def feed_forward_chunk(self, attention_output): class RemBertEncoder (line 352) | class RemBertEncoder(nn.Module): method __init__ (line 353) | def __init__(self, config): method forward (line 361) | def forward( class RemBertPredictionHeadTransform (line 433) | class RemBertPredictionHeadTransform(nn.Module): method __init__ (line 434) | def __init__(self, config): method forward (line 443) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RemBertLMPredictionHead (line 450) | class RemBertLMPredictionHead(nn.Module): method __init__ (line 451) | def __init__(self, config): method forward (line 458) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RemBertOnlyMLMHead (line 467) | class RemBertOnlyMLMHead(nn.Module): method __init__ (line 468) | def __init__(self, config): method forward (line 472) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class RemBertPreTrainedModel (line 478) | class RemBertPreTrainedModel(PreTrainedModel): method _init_weights (line 483) | def _init_weights(self, module): class RemBertModel (line 501) | class RemBertModel(RemBertPreTrainedModel): method __init__ (line 502) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 518) | def get_input_embeddings(self): method set_input_embeddings (line 521) | def set_input_embeddings(self, value): method forward (line 525) | def forward( class RemBertForMaskedLM (line 622) | class RemBertForMaskedLM(RemBertPreTrainedModel): method __init__ (line 623) | def __init__(self, config): method get_output_embeddings (line 638) | def get_output_embeddings(self): method set_output_embeddings (line 641) | def set_output_embeddings(self, new_embeddings): method forward (line 645) | def forward( class RemBertForCausalLM (line 706) | class RemBertForCausalLM(RemBertPreTrainedModel, GenerationMixin): method __init__ (line 707) | def __init__(self, config): method get_output_embeddings (line 719) | def get_output_embeddings(self): method set_output_embeddings (line 722) | def set_output_embeddings(self, new_embeddings): method forward (line 726) | def forward( class RemBertForSequenceClassification (line 812) | class RemBertForSequenceClassification(RemBertPreTrainedModel): method __init__ (line 813) | def __init__(self, config): method forward (line 824) | def forward( class RemBertForMultipleChoice (line 896) | class RemBertForMultipleChoice(RemBertPreTrainedModel): method __init__ (line 897) | def __init__(self, config): method forward (line 908) | def forward( class RemBertForTokenClassification (line 999) | class RemBertForTokenClassification(RemBertPreTrainedModel): method __init__ (line 1000) | def __init__(self, config): method forward (line 1012) | def forward( class RemBertForQuestionAnswering (line 1065) | class RemBertForQuestionAnswering(RemBertPreTrainedModel): method __init__ (line 1066) | def __init__(self, config): method forward (line 1078) | def forward( FILE: src/transformers/models/rembert/tokenization_rembert.py class RemBertTokenizer (line 28) | class RemBertTokenizer(TokenizersBackend): method __init__ (line 76) | def __init__( FILE: src/transformers/models/resnet/configuration_resnet.py class ResNetConfig (line 27) | class ResNetConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 64) | def __post_init__(self, **kwargs): method validate_layer_type (line 72) | def validate_layer_type(self): FILE: src/transformers/models/resnet/convert_resnet_to_pytorch.py class Tracker (line 37) | class Tracker: method _forward_hook (line 42) | def _forward_hook(self, m, inputs: Tensor, outputs: Tensor): method __call__ (line 47) | def __call__(self, x: Tensor): method parametrized (line 55) | def parametrized(self): class ModuleTransfer (line 61) | class ModuleTransfer: method __call__ (line 68) | def __call__(self, x: Tensor): function convert_weight_and_push (line 91) | def convert_weight_and_push(name: str, config: ResNetConfig, save_direct... function convert_weights_and_push (line 115) | def convert_weights_and_push(save_directory: Path, model_name: str | Non... FILE: src/transformers/models/resnet/modeling_resnet.py class ResNetConvLayer (line 39) | class ResNetConvLayer(nn.Module): method __init__ (line 40) | def __init__( method forward (line 50) | def forward(self, input: Tensor) -> Tensor: class ResNetEmbeddings (line 57) | class ResNetEmbeddings(nn.Module): method __init__ (line 62) | def __init__(self, config: ResNetConfig): method forward (line 70) | def forward(self, pixel_values: Tensor) -> Tensor: class ResNetShortCut (line 81) | class ResNetShortCut(nn.Module): method __init__ (line 87) | def __init__(self, in_channels: int, out_channels: int, stride: int = 2): method forward (line 92) | def forward(self, input: Tensor) -> Tensor: class ResNetBasicLayer (line 98) | class ResNetBasicLayer(nn.Module): method __init__ (line 103) | def __init__(self, in_channels: int, out_channels: int, stride: int = ... method forward (line 115) | def forward(self, hidden_state): class ResNetBottleNeckLayer (line 124) | class ResNetBottleNeckLayer(nn.Module): method __init__ (line 133) | def __init__( method forward (line 157) | def forward(self, hidden_state): class ResNetStage (line 166) | class ResNetStage(nn.Module): method __init__ (line 171) | def __init__( method forward (line 197) | def forward(self, input: Tensor) -> Tensor: class ResNetEncoder (line 204) | class ResNetEncoder(nn.Module): method __init__ (line 205) | def __init__(self, config: ResNetConfig): method forward (line 222) | def forward( class ResNetPreTrainedModel (line 246) | class ResNetPreTrainedModel(PreTrainedModel): method _init_weights (line 254) | def _init_weights(self, module): class ResNetModel (line 275) | class ResNetModel(ResNetPreTrainedModel): method __init__ (line 276) | def __init__(self, config): method forward (line 286) | def forward( class ResNetForImageClassification (line 324) | class ResNetForImageClassification(ResNetPreTrainedModel): method __init__ (line 325) | def __init__(self, config): method forward (line 338) | def forward( class ResNetBackbone (line 376) | class ResNetBackbone(BackboneMixin, ResNetPreTrainedModel): method __init__ (line 379) | def __init__(self, config): method forward (line 392) | def forward( FILE: src/transformers/models/roberta/configuration_roberta.py class RobertaConfig (line 25) | class RobertaConfig(PreTrainedConfig): FILE: src/transformers/models/roberta/convert_roberta_original_pytorch_checkpoint_to_pytorch.py function convert_roberta_checkpoint_to_pytorch (line 46) | def convert_roberta_checkpoint_to_pytorch( FILE: src/transformers/models/roberta/modeling_roberta.py class RobertaEmbeddings (line 56) | class RobertaEmbeddings(nn.Module): method __init__ (line 59) | def __init__(self, config): method forward (line 79) | def forward( method create_position_ids_from_inputs_embeds (line 128) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 146) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 162) | def eager_attention_forward( class RobertaSelfAttention (line 190) | class RobertaSelfAttention(nn.Module): method __init__ (line 191) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 215) | def forward( class RobertaCrossAttention (line 257) | class RobertaCrossAttention(nn.Module): method __init__ (line 258) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 281) | def forward( class RobertaSelfOutput (line 334) | class RobertaSelfOutput(nn.Module): method __init__ (line 335) | def __init__(self, config): method forward (line 341) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RobertaAttention (line 348) | class RobertaAttention(nn.Module): method __init__ (line 349) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 356) | def forward( class RobertaIntermediate (line 377) | class RobertaIntermediate(nn.Module): method __init__ (line 378) | def __init__(self, config): method forward (line 386) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RobertaOutput (line 392) | class RobertaOutput(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 399) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RobertaLayer (line 406) | class RobertaLayer(GradientCheckpointingLayer): method __init__ (line 407) | def __init__(self, config, layer_idx=None): method forward (line 426) | def forward( method feed_forward_chunk (line 465) | def feed_forward_chunk(self, attention_output): class RobertaPreTrainedModel (line 472) | class RobertaPreTrainedModel(PreTrainedModel): method _init_weights (line 487) | def _init_weights(self, module): class RobertaEncoder (line 497) | class RobertaEncoder(nn.Module): method __init__ (line 498) | def __init__(self, config): method forward (line 503) | def forward( class RobertaPooler (line 529) | class RobertaPooler(nn.Module): method __init__ (line 530) | def __init__(self, config): method forward (line 535) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RobertaModel (line 556) | class RobertaModel(RobertaPreTrainedModel): method __init__ (line 559) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 576) | def get_input_embeddings(self): method set_input_embeddings (line 579) | def set_input_embeddings(self, value): method forward (line 585) | def forward( method _create_attention_masks (line 650) | def _create_attention_masks( class RobertaForCausalLM (line 688) | class RobertaForCausalLM(RobertaPreTrainedModel, GenerationMixin): method __init__ (line 694) | def __init__(self, config): method get_output_embeddings (line 706) | def get_output_embeddings(self): method set_output_embeddings (line 709) | def set_output_embeddings(self, new_embeddings): method forward (line 714) | def forward( class RobertaForMaskedLM (line 797) | class RobertaForMaskedLM(RobertaPreTrainedModel): method __init__ (line 803) | def __init__(self, config): method get_output_embeddings (line 818) | def get_output_embeddings(self): method set_output_embeddings (line 821) | def set_output_embeddings(self, new_embeddings): method forward (line 826) | def forward( class RobertaLMHead (line 882) | class RobertaLMHead(nn.Module): method __init__ (line 885) | def __init__(self, config): method forward (line 893) | def forward(self, features, **kwargs): class RobertaForSequenceClassification (line 910) | class RobertaForSequenceClassification(RobertaPreTrainedModel): method __init__ (line 911) | def __init__(self, config): method forward (line 924) | def forward( class RobertaForMultipleChoice (line 995) | class RobertaForMultipleChoice(RobertaPreTrainedModel): method __init__ (line 996) | def __init__(self, config): method forward (line 1008) | def forward( class RobertaForTokenClassification (line 1092) | class RobertaForTokenClassification(RobertaPreTrainedModel): method __init__ (line 1093) | def __init__(self, config): method forward (line 1109) | def forward( class RobertaClassificationHead (line 1162) | class RobertaClassificationHead(nn.Module): method __init__ (line 1165) | def __init__(self, config): method forward (line 1174) | def forward(self, features, **kwargs): class RobertaForQuestionAnswering (line 1185) | class RobertaForQuestionAnswering(RobertaPreTrainedModel): method __init__ (line 1186) | def __init__(self, config): method forward (line 1198) | def forward( FILE: src/transformers/models/roberta/modular_roberta.py class RobertaEmbeddings (line 44) | class RobertaEmbeddings(BertEmbeddings): method __init__ (line 45) | def __init__(self, config): method forward (line 56) | def forward( method create_position_ids_from_inputs_embeds (line 105) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 123) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class RobertaSelfAttention (line 139) | class RobertaSelfAttention(BertSelfAttention): class RobertaCrossAttention (line 143) | class RobertaCrossAttention(BertCrossAttention): class RobertaLayer (line 147) | class RobertaLayer(BertLayer): class RobertaPreTrainedModel (line 152) | class RobertaPreTrainedModel(PreTrainedModel): method _init_weights (line 167) | def _init_weights(self, module): class RobertaModel (line 177) | class RobertaModel(BertModel): method __init__ (line 178) | def __init__(self, config, add_pooling_layer=True): class RobertaForCausalLM (line 187) | class RobertaForCausalLM(RobertaPreTrainedModel, GenerationMixin): method __init__ (line 193) | def __init__(self, config): method get_output_embeddings (line 205) | def get_output_embeddings(self): method set_output_embeddings (line 208) | def set_output_embeddings(self, new_embeddings): method forward (line 213) | def forward( class RobertaForMaskedLM (line 296) | class RobertaForMaskedLM(RobertaPreTrainedModel): method __init__ (line 302) | def __init__(self, config): method get_output_embeddings (line 317) | def get_output_embeddings(self): method set_output_embeddings (line 320) | def set_output_embeddings(self, new_embeddings): method forward (line 325) | def forward( class RobertaLMHead (line 381) | class RobertaLMHead(nn.Module): method __init__ (line 384) | def __init__(self, config): method forward (line 392) | def forward(self, features, **kwargs): class RobertaForSequenceClassification (line 409) | class RobertaForSequenceClassification(RobertaPreTrainedModel): method __init__ (line 410) | def __init__(self, config): method forward (line 423) | def forward( class RobertaForMultipleChoice (line 494) | class RobertaForMultipleChoice(RobertaPreTrainedModel): method __init__ (line 495) | def __init__(self, config): method forward (line 507) | def forward( class RobertaForTokenClassification (line 591) | class RobertaForTokenClassification(RobertaPreTrainedModel): method __init__ (line 592) | def __init__(self, config): method forward (line 608) | def forward( class RobertaClassificationHead (line 661) | class RobertaClassificationHead(nn.Module): method __init__ (line 664) | def __init__(self, config): method forward (line 673) | def forward(self, features, **kwargs): class RobertaForQuestionAnswering (line 684) | class RobertaForQuestionAnswering(RobertaPreTrainedModel): method __init__ (line 685) | def __init__(self, config): method forward (line 697) | def forward( FILE: src/transformers/models/roberta/tokenization_roberta.py class RobertaTokenizer (line 28) | class RobertaTokenizer(TokenizersBackend): method __init__ (line 112) | def __init__( FILE: src/transformers/models/roberta/tokenization_roberta_old.py class RobertaTokenizerFast (line 31) | class RobertaTokenizerFast(PreTrainedTokenizerFast): method __init__ (line 116) | def __init__( method mask_token (line 182) | def mask_token(self) -> str: method mask_token (line 197) | def mask_token(self, value): method _batch_encode_plus (line 208) | def _batch_encode_plus(self, *args, **kwargs) -> BatchEncoding: method _encode_plus (line 217) | def _encode_plus(self, *args, **kwargs) -> BatchEncoding: method save_vocabulary (line 227) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method build_inputs_with_special_tokens (line 231) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method create_token_type_ids_from_sequences (line 238) | def create_token_type_ids_from_sequences( FILE: src/transformers/models/roberta_prelayernorm/configuration_roberta_prelayernorm.py class RobertaPreLayerNormConfig (line 26) | class RobertaPreLayerNormConfig(PreTrainedConfig): FILE: src/transformers/models/roberta_prelayernorm/convert_roberta_prelayernorm_original_pytorch_checkpoint_to_pytorch.py function convert_roberta_prelayernorm_checkpoint_to_pytorch (line 29) | def convert_roberta_prelayernorm_checkpoint_to_pytorch(checkpoint_repo: ... FILE: src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py class RobertaPreLayerNormEmbeddings (line 52) | class RobertaPreLayerNormEmbeddings(nn.Module): method __init__ (line 55) | def __init__(self, config): method forward (line 75) | def forward( method create_position_ids_from_inputs_embeds (line 124) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 142) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 159) | def eager_attention_forward( class RobertaPreLayerNormSelfAttention (line 188) | class RobertaPreLayerNormSelfAttention(nn.Module): method __init__ (line 189) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 213) | def forward( class RobertaPreLayerNormCrossAttention (line 256) | class RobertaPreLayerNormCrossAttention(nn.Module): method __init__ (line 257) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 280) | def forward( class RobertaPreLayerNormSelfOutput (line 333) | class RobertaPreLayerNormSelfOutput(nn.Module): method __init__ (line 334) | def __init__(self, config): method forward (line 339) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RobertaPreLayerNormAttention (line 346) | class RobertaPreLayerNormAttention(nn.Module): method __init__ (line 347) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 355) | def forward( class RobertaPreLayerNormIntermediate (line 377) | class RobertaPreLayerNormIntermediate(nn.Module): method __init__ (line 378) | def __init__(self, config): method forward (line 387) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RobertaPreLayerNormOutput (line 394) | class RobertaPreLayerNormOutput(nn.Module): method __init__ (line 395) | def __init__(self, config): method forward (line 400) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RobertaPreLayerNormLayer (line 408) | class RobertaPreLayerNormLayer(GradientCheckpointingLayer): method __init__ (line 409) | def __init__(self, config, layer_idx=None): method forward (line 428) | def forward( method feed_forward_chunk (line 467) | def feed_forward_chunk(self, attention_output): class RobertaPreLayerNormEncoder (line 474) | class RobertaPreLayerNormEncoder(nn.Module): method __init__ (line 475) | def __init__(self, config): method forward (line 482) | def forward( class RobertaPreLayerNormPooler (line 509) | class RobertaPreLayerNormPooler(nn.Module): method __init__ (line 510) | def __init__(self, config): method forward (line 515) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RobertaPreLayerNormPreTrainedModel (line 525) | class RobertaPreLayerNormPreTrainedModel(PreTrainedModel): method _init_weights (line 545) | def _init_weights(self, module): class RobertaPreLayerNormModel (line 570) | class RobertaPreLayerNormModel(RobertaPreLayerNormPreTrainedModel): method __init__ (line 571) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 589) | def get_input_embeddings(self): method set_input_embeddings (line 592) | def set_input_embeddings(self, value): method forward (line 598) | def forward( method _create_attention_masks (line 676) | def _create_attention_masks( class RobertaPreLayerNormForCausalLM (line 715) | class RobertaPreLayerNormForCausalLM(RobertaPreLayerNormPreTrainedModel,... method __init__ (line 721) | def __init__(self, config): method get_output_embeddings (line 735) | def get_output_embeddings(self): method set_output_embeddings (line 738) | def set_output_embeddings(self, new_embeddings): method forward (line 743) | def forward( class RobertaPreLayerNormForMaskedLM (line 830) | class RobertaPreLayerNormForMaskedLM(RobertaPreLayerNormPreTrainedModel): method __init__ (line 837) | def __init__(self, config): method get_output_embeddings (line 852) | def get_output_embeddings(self): method set_output_embeddings (line 855) | def set_output_embeddings(self, new_embeddings): method forward (line 861) | def forward( class RobertaPreLayerNormLMHead (line 918) | class RobertaPreLayerNormLMHead(nn.Module): method __init__ (line 921) | def __init__(self, config): method forward (line 929) | def forward(self, features, **kwargs): class RobertaPreLayerNormForSequenceClassification (line 946) | class RobertaPreLayerNormForSequenceClassification(RobertaPreLayerNormPr... method __init__ (line 947) | def __init__(self, config): method forward (line 961) | def forward( class RobertaPreLayerNormForMultipleChoice (line 1033) | class RobertaPreLayerNormForMultipleChoice(RobertaPreLayerNormPreTrained... method __init__ (line 1034) | def __init__(self, config): method forward (line 1046) | def forward( class RobertaPreLayerNormForTokenClassification (line 1130) | class RobertaPreLayerNormForTokenClassification(RobertaPreLayerNormPreTr... method __init__ (line 1131) | def __init__(self, config): method forward (line 1148) | def forward( class RobertaPreLayerNormClassificationHead (line 1202) | class RobertaPreLayerNormClassificationHead(nn.Module): method __init__ (line 1205) | def __init__(self, config): method forward (line 1214) | def forward(self, features, **kwargs): class RobertaPreLayerNormForQuestionAnswering (line 1225) | class RobertaPreLayerNormForQuestionAnswering(RobertaPreLayerNormPreTrai... method __init__ (line 1226) | def __init__(self, config): method forward (line 1239) | def forward( FILE: src/transformers/models/roc_bert/configuration_roc_bert.py class RoCBertConfig (line 24) | class RoCBertConfig(PreTrainedConfig): FILE: src/transformers/models/roc_bert/modeling_roc_bert.py class RoCBertEmbeddings (line 50) | class RoCBertEmbeddings(nn.Module): method __init__ (line 53) | def __init__(self, config): method forward (line 93) | def forward( function eager_attention_forward (line 178) | def eager_attention_forward( class RoCBertSelfAttention (line 207) | class RoCBertSelfAttention(nn.Module): method __init__ (line 208) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 232) | def forward( class RoCBertCrossAttention (line 275) | class RoCBertCrossAttention(nn.Module): method __init__ (line 276) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 299) | def forward( class RoCBertSelfOutput (line 353) | class RoCBertSelfOutput(nn.Module): method __init__ (line 354) | def __init__(self, config): method forward (line 360) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RoCBertAttention (line 368) | class RoCBertAttention(nn.Module): method __init__ (line 369) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 376) | def forward( class RoCBertIntermediate (line 398) | class RoCBertIntermediate(nn.Module): method __init__ (line 399) | def __init__(self, config): method forward (line 407) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RoCBertOutput (line 414) | class RoCBertOutput(nn.Module): method __init__ (line 415) | def __init__(self, config): method forward (line 421) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RoCBertLayer (line 429) | class RoCBertLayer(GradientCheckpointingLayer): method __init__ (line 430) | def __init__(self, config, layer_idx=None): method forward (line 449) | def forward( method feed_forward_chunk (line 488) | def feed_forward_chunk(self, attention_output): class RoCBertEncoder (line 495) | class RoCBertEncoder(nn.Module): method __init__ (line 496) | def __init__(self, config): method forward (line 501) | def forward( class RoCBertPooler (line 528) | class RoCBertPooler(nn.Module): method __init__ (line 529) | def __init__(self, config): method forward (line 534) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RoCBertPredictionHeadTransform (line 544) | class RoCBertPredictionHeadTransform(nn.Module): method __init__ (line 545) | def __init__(self, config): method forward (line 554) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RoCBertLMPredictionHead (line 562) | class RoCBertLMPredictionHead(nn.Module): method __init__ (line 563) | def __init__(self, config): method forward (line 572) | def forward(self, hidden_states): class RoCBertOnlyMLMHead (line 579) | class RoCBertOnlyMLMHead(nn.Module): method __init__ (line 580) | def __init__(self, config): method forward (line 584) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class RoCBertPreTrainedModel (line 590) | class RoCBertPreTrainedModel(PreTrainedModel): method _init_weights (line 605) | def _init_weights(self, module): class RoCBertModel (line 628) | class RoCBertModel(RoCBertPreTrainedModel): method __init__ (line 629) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 647) | def get_input_embeddings(self): method set_input_embeddings (line 651) | def set_input_embeddings(self, value): method get_pronunciation_embeddings (line 654) | def get_pronunciation_embeddings(self): method set_pronunciation_embeddings (line 657) | def set_pronunciation_embeddings(self, value): method get_shape_embeddings (line 660) | def get_shape_embeddings(self): method set_shape_embeddings (line 663) | def set_shape_embeddings(self, value): method forward (line 669) | def forward( method _create_attention_masks (line 751) | def _create_attention_masks( class RoCBertForPreTraining (line 789) | class RoCBertForPreTraining(RoCBertPreTrainedModel): method __init__ (line 795) | def __init__(self, config): method get_output_embeddings (line 805) | def get_output_embeddings(self): method set_output_embeddings (line 809) | def set_output_embeddings(self, new_embeddings): method forward (line 815) | def forward( class RoCBertForMaskedLM (line 985) | class RoCBertForMaskedLM(RoCBertPreTrainedModel): method __init__ (line 992) | def __init__(self, config): method get_output_embeddings (line 1008) | def get_output_embeddings(self): method set_output_embeddings (line 1012) | def set_output_embeddings(self, new_embeddings): method forward (line 1018) | def forward( class RoCBertForCausalLM (line 1108) | class RoCBertForCausalLM(RoCBertPreTrainedModel, GenerationMixin): method __init__ (line 1115) | def __init__(self, config): method get_output_embeddings (line 1128) | def get_output_embeddings(self): method set_output_embeddings (line 1132) | def set_output_embeddings(self, new_embeddings): method forward (line 1138) | def forward( method prepare_inputs_for_generation (line 1226) | def prepare_inputs_for_generation( class RoCBertForSequenceClassification (line 1260) | class RoCBertForSequenceClassification(RoCBertPreTrainedModel): method __init__ (line 1262) | def __init__(self, config): method forward (line 1279) | def forward( class RoCBertForMultipleChoice (line 1360) | class RoCBertForMultipleChoice(RoCBertPreTrainedModel): method __init__ (line 1362) | def __init__(self, config): method forward (line 1377) | def forward( class RoCBertForTokenClassification (line 1483) | class RoCBertForTokenClassification(RoCBertPreTrainedModel): method __init__ (line 1485) | def __init__(self, config): method forward (line 1501) | def forward( class RoCBertForQuestionAnswering (line 1562) | class RoCBertForQuestionAnswering(RoCBertPreTrainedModel): method __init__ (line 1564) | def __init__(self, config): method forward (line 1576) | def forward( FILE: src/transformers/models/roc_bert/tokenization_roc_bert.py function load_vocab (line 49) | def load_vocab(vocab_file): function whitespace_tokenize (line 60) | def whitespace_tokenize(text): class RoCBertTokenizer (line 69) | class RoCBertTokenizer(PreTrainedTokenizer): method __init__ (line 113) | def __init__( method __call__ (line 171) | def __call__( method encode_plus (line 296) | def encode_plus( method batch_encode_plus (line 349) | def batch_encode_plus( method do_lower_case (line 406) | def do_lower_case(self): method vocab_size (line 410) | def vocab_size(self): method get_vocab (line 413) | def get_vocab(self): method _tokenize (line 416) | def _tokenize(self, text, split_special_tokens=False): method _encode_plus (line 431) | def _encode_plus( method prepare_for_model (line 528) | def prepare_for_model( method _pad (line 710) | def _pad( method _batch_encode_plus (line 772) | def _batch_encode_plus( method _batch_prepare_for_model (line 877) | def _batch_prepare_for_model( method _convert_token_to_id (line 960) | def _convert_token_to_id(self, token): method _convert_token_to_shape_id (line 964) | def _convert_token_to_shape_id(self, token): method convert_tokens_to_shape_ids (line 968) | def convert_tokens_to_shape_ids(self, tokens: str | list[str]) -> int ... method _convert_token_to_pronunciation_id (line 977) | def _convert_token_to_pronunciation_id(self, token): method convert_tokens_to_pronunciation_ids (line 981) | def convert_tokens_to_pronunciation_ids(self, tokens: str | list[str])... method _convert_id_to_token (line 990) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 994) | def convert_tokens_to_string(self, tokens): method build_inputs_with_special_tokens (line 999) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 1028) | def get_special_tokens_mask( method save_vocabulary (line 1056) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... class RoCBertBasicTokenizer (line 1101) | class RoCBertBasicTokenizer: method __init__ (line 1124) | def __init__( method tokenize (line 1140) | def tokenize(self, text, never_split=None): method _run_strip_accents (line 1178) | def _run_strip_accents(self, text): method _run_split_on_punc (line 1189) | def _run_split_on_punc(self, text, never_split=None): method _tokenize_chinese_chars (line 1211) | def _tokenize_chinese_chars(self, text): method _is_chinese_char (line 1224) | def _is_chinese_char(self, cp): method _clean_text (line 1248) | def _clean_text(self, text): class RoCBertWordpieceTokenizer (line 1262) | class RoCBertWordpieceTokenizer: method __init__ (line 1265) | def __init__(self, vocab, unk_token, max_input_chars_per_word=100): method tokenize (line 1270) | def tokenize(self, text): FILE: src/transformers/models/roformer/configuration_roformer.py class RoFormerConfig (line 24) | class RoFormerConfig(PreTrainedConfig): method __post_init__ (line 68) | def __post_init__(self, **kwargs): FILE: src/transformers/models/roformer/convert_roformer_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_roformer (line 29) | def load_tf_weights_in_roformer(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 102) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_fil... FILE: src/transformers/models/roformer/modeling_roformer.py class RoFormerSinusoidalPositionalEmbedding (line 48) | class RoFormerSinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 51) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method create_weight (line 54) | def create_weight(self): method forward (line 70) | def forward( class RoFormerEmbeddings (line 82) | class RoFormerEmbeddings(nn.Module): method __init__ (line 85) | def __init__(self, config): method forward (line 93) | def forward(self, input_ids=None, token_type_ids=None, inputs_embeds=N... class RoFormerSelfAttention (line 114) | class RoFormerSelfAttention(nn.Module): method __init__ (line 115) | def __init__(self, config, layer_idx=None): method forward (line 137) | def forward( method apply_rotary_position_embeddings (line 229) | def apply_rotary_position_embeddings(sinusoidal_pos, query_layer, key_... class RoFormerSelfOutput (line 257) | class RoFormerSelfOutput(nn.Module): method __init__ (line 258) | def __init__(self, config): method forward (line 264) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RoFormerAttention (line 271) | class RoFormerAttention(nn.Module): method __init__ (line 272) | def __init__(self, config, layer_idx=None): method forward (line 277) | def forward( class RoFormerIntermediate (line 301) | class RoFormerIntermediate(nn.Module): method __init__ (line 302) | def __init__(self, config): method forward (line 310) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RoFormerOutput (line 317) | class RoFormerOutput(nn.Module): method __init__ (line 318) | def __init__(self, config): method forward (line 324) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class RoFormerLayer (line 331) | class RoFormerLayer(GradientCheckpointingLayer): method __init__ (line 332) | def __init__(self, config, layer_idx=None): method forward (line 346) | def forward( method feed_forward_chunk (line 390) | def feed_forward_chunk(self, attention_output): class RoFormerEncoder (line 396) | class RoFormerEncoder(nn.Module): method __init__ (line 397) | def __init__(self, config): method forward (line 406) | def forward( class RoFormerSequenceSummary (line 480) | class RoFormerSequenceSummary(nn.Module): method __init__ (line 506) | def __init__(self, config: RoFormerConfig): method forward (line 535) | def forward( class RoFormerPredictionHeadTransform (line 579) | class RoFormerPredictionHeadTransform(nn.Module): method __init__ (line 580) | def __init__(self, config): method forward (line 589) | def forward(self, hidden_states): class RoFormerLMPredictionHead (line 596) | class RoFormerLMPredictionHead(nn.Module): method __init__ (line 597) | def __init__(self, config): method forward (line 607) | def forward(self, hidden_states): class RoFormerOnlyMLMHead (line 614) | class RoFormerOnlyMLMHead(nn.Module): method __init__ (line 615) | def __init__(self, config): method forward (line 619) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class RoFormerPreTrainedModel (line 625) | class RoFormerPreTrainedModel(PreTrainedModel): method _init_weights (line 631) | def _init_weights(self, module): class RoFormerModel (line 652) | class RoFormerModel(RoFormerPreTrainedModel): method __init__ (line 653) | def __init__(self, config): method get_input_embeddings (line 666) | def get_input_embeddings(self): method set_input_embeddings (line 669) | def set_input_embeddings(self, value): method forward (line 673) | def forward( class RoFormerForMaskedLM (line 773) | class RoFormerForMaskedLM(RoFormerPreTrainedModel): method __init__ (line 779) | def __init__(self, config): method get_output_embeddings (line 794) | def get_output_embeddings(self): method set_output_embeddings (line 797) | def set_output_embeddings(self, new_embeddings): method forward (line 802) | def forward( class RoFormerForCausalLM (line 861) | class RoFormerForCausalLM(RoFormerPreTrainedModel, GenerationMixin): method __init__ (line 867) | def __init__(self, config): method get_output_embeddings (line 879) | def get_output_embeddings(self): method set_output_embeddings (line 882) | def set_output_embeddings(self, new_embeddings): method forward (line 887) | def forward( class RoFormerClassificationHead (line 965) | class RoFormerClassificationHead(nn.Module): method __init__ (line 968) | def __init__(self, config): method forward (line 976) | def forward(self, features, **kwargs): class RoFormerForSequenceClassification (line 992) | class RoFormerForSequenceClassification(RoFormerPreTrainedModel): method __init__ (line 993) | def __init__(self, config): method forward (line 1003) | def forward( class RoFormerForMultipleChoice (line 1071) | class RoFormerForMultipleChoice(RoFormerPreTrainedModel): method __init__ (line 1072) | def __init__(self, config): method forward (line 1083) | def forward( class RoFormerForTokenClassification (line 1167) | class RoFormerForTokenClassification(RoFormerPreTrainedModel): method __init__ (line 1168) | def __init__(self, config): method forward (line 1180) | def forward( class RoFormerForQuestionAnswering (line 1231) | class RoFormerForQuestionAnswering(RoFormerPreTrainedModel): method __init__ (line 1232) | def __init__(self, config): method forward (line 1245) | def forward( FILE: src/transformers/models/roformer/tokenization_roformer.py class RoFormerTokenizer (line 29) | class RoFormerTokenizer(PreTrainedTokenizerFast): method __init__ (line 49) | def __init__( method __getstate__ (line 95) | def __getstate__(self): method __setstate__ (line 102) | def __setstate__(self, d): method build_inputs_with_special_tokens (line 107) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method create_token_type_ids_from_sequences (line 131) | def create_token_type_ids_from_sequences( method save_vocabulary (line 148) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method save_pretrained (line 152) | def save_pretrained( FILE: src/transformers/models/roformer/tokenization_utils.py class JiebaPreTokenizer (line 19) | class JiebaPreTokenizer: method __init__ (line 20) | def __init__(self, vocab) -> None: method jieba_split (line 37) | def jieba_split(self, i: int, normalized_string: NormalizedString) -> ... method pre_tokenize (line 64) | def pre_tokenize(self, pretok: PreTokenizedString): FILE: src/transformers/models/rt_detr/configuration_rt_detr.py class RTDetrConfig (line 26) | class RTDetrConfig(PreTrainedConfig): method __post_init__ (line 177) | def __post_init__(self, **kwargs): FILE: src/transformers/models/rt_detr/configuration_rt_detr_resnet.py class RTDetrResNetConfig (line 25) | class RTDetrResNetConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 69) | def __post_init__(self, **kwargs): method validate_architecture (line 77) | def validate_architecture(self): FILE: src/transformers/models/rt_detr/convert_rt_detr_original_pytorch_checkpoint_to_hf.py function get_rt_detr_config (line 35) | def get_rt_detr_config(model_name: str) -> RTDetrConfig: function create_rename_keys (line 87) | def create_rename_keys(config): function rename_key (line 492) | def rename_key(state_dict, old, new): function read_in_q_k_v (line 497) | def read_in_q_k_v(state_dict, config): function prepare_img (line 536) | def prepare_img(): function convert_rt_detr_checkpoint (line 544) | def convert_rt_detr_checkpoint(model_name, pytorch_dump_folder_path, pus... FILE: src/transformers/models/rt_detr/image_processing_pil_rt_detr.py class RTDetrImageProcessorKwargs (line 58) | class RTDetrImageProcessorKwargs(ImagesKwargs, total=False): function prepare_coco_detection_annotation_pil (line 75) | def prepare_coco_detection_annotation_pil( class RTDetrImageProcessorPil (line 131) | class RTDetrImageProcessorPil(PilBackend): method __init__ (line 146) | def __init__(self, **kwargs: Unpack[RTDetrImageProcessorKwargs]) -> None: method prepare_annotation (line 155) | def prepare_annotation( method resize (line 178) | def resize( method resize_annotation (line 232) | def resize_annotation( method normalize_annotation (line 285) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 298) | def _update_annotation_for_padded_image( method pad (line 342) | def pad( method preprocess (line 381) | def preprocess( method _preprocess (line 399) | def _preprocess( method post_process_object_detection (line 509) | def post_process_object_detection( FILE: src/transformers/models/rt_detr/image_processing_rt_detr.py class RTDetrImageProcessorKwargs (line 51) | class RTDetrImageProcessorKwargs(ImagesKwargs, total=False): function prepare_coco_detection_annotation (line 68) | def prepare_coco_detection_annotation( class RTDetrImageProcessor (line 128) | class RTDetrImageProcessor(TorchvisionBackend): method __init__ (line 143) | def __init__(self, **kwargs: Unpack[RTDetrImageProcessorKwargs]) -> None: method prepare_annotation (line 152) | def prepare_annotation( method resize (line 175) | def resize( method resize_annotation (line 220) | def resize_annotation( method normalize_annotation (line 277) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 292) | def _update_annotation_for_padded_image( method pad (line 327) | def pad( method preprocess (line 358) | def preprocess( method _preprocess (line 376) | def _preprocess( method post_process_object_detection (line 482) | def post_process_object_detection( FILE: src/transformers/models/rt_detr/modeling_rt_detr.py class RTDetrDecoderOutput (line 59) | class RTDetrDecoderOutput(ModelOutput): class RTDetrModelOutput (line 94) | class RTDetrModelOutput(ModelOutput): class RTDetrObjectDetectionOutput (line 152) | class RTDetrObjectDetectionOutput(ModelOutput): class RTDetrMLP (line 224) | class RTDetrMLP(nn.Module): method __init__ (line 225) | def __init__(self, config: RTDetrConfig, hidden_size: int, intermediat... method forward (line 233) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RTDetrFrozenBatchNorm2d (line 241) | class RTDetrFrozenBatchNorm2d(nn.Module): method __init__ (line 249) | def __init__(self, n): method _load_from_state_dict (line 256) | def _load_from_state_dict( method forward (line 267) | def forward(self, x): function eager_attention_forward (line 280) | def eager_attention_forward( class RTDetrSelfAttention (line 308) | class RTDetrSelfAttention(nn.Module): method __init__ (line 315) | def __init__( method forward (line 335) | def forward( function replace_batch_norm (line 374) | def replace_batch_norm(model): class RTDetrConvEncoder (line 398) | class RTDetrConvEncoder(nn.Module): method __init__ (line 406) | def __init__(self, config): method forward (line 418) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class RTDetrConvNormLayer (line 430) | class RTDetrConvNormLayer(nn.Module): method __init__ (line 431) | def __init__(self, config, in_channels, out_channels, kernel_size, str... method forward (line 444) | def forward(self, hidden_state): class RTDetrEncoderLayer (line 451) | class RTDetrEncoderLayer(nn.Module): method __init__ (line 452) | def __init__(self, config: RTDetrConfig): method forward (line 469) | def forward( class RTDetrRepVggBlock (line 520) | class RTDetrRepVggBlock(nn.Module): method __init__ (line 525) | def __init__(self, config: RTDetrConfig): method forward (line 534) | def forward(self, x): class RTDetrCSPRepLayer (line 539) | class RTDetrCSPRepLayer(nn.Module): method __init__ (line 544) | def __init__(self, config: RTDetrConfig): method forward (line 561) | def forward(self, hidden_state): class MultiScaleDeformableAttention (line 569) | class MultiScaleDeformableAttention(nn.Module): method forward (line 570) | def forward( class RTDetrMultiscaleDeformableAttention (line 623) | class RTDetrMultiscaleDeformableAttention(nn.Module): method __init__ (line 628) | def __init__(self, config: RTDetrConfig, num_heads: int, n_points: int): method forward (line 660) | def forward( class RTDetrDecoderLayer (line 730) | class RTDetrDecoderLayer(nn.Module): method __init__ (line 731) | def __init__(self, config: RTDetrConfig): method forward (line 756) | def forward( class RTDetrSinePositionEmbedding (line 829) | class RTDetrSinePositionEmbedding(nn.Module): method __init__ (line 834) | def __init__(self, embed_dim: int = 256, temperature: int = 10000): method forward (line 840) | def forward( class RTDetrAIFILayer (line 868) | class RTDetrAIFILayer(nn.Module): method __init__ (line 873) | def __init__(self, config: RTDetrConfig): method forward (line 885) | def forward( class RTDetrMLPPredictionHead (line 925) | class RTDetrMLPPredictionHead(nn.Module): method __init__ (line 932) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 938) | def forward(self, x): class RTDetrPreTrainedModel (line 945) | class RTDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 957) | def _init_weights(self, module): class RTDetrHybridEncoder (line 1020) | class RTDetrHybridEncoder(RTDetrPreTrainedModel): method __init__ (line 1035) | def __init__(self, config: RTDetrConfig): method forward (line 1088) | def forward( function inverse_sigmoid (line 1134) | def inverse_sigmoid(x, eps=1e-5): class RTDetrDecoder (line 1141) | class RTDetrDecoder(RTDetrPreTrainedModel): method __init__ (line 1148) | def __init__(self, config: RTDetrConfig): method forward (line 1164) | def forward( function get_contrastive_denoising_training_group (line 1250) | def get_contrastive_denoising_training_group( class RTDetrModel (line 1378) | class RTDetrModel(RTDetrPreTrainedModel): method __init__ (line 1379) | def __init__(self, config: RTDetrConfig): method freeze_backbone (line 1452) | def freeze_backbone(self): method unfreeze_backbone (line 1456) | def unfreeze_backbone(self): method generate_anchors (line 1461) | def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device... method forward (line 1491) | def forward( class RTDetrForObjectDetection (line 1693) | class RTDetrForObjectDetection(RTDetrPreTrainedModel): method __init__ (line 1698) | def __init__(self, config: RTDetrConfig): method _set_aux_loss (line 1711) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 1716) | def forward( FILE: src/transformers/models/rt_detr/modeling_rt_detr_resnet.py class RTDetrResNetConvLayer (line 38) | class RTDetrResNetConvLayer(nn.Module): method __init__ (line 39) | def __init__( method forward (line 49) | def forward(self, input: Tensor) -> Tensor: class RTDetrResNetEmbeddings (line 56) | class RTDetrResNetEmbeddings(nn.Module): method __init__ (line 61) | def __init__(self, config: RTDetrResNetConfig): method forward (line 91) | def forward(self, pixel_values: Tensor) -> Tensor: class RTDetrResNetShortCut (line 103) | class RTDetrResNetShortCut(nn.Module): method __init__ (line 109) | def __init__(self, in_channels: int, out_channels: int, stride: int = 2): method forward (line 114) | def forward(self, input: Tensor) -> Tensor: class RTDetrResNetBasicLayer (line 120) | class RTDetrResNetBasicLayer(nn.Module): method __init__ (line 126) | def __init__( method forward (line 155) | def forward(self, hidden_state): class RTDetrResNetBottleNeckLayer (line 164) | class RTDetrResNetBottleNeckLayer(nn.Module): method __init__ (line 173) | def __init__( method forward (line 210) | def forward(self, hidden_state): class RTDetrResNetStage (line 219) | class RTDetrResNetStage(nn.Module): method __init__ (line 224) | def __init__( method forward (line 249) | def forward(self, input: Tensor) -> Tensor: class RTDetrResNetEncoder (line 257) | class RTDetrResNetEncoder(nn.Module): method __init__ (line 258) | def __init__(self, config: RTDetrResNetConfig): method forward (line 275) | def forward( class RTDetrResNetPreTrainedModel (line 300) | class RTDetrResNetPreTrainedModel(PreTrainedModel): method _init_weights (line 308) | def _init_weights(self, module): class RTDetrResNetBackbone (line 333) | class RTDetrResNetBackbone(BackboneMixin, RTDetrResNetPreTrainedModel): method __init__ (line 336) | def __init__(self, config): method forward (line 349) | def forward( FILE: src/transformers/models/rt_detr/modular_rt_detr.py function prepare_coco_detection_annotation (line 69) | def prepare_coco_detection_annotation( function prepare_coco_detection_annotation_pil (line 128) | def prepare_coco_detection_annotation_pil( class RTDetrImageProcessorKwargs (line 183) | class RTDetrImageProcessorKwargs(ImagesKwargs, total=False): class RTDetrImageProcessor (line 197) | class RTDetrImageProcessor(DetrImageProcessor): method __init__ (line 212) | def __init__(self, **kwargs: Unpack[RTDetrImageProcessorKwargs]) -> None: method prepare_annotation (line 221) | def prepare_annotation( method _preprocess (line 241) | def _preprocess( method post_process_object_detection (line 347) | def post_process_object_detection( method post_process_instance_segmentation (line 419) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 422) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 425) | def post_process_panoptic_segmentation(self): class RTDetrImageProcessorKwargs (line 429) | class RTDetrImageProcessorKwargs(ImagesKwargs, total=False): class RTDetrImageProcessorPil (line 444) | class RTDetrImageProcessorPil(DetrImageProcessorPil): method __init__ (line 459) | def __init__(self, **kwargs: Unpack[RTDetrImageProcessorKwargs]) -> None: method prepare_annotation (line 468) | def prepare_annotation( method _preprocess (line 488) | def _preprocess( method post_process_object_detection (line 597) | def post_process_object_detection( method post_process_instance_segmentation (line 669) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 672) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 675) | def post_process_panoptic_segmentation(self): class RTDetrDecoderOutput (line 688) | class RTDetrDecoderOutput(ModelOutput): class RTDetrModelOutput (line 723) | class RTDetrModelOutput(ModelOutput): class RTDetrObjectDetectionOutput (line 781) | class RTDetrObjectDetectionOutput(ModelOutput): class RTDetrMLP (line 853) | class RTDetrMLP(nn.Module): method __init__ (line 854) | def __init__(self, config: RTDetrConfig, hidden_size: int, intermediat... method forward (line 862) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class RTDetrFrozenBatchNorm2d (line 870) | class RTDetrFrozenBatchNorm2d(DetrFrozenBatchNorm2d): class RTDetrSelfAttention (line 874) | class RTDetrSelfAttention(DetrSelfAttention): function get_contrastive_denoising_training_group (line 878) | def get_contrastive_denoising_training_group( class RTDetrConvEncoder (line 1001) | class RTDetrConvEncoder(nn.Module): method __init__ (line 1009) | def __init__(self, config): method forward (line 1021) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class RTDetrConvNormLayer (line 1033) | class RTDetrConvNormLayer(nn.Module): method __init__ (line 1034) | def __init__(self, config, in_channels, out_channels, kernel_size, str... method forward (line 1047) | def forward(self, hidden_state): class RTDetrEncoderLayer (line 1054) | class RTDetrEncoderLayer(nn.Module): method __init__ (line 1055) | def __init__(self, config: RTDetrConfig): method forward (line 1072) | def forward( class RTDetrRepVggBlock (line 1123) | class RTDetrRepVggBlock(nn.Module): method __init__ (line 1128) | def __init__(self, config: RTDetrConfig): method forward (line 1137) | def forward(self, x): class RTDetrCSPRepLayer (line 1142) | class RTDetrCSPRepLayer(nn.Module): method __init__ (line 1147) | def __init__(self, config: RTDetrConfig): method forward (line 1164) | def forward(self, hidden_state): class RTDetrMultiscaleDeformableAttention (line 1171) | class RTDetrMultiscaleDeformableAttention(DeformableDetrMultiscaleDeform... class RTDetrDecoderLayer (line 1175) | class RTDetrDecoderLayer(nn.Module): method __init__ (line 1176) | def __init__(self, config: RTDetrConfig): method forward (line 1201) | def forward( class RTDetrSinePositionEmbedding (line 1274) | class RTDetrSinePositionEmbedding(nn.Module): method __init__ (line 1279) | def __init__(self, embed_dim: int = 256, temperature: int = 10000): method forward (line 1285) | def forward( class RTDetrAIFILayer (line 1313) | class RTDetrAIFILayer(nn.Module): method __init__ (line 1318) | def __init__(self, config: RTDetrConfig): method forward (line 1330) | def forward( class RTDetrMLPPredictionHead (line 1370) | class RTDetrMLPPredictionHead(DetrMLPPredictionHead): class RTDetrPreTrainedModel (line 1375) | class RTDetrPreTrainedModel(PreTrainedModel): method _init_weights (line 1387) | def _init_weights(self, module): class RTDetrHybridEncoder (line 1450) | class RTDetrHybridEncoder(RTDetrPreTrainedModel): method __init__ (line 1465) | def __init__(self, config: RTDetrConfig): method forward (line 1518) | def forward( class RTDetrDecoder (line 1564) | class RTDetrDecoder(RTDetrPreTrainedModel): method __init__ (line 1571) | def __init__(self, config: RTDetrConfig): method forward (line 1587) | def forward( class RTDetrModel (line 1678) | class RTDetrModel(RTDetrPreTrainedModel): method __init__ (line 1679) | def __init__(self, config: RTDetrConfig): method freeze_backbone (line 1752) | def freeze_backbone(self): method unfreeze_backbone (line 1756) | def unfreeze_backbone(self): method generate_anchors (line 1761) | def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device... method forward (line 1791) | def forward( class RTDetrForObjectDetection (line 1993) | class RTDetrForObjectDetection(RTDetrPreTrainedModel): method __init__ (line 1998) | def __init__(self, config: RTDetrConfig): method _set_aux_loss (line 2011) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 2016) | def forward( FILE: src/transformers/models/rt_detr_v2/configuration_rt_detr_v2.py class RTDetrV2Config (line 30) | class RTDetrV2Config(PreTrainedConfig): method __post_init__ (line 192) | def __post_init__(self, **kwargs): FILE: src/transformers/models/rt_detr_v2/convert_rt_detr_v2_weights_to_hf.py function get_rt_detr_v2_config (line 36) | def get_rt_detr_v2_config(model_name: str) -> RTDetrV2Config: function convert_old_keys_to_new_keys (line 162) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function read_in_q_k_v (line 173) | def read_in_q_k_v(state_dict, config): function prepare_img (line 212) | def prepare_img(): function write_model_and_image_processor (line 220) | def write_model_and_image_processor(model_name, output_dir, push_to_hub,... FILE: src/transformers/models/rt_detr_v2/modeling_rt_detr_v2.py function multi_scale_deformable_attention_v2 (line 44) | def multi_scale_deformable_attention_v2( class RTDetrV2MultiscaleDeformableAttention (line 119) | class RTDetrV2MultiscaleDeformableAttention(nn.Module): method __init__ (line 125) | def __init__(self, config: RTDetrV2Config): method forward (line 166) | def forward( class RTDetrV2MLP (line 228) | class RTDetrV2MLP(nn.Module): method __init__ (line 229) | def __init__(self, config: RTDetrV2Config, hidden_size: int, intermedi... method forward (line 237) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 245) | def eager_attention_forward( class RTDetrV2SelfAttention (line 273) | class RTDetrV2SelfAttention(nn.Module): method __init__ (line 280) | def __init__( method forward (line 300) | def forward( class RTDetrV2DecoderLayer (line 339) | class RTDetrV2DecoderLayer(nn.Module): method __init__ (line 340) | def __init__(self, config: RTDetrV2Config): method forward (line 361) | def forward( class RTDetrV2PreTrainedModel (line 435) | class RTDetrV2PreTrainedModel(PreTrainedModel): method _init_weights (line 447) | def _init_weights(self, module): class RTDetrV2DecoderOutput (line 522) | class RTDetrV2DecoderOutput(ModelOutput): function inverse_sigmoid (line 551) | def inverse_sigmoid(x, eps=1e-5): class RTDetrV2Decoder (line 558) | class RTDetrV2Decoder(RTDetrV2PreTrainedModel): method __init__ (line 565) | def __init__(self, config: RTDetrV2Config): method forward (line 581) | def forward( class RTDetrV2ModelOutput (line 673) | class RTDetrV2ModelOutput(ModelOutput): class RTDetrV2FrozenBatchNorm2d (line 725) | class RTDetrV2FrozenBatchNorm2d(nn.Module): method __init__ (line 733) | def __init__(self, n): method _load_from_state_dict (line 740) | def _load_from_state_dict( method forward (line 751) | def forward(self, x): function replace_batch_norm (line 764) | def replace_batch_norm(model): class RTDetrV2ConvEncoder (line 788) | class RTDetrV2ConvEncoder(nn.Module): method __init__ (line 796) | def __init__(self, config): method forward (line 808) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class RTDetrV2ConvNormLayer (line 820) | class RTDetrV2ConvNormLayer(nn.Module): method __init__ (line 821) | def __init__(self, config, in_channels, out_channels, kernel_size, str... method forward (line 834) | def forward(self, hidden_state): class RTDetrV2EncoderLayer (line 841) | class RTDetrV2EncoderLayer(nn.Module): method __init__ (line 842) | def __init__(self, config: RTDetrV2Config): method forward (line 859) | def forward( class RTDetrV2RepVggBlock (line 910) | class RTDetrV2RepVggBlock(nn.Module): method __init__ (line 915) | def __init__(self, config: RTDetrV2Config): method forward (line 924) | def forward(self, x): class RTDetrV2CSPRepLayer (line 929) | class RTDetrV2CSPRepLayer(nn.Module): method __init__ (line 934) | def __init__(self, config: RTDetrV2Config): method forward (line 951) | def forward(self, hidden_state): class RTDetrV2SinePositionEmbedding (line 958) | class RTDetrV2SinePositionEmbedding(nn.Module): method __init__ (line 963) | def __init__(self, embed_dim: int = 256, temperature: int = 10000): method forward (line 969) | def forward( class RTDetrV2AIFILayer (line 997) | class RTDetrV2AIFILayer(nn.Module): method __init__ (line 1002) | def __init__(self, config: RTDetrV2Config): method forward (line 1014) | def forward( class RTDetrV2HybridEncoder (line 1054) | class RTDetrV2HybridEncoder(RTDetrV2PreTrainedModel): method __init__ (line 1069) | def __init__(self, config: RTDetrV2Config): method forward (line 1122) | def forward( function get_contrastive_denoising_training_group (line 1168) | def get_contrastive_denoising_training_group( class RTDetrV2Model (line 1296) | class RTDetrV2Model(RTDetrV2PreTrainedModel): method __init__ (line 1297) | def __init__(self, config: RTDetrV2Config): method freeze_backbone (line 1369) | def freeze_backbone(self): method unfreeze_backbone (line 1373) | def unfreeze_backbone(self): method generate_anchors (line 1378) | def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device... method forward (line 1408) | def forward( class RTDetrV2MLPPredictionHead (line 1604) | class RTDetrV2MLPPredictionHead(nn.Module): method __init__ (line 1611) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 1617) | def forward(self, x): class RTDetrV2ObjectDetectionOutput (line 1629) | class RTDetrV2ObjectDetectionOutput(ModelOutput): class RTDetrV2ForObjectDetection (line 1707) | class RTDetrV2ForObjectDetection(RTDetrV2PreTrainedModel): method __init__ (line 1718) | def __init__(self, config: RTDetrV2Config): method _set_aux_loss (line 1737) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 1742) | def forward( FILE: src/transformers/models/rt_detr_v2/modular_rt_detr_v2.py class RTDetrV2Config (line 43) | class RTDetrV2Config(PreTrainedConfig): method __post_init__ (line 205) | def __post_init__(self, **kwargs): function multi_scale_deformable_attention_v2 (line 215) | def multi_scale_deformable_attention_v2( class RTDetrV2MultiscaleDeformableAttention (line 290) | class RTDetrV2MultiscaleDeformableAttention(nn.Module): method __init__ (line 296) | def __init__(self, config: RTDetrV2Config): method forward (line 337) | def forward( class RTDetrV2DecoderLayer (line 399) | class RTDetrV2DecoderLayer(RTDetrDecoderLayer): method __init__ (line 400) | def __init__(self, config: RTDetrV2Config): class RTDetrV2PreTrainedModel (line 407) | class RTDetrV2PreTrainedModel(RTDetrPreTrainedModel): method _init_weights (line 408) | def _init_weights(self, module): class RTDetrV2Decoder (line 415) | class RTDetrV2Decoder(RTDetrDecoder): method __init__ (line 416) | def __init__(self, config: RTDetrV2Config): class RTDetrV2Model (line 421) | class RTDetrV2Model(RTDetrModel): method __init__ (line 422) | def __init__(self, config: RTDetrV2Config): class RTDetrV2MLPPredictionHead (line 428) | class RTDetrV2MLPPredictionHead(RTDetrMLPPredictionHead): class RTDetrV2ForObjectDetection (line 432) | class RTDetrV2ForObjectDetection(RTDetrForObjectDetection, RTDetrV2PreTr... method __init__ (line 440) | def __init__(self, config: RTDetrV2Config): FILE: src/transformers/models/rwkv/configuration_rwkv.py class RwkvConfig (line 25) | class RwkvConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/rwkv/convert_rwkv_checkpoint_to_hf.py function convert_state_dict (line 48) | def convert_state_dict(state_dict): function convert_rmkv_checkpoint_to_hf_format (line 79) | def convert_rmkv_checkpoint_to_hf_format( FILE: src/transformers/models/rwkv/modeling_rwkv.py function load_wkv_cuda_kernel (line 45) | def load_wkv_cuda_kernel(context_length): class RwkvLinearAttention (line 56) | class RwkvLinearAttention(torch.autograd.Function): method forward (line 58) | def forward(ctx, time_decay, time_first, key, value, state=None, retur... method backward (line 122) | def backward(ctx, g_output, g_state=None): function rwkv_linear_attention_cpu (line 162) | def rwkv_linear_attention_cpu(time_decay, time_first, key, value, state=... function rwkv_linear_attention (line 206) | def rwkv_linear_attention(time_decay, time_first, key, value, state=None... class RwkvSelfAttention (line 217) | class RwkvSelfAttention(nn.Module): method __init__ (line 218) | def __init__(self, config, layer_id=0): method extract_key_value (line 248) | def extract_key_value(self, hidden, state=None): method forward (line 267) | def forward(self, hidden, state=None, use_cache=False): class RwkvFeedForward (line 287) | class RwkvFeedForward(nn.Module): method __init__ (line 288) | def __init__(self, config, layer_id=0): method forward (line 305) | def forward(self, hidden, state=None): class RwkvBlock (line 325) | class RwkvBlock(GradientCheckpointingLayer): method __init__ (line 326) | def __init__(self, config, layer_id): method forward (line 340) | def forward(self, hidden, state=None, use_cache=False, output_attentio... class RwkvPreTrainedModel (line 360) | class RwkvPreTrainedModel(PreTrainedModel): method _init_weights (line 369) | def _init_weights(self, module: nn.Module): class RwkvOutput (line 451) | class RwkvOutput(ModelOutput): class RwkvCausalLMOutput (line 470) | class RwkvCausalLMOutput(ModelOutput): class RwkvModel (line 489) | class RwkvModel(RwkvPreTrainedModel): method __init__ (line 490) | def __init__(self, config): method get_input_embeddings (line 504) | def get_input_embeddings(self): method set_input_embeddings (line 507) | def set_input_embeddings(self, new_embeddings): method forward (line 511) | def forward( method _rescale_layers (line 617) | def _rescale_layers(self): method _bnb_4bit_dequantize_and_rescale (line 641) | def _bnb_4bit_dequantize_and_rescale(self, target_layer, block_id): class RwkvForCausalLM (line 669) | class RwkvForCausalLM(RwkvPreTrainedModel, GenerationMixin): method __init__ (line 672) | def __init__(self, config): method get_output_embeddings (line 680) | def get_output_embeddings(self): method set_output_embeddings (line 683) | def set_output_embeddings(self, new_embeddings): method forward (line 687) | def forward( FILE: src/transformers/models/sam/configuration_sam.py class SamPromptEncoderConfig (line 24) | class SamPromptEncoderConfig(PreTrainedConfig): method __post_init__ (line 42) | def __post_init__(self, **kwargs): class SamMaskDecoderConfig (line 49) | class SamMaskDecoderConfig(PreTrainedConfig): class SamVisionConfig (line 79) | class SamVisionConfig(PreTrainedConfig): method __post_init__ (line 136) | def __post_init__(self, **kwargs): class SamConfig (line 144) | class SamConfig(PreTrainedConfig): method __post_init__ (line 193) | def __post_init__(self, **kwargs): FILE: src/transformers/models/sam/convert_sam_to_hf.py function get_config (line 41) | def get_config(model_name): function replace_keys (line 107) | def replace_keys(state_dict): function convert_sam_checkpoint (line 137) | def convert_sam_checkpoint(model_name, checkpoint_path, pytorch_dump_fol... FILE: src/transformers/models/sam/image_processing_pil_sam.py function get_resize_output_image_size (line 50) | def get_resize_output_image_size( class SamImageProcessorKwargs (line 68) | class SamImageProcessorKwargs(ImagesKwargs, total=False): class SamImageProcessorPil (line 83) | class SamImageProcessorPil(PilBackend): method __init__ (line 98) | def __init__(self, **kwargs: Unpack[SamImageProcessorKwargs]): method preprocess (line 102) | def preprocess( method _standardize_kwargs (line 114) | def _standardize_kwargs( method _get_preprocess_shape (line 135) | def _get_preprocess_shape(self, old_shape: tuple[int, int], longest_ed... method resize (line 146) | def resize( method _preprocess_image_like_inputs (line 177) | def _preprocess_image_like_inputs( method _preprocess (line 227) | def _preprocess( method generate_crop_boxes (line 267) | def generate_crop_boxes( method filter_masks (line 316) | def filter_masks( method post_process_masks (line 396) | def post_process_masks( method post_process_for_mask_generation (line 454) | def post_process_for_mask_generation(self, all_masks, all_scores, all_... function _compute_stability_score (line 471) | def _compute_stability_score(masks: "torch.Tensor", mask_threshold: floa... function _batched_mask_to_box (line 482) | def _batched_mask_to_box(masks: "torch.Tensor"): function _is_box_near_crop_edge (line 531) | def _is_box_near_crop_edge(boxes, crop_box, orig_box, atol=20.0): function _pad_masks (line 549) | def _pad_masks(masks, crop_box: list[int], orig_height: int, orig_width:... function _generate_crop_boxes (line 559) | def _generate_crop_boxes( function _generate_per_layer_crops (line 611) | def _generate_per_layer_crops(crop_n_layers, overlap_ratio, original_size): function _build_point_grid (line 645) | def _build_point_grid(n_per_side: int) -> np.ndarray: function _generate_crop_images (line 655) | def _generate_crop_images( function _normalize_coordinates (line 680) | def _normalize_coordinates( function _rle_to_mask (line 708) | def _rle_to_mask(rle: dict[str, Any]) -> np.ndarray: function _post_process_for_mask_generation (line 722) | def _post_process_for_mask_generation(rle_masks, iou_scores, mask_boxes,... function _mask_to_rle (line 757) | def _mask_to_rle(input_mask: "torch.Tensor"): FILE: src/transformers/models/sam/image_processing_sam.py class SamImageProcessorKwargs (line 47) | class SamImageProcessorKwargs(ImagesKwargs, total=False): class SamImageProcessor (line 61) | class SamImageProcessor(TorchvisionBackend): method __init__ (line 76) | def __init__(self, **kwargs: Unpack[SamImageProcessorKwargs]): method preprocess (line 80) | def preprocess( method _standardize_kwargs (line 92) | def _standardize_kwargs( method _get_preprocess_shape (line 113) | def _get_preprocess_shape(self, old_shape: tuple[int, int], longest_ed... method resize (line 124) | def resize( method _preprocess_image_like_inputs (line 155) | def _preprocess_image_like_inputs( method _preprocess (line 205) | def _preprocess( method generate_crop_boxes (line 252) | def generate_crop_boxes( method filter_masks (line 301) | def filter_masks( method post_process_masks (line 379) | def post_process_masks( method post_process_for_mask_generation (line 432) | def post_process_for_mask_generation(self, all_masks, all_scores, all_... function _compute_stability_score (line 449) | def _compute_stability_score(masks: "torch.Tensor", mask_threshold: floa... function _batched_mask_to_box (line 460) | def _batched_mask_to_box(masks: "torch.Tensor"): function _is_box_near_crop_edge (line 509) | def _is_box_near_crop_edge(boxes, crop_box, orig_box, atol=20.0): function _pad_masks (line 527) | def _pad_masks(masks, crop_box: list[int], orig_height: int, orig_width:... function _generate_crop_boxes (line 537) | def _generate_crop_boxes( function _generate_per_layer_crops (line 590) | def _generate_per_layer_crops(crop_n_layers, overlap_ratio, original_size): function _build_point_grid (line 624) | def _build_point_grid(n_per_side: int) -> torch.Tensor: function _generate_crop_images (line 634) | def _generate_crop_images( function _normalize_coordinates (line 659) | def _normalize_coordinates( function _rle_to_mask (line 687) | def _rle_to_mask(rle: dict[str, Any]) -> torch.Tensor: function _post_process_for_mask_generation (line 701) | def _post_process_for_mask_generation(rle_masks, iou_scores, mask_boxes,... function _mask_to_rle (line 730) | def _mask_to_rle(input_mask: "torch.Tensor"): FILE: src/transformers/models/sam/modeling_sam.py class SamVisionEncoderOutput (line 47) | class SamVisionEncoderOutput(ModelOutput): class SamImageSegmentationOutput (line 65) | class SamImageSegmentationOutput(ModelOutput): class SamPatchEmbeddings (line 97) | class SamPatchEmbeddings(nn.Module): method __init__ (line 104) | def __init__(self, config): method forward (line 118) | def forward(self, pixel_values): class SamMLPBlock (line 132) | class SamMLPBlock(nn.Module): method __init__ (line 133) | def __init__(self, config): method forward (line 139) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SamLayerNorm (line 147) | class SamLayerNorm(nn.LayerNorm): method __init__ (line 153) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 159) | def forward(self, features: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 173) | def eager_attention_forward( class SamAttention (line 195) | class SamAttention(nn.Module): method __init__ (line 201) | def __init__(self, config, downsample_rate=None): method _separate_heads (line 221) | def _separate_heads(self, hidden_states: Tensor, num_attention_heads: ... method _recombine_heads (line 227) | def _recombine_heads(self, hidden_states: Tensor, point_batch_size: in... method forward (line 231) | def forward( class SamTwoWayAttentionBlock (line 273) | class SamTwoWayAttentionBlock(nn.Module): method __init__ (line 274) | def __init__(self, config, attention_downsample_rate: int = 2, skip_fi... method forward (line 306) | def forward( class SamTwoWayTransformer (line 351) | class SamTwoWayTransformer(nn.Module): method __init__ (line 352) | def __init__(self, config: SamMaskDecoderConfig): method forward (line 365) | def forward( class SamFeedForward (line 408) | class SamFeedForward(nn.Module): method __init__ (line 409) | def __init__( method forward (line 420) | def forward(self, hidden_states): class SamMaskDecoder (line 432) | class SamMaskDecoder(nn.Module): method __init__ (line 433) | def __init__(self, config: SamMaskDecoderConfig): method forward (line 461) | def forward( class SamPositionalEmbedding (line 546) | class SamPositionalEmbedding(nn.Module): method __init__ (line 547) | def __init__(self, config): method forward (line 552) | def forward(self, input_coords, input_shape=None): class SamMaskEmbedding (line 569) | class SamMaskEmbedding(nn.Module): method __init__ (line 570) | def __init__(self, config: SamPromptEncoderConfig): method forward (line 584) | def forward(self, masks): class SamPromptEncoder (line 596) | class SamPromptEncoder(nn.Module): method __init__ (line 597) | def __init__(self, config: SamConfig): method _embed_points (line 613) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 647) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 658) | def forward( class SamVisionAttention (line 701) | class SamVisionAttention(nn.Module): method __init__ (line 704) | def __init__(self, config, window_size): method get_rel_pos (line 729) | def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor)... method get_decomposed_rel_pos (line 761) | def get_decomposed_rel_pos( method forward (line 803) | def forward(self, hidden_states: torch.Tensor, output_attentions=None)... class SamVisionSdpaAttention (line 834) | class SamVisionSdpaAttention(SamVisionAttention): method __init__ (line 840) | def __init__(self, config, window_size): method forward (line 843) | def forward(self, hidden_states: torch.Tensor, output_attentions=False... class SamVisionLayer (line 891) | class SamVisionLayer(GradientCheckpointingLayer): method __init__ (line 892) | def __init__(self, config, window_size): method window_partition (line 900) | def window_partition(self, hidden_states: torch.Tensor, window_size: i... method window_unpartition (line 924) | def window_unpartition( method forward (line 954) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.FloatTen... class SamVisionNeck (line 975) | class SamVisionNeck(nn.Module): method __init__ (line 976) | def __init__(self, config: SamVisionConfig): method forward (line 985) | def forward(self, hidden_states): class SamPreTrainedModel (line 996) | class SamPreTrainedModel(PreTrainedModel): method _init_weights (line 1006) | def _init_weights(self, module: nn.Module): class SamVisionEncoder (line 1019) | class SamVisionEncoder(SamPreTrainedModel): method __init__ (line 1022) | def __init__(self, config: SamVisionConfig): method get_input_embeddings (line 1053) | def get_input_embeddings(self): method forward (line 1058) | def forward( class SamVisionModel (line 1080) | class SamVisionModel(SamPreTrainedModel): method __init__ (line 1084) | def __init__(self, config: SamVisionConfig): method get_input_embeddings (line 1089) | def get_input_embeddings(self) -> nn.Module: method forward (line 1093) | def forward( class SamModel (line 1107) | class SamModel(SamPreTrainedModel): method __init__ (line 1114) | def __init__(self, config: SamConfig): method get_input_embeddings (line 1125) | def get_input_embeddings(self): method get_image_wide_positional_embeddings (line 1128) | def get_image_wide_positional_embeddings(self): method get_image_embeddings (line 1142) | def get_image_embeddings(self, pixel_values, **kwargs: Unpack[Transfor... method get_prompt_embeddings (line 1158) | def get_prompt_embeddings( method forward (line 1193) | def forward( FILE: src/transformers/models/sam/processing_sam.py class SamImagesKwargs (line 35) | class SamImagesKwargs(ImagesKwargs, total=False): class SamProcessorKwargs (line 72) | class SamProcessorKwargs(ProcessingKwargs, total=False): class SamProcessor (line 82) | class SamProcessor(ProcessorMixin): method __init__ (line 83) | def __init__(self, image_processor): method __call__ (line 88) | def __call__( method _normalize_and_convert (line 133) | def _normalize_and_convert( method _pad_points_and_labels (line 199) | def _pad_points_and_labels(self, input_points, input_labels, point_pad... method _normalize_coordinates (line 215) | def _normalize_coordinates( method _check_and_preprocess_points (line 236) | def _check_and_preprocess_points( method model_input_names (line 284) | def model_input_names(self): method post_process_masks (line 288) | def post_process_masks(self, *args, **kwargs): FILE: src/transformers/models/sam2/configuration_sam2.py class Sam2HieraDetConfig (line 25) | class Sam2HieraDetConfig(PreTrainedConfig): method __post_init__ (line 74) | def __post_init__(self, **kwargs): class Sam2VisionConfig (line 103) | class Sam2VisionConfig(PreTrainedConfig): method __post_init__ (line 142) | def __post_init__(self, **kwargs): class Sam2PromptEncoderConfig (line 162) | class Sam2PromptEncoderConfig(PreTrainedConfig): class Sam2MaskDecoderConfig (line 186) | class Sam2MaskDecoderConfig(PreTrainedConfig): class Sam2Config (line 224) | class Sam2Config(PreTrainedConfig): method __post_init__ (line 272) | def __post_init__(self, **kwargs): FILE: src/transformers/models/sam2/convert_sam2_to_hf.py function get_config (line 42) | def get_config(model_name): function replace_keys (line 137) | def replace_keys(state_dict): function convert_sam2_checkpoint (line 218) | def convert_sam2_checkpoint(model_name, checkpoint_path, pytorch_dump_fo... FILE: src/transformers/models/sam2/image_processing_sam2.py class Sam2ImageProcessorKwargs (line 48) | class Sam2ImageProcessorKwargs(ImagesKwargs, total=False): function _compute_stability_score (line 57) | def _compute_stability_score(masks: "torch.Tensor", mask_threshold: floa... function _batched_mask_to_box (line 68) | def _batched_mask_to_box(masks: "torch.Tensor"): function _is_box_near_crop_edge (line 117) | def _is_box_near_crop_edge(boxes, crop_box, orig_box, atol=20.0): function _pad_masks (line 135) | def _pad_masks(masks, crop_box: list[int], orig_height: int, orig_width:... function _generate_crop_boxes (line 145) | def _generate_crop_boxes( function _generate_per_layer_crops (line 198) | def _generate_per_layer_crops(crop_n_layers, overlap_ratio, original_size): function _build_point_grid (line 232) | def _build_point_grid(n_per_side: int) -> torch.Tensor: function _generate_crop_images (line 242) | def _generate_crop_images( function _normalize_coordinates (line 267) | def _normalize_coordinates( function _rle_to_mask (line 295) | def _rle_to_mask(rle: dict[str, Any]) -> torch.Tensor: function _post_process_for_mask_generation (line 309) | def _post_process_for_mask_generation(rle_masks, iou_scores, mask_boxes,... function _mask_to_rle (line 338) | def _mask_to_rle(input_mask: "torch.Tensor"): class Sam2ImageProcessor (line 370) | class Sam2ImageProcessor(TorchvisionBackend): method __init__ (line 387) | def __init__(self, **kwargs: Unpack[Sam2ImageProcessorKwargs]): method preprocess (line 391) | def preprocess( method _standardize_kwargs (line 403) | def _standardize_kwargs( method _preprocess_image_like_inputs (line 416) | def _preprocess_image_like_inputs( method _preprocess (line 463) | def _preprocess( method generate_crop_boxes (line 471) | def generate_crop_boxes( method filter_masks (line 520) | def filter_masks( method post_process_masks (line 598) | def post_process_masks( method post_process_for_mask_generation (line 651) | def post_process_for_mask_generation(self, all_masks, all_scores, all_... method _apply_non_overlapping_constraints (line 667) | def _apply_non_overlapping_constraints(self, pred_masks: torch.Tensor)... FILE: src/transformers/models/sam2/modeling_sam2.py class Sam2VisionEncoderOutput (line 61) | class Sam2VisionEncoderOutput(BaseModelOutputWithPooling): class Sam2ImageSegmentationOutput (line 87) | class Sam2ImageSegmentationOutput(ModelOutput): class Sam2PatchEmbeddings (line 119) | class Sam2PatchEmbeddings(nn.Module): method __init__ (line 133) | def __init__(self, config: Sam2HieraDetConfig): method forward (line 146) | def forward(self, pixel_values): class Sam2SinePositionEmbedding (line 153) | class Sam2SinePositionEmbedding(nn.Module): method __init__ (line 159) | def __init__( method forward (line 171) | def forward( class Sam2VisionNeck (line 199) | class Sam2VisionNeck(nn.Module): method __init__ (line 200) | def __init__(self, config: Sam2VisionConfig): method forward (line 218) | def forward(self, hidden_states: torch.Tensor) -> tuple[tuple[torch.Te... function eager_attention_forward (line 249) | def eager_attention_forward( function do_pool (line 271) | def do_pool(x: torch.Tensor, query_stride: int | None = None) -> torch.T... class Sam2MultiScaleAttention (line 282) | class Sam2MultiScaleAttention(nn.Module): method __init__ (line 283) | def __init__( method forward (line 307) | def forward(self, hidden_states: torch.Tensor, **kwargs) -> torch.Tensor: class Sam2FeedForward (line 348) | class Sam2FeedForward(nn.Module): method __init__ (line 349) | def __init__( method forward (line 366) | def forward(self, hidden_states): function window_partition (line 378) | def window_partition(hidden_state, window_size): function window_unpartition (line 410) | def window_unpartition(windows, window_size, pad_height_width, height_wi... class Sam2MultiScaleBlock (line 441) | class Sam2MultiScaleBlock(GradientCheckpointingLayer): method __init__ (line 442) | def __init__( method forward (line 489) | def forward( class Sam2HieraDetModelOutput (line 540) | class Sam2HieraDetModelOutput(ModelOutput): class Sam2PreTrainedModel (line 555) | class Sam2PreTrainedModel(PreTrainedModel): method _init_weights (line 574) | def _init_weights(self, module): class Sam2HieraDetModel (line 588) | class Sam2HieraDetModel(Sam2PreTrainedModel): method __init__ (line 596) | def __init__(self, config: Sam2HieraDetConfig): method get_input_embeddings (line 620) | def get_input_embeddings(self): method _get_pos_embed (line 623) | def _get_pos_embed(self, hw: tuple[int, int]) -> torch.Tensor: method forward (line 633) | def forward( class Sam2VisionModel (line 662) | class Sam2VisionModel(Sam2PreTrainedModel): method __init__ (line 670) | def __init__(self, config: Sam2VisionConfig): method get_input_embeddings (line 681) | def get_input_embeddings(self): method forward (line 685) | def forward( class Sam2PositionalEmbedding (line 712) | class Sam2PositionalEmbedding(nn.Module): method __init__ (line 713) | def __init__(self, config: Sam2PromptEncoderConfig): method forward (line 719) | def forward(self, input_coords, input_shape=None): class Sam2MaskEmbedding (line 737) | class Sam2MaskEmbedding(nn.Module): method __init__ (line 738) | def __init__(self, config: Sam2PromptEncoderConfig): method forward (line 752) | def forward(self, masks): class Sam2PromptEncoder (line 764) | class Sam2PromptEncoder(nn.Module): method __init__ (line 765) | def __init__(self, config: Sam2PromptEncoderConfig): method _embed_points (line 779) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 804) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 816) | def forward( class Sam2Attention (line 859) | class Sam2Attention(nn.Module): method __init__ (line 865) | def __init__(self, config, downsample_rate=None): method forward (line 881) | def forward( class Sam2TwoWayAttentionBlock (line 930) | class Sam2TwoWayAttentionBlock(GradientCheckpointingLayer): method __init__ (line 931) | def __init__(self, config: Sam2MaskDecoderConfig, skip_first_layer_pe:... method forward (line 962) | def forward( class Sam2TwoWayTransformer (line 1007) | class Sam2TwoWayTransformer(nn.Module): method __init__ (line 1008) | def __init__(self, config: Sam2MaskDecoderConfig): method forward (line 1021) | def forward( class Sam2LayerNorm (line 1064) | class Sam2LayerNorm(nn.LayerNorm): method __init__ (line 1070) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 1076) | def forward(self, features: torch.Tensor) -> torch.Tensor: class Sam2MaskDecoder (line 1090) | class Sam2MaskDecoder(nn.Module): method __init__ (line 1091) | def __init__(self, config: Sam2MaskDecoderConfig): method forward (line 1132) | def forward( method _get_stability_scores (line 1243) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 1255) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... class Sam2Model (line 1299) | class Sam2Model(Sam2PreTrainedModel): method __init__ (line 1304) | def __init__(self, config: Sam2Config): method get_input_embeddings (line 1321) | def get_input_embeddings(self): method get_image_wide_positional_embeddings (line 1324) | def get_image_wide_positional_embeddings(self) -> torch.Tensor: method get_image_embeddings (line 1338) | def get_image_embeddings( method get_prompt_embeddings (line 1366) | def get_prompt_embeddings( method forward (line 1401) | def forward( method get_image_features (line 1576) | def get_image_features( FILE: src/transformers/models/sam2/modular_sam2.py class Sam2ImageProcessorKwargs (line 74) | class Sam2ImageProcessorKwargs(ImagesKwargs, total=False): class Sam2ImageProcessor (line 84) | class Sam2ImageProcessor(SamImageProcessor): method __init__ (line 102) | def __init__(self, **kwargs: Unpack[Sam2ImageProcessorKwargs]): method _preprocess (line 105) | def _preprocess( method preprocess (line 114) | def preprocess( method _preprocess_image_like_inputs (line 126) | def _preprocess_image_like_inputs( method _standardize_kwargs (line 173) | def _standardize_kwargs( method _apply_non_overlapping_constraints (line 186) | def _apply_non_overlapping_constraints(self, pred_masks: torch.Tensor)... method post_process_masks (line 206) | def post_process_masks( method _get_preprocess_shape (line 259) | def _get_preprocess_shape(self): method resize (line 262) | def resize(self): class Sam2VisionEncoderOutput (line 268) | class Sam2VisionEncoderOutput(BaseModelOutputWithPooling): class Sam2ImageSegmentationOutput (line 294) | class Sam2ImageSegmentationOutput(ModelOutput): class Sam2PatchEmbeddings (line 326) | class Sam2PatchEmbeddings(nn.Module): method __init__ (line 340) | def __init__(self, config: Sam2HieraDetConfig): method forward (line 353) | def forward(self, pixel_values): class Sam2SinePositionEmbedding (line 359) | class Sam2SinePositionEmbedding(MaskFormerSinePositionEmbedding): class Sam2VisionNeck (line 363) | class Sam2VisionNeck(nn.Module): method __init__ (line 364) | def __init__(self, config: Sam2VisionConfig): method forward (line 382) | def forward(self, hidden_states: torch.Tensor) -> tuple[tuple[torch.Te... function do_pool (line 413) | def do_pool(x: torch.Tensor, query_stride: int | None = None) -> torch.T... class Sam2MultiScaleAttention (line 424) | class Sam2MultiScaleAttention(nn.Module): method __init__ (line 425) | def __init__( method forward (line 449) | def forward(self, hidden_states: torch.Tensor, **kwargs) -> torch.Tensor: class Sam2FeedForward (line 490) | class Sam2FeedForward(nn.Module): method __init__ (line 491) | def __init__( method forward (line 508) | def forward(self, hidden_states): class Sam2MultiScaleBlock (line 520) | class Sam2MultiScaleBlock(GradientCheckpointingLayer): method __init__ (line 521) | def __init__( method forward (line 568) | def forward( class Sam2HieraDetModelOutput (line 619) | class Sam2HieraDetModelOutput(ModelOutput): class Sam2PreTrainedModel (line 634) | class Sam2PreTrainedModel(PreTrainedModel): method _init_weights (line 653) | def _init_weights(self, module): class Sam2HieraDetModel (line 667) | class Sam2HieraDetModel(Sam2PreTrainedModel): method __init__ (line 675) | def __init__(self, config: Sam2HieraDetConfig): method get_input_embeddings (line 699) | def get_input_embeddings(self): method _get_pos_embed (line 702) | def _get_pos_embed(self, hw: tuple[int, int]) -> torch.Tensor: method forward (line 712) | def forward( class Sam2VisionModel (line 741) | class Sam2VisionModel(Sam2PreTrainedModel): method __init__ (line 749) | def __init__(self, config: Sam2VisionConfig): method get_input_embeddings (line 760) | def get_input_embeddings(self): method forward (line 764) | def forward( class Sam2PositionalEmbedding (line 791) | class Sam2PositionalEmbedding(nn.Module): method __init__ (line 792) | def __init__(self, config: Sam2PromptEncoderConfig): method forward (line 798) | def forward(self, input_coords, input_shape=None): class Sam2MaskEmbedding (line 816) | class Sam2MaskEmbedding(SamMaskEmbedding): class Sam2PromptEncoder (line 820) | class Sam2PromptEncoder(SamPromptEncoder): method __init__ (line 821) | def __init__(self, config: Sam2PromptEncoderConfig): method _embed_points (line 835) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 860) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: class Sam2Attention (line 873) | class Sam2Attention(nn.Module): method __init__ (line 879) | def __init__(self, config, downsample_rate=None): method forward (line 895) | def forward( class Sam2TwoWayAttentionBlock (line 944) | class Sam2TwoWayAttentionBlock(SamTwoWayAttentionBlock, GradientCheckpoi... method __init__ (line 945) | def __init__(self, config: Sam2MaskDecoderConfig, skip_first_layer_pe:... class Sam2TwoWayTransformer (line 964) | class Sam2TwoWayTransformer(SamTwoWayTransformer): class Sam2LayerNorm (line 968) | class Sam2LayerNorm(SamLayerNorm): class Sam2MaskDecoder (line 972) | class Sam2MaskDecoder(SamMaskDecoder): method __init__ (line 973) | def __init__(self, config: Sam2MaskDecoderConfig): method _get_stability_scores (line 994) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 1006) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... method forward (line 1043) | def forward( class Sam2Model (line 1161) | class Sam2Model(SamModel): method __init__ (line 1164) | def __init__(self, config: Sam2Config): method get_image_wide_positional_embeddings (line 1181) | def get_image_wide_positional_embeddings(self) -> torch.Tensor: method get_image_embeddings (line 1195) | def get_image_embeddings( method get_image_features (line 1224) | def get_image_features( method forward (line 1258) | def forward( FILE: src/transformers/models/sam2/processing_sam2.py class Sam2Processor (line 37) | class Sam2Processor(ProcessorMixin): method __init__ (line 38) | def __init__(self, image_processor, target_size: int | None = None, po... method __call__ (line 54) | def __call__( method _normalize_coordinates (line 175) | def _normalize_coordinates( method _convert_to_nested_list (line 205) | def _convert_to_nested_list(self, data, expected_depth, current_depth=0): method _get_nested_dimensions (line 243) | def _get_nested_dimensions(self, nested_list, max_dims=None): method _pad_nested_list (line 280) | def _pad_nested_list(self, nested_list, target_dims, current_level=0, ... method _create_empty_nested_structure (line 342) | def _create_empty_nested_structure(self, dims, pad_value): method _get_nesting_level (line 357) | def _get_nesting_level(self, input_list): method _validate_single_input (line 374) | def _validate_single_input( method _normalize_tensor_coordinates (line 424) | def _normalize_tensor_coordinates(self, tensor, original_sizes, is_bou... method post_process_masks (line 459) | def post_process_masks( method model_input_names (line 506) | def model_input_names(self): FILE: src/transformers/models/sam2_video/configuration_sam2_video.py class Sam2VideoPromptEncoderConfig (line 29) | class Sam2VideoPromptEncoderConfig(PreTrainedConfig): class Sam2VideoMaskDecoderConfig (line 53) | class Sam2VideoMaskDecoderConfig(PreTrainedConfig): class Sam2VideoConfig (line 91) | class Sam2VideoConfig(PreTrainedConfig): method __post_init__ (line 250) | def __post_init__(self, **kwargs): FILE: src/transformers/models/sam2_video/convert_sam2_video_to_hf.py function get_config (line 43) | def get_config(model_name): function replace_keys (line 138) | def replace_keys(state_dict, config): function convert_sam2_checkpoint (line 227) | def convert_sam2_checkpoint(model_name, checkpoint_path, pytorch_dump_fo... FILE: src/transformers/models/sam2_video/modeling_sam2_video.py class Sam2VideoInferenceCache (line 52) | class Sam2VideoInferenceCache: method __init__ (line 55) | def __init__( method cache_vision_features (line 67) | def cache_vision_features(self, frame_idx: int, features: dict): method get_vision_features (line 83) | def get_vision_features(self, frame_idx: int) -> dict | None: method clear_all (line 99) | def clear_all(self): class Sam2VideoInferenceSession (line 104) | class Sam2VideoInferenceSession: method __init__ (line 127) | def __init__( method num_frames (line 175) | def num_frames(self) -> int | None: method obj_id_to_idx (line 179) | def obj_id_to_idx(self, obj_id: int) -> int: method obj_idx_to_id (line 201) | def obj_idx_to_id(self, obj_idx: int) -> int: method get_obj_num (line 205) | def get_obj_num(self) -> int: method add_point_inputs (line 210) | def add_point_inputs(self, obj_idx: int, frame_idx: int, inputs: dict): method remove_point_inputs (line 220) | def remove_point_inputs(self, obj_idx: int, frame_idx: int): method add_mask_inputs (line 224) | def add_mask_inputs(self, obj_idx: int, frame_idx: int, inputs: torch.... method remove_mask_inputs (line 230) | def remove_mask_inputs(self, obj_idx: int, frame_idx: int): method store_output (line 235) | def store_output( method get_output (line 272) | def get_output( method add_new_frame (line 299) | def add_new_frame(self, pixel_values: torch.Tensor, frame_idx: int | N... method get_frame (line 315) | def get_frame(self, frame_idx: int) -> torch.Tensor: method reset_tracking_data (line 319) | def reset_tracking_data(self): method reset_inference_session (line 331) | def reset_inference_session(self): class Sam2VideoLayerNorm (line 344) | class Sam2VideoLayerNorm(nn.LayerNorm): method __init__ (line 350) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 356) | def forward(self, features: torch.Tensor) -> torch.Tensor: class Sam2VideoPositionEmbeddingSine (line 371) | class Sam2VideoPositionEmbeddingSine(nn.Module): method __init__ (line 377) | def __init__( method forward (line 389) | def forward( function eager_attention_forward (line 417) | def eager_attention_forward( class Sam2VideoAttention (line 439) | class Sam2VideoAttention(nn.Module): method __init__ (line 445) | def __init__(self, config, downsample_rate=None): method forward (line 461) | def forward( class Sam2VideoTwoWayAttentionBlock (line 510) | class Sam2VideoTwoWayAttentionBlock(GradientCheckpointingLayer): method __init__ (line 511) | def __init__(self, config: Sam2VideoMaskDecoderConfig, skip_first_laye... method forward (line 542) | def forward( class Sam2VideoFeedForward (line 587) | class Sam2VideoFeedForward(nn.Module): method __init__ (line 588) | def __init__( method forward (line 605) | def forward(self, hidden_states): class Sam2VideoImageSegmentationOutput (line 619) | class Sam2VideoImageSegmentationOutput(ModelOutput): class Sam2VideoSegmentationOutput (line 660) | class Sam2VideoSegmentationOutput(ModelOutput): class Sam2VideoPreTrainedModel (line 679) | class Sam2VideoPreTrainedModel(PreTrainedModel): method _init_weights (line 689) | def _init_weights(self, module): class Sam2VideoVisionRotaryEmbedding (line 711) | class Sam2VideoVisionRotaryEmbedding(nn.Module): method __init__ (line 717) | def __init__(self, config: Sam2VideoConfig): method forward (line 734) | def forward(self) -> tuple[torch.Tensor, torch.Tensor]: method create_inv_freq (line 738) | def create_inv_freq(self): function rotate_pairwise (line 753) | def rotate_pairwise(x): function apply_rotary_pos_emb_2d (line 772) | def apply_rotary_pos_emb_2d( class Sam2VideoRoPEAttention (line 819) | class Sam2VideoRoPEAttention(nn.Module): method __init__ (line 822) | def __init__( method forward (line 847) | def forward( class Sam2VideoMemoryAttentionLayer (line 892) | class Sam2VideoMemoryAttentionLayer(nn.Module): method __init__ (line 893) | def __init__(self, config: Sam2VideoConfig): method forward (line 913) | def forward( class Sam2VideoMemoryAttention (line 943) | class Sam2VideoMemoryAttention(nn.Module): method __init__ (line 944) | def __init__(self, config: Sam2VideoConfig): method forward (line 952) | def forward( class Sam2VideoMemoryFuserCXBlock (line 1000) | class Sam2VideoMemoryFuserCXBlock(GradientCheckpointingLayer): method __init__ (line 1001) | def __init__(self, config: Sam2VideoConfig): method forward (line 1021) | def forward(self, hidden_states): class Sam2VideoMemoryFuser (line 1036) | class Sam2VideoMemoryFuser(nn.Module): method __init__ (line 1037) | def __init__(self, config: Sam2VideoConfig): method forward (line 1043) | def forward(self, hidden_states): class Sam2VideoMaskDownSamplerLayer (line 1050) | class Sam2VideoMaskDownSamplerLayer(nn.Module): method __init__ (line 1051) | def __init__(self, config: Sam2VideoConfig, in_channels: int, out_chan... method forward (line 1063) | def forward(self, x): class Sam2VideoMaskDownSampler (line 1067) | class Sam2VideoMaskDownSampler(nn.Module): method __init__ (line 1076) | def __init__(self, config: Sam2VideoConfig): method forward (line 1091) | def forward(self, x): class Sam2VideoMemoryEncoder (line 1098) | class Sam2VideoMemoryEncoder(nn.Module): method __init__ (line 1099) | def __init__(self, config: Sam2VideoConfig): method forward (line 1110) | def forward( class Sam2VideoPositionalEmbedding (line 1129) | class Sam2VideoPositionalEmbedding(nn.Module): method __init__ (line 1130) | def __init__(self, config: Sam2VideoPromptEncoderConfig): method forward (line 1136) | def forward(self, input_coords, input_shape=None): class Sam2VideoVisionEncoderOutput (line 1156) | class Sam2VideoVisionEncoderOutput(BaseModelOutputWithPooling): class Sam2VideoMaskEmbedding (line 1180) | class Sam2VideoMaskEmbedding(nn.Module): method __init__ (line 1181) | def __init__(self, config: Sam2VideoPromptEncoderConfig): method forward (line 1195) | def forward(self, masks): class Sam2VideoPromptEncoder (line 1207) | class Sam2VideoPromptEncoder(nn.Module): method __init__ (line 1208) | def __init__(self, config: Sam2VideoPromptEncoderConfig): method _embed_points (line 1222) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 1247) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 1259) | def forward( class Sam2VideoTwoWayTransformer (line 1302) | class Sam2VideoTwoWayTransformer(nn.Module): method __init__ (line 1303) | def __init__(self, config: Sam2VideoMaskDecoderConfig): method forward (line 1316) | def forward( class Sam2VideoMaskDecoder (line 1359) | class Sam2VideoMaskDecoder(nn.Module): method __init__ (line 1360) | def __init__(self, config: Sam2VideoMaskDecoderConfig): method forward (line 1401) | def forward( method _get_stability_scores (line 1512) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 1524) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... function get_1d_sine_pe (line 1566) | def get_1d_sine_pe(pos_inds, dim, temperature=10000): class Sam2VideoModel (line 1580) | class Sam2VideoModel(Sam2VideoPreTrainedModel): method __init__ (line 1586) | def __init__(self, config: Sam2VideoConfig): method get_input_embeddings (line 1636) | def get_input_embeddings(self): method get_image_wide_positional_embeddings (line 1639) | def get_image_wide_positional_embeddings(self) -> torch.Tensor: method get_image_embeddings (line 1653) | def get_image_embeddings( method get_prompt_embeddings (line 1681) | def get_prompt_embeddings( method forward (line 1715) | def forward( method get_image_features (line 1840) | def get_image_features( method _prepare_vision_features (line 1871) | def _prepare_vision_features( method _single_frame_forward (line 1901) | def _single_frame_forward( method _use_mask_as_output (line 2099) | def _use_mask_as_output( method _select_closest_cond_frames (line 2156) | def _select_closest_cond_frames(self, frame_idx, cond_frame_outputs, m... method _gather_memory_frame_outputs (line 2196) | def _gather_memory_frame_outputs( method _build_memory_attention_inputs (line 2243) | def _build_memory_attention_inputs( method _get_object_pointers (line 2278) | def _get_object_pointers( method _process_object_pointers (line 2339) | def _process_object_pointers( method _prepare_memory_conditioned_features (line 2388) | def _prepare_memory_conditioned_features( method _use_multimask (line 2504) | def _use_multimask(self, is_init_cond_frame: bool, point_inputs: dict ... method _run_single_frame_inference (line 2514) | def _run_single_frame_inference( method _encode_new_memory (line 2621) | def _encode_new_memory( method _batch_encode_memories (line 2676) | def _batch_encode_memories( method propagate_in_video_iterator (line 2740) | def propagate_in_video_iterator( FILE: src/transformers/models/sam2_video/modular_sam2_video.py class Sam2VideoPromptEncoderConfig (line 66) | class Sam2VideoPromptEncoderConfig(Sam2PromptEncoderConfig): class Sam2VideoMaskDecoderConfig (line 70) | class Sam2VideoMaskDecoderConfig(Sam2MaskDecoderConfig): class Sam2VideoConfig (line 76) | class Sam2VideoConfig(PreTrainedConfig): method __post_init__ (line 235) | def __post_init__(self, **kwargs): class Sam2VideoInferenceCache (line 259) | class Sam2VideoInferenceCache: method __init__ (line 262) | def __init__( method cache_vision_features (line 274) | def cache_vision_features(self, frame_idx: int, features: dict): method get_vision_features (line 290) | def get_vision_features(self, frame_idx: int) -> dict | None: method clear_all (line 306) | def clear_all(self): class Sam2VideoInferenceSession (line 311) | class Sam2VideoInferenceSession: method __init__ (line 334) | def __init__( method num_frames (line 382) | def num_frames(self) -> int | None: method obj_id_to_idx (line 386) | def obj_id_to_idx(self, obj_id: int) -> int: method obj_idx_to_id (line 408) | def obj_idx_to_id(self, obj_idx: int) -> int: method get_obj_num (line 412) | def get_obj_num(self) -> int: method add_point_inputs (line 417) | def add_point_inputs(self, obj_idx: int, frame_idx: int, inputs: dict): method remove_point_inputs (line 427) | def remove_point_inputs(self, obj_idx: int, frame_idx: int): method add_mask_inputs (line 431) | def add_mask_inputs(self, obj_idx: int, frame_idx: int, inputs: torch.... method remove_mask_inputs (line 437) | def remove_mask_inputs(self, obj_idx: int, frame_idx: int): method store_output (line 442) | def store_output( method get_output (line 479) | def get_output( method add_new_frame (line 506) | def add_new_frame(self, pixel_values: torch.Tensor, frame_idx: int | N... method get_frame (line 522) | def get_frame(self, frame_idx: int) -> torch.Tensor: method reset_tracking_data (line 526) | def reset_tracking_data(self): method reset_inference_session (line 538) | def reset_inference_session(self): class Sam2VideoProcessor (line 551) | class Sam2VideoProcessor(Sam2Processor): method __init__ (line 552) | def __init__( method init_video_session (line 559) | def init_video_session( method add_inputs_to_inference_session (line 612) | def add_inputs_to_inference_session( method process_new_points_or_boxes_for_video_frame (line 674) | def process_new_points_or_boxes_for_video_frame( method process_new_mask_for_video_frame (line 783) | def process_new_mask_for_video_frame( class Sam2VideoLayerNorm (line 848) | class Sam2VideoLayerNorm(Sam2LayerNorm): class Sam2VideoPositionEmbeddingSine (line 852) | class Sam2VideoPositionEmbeddingSine(Sam2SinePositionEmbedding): class Sam2VideoTwoWayAttentionBlock (line 856) | class Sam2VideoTwoWayAttentionBlock(Sam2TwoWayAttentionBlock): class Sam2VideoFeedForward (line 860) | class Sam2VideoFeedForward(Sam2FeedForward): class Sam2VideoImageSegmentationOutput (line 864) | class Sam2VideoImageSegmentationOutput(Sam2ImageSegmentationOutput): class Sam2VideoSegmentationOutput (line 897) | class Sam2VideoSegmentationOutput(ModelOutput): class Sam2VideoPreTrainedModel (line 916) | class Sam2VideoPreTrainedModel(PreTrainedModel): method _init_weights (line 926) | def _init_weights(self, module): class Sam2VideoVisionRotaryEmbedding (line 948) | class Sam2VideoVisionRotaryEmbedding(nn.Module): method __init__ (line 954) | def __init__(self, config: Sam2VideoConfig): method forward (line 971) | def forward(self) -> tuple[torch.Tensor, torch.Tensor]: method create_inv_freq (line 975) | def create_inv_freq(self): function rotate_pairwise (line 990) | def rotate_pairwise(x): function apply_rotary_pos_emb_2d (line 1009) | def apply_rotary_pos_emb_2d( class Sam2VideoRoPEAttention (line 1056) | class Sam2VideoRoPEAttention(nn.Module): method __init__ (line 1059) | def __init__( method forward (line 1084) | def forward( class Sam2VideoMemoryAttentionLayer (line 1129) | class Sam2VideoMemoryAttentionLayer(nn.Module): method __init__ (line 1130) | def __init__(self, config: Sam2VideoConfig): method forward (line 1150) | def forward( class Sam2VideoMemoryAttention (line 1180) | class Sam2VideoMemoryAttention(nn.Module): method __init__ (line 1181) | def __init__(self, config: Sam2VideoConfig): method forward (line 1189) | def forward( class Sam2VideoMemoryFuserCXBlock (line 1237) | class Sam2VideoMemoryFuserCXBlock(GradientCheckpointingLayer): method __init__ (line 1238) | def __init__(self, config: Sam2VideoConfig): method forward (line 1258) | def forward(self, hidden_states): class Sam2VideoMemoryFuser (line 1273) | class Sam2VideoMemoryFuser(nn.Module): method __init__ (line 1274) | def __init__(self, config: Sam2VideoConfig): method forward (line 1280) | def forward(self, hidden_states): class Sam2VideoMaskDownSamplerLayer (line 1287) | class Sam2VideoMaskDownSamplerLayer(nn.Module): method __init__ (line 1288) | def __init__(self, config: Sam2VideoConfig, in_channels: int, out_chan... method forward (line 1300) | def forward(self, x): class Sam2VideoMaskDownSampler (line 1304) | class Sam2VideoMaskDownSampler(nn.Module): method __init__ (line 1313) | def __init__(self, config: Sam2VideoConfig): method forward (line 1328) | def forward(self, x): class Sam2VideoMemoryEncoder (line 1335) | class Sam2VideoMemoryEncoder(nn.Module): method __init__ (line 1336) | def __init__(self, config: Sam2VideoConfig): method forward (line 1347) | def forward( class Sam2VideoPositionalEmbedding (line 1366) | class Sam2VideoPositionalEmbedding(Sam2PositionalEmbedding): function get_1d_sine_pe (line 1374) | def get_1d_sine_pe(pos_inds, dim, temperature=10000): class Sam2VideoModel (line 1388) | class Sam2VideoModel(Sam2Model): method __init__ (line 1393) | def __init__(self, config: Sam2VideoConfig): method get_prompt_embeddings (line 1432) | def get_prompt_embeddings( method _prepare_vision_features (line 1464) | def _prepare_vision_features( method _single_frame_forward (line 1494) | def _single_frame_forward( method _use_mask_as_output (line 1692) | def _use_mask_as_output( method _select_closest_cond_frames (line 1749) | def _select_closest_cond_frames(self, frame_idx, cond_frame_outputs, m... method _gather_memory_frame_outputs (line 1789) | def _gather_memory_frame_outputs( method _build_memory_attention_inputs (line 1836) | def _build_memory_attention_inputs( method _get_object_pointers (line 1871) | def _get_object_pointers( method _process_object_pointers (line 1932) | def _process_object_pointers( method _prepare_memory_conditioned_features (line 1981) | def _prepare_memory_conditioned_features( method _use_multimask (line 2097) | def _use_multimask(self, is_init_cond_frame: bool, point_inputs: dict ... method _run_single_frame_inference (line 2107) | def _run_single_frame_inference( method _encode_new_memory (line 2214) | def _encode_new_memory( method forward (line 2271) | def forward( method _batch_encode_memories (line 2394) | def _batch_encode_memories( method propagate_in_video_iterator (line 2458) | def propagate_in_video_iterator( FILE: src/transformers/models/sam2_video/processing_sam2_video.py class Sam2VideoProcessor (line 37) | class Sam2VideoProcessor(ProcessorMixin): method __init__ (line 38) | def __init__( method __call__ (line 56) | def __call__( method _normalize_coordinates (line 177) | def _normalize_coordinates( method _convert_to_nested_list (line 207) | def _convert_to_nested_list(self, data, expected_depth, current_depth=0): method _get_nested_dimensions (line 245) | def _get_nested_dimensions(self, nested_list, max_dims=None): method _pad_nested_list (line 282) | def _pad_nested_list(self, nested_list, target_dims, current_level=0, ... method _create_empty_nested_structure (line 344) | def _create_empty_nested_structure(self, dims, pad_value): method _get_nesting_level (line 359) | def _get_nesting_level(self, input_list): method _validate_single_input (line 376) | def _validate_single_input( method _normalize_tensor_coordinates (line 426) | def _normalize_tensor_coordinates(self, tensor, original_sizes, is_bou... method post_process_masks (line 461) | def post_process_masks( method model_input_names (line 508) | def model_input_names(self): method init_video_session (line 512) | def init_video_session( method add_inputs_to_inference_session (line 565) | def add_inputs_to_inference_session( method process_new_points_or_boxes_for_video_frame (line 627) | def process_new_points_or_boxes_for_video_frame( method process_new_mask_for_video_frame (line 736) | def process_new_mask_for_video_frame( FILE: src/transformers/models/sam2_video/video_processing_sam2_video.py class Sam2VideoVideoProcessor (line 26) | class Sam2VideoVideoProcessor(BaseVideoProcessor): method _preprocess (line 37) | def _preprocess( method post_process_masks (line 57) | def post_process_masks( FILE: src/transformers/models/sam3/configuration_sam3.py class Sam3ViTConfig (line 27) | class Sam3ViTConfig(PreTrainedConfig): method __post_init__ (line 62) | def __post_init__(self, **kwargs): class Sam3VisionConfig (line 70) | class Sam3VisionConfig(PreTrainedConfig): method __post_init__ (line 94) | def __post_init__(self, **kwargs): method image_size (line 108) | def image_size(self): method image_size (line 113) | def image_size(self, value): class Sam3GeometryEncoderConfig (line 120) | class Sam3GeometryEncoderConfig(PreTrainedConfig): class Sam3DETREncoderConfig (line 142) | class Sam3DETREncoderConfig(PreTrainedConfig): class Sam3DETRDecoderConfig (line 163) | class Sam3DETRDecoderConfig(PreTrainedConfig): class Sam3MaskDecoderConfig (line 185) | class Sam3MaskDecoderConfig(PreTrainedConfig): class Sam3Config (line 203) | class Sam3Config(PreTrainedConfig): method __post_init__ (line 248) | def __post_init__(self, **kwargs): method image_size (line 293) | def image_size(self): method image_size (line 298) | def image_size(self, value): FILE: src/transformers/models/sam3/convert_sam3_to_hf.py function convert_old_keys_to_new_keys (line 172) | def convert_old_keys_to_new_keys(state_dict_keys: list[str]) -> dict[str... function split_qkv (line 198) | def split_qkv(state_dict: dict) -> dict: function load_original_state_dict (line 249) | def load_original_state_dict(checkpoint_path: str) -> dict[str, torch.Te... function get_sam3_config (line 267) | def get_sam3_config( function convert_sam3_checkpoint (line 296) | def convert_sam3_checkpoint( function main (line 427) | def main(): FILE: src/transformers/models/sam3/image_processing_sam3.py class Sam3ImageProcessorKwargs (line 50) | class Sam3ImageProcessorKwargs(ImagesKwargs, total=False): function _compute_stability_score (line 59) | def _compute_stability_score(masks: "torch.Tensor", mask_threshold: floa... function _batched_mask_to_box (line 70) | def _batched_mask_to_box(masks: "torch.Tensor"): function _is_box_near_crop_edge (line 119) | def _is_box_near_crop_edge(boxes, crop_box, orig_box, atol=20.0): function _pad_masks (line 137) | def _pad_masks(masks, crop_box: list[int], orig_height: int, orig_width:... function _generate_crop_boxes (line 147) | def _generate_crop_boxes( function _generate_per_layer_crops (line 200) | def _generate_per_layer_crops(crop_n_layers, overlap_ratio, original_size): function _build_point_grid (line 234) | def _build_point_grid(n_per_side: int) -> torch.Tensor: function _generate_crop_images (line 244) | def _generate_crop_images( function _normalize_coordinates (line 269) | def _normalize_coordinates( function _rle_to_mask (line 297) | def _rle_to_mask(rle: dict[str, Any]) -> torch.Tensor: function _post_process_for_mask_generation (line 311) | def _post_process_for_mask_generation(rle_masks, iou_scores, mask_boxes,... function _mask_to_rle (line 340) | def _mask_to_rle(input_mask: "torch.Tensor"): function _scale_boxes (line 371) | def _scale_boxes(boxes, target_sizes): class Sam3ImageProcessor (line 400) | class Sam3ImageProcessor(TorchvisionBackend): method __init__ (line 417) | def __init__(self, **kwargs: Unpack[Sam3ImageProcessorKwargs]): method preprocess (line 421) | def preprocess( method _standardize_kwargs (line 433) | def _standardize_kwargs( method _preprocess_image_like_inputs (line 446) | def _preprocess_image_like_inputs( method _preprocess (line 493) | def _preprocess( method generate_crop_boxes (line 501) | def generate_crop_boxes( method filter_masks (line 550) | def filter_masks( method post_process_masks (line 628) | def post_process_masks( method post_process_for_mask_generation (line 681) | def post_process_for_mask_generation(self, all_masks, all_scores, all_... method _apply_non_overlapping_constraints (line 697) | def _apply_non_overlapping_constraints(self, pred_masks: torch.Tensor)... method post_process_semantic_segmentation (line 717) | def post_process_semantic_segmentation( method post_process_object_detection (line 776) | def post_process_object_detection(self, outputs, threshold: float = 0.... method post_process_instance_segmentation (line 827) | def post_process_instance_segmentation( FILE: src/transformers/models/sam3/modeling_sam3.py class Sam3VisionEncoderOutput (line 70) | class Sam3VisionEncoderOutput(BaseModelOutputWithPooling): class Sam3GeometryEncoderOutput (line 84) | class Sam3GeometryEncoderOutput(ModelOutput): class Sam3DETREncoderOutput (line 98) | class Sam3DETREncoderOutput(ModelOutput): class Sam3DETRDecoderOutput (line 124) | class Sam3DETRDecoderOutput(ModelOutput): class Sam3MaskDecoderOutput (line 147) | class Sam3MaskDecoderOutput(ModelOutput): class Sam3ImageSegmentationOutput (line 164) | class Sam3ImageSegmentationOutput(ModelOutput): function inverse_sigmoid (line 212) | def inverse_sigmoid(x: torch.Tensor, eps: float = 1e-3) -> torch.Tensor: function concat_padded_sequences (line 220) | def concat_padded_sequences(seq1, mask1, seq2, mask2, return_index: bool... function box_cxcywh_to_xyxy (line 274) | def box_cxcywh_to_xyxy(x): class Sam3MLP (line 281) | class Sam3MLP(nn.Module): method __init__ (line 282) | def __init__(self, config: Sam3ViTConfig): method forward (line 290) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 298) | def eager_attention_forward( class Sam3Attention (line 326) | class Sam3Attention(nn.Module): method __init__ (line 332) | def __init__(self, config): method forward (line 346) | def forward( class Sam3ViTRotaryEmbedding (line 409) | class Sam3ViTRotaryEmbedding(nn.Module): method __init__ (line 415) | def __init__(self, config: Sam3ViTConfig, end_x: int, end_y: int, scal... method forward (line 439) | def forward(self) -> tuple[torch.Tensor, torch.Tensor]: function rotate_pairwise (line 444) | def rotate_pairwise(x): function apply_rotary_pos_emb_2d (line 462) | def apply_rotary_pos_emb_2d( class Sam3ViTRoPEAttention (line 489) | class Sam3ViTRoPEAttention(nn.Module): method __init__ (line 492) | def __init__(self, config: Sam3ViTConfig): method forward (line 507) | def forward( class Sam3ViTPatchEmbeddings (line 542) | class Sam3ViTPatchEmbeddings(nn.Module): method __init__ (line 549) | def __init__(self, config: Sam3ViTConfig): method forward (line 564) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class Sam3ViTEmbeddings (line 569) | class Sam3ViTEmbeddings(nn.Module): method __init__ (line 576) | def __init__(self, config: Sam3ViTConfig): method _tile_position_embeddings (line 588) | def _tile_position_embeddings( method forward (line 618) | def forward( function window_partition (line 641) | def window_partition(hidden_state, window_size): function window_unpartition (line 672) | def window_unpartition(windows, window_size, pad_height_width, height_wi... class Sam3ViTLayerScale (line 703) | class Sam3ViTLayerScale(nn.Module): method __init__ (line 704) | def __init__(self, config) -> None: method forward (line 708) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class Sam3ViTLayer (line 712) | class Sam3ViTLayer(GradientCheckpointingLayer): method __init__ (line 715) | def __init__(self, config: Sam3ViTConfig, window_size: int = 0) -> None: method forward (line 739) | def forward( class Sam3PreTrainedModel (line 771) | class Sam3PreTrainedModel(PreTrainedModel): method _init_weights (line 781) | def _init_weights(self, module): class Sam3ViTModel (line 801) | class Sam3ViTModel(Sam3PreTrainedModel): method __init__ (line 808) | def __init__(self, config: Sam3ViTConfig): method get_input_embeddings (line 821) | def get_input_embeddings(self) -> Sam3ViTPatchEmbeddings: method forward (line 827) | def forward( class Sam3SinePositionEmbedding (line 852) | class Sam3SinePositionEmbedding(nn.Module): method __init__ (line 858) | def __init__( method encode_1d_positions (line 869) | def encode_1d_positions(self, x: torch.Tensor, y: torch.Tensor) -> tup... method encode_boxes (line 892) | def encode_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 926) | def forward( class Sam3FPNLayer (line 954) | class Sam3FPNLayer(nn.Module): method __init__ (line 955) | def __init__(self, in_channels: int, fpn_dim: int, scale_factor: float): method forward (line 981) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Sam3VisionNeck (line 992) | class Sam3VisionNeck(nn.Module): method __init__ (line 993) | def __init__(self, config: Sam3VisionConfig): method forward (line 1009) | def forward(self, hidden_states: torch.Tensor) -> tuple[tuple[torch.Te... class Sam3VisionModel (line 1028) | class Sam3VisionModel(Sam3PreTrainedModel): method __init__ (line 1032) | def __init__(self, config: Sam3VisionConfig): method get_input_embeddings (line 1040) | def get_input_embeddings(self): method forward (line 1044) | def forward( class Sam3GeometryEncoderLayer (line 1071) | class Sam3GeometryEncoderLayer(nn.Module): method __init__ (line 1072) | def __init__(self, config: Sam3GeometryEncoderConfig): method forward (line 1084) | def forward( class Sam3GeometryEncoder (line 1111) | class Sam3GeometryEncoder(nn.Module): method __init__ (line 1123) | def __init__(self, config: Sam3GeometryEncoderConfig): method _encode_box_coordinates (line 1149) | def _encode_box_coordinates( method _encode_boxes (line 1168) | def _encode_boxes(self, boxes, boxes_mask, boxes_labels, vision_featur... method forward (line 1204) | def forward( class Sam3DetrEncoderLayer (line 1275) | class Sam3DetrEncoderLayer(nn.Module): method __init__ (line 1278) | def __init__(self, config: Sam3DETREncoderConfig): method forward (line 1291) | def forward( class Sam3DetrEncoder (line 1345) | class Sam3DetrEncoder(Sam3PreTrainedModel): method __init__ (line 1358) | def __init__(self, config: Sam3DETREncoderConfig): method _prepare_multilevel_features (line 1367) | def _prepare_multilevel_features( method forward (line 1411) | def forward( class Sam3DecoderMLP (line 1475) | class Sam3DecoderMLP(nn.Module): method __init__ (line 1478) | def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, n... method forward (line 1491) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Sam3DetrDecoderLayer (line 1501) | class Sam3DetrDecoderLayer(nn.Module): method __init__ (line 1504) | def __init__(self, config: Sam3DETRDecoderConfig): method forward (line 1523) | def forward( class Sam3DetrDecoder (line 1602) | class Sam3DetrDecoder(Sam3PreTrainedModel): method __init__ (line 1618) | def __init__( method _get_coords (line 1650) | def _get_coords( method _get_rpb_matrix (line 1658) | def _get_rpb_matrix( method forward (line 1707) | def forward( class Sam3DotProductScoring (line 1809) | class Sam3DotProductScoring(nn.Module): method __init__ (line 1815) | def __init__(self, config: Sam3Config): method _pool_text_features (line 1841) | def _pool_text_features(self, text_features: torch.Tensor, text_mask: ... method forward (line 1866) | def forward( class Sam3MaskEmbedder (line 1903) | class Sam3MaskEmbedder(nn.Module): method __init__ (line 1909) | def __init__(self, config: Sam3MaskDecoderConfig): method forward (line 1923) | def forward(self, queries: torch.Tensor) -> torch.Tensor: class Sam3PixelDecoder (line 1939) | class Sam3PixelDecoder(nn.Module): method __init__ (line 1945) | def __init__(self, config: Sam3MaskDecoderConfig): method forward (line 1962) | def forward(self, backbone_features: list[torch.Tensor]) -> torch.Tensor: class Sam3MaskDecoder (line 1989) | class Sam3MaskDecoder(Sam3PreTrainedModel): method __init__ (line 1999) | def __init__(self, config: Sam3MaskDecoderConfig): method forward (line 2024) | def forward( method _embed_pixels (line 2086) | def _embed_pixels( class Sam3Model (line 2120) | class Sam3Model(Sam3PreTrainedModel): method __init__ (line 2128) | def __init__(self, config: Sam3Config): method get_text_features (line 2162) | def get_text_features( method get_vision_features (line 2201) | def get_vision_features( method forward (line 2235) | def forward( FILE: src/transformers/models/sam3/modular_sam3.py function _scale_boxes (line 25) | def _scale_boxes(boxes, target_sizes): class Sam3ImageProcessor (line 53) | class Sam3ImageProcessor(Sam2ImageProcessor): method post_process_semantic_segmentation (line 59) | def post_process_semantic_segmentation( method post_process_object_detection (line 118) | def post_process_object_detection(self, outputs, threshold: float = 0.... method post_process_instance_segmentation (line 169) | def post_process_instance_segmentation( FILE: src/transformers/models/sam3/processing_sam3.py function box_cxcywh_to_xyxy (line 35) | def box_cxcywh_to_xyxy(x): function box_cxcywh_to_xywh (line 41) | def box_cxcywh_to_xywh(x): function box_xywh_to_xyxy (line 47) | def box_xywh_to_xyxy(x): function box_xywh_to_cxcywh (line 53) | def box_xywh_to_cxcywh(x): function box_xyxy_to_xywh (line 59) | def box_xyxy_to_xywh(x): function box_xyxy_to_cxcywh (line 65) | def box_xyxy_to_cxcywh(x): function box_area (line 71) | def box_area(boxes): class Sam3Processor (line 87) | class Sam3Processor(ProcessorMixin): method __init__ (line 88) | def __init__( method __call__ (line 102) | def __call__( method _normalize_coordinates (line 206) | def _normalize_coordinates(self, coords: "torch.Tensor", original_size... method _convert_to_nested_list (line 233) | def _convert_to_nested_list(self, data, expected_depth, current_depth=0): method _resolve_text_prompts (line 275) | def _resolve_text_prompts(self, text, input_boxes): method _get_nested_dimensions (line 302) | def _get_nested_dimensions(self, nested_list, max_dims=None): method _pad_nested_list (line 342) | def _pad_nested_list(self, nested_list, target_dims, current_level=0, ... method _create_empty_nested_structure (line 408) | def _create_empty_nested_structure(self, dims, pad_value): method _get_nesting_level (line 423) | def _get_nesting_level(self, input_list): method _validate_single_input (line 445) | def _validate_single_input( method _normalize_tensor_coordinates (line 495) | def _normalize_tensor_coordinates(self, tensor, original_sizes, is_bou... method post_process_semantic_segmentation (line 530) | def post_process_semantic_segmentation(self, outputs, target_sizes=Non... method post_process_object_detection (line 550) | def post_process_object_detection(self, outputs, threshold=0.3, target... method post_process_instance_segmentation (line 595) | def post_process_instance_segmentation( FILE: src/transformers/models/sam3_tracker/configuration_sam3_tracker.py class Sam3TrackerPromptEncoderConfig (line 31) | class Sam3TrackerPromptEncoderConfig(PreTrainedConfig): class Sam3TrackerMaskDecoderConfig (line 56) | class Sam3TrackerMaskDecoderConfig(PreTrainedConfig): class Sam3TrackerConfig (line 94) | class Sam3TrackerConfig(PreTrainedConfig): method __post_init__ (line 142) | def __post_init__(self, **kwargs): FILE: src/transformers/models/sam3_tracker/modeling_sam3_tracker.py class Sam3TrackerImageSegmentationOutput (line 49) | class Sam3TrackerImageSegmentationOutput(ModelOutput): class Sam3TrackerFeedForward (line 81) | class Sam3TrackerFeedForward(nn.Module): method __init__ (line 82) | def __init__( method forward (line 99) | def forward(self, hidden_states): class Sam3TrackerPreTrainedModel (line 117) | class Sam3TrackerPreTrainedModel(PreTrainedModel): method _init_weights (line 136) | def _init_weights(self, module): class Sam3TrackerPositionalEmbedding (line 145) | class Sam3TrackerPositionalEmbedding(nn.Module): method __init__ (line 146) | def __init__(self, config: Sam3TrackerPromptEncoderConfig): method forward (line 152) | def forward(self, input_coords, input_shape=None): class Sam3TrackerMaskEmbedding (line 170) | class Sam3TrackerMaskEmbedding(nn.Module): method __init__ (line 171) | def __init__(self, config: Sam3TrackerPromptEncoderConfig): method forward (line 185) | def forward(self, masks): class Sam3TrackerPromptEncoder (line 197) | class Sam3TrackerPromptEncoder(nn.Module): method __init__ (line 198) | def __init__(self, config: Sam3TrackerPromptEncoderConfig): method _embed_points (line 212) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 237) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 249) | def forward( function eager_attention_forward (line 292) | def eager_attention_forward( class Sam3TrackerAttention (line 314) | class Sam3TrackerAttention(nn.Module): method __init__ (line 320) | def __init__(self, config, downsample_rate=None): method forward (line 336) | def forward( class Sam3TrackerTwoWayAttentionBlock (line 385) | class Sam3TrackerTwoWayAttentionBlock(GradientCheckpointingLayer): method __init__ (line 386) | def __init__(self, config: Sam3TrackerMaskDecoderConfig, skip_first_la... method forward (line 417) | def forward( class Sam3TrackerTwoWayTransformer (line 462) | class Sam3TrackerTwoWayTransformer(nn.Module): method __init__ (line 463) | def __init__(self, config: Sam3TrackerMaskDecoderConfig): method forward (line 476) | def forward( class Sam3TrackerLayerNorm (line 519) | class Sam3TrackerLayerNorm(nn.LayerNorm): method __init__ (line 525) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 531) | def forward(self, features: torch.Tensor) -> torch.Tensor: class Sam3TrackerMaskDecoder (line 545) | class Sam3TrackerMaskDecoder(nn.Module): method __init__ (line 546) | def __init__(self, config: Sam3TrackerMaskDecoderConfig): method forward (line 587) | def forward( method _get_stability_scores (line 698) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 710) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... class Sam3TrackerVisionEncoderOutput (line 750) | class Sam3TrackerVisionEncoderOutput(BaseModelOutputWithPooling): class Sam3TrackerModel (line 780) | class Sam3TrackerModel(Sam3TrackerPreTrainedModel): method __init__ (line 796) | def __init__(self, config: Sam3TrackerConfig): method get_input_embeddings (line 817) | def get_input_embeddings(self): method get_image_wide_positional_embeddings (line 820) | def get_image_wide_positional_embeddings(self) -> torch.Tensor: method get_image_embeddings (line 834) | def get_image_embeddings( method get_prompt_embeddings (line 862) | def get_prompt_embeddings( method forward (line 897) | def forward( method get_image_features (line 1074) | def get_image_features( FILE: src/transformers/models/sam3_tracker/modular_sam3_tracker.py class Sam3TrackerPromptEncoderConfig (line 48) | class Sam3TrackerPromptEncoderConfig(Sam2PromptEncoderConfig): class Sam3TrackerProcessor (line 64) | class Sam3TrackerProcessor(Sam2Processor): class Sam3TrackerMaskDecoderConfig (line 70) | class Sam3TrackerMaskDecoderConfig(Sam2MaskDecoderConfig): class Sam3TrackerConfig (line 76) | class Sam3TrackerConfig(Sam2Config): method __post_init__ (line 112) | def __post_init__(self, **kwargs): class Sam3TrackerImageSegmentationOutput (line 134) | class Sam3TrackerImageSegmentationOutput(Sam2ImageSegmentationOutput): class Sam3TrackerFeedForward (line 138) | class Sam3TrackerFeedForward(Sam2FeedForward): class Sam3TrackerPreTrainedModel (line 148) | class Sam3TrackerPreTrainedModel(Sam2PreTrainedModel): method _init_weights (line 150) | def _init_weights(self, module): class Sam3TrackerPositionalEmbedding (line 159) | class Sam3TrackerPositionalEmbedding(Sam2PositionalEmbedding): class Sam3TrackerMaskEmbedding (line 163) | class Sam3TrackerMaskEmbedding(Sam2MaskEmbedding): class Sam3TrackerPromptEncoder (line 167) | class Sam3TrackerPromptEncoder(Sam2PromptEncoder): class Sam3TrackerAttention (line 171) | class Sam3TrackerAttention(Sam2Attention): class Sam3TrackerTwoWayAttentionBlock (line 175) | class Sam3TrackerTwoWayAttentionBlock(Sam2TwoWayAttentionBlock): class Sam3TrackerTwoWayTransformer (line 179) | class Sam3TrackerTwoWayTransformer(Sam2TwoWayTransformer): class Sam3TrackerLayerNorm (line 183) | class Sam3TrackerLayerNorm(Sam2LayerNorm): class Sam3TrackerMaskDecoder (line 187) | class Sam3TrackerMaskDecoder(Sam2MaskDecoder): class Sam3TrackerModel (line 191) | class Sam3TrackerModel(Sam2Model): method __init__ (line 204) | def __init__(self, config: Sam3TrackerConfig): FILE: src/transformers/models/sam3_tracker/processing_sam3_tracker.py class Sam3TrackerProcessor (line 36) | class Sam3TrackerProcessor(ProcessorMixin): method __init__ (line 37) | def __init__(self, image_processor, target_size: int | None = None, po... method __call__ (line 53) | def __call__( method _normalize_coordinates (line 174) | def _normalize_coordinates( method _convert_to_nested_list (line 204) | def _convert_to_nested_list(self, data, expected_depth, current_depth=0): method _get_nested_dimensions (line 242) | def _get_nested_dimensions(self, nested_list, max_dims=None): method _pad_nested_list (line 279) | def _pad_nested_list(self, nested_list, target_dims, current_level=0, ... method _create_empty_nested_structure (line 341) | def _create_empty_nested_structure(self, dims, pad_value): method _get_nesting_level (line 356) | def _get_nesting_level(self, input_list): method _validate_single_input (line 373) | def _validate_single_input( method _normalize_tensor_coordinates (line 423) | def _normalize_tensor_coordinates(self, tensor, original_sizes, is_bou... method post_process_masks (line 458) | def post_process_masks( method model_input_names (line 505) | def model_input_names(self): FILE: src/transformers/models/sam3_tracker_video/configuration_sam3_tracker_video.py class Sam3TrackerVideoPromptEncoderConfig (line 31) | class Sam3TrackerVideoPromptEncoderConfig(PreTrainedConfig): class Sam3TrackerVideoMaskDecoderConfig (line 56) | class Sam3TrackerVideoMaskDecoderConfig(PreTrainedConfig): class Sam3TrackerVideoConfig (line 94) | class Sam3TrackerVideoConfig(PreTrainedConfig): method __post_init__ (line 252) | def __post_init__(self, **kwargs): method image_size (line 279) | def image_size(self): method image_size (line 284) | def image_size(self, value): FILE: src/transformers/models/sam3_tracker_video/modeling_sam3_tracker_video.py class Sam3TrackerVideoInferenceCache (line 57) | class Sam3TrackerVideoInferenceCache: method __init__ (line 60) | def __init__( method cache_vision_features (line 72) | def cache_vision_features(self, frame_idx: int, features: dict): method get_vision_features (line 88) | def get_vision_features(self, frame_idx: int) -> dict | None: method clear_all (line 104) | def clear_all(self): class Sam3TrackerVideoInferenceSession (line 109) | class Sam3TrackerVideoInferenceSession: method __init__ (line 132) | def __init__( method num_frames (line 180) | def num_frames(self) -> int | None: method obj_id_to_idx (line 184) | def obj_id_to_idx(self, obj_id: int) -> int: method obj_idx_to_id (line 206) | def obj_idx_to_id(self, obj_idx: int) -> int: method get_obj_num (line 210) | def get_obj_num(self) -> int: method add_point_inputs (line 215) | def add_point_inputs(self, obj_idx: int, frame_idx: int, inputs: dict): method remove_point_inputs (line 225) | def remove_point_inputs(self, obj_idx: int, frame_idx: int): method add_mask_inputs (line 229) | def add_mask_inputs(self, obj_idx: int, frame_idx: int, inputs: torch.... method remove_mask_inputs (line 235) | def remove_mask_inputs(self, obj_idx: int, frame_idx: int): method store_output (line 240) | def store_output( method get_output (line 277) | def get_output( method add_new_frame (line 304) | def add_new_frame(self, pixel_values: torch.Tensor, frame_idx: int | N... method get_frame (line 320) | def get_frame(self, frame_idx: int) -> torch.Tensor: method reset_tracking_data (line 324) | def reset_tracking_data(self): method reset_inference_session (line 336) | def reset_inference_session(self): class Sam3TrackerVideoLayerNorm (line 349) | class Sam3TrackerVideoLayerNorm(nn.LayerNorm): method __init__ (line 355) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 361) | def forward(self, features: torch.Tensor) -> torch.Tensor: class Sam3TrackerVideoPositionEmbeddingSine (line 376) | class Sam3TrackerVideoPositionEmbeddingSine(nn.Module): method __init__ (line 382) | def __init__( method forward (line 394) | def forward( function eager_attention_forward (line 422) | def eager_attention_forward( class Sam3TrackerVideoAttention (line 444) | class Sam3TrackerVideoAttention(nn.Module): method __init__ (line 450) | def __init__(self, config, downsample_rate=None): method forward (line 466) | def forward( class Sam3TrackerVideoTwoWayAttentionBlock (line 515) | class Sam3TrackerVideoTwoWayAttentionBlock(GradientCheckpointingLayer): method __init__ (line 516) | def __init__(self, config: Sam3TrackerVideoMaskDecoderConfig, skip_fir... method forward (line 547) | def forward( class Sam3TrackerVideoFeedForward (line 592) | class Sam3TrackerVideoFeedForward(nn.Module): method __init__ (line 593) | def __init__( method forward (line 610) | def forward(self, hidden_states): class Sam3TrackerVideoImageSegmentationOutput (line 624) | class Sam3TrackerVideoImageSegmentationOutput(ModelOutput): class Sam3TrackerVideoSegmentationOutput (line 665) | class Sam3TrackerVideoSegmentationOutput(ModelOutput): class Sam3TrackerVideoPreTrainedModel (line 684) | class Sam3TrackerVideoPreTrainedModel(PreTrainedModel): method _init_weights (line 694) | def _init_weights(self, module): class Sam3TrackerVideoVisionRotaryEmbedding (line 716) | class Sam3TrackerVideoVisionRotaryEmbedding(nn.Module): method __init__ (line 722) | def __init__(self, config: Sam3TrackerVideoConfig): method forward (line 739) | def forward(self) -> tuple[torch.Tensor, torch.Tensor]: method create_inv_freq (line 743) | def create_inv_freq(self): function rotate_pairwise (line 758) | def rotate_pairwise(x): function apply_rotary_pos_emb_2d (line 777) | def apply_rotary_pos_emb_2d( class Sam3TrackerVideoRoPEAttention (line 824) | class Sam3TrackerVideoRoPEAttention(nn.Module): method __init__ (line 827) | def __init__( method forward (line 852) | def forward( class Sam3TrackerVideoMemoryAttentionLayer (line 897) | class Sam3TrackerVideoMemoryAttentionLayer(nn.Module): method __init__ (line 898) | def __init__(self, config: Sam3TrackerVideoConfig): method forward (line 918) | def forward( class Sam3TrackerVideoMemoryAttention (line 948) | class Sam3TrackerVideoMemoryAttention(nn.Module): method __init__ (line 949) | def __init__(self, config: Sam3TrackerVideoConfig): method forward (line 957) | def forward( class Sam3TrackerVideoMemoryFuserCXBlock (line 1005) | class Sam3TrackerVideoMemoryFuserCXBlock(GradientCheckpointingLayer): method __init__ (line 1006) | def __init__(self, config: Sam3TrackerVideoConfig): method forward (line 1028) | def forward(self, hidden_states): class Sam3TrackerVideoMemoryFuser (line 1043) | class Sam3TrackerVideoMemoryFuser(nn.Module): method __init__ (line 1044) | def __init__(self, config: Sam3TrackerVideoConfig): method forward (line 1050) | def forward(self, hidden_states): class Sam3TrackerVideoMaskDownSamplerLayer (line 1057) | class Sam3TrackerVideoMaskDownSamplerLayer(nn.Module): method __init__ (line 1058) | def __init__(self, config: Sam3TrackerVideoConfig, in_channels: int, o... method forward (line 1070) | def forward(self, x): class Sam3TrackerVideoMaskDownSampler (line 1074) | class Sam3TrackerVideoMaskDownSampler(nn.Module): method __init__ (line 1083) | def __init__(self, config: Sam3TrackerVideoConfig): method forward (line 1098) | def forward(self, x): class Sam3TrackerVideoMemoryEncoder (line 1105) | class Sam3TrackerVideoMemoryEncoder(nn.Module): method __init__ (line 1106) | def __init__(self, config: Sam3TrackerVideoConfig): method forward (line 1119) | def forward( class Sam3TrackerVideoVisionEncoderOutput (line 1140) | class Sam3TrackerVideoVisionEncoderOutput(BaseModelOutputWithPooling): class Sam3TrackerVideoPositionalEmbedding (line 1164) | class Sam3TrackerVideoPositionalEmbedding(nn.Module): method __init__ (line 1165) | def __init__(self, config: Sam3TrackerVideoPromptEncoderConfig): method forward (line 1171) | def forward(self, input_coords, input_shape=None): class Sam3TrackerVideoMaskEmbedding (line 1189) | class Sam3TrackerVideoMaskEmbedding(nn.Module): method __init__ (line 1190) | def __init__(self, config: Sam3TrackerVideoPromptEncoderConfig): method forward (line 1204) | def forward(self, masks): class Sam3TrackerVideoPromptEncoder (line 1216) | class Sam3TrackerVideoPromptEncoder(nn.Module): method __init__ (line 1217) | def __init__(self, config: Sam3TrackerVideoPromptEncoderConfig): method _embed_points (line 1231) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 1256) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 1268) | def forward( class Sam3TrackerVideoTwoWayTransformer (line 1311) | class Sam3TrackerVideoTwoWayTransformer(nn.Module): method __init__ (line 1312) | def __init__(self, config: Sam3TrackerVideoMaskDecoderConfig): method forward (line 1325) | def forward( class Sam3TrackerVideoMaskDecoder (line 1368) | class Sam3TrackerVideoMaskDecoder(nn.Module): method __init__ (line 1369) | def __init__(self, config: Sam3TrackerVideoMaskDecoderConfig): method forward (line 1410) | def forward( method _get_stability_scores (line 1521) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 1533) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... function get_1d_sine_pe (line 1575) | def get_1d_sine_pe(pos_inds, dim, temperature=10000): class Sam3TrackerVideoModel (line 1589) | class Sam3TrackerVideoModel(Sam3TrackerVideoPreTrainedModel): method __init__ (line 1595) | def __init__(self, config: Sam3TrackerVideoConfig, remove_vision_encod... method get_input_embeddings (line 1654) | def get_input_embeddings(self): method get_image_wide_positional_embeddings (line 1657) | def get_image_wide_positional_embeddings(self) -> torch.Tensor: method get_image_embeddings (line 1671) | def get_image_embeddings( method get_prompt_embeddings (line 1699) | def get_prompt_embeddings( method forward (line 1733) | def forward( method get_image_features (line 1858) | def get_image_features( method _prepare_vision_features (line 1891) | def _prepare_vision_features( method _single_frame_forward (line 1921) | def _single_frame_forward( method _use_mask_as_output (line 2119) | def _use_mask_as_output( method _select_closest_cond_frames (line 2176) | def _select_closest_cond_frames(self, frame_idx, cond_frame_outputs, m... method _gather_memory_frame_outputs (line 2216) | def _gather_memory_frame_outputs( method _build_memory_attention_inputs (line 2263) | def _build_memory_attention_inputs( method _get_object_pointers (line 2298) | def _get_object_pointers( method _process_object_pointers (line 2359) | def _process_object_pointers( method _prepare_memory_conditioned_features (line 2408) | def _prepare_memory_conditioned_features( method _use_multimask (line 2524) | def _use_multimask(self, is_init_cond_frame: bool, point_inputs: dict ... method _run_single_frame_inference (line 2534) | def _run_single_frame_inference( method _encode_new_memory (line 2641) | def _encode_new_memory( method _batch_encode_memories (line 2696) | def _batch_encode_memories( method propagate_in_video_iterator (line 2760) | def propagate_in_video_iterator( FILE: src/transformers/models/sam3_tracker_video/modular_sam3_tracker_video.py class Sam3TrackerVideoPromptEncoderConfig (line 57) | class Sam3TrackerVideoPromptEncoderConfig(Sam2VideoPromptEncoderConfig): class Sam3TrackerVideoProcessor (line 73) | class Sam3TrackerVideoProcessor(Sam2VideoProcessor): class Sam3TrackerVideoMaskDecoderConfig (line 79) | class Sam3TrackerVideoMaskDecoderConfig(Sam2VideoMaskDecoderConfig): class Sam3TrackerVideoConfig (line 85) | class Sam3TrackerVideoConfig(PreTrainedConfig): method __post_init__ (line 243) | def __post_init__(self, **kwargs): method image_size (line 270) | def image_size(self): method image_size (line 275) | def image_size(self, value): class Sam3TrackerVideoInferenceCache (line 295) | class Sam3TrackerVideoInferenceCache(Sam2VideoInferenceCache): class Sam3TrackerVideoInferenceSession (line 299) | class Sam3TrackerVideoInferenceSession(Sam2VideoInferenceSession): class Sam3TrackerVideoLayerNorm (line 303) | class Sam3TrackerVideoLayerNorm(Sam2VideoLayerNorm): class Sam3TrackerVideoPositionEmbeddingSine (line 307) | class Sam3TrackerVideoPositionEmbeddingSine(Sam2VideoPositionEmbeddingSi... class Sam3TrackerVideoAttention (line 311) | class Sam3TrackerVideoAttention(Sam2VideoAttention): class Sam3TrackerVideoTwoWayAttentionBlock (line 315) | class Sam3TrackerVideoTwoWayAttentionBlock(Sam2VideoTwoWayAttentionBlock): class Sam3TrackerVideoFeedForward (line 319) | class Sam3TrackerVideoFeedForward(Sam2VideoFeedForward): class Sam3TrackerVideoImageSegmentationOutput (line 323) | class Sam3TrackerVideoImageSegmentationOutput(Sam2VideoImageSegmentation... class Sam3TrackerVideoSegmentationOutput (line 327) | class Sam3TrackerVideoSegmentationOutput(Sam2VideoSegmentationOutput): class Sam3TrackerVideoPreTrainedModel (line 331) | class Sam3TrackerVideoPreTrainedModel(Sam2VideoPreTrainedModel): class Sam3TrackerVideoVisionRotaryEmbedding (line 335) | class Sam3TrackerVideoVisionRotaryEmbedding(Sam2VideoVisionRotaryEmbeddi... class Sam3TrackerVideoRoPEAttention (line 339) | class Sam3TrackerVideoRoPEAttention(Sam2VideoRoPEAttention): class Sam3TrackerVideoMemoryAttentionLayer (line 343) | class Sam3TrackerVideoMemoryAttentionLayer(Sam2VideoMemoryAttentionLayer): class Sam3TrackerVideoMemoryAttention (line 347) | class Sam3TrackerVideoMemoryAttention(Sam2VideoMemoryAttention): class Sam3TrackerVideoMemoryFuserCXBlock (line 351) | class Sam3TrackerVideoMemoryFuserCXBlock(Sam2VideoMemoryFuserCXBlock): class Sam3TrackerVideoMemoryFuser (line 355) | class Sam3TrackerVideoMemoryFuser(Sam2VideoMemoryFuser): class Sam3TrackerVideoMaskDownSamplerLayer (line 359) | class Sam3TrackerVideoMaskDownSamplerLayer(Sam2VideoMaskDownSamplerLayer): class Sam3TrackerVideoMaskDownSampler (line 363) | class Sam3TrackerVideoMaskDownSampler(Sam2VideoMaskDownSampler): class Sam3TrackerVideoMemoryEncoder (line 367) | class Sam3TrackerVideoMemoryEncoder(Sam2VideoMemoryEncoder): class Sam3TrackerVideoVisionEncoderOutput (line 371) | class Sam3TrackerVideoVisionEncoderOutput(Sam2VideoVisionEncoderOutput): class Sam3TrackerVideoPositionalEmbedding (line 375) | class Sam3TrackerVideoPositionalEmbedding(Sam2VideoPositionalEmbedding): class Sam3TrackerVideoMaskEmbedding (line 379) | class Sam3TrackerVideoMaskEmbedding(Sam2VideoMaskEmbedding): class Sam3TrackerVideoPromptEncoder (line 383) | class Sam3TrackerVideoPromptEncoder(Sam2VideoPromptEncoder): class Sam3TrackerVideoTwoWayTransformer (line 387) | class Sam3TrackerVideoTwoWayTransformer(Sam2VideoTwoWayTransformer): class Sam3TrackerVideoMaskDecoder (line 391) | class Sam3TrackerVideoMaskDecoder(Sam2VideoMaskDecoder): class Sam3TrackerVideoModel (line 395) | class Sam3TrackerVideoModel(Sam2VideoModel): method __init__ (line 398) | def __init__(self, config: Sam3TrackerVideoConfig, remove_vision_encod... method get_image_features (line 459) | def get_image_features( FILE: src/transformers/models/sam3_tracker_video/processing_sam3_tracker_video.py class Sam3TrackerVideoProcessor (line 39) | class Sam3TrackerVideoProcessor(ProcessorMixin): method __init__ (line 40) | def __init__( method __call__ (line 58) | def __call__( method _normalize_coordinates (line 179) | def _normalize_coordinates( method _convert_to_nested_list (line 209) | def _convert_to_nested_list(self, data, expected_depth, current_depth=0): method _get_nested_dimensions (line 247) | def _get_nested_dimensions(self, nested_list, max_dims=None): method _pad_nested_list (line 284) | def _pad_nested_list(self, nested_list, target_dims, current_level=0, ... method _create_empty_nested_structure (line 346) | def _create_empty_nested_structure(self, dims, pad_value): method _get_nesting_level (line 361) | def _get_nesting_level(self, input_list): method _validate_single_input (line 378) | def _validate_single_input( method _normalize_tensor_coordinates (line 428) | def _normalize_tensor_coordinates(self, tensor, original_sizes, is_bou... method post_process_masks (line 463) | def post_process_masks( method model_input_names (line 510) | def model_input_names(self): method init_video_session (line 514) | def init_video_session( method add_inputs_to_inference_session (line 567) | def add_inputs_to_inference_session( method process_new_points_or_boxes_for_video_frame (line 629) | def process_new_points_or_boxes_for_video_frame( method process_new_mask_for_video_frame (line 738) | def process_new_mask_for_video_frame( FILE: src/transformers/models/sam3_video/configuration_sam3_video.py class Sam3VideoConfig (line 28) | class Sam3VideoConfig(PreTrainedConfig): method __post_init__ (line 137) | def __post_init__(self, **kwargs): method validate_architecture (line 153) | def validate_architecture(self): method image_size (line 166) | def image_size(self): method image_size (line 171) | def image_size(self, value): FILE: src/transformers/models/sam3_video/convert_sam3_video_to_hf.py function adapt_internal_ckpt (line 231) | def adapt_internal_ckpt(ov_sd): function replace_keys (line 359) | def replace_keys(key_mapping: dict): function convert_old_keys_to_new_keys (line 441) | def convert_old_keys_to_new_keys(state_dict_keys: list[str]) -> dict[str... function split_qkv (line 470) | def split_qkv(state_dict: dict) -> dict: function load_original_state_dict (line 521) | def load_original_state_dict(checkpoint_path: str) -> dict[str, torch.Te... function get_sam3_video_config (line 539) | def get_sam3_video_config( function convert_sam3_checkpoint (line 568) | def convert_sam3_checkpoint( function main (line 744) | def main(): FILE: src/transformers/models/sam3_video/modeling_sam3_video.py function _load_cv_utils_kernel_once (line 43) | def _load_cv_utils_kernel_once(): class Sam3VideoInferenceCache (line 67) | class Sam3VideoInferenceCache: method __init__ (line 70) | def __init__( method cache_vision_features (line 82) | def cache_vision_features(self, frame_idx: int, features: dict): method get_vision_features (line 98) | def get_vision_features(self, frame_idx: int) -> dict | None: method clear_all (line 114) | def clear_all(self): class Sam3VideoInferenceSession (line 119) | class Sam3VideoInferenceSession: method __init__ (line 142) | def __init__( method num_frames (line 211) | def num_frames(self) -> int | None: method add_prompt (line 215) | def add_prompt(self, prompt_text: str) -> int: method obj_id_to_idx (line 229) | def obj_id_to_idx(self, obj_id: int) -> int: method obj_idx_to_id (line 247) | def obj_idx_to_id(self, obj_idx: int) -> int: method get_obj_num (line 251) | def get_obj_num(self) -> int: method add_mask_inputs (line 255) | def add_mask_inputs(self, obj_idx: int, frame_idx: int, inputs: torch.... method remove_mask_inputs (line 261) | def remove_mask_inputs(self, obj_idx: int, frame_idx: int): method remove_object (line 265) | def remove_object(self, obj_id: int, strict: bool = False): method store_output (line 320) | def store_output( method get_output (line 357) | def get_output( method add_new_frame (line 384) | def add_new_frame(self, pixel_values: torch.Tensor, frame_idx: int | N... method get_frame (line 400) | def get_frame(self, frame_idx: int) -> torch.Tensor: method reset_tracking_data (line 404) | def reset_tracking_data(self): method reset_inference_session (line 416) | def reset_inference_session(self): method reset_state (line 428) | def reset_state(self): class Sam3VideoSegmentationOutput (line 462) | class Sam3VideoSegmentationOutput(ModelOutput): class Sam3VideoPreTrainedModel (line 490) | class Sam3VideoPreTrainedModel(PreTrainedModel): class Sam3VideoModel (line 507) | class Sam3VideoModel(Sam3VideoPreTrainedModel): method __init__ (line 508) | def __init__(self, config: Sam3VideoConfig): method get_vision_features_for_tracker (line 545) | def get_vision_features_for_tracker(self, vision_embeds: torch.Tensor): method run_detection (line 567) | def run_detection( method run_tracker_propagation (line 639) | def run_tracker_propagation( method _associate_det_trk (line 682) | def _associate_det_trk( method _process_hotstart (line 803) | def _process_hotstart( method run_memory_encoder (line 926) | def run_memory_encoder( method _prepare_recondition_masks (line 949) | def _prepare_recondition_masks( method _get_objects_to_suppress_based_on_most_recently_occluded (line 987) | def _get_objects_to_suppress_based_on_most_recently_occluded( method _suppress_overlapping_based_on_recent_occlusion (line 1028) | def _suppress_overlapping_based_on_recent_occlusion( method _apply_non_overlapping_constraints (line 1116) | def _apply_non_overlapping_constraints(self, pred_masks): method _suppress_shrinked_masks (line 1136) | def _suppress_shrinked_masks(self, pred_masks, new_pred_masks, shrink_... method _suppress_object_pw_area_shrinkage (line 1146) | def _suppress_object_pw_area_shrinkage( method _suppress_object_pw_area_shrinkage_impl (line 1170) | def _suppress_object_pw_area_shrinkage_impl(self, pred_masks): method _tracker_update_memories (line 1178) | def _tracker_update_memories( method run_tracker_update_planning_phase (line 1249) | def run_tracker_update_planning_phase( method _tracker_add_new_objects (line 1447) | def _tracker_add_new_objects( method run_tracker_update_execution_phase (line 1470) | def run_tracker_update_execution_phase( method build_outputs (line 1500) | def build_outputs( method _merge_detections_from_prompts (line 1551) | def _merge_detections_from_prompts( method _det_track_one_frame (line 1598) | def _det_track_one_frame( method forward (line 1695) | def forward( method _get_processing_order (line 1763) | def _get_processing_order( method propagate_in_video_iterator (line 1791) | def propagate_in_video_iterator( function fast_diag_box_iou (line 1846) | def fast_diag_box_iou(boxes1, boxes2): function mask_iou (line 1863) | def mask_iou(pred_masks: torch.Tensor, gt_masks: torch.Tensor) -> torch.... function nms_masks (line 1886) | def nms_masks( function fill_holes_in_mask_scores (line 1928) | def fill_holes_in_mask_scores(mask, max_area, fill_holes=True, remove_sp... function _get_connected_components_with_padding (line 1967) | def _get_connected_components_with_padding(mask): FILE: src/transformers/models/sam3_video/processing_sam3_video.py class Sam3VideoProcessor (line 39) | class Sam3VideoProcessor(ProcessorMixin): method __init__ (line 40) | def __init__( method __call__ (line 56) | def __call__( method add_text_prompt (line 101) | def add_text_prompt(self, inference_session: Sam3VideoInferenceSession... method init_video_session (line 133) | def init_video_session( method _apply_non_overlapping_constraints (line 186) | def _apply_non_overlapping_constraints(self, pred_masks): method _apply_object_wise_non_overlapping_constraints (line 206) | def _apply_object_wise_non_overlapping_constraints( method _apply_object_wise_non_overlapping_constraints_impl (line 237) | def _apply_object_wise_non_overlapping_constraints_impl(self, pred_mas... method postprocess_outputs (line 247) | def postprocess_outputs( FILE: src/transformers/models/sam_hq/configuration_sam_hq.py class SamHQPromptEncoderConfig (line 29) | class SamHQPromptEncoderConfig(PreTrainedConfig): method __post_init__ (line 47) | def __post_init__(self, **kwargs): class SamHQVisionConfig (line 54) | class SamHQVisionConfig(PreTrainedConfig): method __post_init__ (line 111) | def __post_init__(self, **kwargs): class SamHQMaskDecoderConfig (line 119) | class SamHQMaskDecoderConfig(PreTrainedConfig): class SamHQConfig (line 153) | class SamHQConfig(PreTrainedConfig): method __post_init__ (line 174) | def __post_init__(self, **kwargs): FILE: src/transformers/models/sam_hq/convert_samhq_to_hf.py function get_config (line 34) | def get_config(model_name): function replace_keys (line 119) | def replace_keys(state_dict): function convert_sam_hq_checkpoint (line 158) | def convert_sam_hq_checkpoint(model_name, checkpoint_path, pytorch_dump_... FILE: src/transformers/models/sam_hq/modeling_sam_hq.py class SamHQVisionEncoderOutput (line 52) | class SamHQVisionEncoderOutput(ModelOutput): class SamHQMMaskDecoderOutputs (line 71) | class SamHQMMaskDecoderOutputs(ModelOutput): class SamHQImageSegmentationOutput (line 93) | class SamHQImageSegmentationOutput(ModelOutput): class SamHQVisionAttention (line 125) | class SamHQVisionAttention(nn.Module): method __init__ (line 128) | def __init__(self, config, window_size): method get_rel_pos (line 153) | def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor)... method get_decomposed_rel_pos (line 185) | def get_decomposed_rel_pos( method forward (line 227) | def forward(self, hidden_states: torch.Tensor, output_attentions=None)... class SamHQMLPBlock (line 258) | class SamHQMLPBlock(nn.Module): method __init__ (line 259) | def __init__(self, config): method forward (line 265) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SamHQVisionSdpaAttention (line 272) | class SamHQVisionSdpaAttention(SamHQVisionAttention): method __init__ (line 278) | def __init__(self, config, window_size): method forward (line 281) | def forward(self, hidden_states: torch.Tensor, output_attentions=False... class SamHQVisionLayer (line 329) | class SamHQVisionLayer(GradientCheckpointingLayer): method __init__ (line 330) | def __init__(self, config, window_size): method window_partition (line 338) | def window_partition(self, hidden_states: torch.Tensor, window_size: i... method window_unpartition (line 362) | def window_unpartition( method forward (line 392) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.FloatTen... class SamHQPositionalEmbedding (line 413) | class SamHQPositionalEmbedding(nn.Module): method __init__ (line 414) | def __init__(self, config): method forward (line 419) | def forward(self, input_coords, input_shape=None): class SamHQPreTrainedModel (line 437) | class SamHQPreTrainedModel(PreTrainedModel): method _init_weights (line 447) | def _init_weights(self, module: nn.Module): class SamHQPatchEmbeddings (line 460) | class SamHQPatchEmbeddings(nn.Module): method __init__ (line 467) | def __init__(self, config): method forward (line 481) | def forward(self, pixel_values): class SamHQVisionNeck (line 495) | class SamHQVisionNeck(nn.Module): method __init__ (line 496) | def __init__(self, config: SamHQVisionConfig): method forward (line 505) | def forward(self, hidden_states): class SamHQVisionEncoder (line 515) | class SamHQVisionEncoder(SamHQPreTrainedModel): method __init__ (line 521) | def __init__(self, config: SamHQVisionConfig): method get_input_embeddings (line 552) | def get_input_embeddings(self): method forward (line 557) | def forward( class SamHQLayerNorm (line 584) | class SamHQLayerNorm(nn.LayerNorm): method __init__ (line 590) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 596) | def forward(self, features: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 610) | def eager_attention_forward( class SamHQAttention (line 632) | class SamHQAttention(nn.Module): method __init__ (line 638) | def __init__(self, config, downsample_rate=None): method _separate_heads (line 658) | def _separate_heads(self, hidden_states: Tensor, num_attention_heads: ... method _recombine_heads (line 664) | def _recombine_heads(self, hidden_states: Tensor, point_batch_size: in... method forward (line 668) | def forward( class SamHQTwoWayAttentionBlock (line 710) | class SamHQTwoWayAttentionBlock(nn.Module): method __init__ (line 711) | def __init__(self, config, attention_downsample_rate: int = 2, skip_fi... method forward (line 743) | def forward( class SamHQTwoWayTransformer (line 788) | class SamHQTwoWayTransformer(nn.Module): method __init__ (line 789) | def __init__(self, config: SamHQMaskDecoderConfig): method forward (line 802) | def forward( class SamHQFeedForward (line 845) | class SamHQFeedForward(nn.Module): method __init__ (line 846) | def __init__( method forward (line 857) | def forward(self, hidden_states): class SamHQMaskDecoder (line 869) | class SamHQMaskDecoder(nn.Module): method __init__ (line 870) | def __init__(self, config: SamHQMaskDecoderConfig): method forward (line 915) | def forward( class SamHQVisionModel (line 1075) | class SamHQVisionModel(SamHQPreTrainedModel): method __init__ (line 1079) | def __init__(self, config: SamHQVisionConfig): method get_input_embeddings (line 1084) | def get_input_embeddings(self) -> nn.Module: method forward (line 1088) | def forward( class SamHQMaskEmbedding (line 1096) | class SamHQMaskEmbedding(nn.Module): method __init__ (line 1097) | def __init__(self, config: SamHQPromptEncoderConfig): method forward (line 1111) | def forward(self, masks): class SamHQPromptEncoder (line 1123) | class SamHQPromptEncoder(nn.Module): method __init__ (line 1124) | def __init__(self, config: SamHQConfig): method _embed_points (line 1140) | def _embed_points(self, points: torch.Tensor, labels: torch.Tensor, pa... method _embed_boxes (line 1174) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method forward (line 1185) | def forward( class SamHQModel (line 1233) | class SamHQModel(SamHQPreTrainedModel): method __init__ (line 1240) | def __init__(self, config): method get_input_embeddings (line 1251) | def get_input_embeddings(self): method get_image_wide_positional_embeddings (line 1254) | def get_image_wide_positional_embeddings(self): method get_image_embeddings (line 1268) | def get_image_embeddings( method get_prompt_embeddings (line 1285) | def get_prompt_embeddings( method forward (line 1320) | def forward( FILE: src/transformers/models/sam_hq/modular_sam_hq.py class SamHQPromptEncoderConfig (line 46) | class SamHQPromptEncoderConfig(SamPromptEncoderConfig): class SamHQVisionConfig (line 52) | class SamHQVisionConfig(SamVisionConfig): class SamHQMaskDecoderConfig (line 58) | class SamHQMaskDecoderConfig(SamMaskDecoderConfig): class SamHQConfig (line 79) | class SamHQConfig(SamConfig): class SamHQVisionEncoderOutput (line 88) | class SamHQVisionEncoderOutput(SamVisionEncoderOutput): class SamHQMMaskDecoderOutputs (line 102) | class SamHQMMaskDecoderOutputs(ModelOutput): class SamHQImageSegmentationOutput (line 118) | class SamHQImageSegmentationOutput(SamImageSegmentationOutput): class SamHQVisionAttention (line 122) | class SamHQVisionAttention(SamVisionAttention): class SamHQVisionLayer (line 126) | class SamHQVisionLayer(SamVisionLayer): class SamHQPreTrainedModel (line 130) | class SamHQPreTrainedModel(SamPreTrainedModel): class SamHQVisionEncoder (line 134) | class SamHQVisionEncoder(SamVisionEncoder, SamHQPreTrainedModel): method forward (line 142) | def forward( class SamHQLayerNorm (line 169) | class SamHQLayerNorm(SamLayerNorm): class SamHQTwoWayTransformer (line 173) | class SamHQTwoWayTransformer(SamTwoWayTransformer): class SamHQFeedForward (line 177) | class SamHQFeedForward(SamFeedForward): class SamHQMaskDecoder (line 181) | class SamHQMaskDecoder(nn.Module): method __init__ (line 182) | def __init__(self, config: SamHQMaskDecoderConfig): method forward (line 227) | def forward( class SamHQVisionModel (line 382) | class SamHQVisionModel(SamVisionModel): class SamHQModel (line 391) | class SamHQModel(SamModel): method __init__ (line 392) | def __init__(self, config): method get_image_embeddings (line 401) | def get_image_embeddings( method forward (line 417) | def forward( FILE: src/transformers/models/sam_hq/processing_sam_hq.py class SamHQImagesKwargs (line 35) | class SamHQImagesKwargs(ImagesKwargs, total=False): class SamHQProcessorKwargs (line 73) | class SamHQProcessorKwargs(ProcessingKwargs, total=False): class SamHQProcessor (line 83) | class SamHQProcessor(ProcessorMixin): method __init__ (line 84) | def __init__(self, image_processor): method __call__ (line 94) | def __call__( method _normalize_and_convert (line 138) | def _normalize_and_convert( method _pad_points_and_labels (line 182) | def _pad_points_and_labels(self, input_points, input_labels, point_pad... method _normalize_coordinates (line 198) | def _normalize_coordinates( method _preprocess_input (line 219) | def _preprocess_input(self, inputs, error_message, expected_nesting=1,... method _check_and_preprocess_points (line 255) | def _check_and_preprocess_points( method model_input_names (line 281) | def model_input_names(self): method post_process_masks (line 285) | def post_process_masks(self, *args, **kwargs): method _to_tensor (line 288) | def _to_tensor(self, array, min_dim, return_tensors): method _normalize_batch_coordinates (line 303) | def _normalize_batch_coordinates(self, inputs, original_sizes, is_boun... FILE: src/transformers/models/seamless_m4t/configuration_seamless_m4t.py class SeamlessM4TConfig (line 24) | class SeamlessM4TConfig(PreTrainedConfig): FILE: src/transformers/models/seamless_m4t/convert_fairseq2_to_hf.py function assert_param_count (line 40) | def assert_param_count(model_1, model_2): function param_count (line 46) | def param_count(model): function _grab_best_device (line 50) | def _grab_best_device(use_gpu=True): function _load_hf_config (line 135) | def _load_hf_config(model_type="medium"): function _convert_model (line 155) | def _convert_model( function load_model (line 217) | def load_model(save_dir, model_type, repo_id): FILE: src/transformers/models/seamless_m4t/feature_extraction_seamless_m4t.py class SeamlessM4TFeatureExtractor (line 35) | class SeamlessM4TFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 60) | def __init__( method zero_mean_unit_var_norm (line 91) | def zero_mean_unit_var_norm( method _extract_fbank_features (line 112) | def _extract_fbank_features( method __call__ (line 141) | def __call__( FILE: src/transformers/models/seamless_m4t/modeling_seamless_m4t.py class SeamlessM4TGenerationOutput (line 86) | class SeamlessM4TGenerationOutput(ModelOutput): function shift_tokens_right (line 112) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... function _compute_new_attention_mask (line 128) | def _compute_new_attention_mask(hidden_states: torch.Tensor, seq_lens: t... function format_speech_generation_kwargs (line 155) | def format_speech_generation_kwargs(kwargs): class SeamlessM4TConformerPositionalConvEmbedding (line 198) | class SeamlessM4TConformerPositionalConvEmbedding(nn.Module): method __init__ (line 199) | def __init__(self, config): method forward (line 232) | def forward(self, hidden_states): class SeamlessM4TConformerRotaryPositionalEmbedding (line 244) | class SeamlessM4TConformerRotaryPositionalEmbedding(nn.Module): method __init__ (line 249) | def __init__(self, config): method forward (line 259) | def forward(self, hidden_states): class SeamlessM4TConformerRelPositionalEmbedding (line 279) | class SeamlessM4TConformerRelPositionalEmbedding(nn.Module): method __init__ (line 282) | def __init__(self, config): method extend_pe (line 288) | def extend_pe(self, x, pe=None): method forward (line 319) | def forward(self, hidden_states: torch.Tensor): class SeamlessM4TConformerSamePadLayer (line 329) | class SeamlessM4TConformerSamePadLayer(nn.Module): method __init__ (line 330) | def __init__(self, num_conv_pos_embeddings): method forward (line 334) | def forward(self, hidden_states): class SeamlessM4TConformerFeatureProjection (line 340) | class SeamlessM4TConformerFeatureProjection(nn.Module): method __init__ (line 341) | def __init__(self, config): method forward (line 347) | def forward(self, hidden_states): class SeamlessM4TConformerFeedForward (line 355) | class SeamlessM4TConformerFeedForward(nn.Module): method __init__ (line 356) | def __init__(self, config, act_fn=None, dropout=None): method forward (line 368) | def forward(self, hidden_states): class SeamlessM4TConformerConvolutionModule (line 378) | class SeamlessM4TConformerConvolutionModule(nn.Module): method __init__ (line 381) | def __init__(self, config): method forward (line 416) | def forward(self, hidden_states, attention_mask=None): class SeamlessM4TConformerSelfAttention (line 444) | class SeamlessM4TConformerSelfAttention(nn.Module): method __init__ (line 449) | def __init__(self, config, use_position_embeddings=True): method forward (line 472) | def forward( method _apply_rotary_embedding (line 535) | def _apply_rotary_embedding(self, hidden_states, relative_position_emb... method _apply_relative_embeddings (line 555) | def _apply_relative_embeddings(self, query, key, relative_position_emb... class SeamlessM4TConformerEncoderLayer (line 595) | class SeamlessM4TConformerEncoderLayer(GradientCheckpointingLayer): method __init__ (line 599) | def __init__(self, config): method forward (line 621) | def forward( class SeamlessM4TConformerEncoder (line 662) | class SeamlessM4TConformerEncoder(nn.Module): method __init__ (line 663) | def __init__(self, config): method forward (line 683) | def forward( class SeamlessM4TConformerAdapterLayer (line 752) | class SeamlessM4TConformerAdapterLayer(nn.Module): method __init__ (line 753) | def __init__(self, config): method _compute_sub_sample_lengths_from_attention_mask (line 790) | def _compute_sub_sample_lengths_from_attention_mask(self, attention_ma... method forward (line 798) | def forward( class SeamlessM4TConformerAdapter (line 853) | class SeamlessM4TConformerAdapter(nn.Module): method __init__ (line 854) | def __init__(self, config): method forward (line 859) | def forward(self, hidden_states, attention_mask): class SeamlessM4TScaledWordEmbedding (line 872) | class SeamlessM4TScaledWordEmbedding(nn.Embedding): method __init__ (line 877) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 881) | def forward(self, input_ids: torch.Tensor): class SeamlessM4TSinusoidalPositionalEmbedding (line 886) | class SeamlessM4TSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 889) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 897) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 906) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 927) | def forward( method create_position_ids_from_inputs_embeds (line 953) | def create_position_ids_from_inputs_embeds(inputs_embeds, past_key_val... method create_position_ids_from_input_ids (line 972) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class SeamlessM4TAttention (line 988) | class SeamlessM4TAttention(nn.Module): method __init__ (line 992) | def __init__( method forward (line 1031) | def forward( class SeamlessM4TFeedForwardNetwork (line 1139) | class SeamlessM4TFeedForwardNetwork(nn.Module): method __init__ (line 1140) | def __init__(self, config: SeamlessM4TConfig, ffn_dim: int): method forward (line 1147) | def forward(self, hidden_states: torch.Tensor): class SeamlessM4TEncoderLayer (line 1161) | class SeamlessM4TEncoderLayer(GradientCheckpointingLayer): method __init__ (line 1162) | def __init__(self, config: SeamlessM4TConfig, encoder_ffn_dim=None, en... method forward (line 1183) | def forward( class SeamlessM4TDecoderLayer (line 1224) | class SeamlessM4TDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1225) | def __init__(self, config: SeamlessM4TConfig, decoder_ffn_dim=None, de... method forward (line 1259) | def forward( class SeamlessM4TPreTrainedModel (line 1334) | class SeamlessM4TPreTrainedModel(PreTrainedModel): method _init_weights (line 1341) | def _init_weights(self, module: nn.Module): method _compute_sub_sample_lengths_from_attention_mask (line 1394) | def _compute_sub_sample_lengths_from_attention_mask(self, attention_ma... method compute_last_hidden_states_per_sample (line 1403) | def compute_last_hidden_states_per_sample( class SeamlessM4TSpeechEncoder (line 1463) | class SeamlessM4TSpeechEncoder(SeamlessM4TPreTrainedModel): method __init__ (line 1467) | def __init__(self, config: SeamlessM4TConfig): method forward (line 1479) | def forward( class SeamlessM4TEncoder (line 1536) | class SeamlessM4TEncoder(SeamlessM4TPreTrainedModel): method __init__ (line 1537) | def __init__( method forward (line 1593) | def forward( class SeamlessM4TDecoder (line 1720) | class SeamlessM4TDecoder(SeamlessM4TPreTrainedModel): method __init__ (line 1721) | def __init__( method forward (line 1773) | def forward( class SeamlessM4TTextToUnitModel (line 1902) | class SeamlessM4TTextToUnitModel(SeamlessM4TPreTrainedModel): method __init__ (line 1903) | def __init__( method forward (line 1920) | def forward( class SeamlessM4TTextToUnitForConditionalGeneration (line 1994) | class SeamlessM4TTextToUnitForConditionalGeneration(SeamlessM4TPreTraine... method __init__ (line 2003) | def __init__( method get_encoder (line 2026) | def get_encoder(self): method get_decoder (line 2029) | def get_decoder(self): method get_input_embeddings (line 2032) | def get_input_embeddings(self): method set_input_embeddings (line 2035) | def set_input_embeddings(self, value): method forward (line 2039) | def forward( method prepare_decoder_input_ids_from_labels (line 2111) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class HifiGanResidualBlock (line 2119) | class HifiGanResidualBlock(nn.Module): method __init__ (line 2120) | def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_... method get_padding (line 2151) | def get_padding(self, kernel_size, dilation=1): method apply_weight_norm (line 2154) | def apply_weight_norm(self): method remove_weight_norm (line 2164) | def remove_weight_norm(self): method forward (line 2170) | def forward(self, hidden_states): class SeamlessM4TVariancePredictor (line 2181) | class SeamlessM4TVariancePredictor(nn.Module): method __init__ (line 2182) | def __init__(self, config): method forward (line 2207) | def forward(self, hidden_states: Tensor) -> Tensor: class SeamlessM4THifiGan (line 2218) | class SeamlessM4THifiGan(nn.Module): method __init__ (line 2219) | def __init__(self, config: SeamlessM4TConfig): method forward (line 2254) | def forward(self, inputs_embeds: torch.FloatTensor) -> torch.FloatTensor: class SeamlessM4TCodeHifiGan (line 2296) | class SeamlessM4TCodeHifiGan(PreTrainedModel): method __init__ (line 2302) | def __init__(self, config): method _get_dur_output_lengths (line 2317) | def _get_dur_output_lengths(self, input_ids, dur_out): method _get_output_hifigan_lengths (line 2331) | def _get_output_hifigan_lengths(self, input_lengths: torch.LongTensor ... method forward (line 2373) | def forward( method apply_weight_norm (line 2422) | def apply_weight_norm(self): method remove_weight_norm (line 2434) | def remove_weight_norm(self): class SeamlessM4TForTextToText (line 2451) | class SeamlessM4TForTextToText(SeamlessM4TPreTrainedModel, GenerationMix... method __init__ (line 2461) | def __init__(self, config: SeamlessM4TConfig): method get_encoder (line 2473) | def get_encoder(self): method get_decoder (line 2476) | def get_decoder(self): method get_input_embeddings (line 2479) | def get_input_embeddings(self): method set_input_embeddings (line 2482) | def set_input_embeddings(self, value): method forward (line 2488) | def forward( method generate (line 2585) | def generate( class SeamlessM4TForSpeechToText (line 2702) | class SeamlessM4TForSpeechToText(SeamlessM4TPreTrainedModel, GenerationM... method __init__ (line 2712) | def __init__(self, config: SeamlessM4TConfig): method get_encoder (line 2723) | def get_encoder(self): method get_decoder (line 2726) | def get_decoder(self): method get_input_embeddings (line 2729) | def get_input_embeddings(self): method set_input_embeddings (line 2732) | def set_input_embeddings(self, value): method forward (line 2736) | def forward( method generate (line 2840) | def generate( class SeamlessM4TForTextToSpeech (line 2959) | class SeamlessM4TForTextToSpeech(SeamlessM4TPreTrainedModel, GenerationM... method __init__ (line 2970) | def __init__(self, config: SeamlessM4TConfig): method get_encoder (line 2985) | def get_encoder(self): method get_decoder (line 2988) | def get_decoder(self): method get_input_embeddings (line 2991) | def get_input_embeddings(self): method set_input_embeddings (line 2994) | def set_input_embeddings(self, value): method forward (line 3000) | def forward( method generate (line 3104) | def generate( class SeamlessM4TForSpeechToSpeech (line 3276) | class SeamlessM4TForSpeechToSpeech(SeamlessM4TPreTrainedModel, Generatio... method __init__ (line 3284) | def __init__(self, config): method get_encoder (line 3296) | def get_encoder(self): method get_decoder (line 3299) | def get_decoder(self): method get_input_embeddings (line 3302) | def get_input_embeddings(self): method set_input_embeddings (line 3305) | def set_input_embeddings(self, value): method forward (line 3309) | def forward( method generate (line 3420) | def generate( class SeamlessM4TModel (line 3599) | class SeamlessM4TModel(SeamlessM4TPreTrainedModel, GenerationMixin): method __init__ (line 3608) | def __init__(self, config, current_modality="text"): method set_modality (line 3633) | def set_modality(self, modality="text"): method get_encoder (line 3643) | def get_encoder(self): method get_input_embeddings (line 3649) | def get_input_embeddings(self): method set_input_embeddings (line 3652) | def set_input_embeddings(self, value): method forward (line 3658) | def forward( method generate (line 3806) | def generate( FILE: src/transformers/models/seamless_m4t/processing_seamless_m4t.py class SeamlessM4TTextKwargs (line 27) | class SeamlessM4TTextKwargs(TextKwargs): class SeamlessM4TProcessorKwargs (line 42) | class SeamlessM4TProcessorKwargs(ProcessingKwargs, total=False): class SeamlessM4TProcessor (line 48) | class SeamlessM4TProcessor(ProcessorMixin): method __init__ (line 51) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 55) | def __call__( FILE: src/transformers/models/seamless_m4t/tokenization_seamless_m4t.py class SeamlessM4TTokenizer (line 33) | class SeamlessM4TTokenizer(TokenizersBackend): method __init__ (line 109) | def __init__( method convert_from_spm_model (line 200) | def convert_from_spm_model(cls, vocab, **kwargs): method src_lang (line 214) | def src_lang(self) -> str: method src_lang (line 218) | def src_lang(self, new_src_lang: str) -> None: method tgt_lang (line 226) | def tgt_lang(self) -> str: method tgt_lang (line 230) | def tgt_lang(self, new_tgt_lang: str) -> None: method _build_translation_inputs (line 237) | def _build_translation_inputs( method prepare_seq2seq_batch (line 251) | def prepare_seq2seq_batch( method _switch_to_input_mode (line 303) | def _switch_to_input_mode(self): method _switch_to_target_mode (line 306) | def _switch_to_target_mode(self): method set_src_lang_special_tokens (line 309) | def set_src_lang_special_tokens(self, src_lang) -> None: method set_tgt_lang_special_tokens (line 332) | def set_tgt_lang_special_tokens(self, lang: str) -> None: method __call__ (line 355) | def __call__( FILE: src/transformers/models/seamless_m4t_v2/configuration_seamless_m4t_v2.py class SeamlessM4Tv2Config (line 24) | class SeamlessM4Tv2Config(PreTrainedConfig): FILE: src/transformers/models/seamless_m4t_v2/convert_fairseq2_to_hf.py function assert_param_count (line 47) | def assert_param_count(model_1, model_2): function param_count (line 53) | def param_count(model): function _grab_best_device (line 57) | def _grab_best_device(use_gpu=True): function _load_hf_config (line 152) | def _load_hf_config(): function _convert_model (line 156) | def _convert_model( function load_model (line 218) | def load_model(save_dir, model_type, repo_id): FILE: src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py class SeamlessM4Tv2GenerationOutput (line 87) | class SeamlessM4Tv2GenerationOutput(ModelOutput): class SeamlessM4Tv2TextToUnitDecoderOutput (line 115) | class SeamlessM4Tv2TextToUnitDecoderOutput(ModelOutput): class SeamlessM4Tv2TextToUnitOutput (line 135) | class SeamlessM4Tv2TextToUnitOutput(ModelOutput): function shift_tokens_right (line 163) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... function _compute_new_attention_mask (line 179) | def _compute_new_attention_mask(hidden_states: torch.Tensor, seq_lens: t... function format_speech_generation_kwargs (line 207) | def format_speech_generation_kwargs(kwargs): class SeamlessM4Tv2ConformerFeatureProjection (line 249) | class SeamlessM4Tv2ConformerFeatureProjection(nn.Module): method __init__ (line 251) | def __init__(self, config): method forward (line 257) | def forward(self, hidden_states): class SeamlessM4Tv2ConformerFeedForward (line 266) | class SeamlessM4Tv2ConformerFeedForward(nn.Module): method __init__ (line 267) | def __init__(self, config, act_fn=None, dropout=None): method forward (line 279) | def forward(self, hidden_states): class SeamlessM4Tv2ConformerConvolutionModule (line 289) | class SeamlessM4Tv2ConformerConvolutionModule(nn.Module): method __init__ (line 294) | def __init__(self, config): method forward (line 329) | def forward(self, hidden_states, attention_mask=None): class SeamlessM4Tv2ConformerSelfAttention (line 360) | class SeamlessM4Tv2ConformerSelfAttention(nn.Module): method __init__ (line 365) | def __init__(self, config, use_position_embeddings=True): method forward (line 385) | def forward( class SeamlessM4Tv2ConformerEncoderLayer (line 445) | class SeamlessM4Tv2ConformerEncoderLayer(GradientCheckpointingLayer): method __init__ (line 449) | def __init__(self, config): method forward (line 471) | def forward( class SeamlessM4Tv2ConformerEncoder (line 510) | class SeamlessM4Tv2ConformerEncoder(nn.Module): method __init__ (line 511) | def __init__(self, config): method _apply_chunk_attention (line 524) | def _apply_chunk_attention(self, attention_mask, hidden_states): method forward (line 555) | def forward( class SeamlessM4Tv2ConformerAdapterLayer (line 624) | class SeamlessM4Tv2ConformerAdapterLayer(nn.Module): method __init__ (line 625) | def __init__(self, config): method _compute_sub_sample_lengths_from_attention_mask (line 662) | def _compute_sub_sample_lengths_from_attention_mask(self, attention_ma... method forward (line 670) | def forward( class SeamlessM4Tv2ConformerAdapter (line 726) | class SeamlessM4Tv2ConformerAdapter(nn.Module): method __init__ (line 727) | def __init__(self, config): method forward (line 734) | def forward(self, hidden_states, attention_mask): class SeamlessM4Tv2ScaledWordEmbedding (line 747) | class SeamlessM4Tv2ScaledWordEmbedding(nn.Embedding): method __init__ (line 752) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 756) | def forward(self, input_ids: torch.Tensor): class SeamlessM4Tv2SinusoidalPositionalEmbedding (line 761) | class SeamlessM4Tv2SinusoidalPositionalEmbedding(nn.Module): method __init__ (line 764) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 772) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 781) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 802) | def forward( method create_position_ids_from_inputs_embeds (line 828) | def create_position_ids_from_inputs_embeds(inputs_embeds, past_key_val... method create_position_ids_from_input_ids (line 847) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... class SeamlessM4Tv2Attention (line 863) | class SeamlessM4Tv2Attention(nn.Module): method __init__ (line 867) | def __init__( method forward (line 906) | def forward( class SeamlessM4Tv2FeedForwardNetwork (line 972) | class SeamlessM4Tv2FeedForwardNetwork(nn.Module): method __init__ (line 973) | def __init__(self, config: SeamlessM4Tv2Config, ffn_dim: int): method forward (line 980) | def forward(self, hidden_states: torch.Tensor): class SeamlessM4Tv2EncoderLayer (line 995) | class SeamlessM4Tv2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 996) | def __init__(self, config: SeamlessM4Tv2Config, encoder_ffn_dim=None, ... method forward (line 1017) | def forward( class SeamlessM4Tv2DecoderLayer (line 1059) | class SeamlessM4Tv2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 1060) | def __init__( method forward (line 1096) | def forward( class SeamlessM4Tv2TextToUnitDecoderLayer (line 1167) | class SeamlessM4Tv2TextToUnitDecoderLayer(GradientCheckpointingLayer): method __init__ (line 1168) | def __init__(self, config: SeamlessM4Tv2Config, decoder_ffn_dim=None, ... method forward (line 1192) | def forward( class SeamlessM4Tv2PreTrainedModel (line 1249) | class SeamlessM4Tv2PreTrainedModel(PreTrainedModel): method _init_weights (line 1261) | def _init_weights(self, module: nn.Module): method _compute_sub_sample_lengths_from_attention_mask (line 1300) | def _compute_sub_sample_lengths_from_attention_mask(self, attention_ma... method _indices_to_subwords (line 1309) | def _indices_to_subwords(self, input_ids): method _count_character_length_in_subword (line 1329) | def _count_character_length_in_subword( method _get_char_input_ids (line 1413) | def _get_char_input_ids(self, input_ids, subwords_batch, char_count_pe... method _hard_upsample (line 1460) | def _hard_upsample(self, hidden_states, durations): class SeamlessM4Tv2SpeechEncoder (line 1496) | class SeamlessM4Tv2SpeechEncoder(SeamlessM4Tv2PreTrainedModel): method __init__ (line 1500) | def __init__(self, config: SeamlessM4Tv2Config): method forward (line 1512) | def forward( class SeamlessM4Tv2Encoder (line 1570) | class SeamlessM4Tv2Encoder(SeamlessM4Tv2PreTrainedModel): method __init__ (line 1571) | def __init__( method forward (line 1627) | def forward( class SeamlessM4Tv2Decoder (line 1755) | class SeamlessM4Tv2Decoder(SeamlessM4Tv2PreTrainedModel): method __init__ (line 1756) | def __init__( method forward (line 1808) | def forward( class SeamlessM4Tv2TextToUnitDecoder (line 1937) | class SeamlessM4Tv2TextToUnitDecoder(SeamlessM4Tv2PreTrainedModel): method __init__ (line 1938) | def __init__( method forward (line 2000) | def forward( class SeamlessM4Tv2TextToUnitModel (line 2110) | class SeamlessM4Tv2TextToUnitModel(SeamlessM4Tv2PreTrainedModel): method __init__ (line 2112) | def __init__( method forward (line 2129) | def forward( class SeamlessM4Tv2TextToUnitForConditionalGeneration (line 2194) | class SeamlessM4Tv2TextToUnitForConditionalGeneration(SeamlessM4Tv2PreTr... method __init__ (line 2204) | def __init__( method get_encoder (line 2228) | def get_encoder(self): method get_decoder (line 2232) | def get_decoder(self): method get_input_embeddings (line 2236) | def get_input_embeddings(self): method set_input_embeddings (line 2240) | def set_input_embeddings(self, value): method forward (line 2244) | def forward( class HifiGanResidualBlock (line 2314) | class HifiGanResidualBlock(nn.Module): method __init__ (line 2315) | def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_... method get_padding (line 2346) | def get_padding(self, kernel_size, dilation=1): method apply_weight_norm (line 2349) | def apply_weight_norm(self): method remove_weight_norm (line 2359) | def remove_weight_norm(self): method forward (line 2365) | def forward(self, hidden_states): class SeamlessM4Tv2VariancePredictor (line 2376) | class SeamlessM4Tv2VariancePredictor(nn.Module): method __init__ (line 2377) | def __init__(self, embed_dim, hidden_dim, kernel_size, var_pred_dropout): method forward (line 2398) | def forward(self, hidden_states: Tensor, padding_mask: Tensor | None =... class SeamlessM4Tv2HifiGan (line 2414) | class SeamlessM4Tv2HifiGan(nn.Module): method __init__ (line 2415) | def __init__(self, config: SeamlessM4Tv2Config): method forward (line 2450) | def forward(self, inputs_embeds: torch.FloatTensor) -> torch.FloatTensor: class SeamlessM4Tv2CodeHifiGan (line 2492) | class SeamlessM4Tv2CodeHifiGan(PreTrainedModel): method __init__ (line 2498) | def __init__(self, config): method _get_dur_output_lengths (line 2517) | def _get_dur_output_lengths(self, input_ids, dur_out): method _get_output_hifigan_lengths (line 2532) | def _get_output_hifigan_lengths(self, input_lengths: torch.LongTensor ... method forward (line 2575) | def forward( method apply_weight_norm (line 2625) | def apply_weight_norm(self): method remove_weight_norm (line 2638) | def remove_weight_norm(self): class SeamlessM4Tv2ForTextToText (line 2656) | class SeamlessM4Tv2ForTextToText(SeamlessM4Tv2PreTrainedModel, Generatio... method __init__ (line 2666) | def __init__(self, config: SeamlessM4Tv2Config): method get_encoder (line 2678) | def get_encoder(self): method get_decoder (line 2681) | def get_decoder(self): method get_input_embeddings (line 2684) | def get_input_embeddings(self): method set_input_embeddings (line 2687) | def set_input_embeddings(self, value): method forward (line 2693) | def forward( method generate (line 2790) | def generate( class SeamlessM4Tv2ForSpeechToText (line 2907) | class SeamlessM4Tv2ForSpeechToText(SeamlessM4Tv2PreTrainedModel, Generat... method __init__ (line 2918) | def __init__(self, config: SeamlessM4Tv2Config): method get_encoder (line 2930) | def get_encoder(self): method get_decoder (line 2934) | def get_decoder(self): method get_input_embeddings (line 2938) | def get_input_embeddings(self): method set_input_embeddings (line 2942) | def set_input_embeddings(self, value): method forward (line 2947) | def forward( method generate (line 3052) | def generate( class SeamlessM4Tv2ForTextToSpeech (line 3171) | class SeamlessM4Tv2ForTextToSpeech(SeamlessM4Tv2PreTrainedModel, Generat... method __init__ (line 3183) | def __init__(self, config: SeamlessM4Tv2Config): method get_encoder (line 3199) | def get_encoder(self): method get_decoder (line 3203) | def get_decoder(self): method get_input_embeddings (line 3207) | def get_input_embeddings(self): method set_input_embeddings (line 3211) | def set_input_embeddings(self, value): method forward (line 3218) | def forward( method generate (line 3322) | def generate( class SeamlessM4Tv2ForSpeechToSpeech (line 3525) | class SeamlessM4Tv2ForSpeechToSpeech(SeamlessM4Tv2PreTrainedModel, Gener... method __init__ (line 3534) | def __init__(self, config): method get_encoder (line 3547) | def get_encoder(self): method get_decoder (line 3551) | def get_decoder(self): method get_input_embeddings (line 3555) | def get_input_embeddings(self): method set_input_embeddings (line 3559) | def set_input_embeddings(self, value): method forward (line 3564) | def forward( method generate (line 3675) | def generate( class SeamlessM4Tv2Model (line 3884) | class SeamlessM4Tv2Model(SeamlessM4Tv2PreTrainedModel, GenerationMixin): method __init__ (line 3894) | def __init__(self, config, current_modality="text"): method set_modality (line 3920) | def set_modality(self, modality="text"): method get_encoder (line 3931) | def get_encoder(self): method get_input_embeddings (line 3938) | def get_input_embeddings(self): method set_input_embeddings (line 3942) | def set_input_embeddings(self, value): method forward (line 3949) | def forward( method generate (line 4097) | def generate( FILE: src/transformers/models/seed_oss/configuration_seed_oss.py class SeedOssConfig (line 25) | class SeedOssConfig(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/seed_oss/modeling_seed_oss.py class SeedOssRMSNorm (line 49) | class SeedOssRMSNorm(nn.Module): method __init__ (line 50) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 58) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 65) | def extra_repr(self): class SeedOssMLP (line 69) | class SeedOssMLP(nn.Module): method __init__ (line 70) | def __init__(self, config): method forward (line 81) | def forward(self, x): function rotate_half (line 87) | def rotate_half(x): function apply_rotary_pos_emb (line 95) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 120) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 132) | def eager_attention_forward( class SeedOssAttention (line 157) | class SeedOssAttention(nn.Module): method __init__ (line 158) | def __init__(self, config: SeedOssConfig, layer_idx: int): method forward (line 185) | def forward( class SeedOssDecoderLayer (line 228) | class SeedOssDecoderLayer(GradientCheckpointingLayer): method __init__ (line 229) | def __init__(self, config: SeedOssConfig, layer_idx: int): method forward (line 239) | def forward( class SeedOssPreTrainedModel (line 272) | class SeedOssPreTrainedModel(PreTrainedModel): class SeedOssRotaryEmbedding (line 290) | class SeedOssRotaryEmbedding(nn.Module): method __init__ (line 293) | def __init__(self, config: SeedOssConfig, device=None): method compute_default_rope_parameters (line 310) | def compute_default_rope_parameters( method forward (line 341) | def forward(self, x, position_ids): class SeedOssModel (line 356) | class SeedOssModel(SeedOssPreTrainedModel): method __init__ (line 357) | def __init__(self, config: SeedOssConfig): method forward (line 376) | def forward( class SeedOssForCausalLM (line 430) | class SeedOssForCausalLM(SeedOssPreTrainedModel, GenerationMixin): method __init__ (line 435) | def __init__(self, config): method forward (line 446) | def forward( class SeedOssForSequenceClassification (line 508) | class SeedOssForSequenceClassification(GenericForSequenceClassification,... class SeedOssForTokenClassification (line 512) | class SeedOssForTokenClassification(GenericForTokenClassification, SeedO... class SeedOssForQuestionAnswering (line 516) | class SeedOssForQuestionAnswering(GenericForQuestionAnswering, SeedOssPr... FILE: src/transformers/models/seed_oss/modular_seed_oss.py class SeedOssRMSNorm (line 47) | class SeedOssRMSNorm(LlamaRMSNorm): class SeedOssMLP (line 51) | class SeedOssMLP(nn.Module): method __init__ (line 52) | def __init__(self, config): method forward (line 63) | def forward(self, x): class SeedOssAttention (line 69) | class SeedOssAttention(nn.Module): method __init__ (line 70) | def __init__(self, config: SeedOssConfig, layer_idx: int): method forward (line 97) | def forward( class SeedOssDecoderLayer (line 140) | class SeedOssDecoderLayer(LlamaDecoderLayer): class SeedOssPreTrainedModel (line 144) | class SeedOssPreTrainedModel(LlamaPreTrainedModel): class SeedOssModel (line 148) | class SeedOssModel(LlamaModel): class SeedOssForCausalLM (line 152) | class SeedOssForCausalLM(LlamaForCausalLM): method forward (line 153) | def forward( class SeedOssForSequenceClassification (line 182) | class SeedOssForSequenceClassification(LlamaForSequenceClassification): class SeedOssForTokenClassification (line 186) | class SeedOssForTokenClassification(LlamaForTokenClassification): class SeedOssForQuestionAnswering (line 190) | class SeedOssForQuestionAnswering(LlamaForQuestionAnswering): FILE: src/transformers/models/segformer/configuration_segformer.py class SegformerConfig (line 24) | class SegformerConfig(PreTrainedConfig): FILE: src/transformers/models/segformer/convert_segformer_original_to_pytorch.py function rename_keys (line 40) | def rename_keys(state_dict, encoder_only=False): function read_in_k_v (line 91) | def read_in_k_v(state_dict, config): function prepare_img (line 112) | def prepare_img(): function convert_segformer_checkpoint (line 120) | def convert_segformer_checkpoint(model_name, checkpoint_path, pytorch_du... FILE: src/transformers/models/segformer/image_processing_pil_segformer.py class SegformerImageProcessorKwargs (line 45) | class SegformerImageProcessorKwargs(ImagesKwargs, total=False): class SegformerImageProcessorPil (line 57) | class SegformerImageProcessorPil(PilBackend): method __init__ (line 74) | def __init__(self, **kwargs: Unpack[SegformerImageProcessorKwargs]): method preprocess (line 78) | def preprocess( method _preprocess_image_like_inputs (line 90) | def _preprocess_image_like_inputs( method reduce_label (line 139) | def reduce_label(self, image: np.ndarray) -> np.ndarray: method _preprocess (line 147) | def _preprocess( method post_process_semantic_segmentation (line 177) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/segformer/image_processing_segformer.py class SegformerImageProcessorKwargs (line 42) | class SegformerImageProcessorKwargs(ImagesKwargs, total=False): class SegformerImageProcessor (line 54) | class SegformerImageProcessor(TorchvisionBackend): method __init__ (line 71) | def __init__(self, **kwargs: Unpack[SegformerImageProcessorKwargs]): method preprocess (line 75) | def preprocess( method _preprocess_image_like_inputs (line 87) | def _preprocess_image_like_inputs( method reduce_label (line 137) | def reduce_label(self, labels: list["torch.Tensor"]) -> list["torch.Te... method _preprocess (line 147) | def _preprocess( method post_process_semantic_segmentation (line 191) | def post_process_semantic_segmentation(self, outputs, target_sizes: li... FILE: src/transformers/models/segformer/modeling_segformer.py class SegFormerImageClassifierOutput (line 32) | class SegFormerImageClassifierOutput(ImageClassifierOutput): function drop_path (line 60) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class SegformerDropPath (line 76) | class SegformerDropPath(nn.Module): method __init__ (line 79) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 83) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 86) | def extra_repr(self) -> str: class SegformerOverlapPatchEmbeddings (line 90) | class SegformerOverlapPatchEmbeddings(nn.Module): method __init__ (line 93) | def __init__(self, patch_size, stride, num_channels, hidden_size): method forward (line 105) | def forward(self, pixel_values): class SegformerEfficientSelfAttention (line 115) | class SegformerEfficientSelfAttention(nn.Module): method __init__ (line 119) | def __init__(self, config, hidden_size, num_attention_heads, sequence_... method forward (line 146) | def forward( class SegformerSelfOutput (line 204) | class SegformerSelfOutput(nn.Module): method __init__ (line 205) | def __init__(self, config, hidden_size): method forward (line 210) | def forward(self, hidden_states, input_tensor): class SegformerAttention (line 216) | class SegformerAttention(nn.Module): method __init__ (line 217) | def __init__(self, config, hidden_size, num_attention_heads, sequence_... method forward (line 227) | def forward(self, hidden_states, height, width, output_attentions=False): class SegformerDWConv (line 235) | class SegformerDWConv(nn.Module): method __init__ (line 236) | def __init__(self, dim=768): method forward (line 240) | def forward(self, hidden_states, height, width): class SegformerMixFFN (line 249) | class SegformerMixFFN(nn.Module): method __init__ (line 250) | def __init__(self, config, in_features, hidden_features=None, out_feat... method forward (line 262) | def forward(self, hidden_states, height, width): class SegformerLayer (line 272) | class SegformerLayer(nn.Module): method __init__ (line 275) | def __init__(self, config, hidden_size, num_attention_heads, drop_path... method forward (line 289) | def forward(self, hidden_states, height, width, output_attentions=False): class SegformerEncoder (line 315) | class SegformerEncoder(nn.Module): method __init__ (line 316) | def __init__(self, config): method forward (line 366) | def forward( class SegformerPreTrainedModel (line 409) | class SegformerPreTrainedModel(PreTrainedModel): class SegformerModel (line 417) | class SegformerModel(SegformerPreTrainedModel): method __init__ (line 418) | def __init__(self, config): method forward (line 429) | def forward( class SegformerForImageClassification (line 467) | class SegformerForImageClassification(SegformerPreTrainedModel): method __init__ (line 468) | def __init__(self, config): method forward (line 481) | def forward( class SegformerMLP (line 535) | class SegformerMLP(nn.Module): method __init__ (line 540) | def __init__(self, config: SegformerConfig, input_dim): method forward (line 544) | def forward(self, hidden_states: torch.Tensor): class SegformerDecodeHead (line 550) | class SegformerDecodeHead(nn.Module): method __init__ (line 551) | def __init__(self, config): method forward (line 575) | def forward(self, encoder_hidden_states: torch.FloatTensor, **kwargs) ... class SegformerForSemanticSegmentation (line 613) | class SegformerForSemanticSegmentation(SegformerPreTrainedModel): method __init__ (line 614) | def __init__(self, config): method forward (line 623) | def forward( FILE: src/transformers/models/segformer/modular_segformer.py class SegformerImageProcessorKwargs (line 39) | class SegformerImageProcessorKwargs(ImagesKwargs, total=False): class SegformerImageProcessor (line 50) | class SegformerImageProcessor(BeitImageProcessor): method _preprocess_image_like_inputs (line 63) | def _preprocess_image_like_inputs( method _preprocess (line 113) | def _preprocess( class SegformerImageProcessorPil (line 158) | class SegformerImageProcessorPil(BeitImageProcessorPil): method _preprocess_image_like_inputs (line 171) | def _preprocess_image_like_inputs( method _preprocess (line 220) | def _preprocess( FILE: src/transformers/models/seggpt/configuration_seggpt.py class SegGptConfig (line 24) | class SegGptConfig(PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): method validate_architecture (line 81) | def validate_architecture(self): FILE: src/transformers/models/seggpt/convert_seggpt_to_hf.py function create_rename_keys (line 35) | def create_rename_keys(config): function rename_key (line 86) | def rename_key(dct, old, new): function prepare_input (line 92) | def prepare_input(): function convert_seggpt_checkpoint (line 114) | def convert_seggpt_checkpoint(args): FILE: src/transformers/models/seggpt/image_processing_pil_seggpt.py class SegGptImageProcessorKwargs (line 34) | class SegGptImageProcessorKwargs(ImagesKwargs, total=False): function build_palette (line 49) | def build_palette(num_labels: int) -> list[tuple[int, int, int]]: class SegGptImageProcessorPil (line 70) | class SegGptImageProcessorPil(PilBackend): method __init__ (line 83) | def __init__(self, **kwargs: Unpack[SegGptImageProcessorKwargs]): method get_palette (line 86) | def get_palette(self, num_labels: int) -> list[tuple[int, int, int]]: method mask_to_rgb (line 98) | def mask_to_rgb(self, mask: np.ndarray, palette: list[tuple[int, int, ... method preprocess (line 132) | def preprocess( method _preprocess_image_like_inputs (line 155) | def _preprocess_image_like_inputs( method _preprocess (line 208) | def _preprocess( method post_process_semantic_segmentation (line 234) | def post_process_semantic_segmentation( FILE: src/transformers/models/seggpt/image_processing_seggpt.py function build_palette (line 39) | def build_palette(num_labels: int) -> list[tuple[int, int, int]]: class SegGptImageProcessorKwargs (line 59) | class SegGptImageProcessorKwargs(ImagesKwargs, total=False): class SegGptImageProcessor (line 72) | class SegGptImageProcessor(TorchvisionBackend): method __init__ (line 85) | def __init__(self, **kwargs: Unpack[SegGptImageProcessorKwargs]): method get_palette (line 88) | def get_palette(self, num_labels: int) -> list[tuple[int, int, int]]: method mask_to_rgb (line 100) | def mask_to_rgb(self, mask: np.ndarray, palette: list[tuple[int, int, ... method preprocess (line 134) | def preprocess( method _preprocess_image_like_inputs (line 158) | def _preprocess_image_like_inputs( method _preprocess (line 222) | def _preprocess( method post_process_semantic_segmentation (line 254) | def post_process_semantic_segmentation( FILE: src/transformers/models/seggpt/modeling_seggpt.py class SegGptEncoderOutput (line 40) | class SegGptEncoderOutput(ModelOutput): class SegGptImageSegmentationOutput (line 68) | class SegGptImageSegmentationOutput(ModelOutput): class SegGptPatchEmbeddings (line 89) | class SegGptPatchEmbeddings(nn.Module): method __init__ (line 96) | def __init__(self, config): method forward (line 110) | def forward(self, pixel_values): class SegGptEmbeddings (line 124) | class SegGptEmbeddings(nn.Module): method __init__ (line 129) | def __init__(self, config: SegGptConfig) -> None: method interpolate_pos_encoding (line 145) | def interpolate_pos_encoding(self, height: int, width: int) -> torch.T... method forward (line 163) | def forward( class SegGptAttention (line 209) | class SegGptAttention(nn.Module): method __init__ (line 212) | def __init__(self, config): method get_rel_pos (line 236) | def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor)... method add_decomposed_rel_pos (line 268) | def add_decomposed_rel_pos( method forward (line 313) | def forward(self, hidden_states: torch.Tensor, output_attentions=False... class SegGptMlp (line 352) | class SegGptMlp(nn.Module): method __init__ (line 353) | def __init__(self, config): method forward (line 359) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function drop_path (line 367) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class SegGptDropPath (line 383) | class SegGptDropPath(nn.Module): method __init__ (line 386) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 390) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 393) | def extra_repr(self) -> str: class SegGptLayer (line 397) | class SegGptLayer(GradientCheckpointingLayer): method __init__ (line 398) | def __init__(self, config: SegGptConfig, drop_path_rate: float) -> None: method forward (line 406) | def forward( class SegGptEncoder (line 444) | class SegGptEncoder(nn.Module): method __init__ (line 445) | def __init__(self, config: SegGptConfig) -> None: method forward (line 453) | def forward( class SegGptLayerNorm (line 505) | class SegGptLayerNorm(nn.LayerNorm): method __init__ (line 511) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 517) | def forward(self, features: torch.Tensor) -> torch.Tensor: class SegGptDecoderHead (line 531) | class SegGptDecoderHead(nn.Module): method __init__ (line 532) | def __init__(self, config): method forward (line 546) | def forward(self, hidden_states: torch.FloatTensor): class SegGptDecoder (line 555) | class SegGptDecoder(nn.Module): method __init__ (line 556) | def __init__(self, config): method _reshape_hidden_states (line 568) | def _reshape_hidden_states(self, hidden_states: torch.FloatTensor) -> ... method forward (line 580) | def forward(self, hidden_states: torch.FloatTensor): class SegGptPreTrainedModel (line 589) | class SegGptPreTrainedModel(PreTrainedModel): method _init_weights (line 598) | def _init_weights(self, module: nn.Module) -> None: class SegGptModel (line 621) | class SegGptModel(SegGptPreTrainedModel): method __init__ (line 622) | def __init__(self, config: SegGptConfig): method get_input_embeddings (line 632) | def get_input_embeddings(self) -> SegGptPatchEmbeddings: method forward (line 636) | def forward( function patchify (line 753) | def patchify(tensor: torch.Tensor, patch_size: int) -> torch.Tensor: function unpatchify (line 765) | def unpatchify(tensor: torch.Tensor, patch_height: int, patch_width: int... class SegGptLoss (line 780) | class SegGptLoss(nn.Module): method __init__ (line 781) | def __init__(self, config): method forward (line 786) | def forward( class SegGptForImageSegmentation (line 827) | class SegGptForImageSegmentation(SegGptPreTrainedModel): method __init__ (line 828) | def __init__(self, config: SegGptConfig): method forward (line 839) | def forward( FILE: src/transformers/models/sew/configuration_sew.py class SEWConfig (line 27) | class SEWConfig(PreTrainedConfig): method __post_init__ (line 153) | def __post_init__(self, **kwargs): method validate_architecture (line 157) | def validate_architecture(self): method inputs_to_logits_ratio (line 172) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/sew/convert_sew_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 60) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 88) | def recursively_load_weights(fairseq_model, hf_model, is_finetuned): function load_conv_layer (line 132) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_config (line 172) | def convert_config(model, is_finetuned): function convert_sew_checkpoint (line 222) | def convert_sew_checkpoint( FILE: src/transformers/models/sew/modeling_sew.py class SEWNoLayerNormConvLayer (line 46) | class SEWNoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 47) | def __init__(self, config, layer_id=0): method forward (line 61) | def forward(self, hidden_states): class SEWLayerNormConvLayer (line 67) | class SEWLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 68) | def __init__(self, config, layer_id=0): method forward (line 83) | def forward(self, hidden_states): class SEWGroupNormConvLayer (line 94) | class SEWGroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 95) | def __init__(self, config, layer_id=0): method forward (line 111) | def forward(self, hidden_states): class SEWPositionalConvEmbedding (line 118) | class SEWPositionalConvEmbedding(nn.Module): method __init__ (line 119) | def __init__(self, config): method forward (line 153) | def forward(self, hidden_states): class SEWSamePadLayer (line 161) | class SEWSamePadLayer(nn.Module): method __init__ (line 162) | def __init__(self, num_conv_pos_embeddings): method forward (line 166) | def forward(self, hidden_states): class SEWUpsampling (line 172) | class SEWUpsampling(nn.Module): method __init__ (line 173) | def __init__(self, config): method forward (line 179) | def forward(self, hidden_states): class SEWFeatureEncoder (line 194) | class SEWFeatureEncoder(nn.Module): method __init__ (line 197) | def __init__(self, config): method _freeze_parameters (line 214) | def _freeze_parameters(self): method forward (line 219) | def forward(self, input_values): function eager_attention_forward (line 232) | def eager_attention_forward( class SEWAttention (line 260) | class SEWAttention(nn.Module): method __init__ (line 263) | def __init__( method forward (line 294) | def forward( class SEWFeedForward (line 346) | class SEWFeedForward(nn.Module): method __init__ (line 347) | def __init__(self, config): method forward (line 360) | def forward(self, hidden_states): class SEWEncoderLayer (line 370) | class SEWEncoderLayer(GradientCheckpointingLayer): method __init__ (line 371) | def __init__(self, config): method forward (line 386) | def forward(self, hidden_states, attention_mask=None, output_attention... class SEWEncoder (line 406) | class SEWEncoder(nn.Module): method __init__ (line 407) | def __init__(self, config): method forward (line 418) | def forward( class SEWPreTrainedModel (line 509) | class SEWPreTrainedModel(PreTrainedModel): method _init_weights (line 520) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 550) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 565) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... function _compute_mask_indices (line 578) | def _compute_mask_indices( class SEWModel (line 698) | class SEWModel(SEWPreTrainedModel): method __init__ (line 699) | def __init__(self, config: SEWConfig): method _mask_hidden_states (line 719) | def _mask_hidden_states( method forward (line 766) | def forward( class SEWForCTC (line 829) | class SEWForCTC(SEWPreTrainedModel): method __init__ (line 830) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 859) | def tie_weights(self, **kwargs): method freeze_feature_encoder (line 883) | def freeze_feature_encoder(self): method freeze_base_model (line 890) | def freeze_base_model(self): method forward (line 899) | def forward( class SEWForSequenceClassification (line 977) | class SEWForSequenceClassification(SEWPreTrainedModel): method __init__ (line 978) | def __init__(self, config): method freeze_feature_encoder (line 995) | def freeze_feature_encoder(self): method freeze_base_model (line 1002) | def freeze_base_model(self): method forward (line 1011) | def forward( FILE: src/transformers/models/sew/modular_sew.py class SEWNoLayerNormConvLayer (line 48) | class SEWNoLayerNormConvLayer(Wav2Vec2NoLayerNormConvLayer): class SEWLayerNormConvLayer (line 52) | class SEWLayerNormConvLayer(Wav2Vec2LayerNormConvLayer): class SEWGroupNormConvLayer (line 56) | class SEWGroupNormConvLayer(Wav2Vec2GroupNormConvLayer): class SEWPositionalConvEmbedding (line 60) | class SEWPositionalConvEmbedding(nn.Module): method __init__ (line 61) | def __init__(self, config): method forward (line 95) | def forward(self, hidden_states): class SEWSamePadLayer (line 103) | class SEWSamePadLayer(Wav2Vec2SamePadLayer): class SEWUpsampling (line 107) | class SEWUpsampling(nn.Module): method __init__ (line 108) | def __init__(self, config): method forward (line 114) | def forward(self, hidden_states): class SEWFeatureEncoder (line 129) | class SEWFeatureEncoder(Wav2Vec2FeatureEncoder): class SEWAttention (line 133) | class SEWAttention(Wav2Vec2Attention): class SEWFeedForward (line 137) | class SEWFeedForward(Wav2Vec2FeedForward): class SEWEncoderLayer (line 141) | class SEWEncoderLayer(Wav2Vec2EncoderLayer): class SEWEncoder (line 145) | class SEWEncoder(nn.Module): method __init__ (line 146) | def __init__(self, config): method forward (line 157) | def forward( class SEWPreTrainedModel (line 248) | class SEWPreTrainedModel(PreTrainedModel): method _init_weights (line 259) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 289) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 304) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... class SEWModel (line 318) | class SEWModel(SEWPreTrainedModel): method __init__ (line 319) | def __init__(self, config: SEWConfig): method _mask_hidden_states (line 339) | def _mask_hidden_states( method forward (line 386) | def forward( class SEWForCTC (line 441) | class SEWForCTC(Wav2Vec2ForCTC): class SEWForSequenceClassification (line 445) | class SEWForSequenceClassification(Wav2Vec2ForSequenceClassification): FILE: src/transformers/models/sew_d/configuration_sew_d.py class SEWDConfig (line 27) | class SEWDConfig(PreTrainedConfig): method __post_init__ (line 173) | def __post_init__(self, **kwargs): method validate_architecture (line 177) | def validate_architecture(self): method inputs_to_logits_ratio (line 192) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/sew_d/convert_sew_d_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 62) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 90) | def recursively_load_weights(fairseq_model, hf_model, is_finetuned): function load_conv_layer (line 136) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_config (line 176) | def convert_config(model, is_finetuned): function convert_sew_checkpoint (line 234) | def convert_sew_checkpoint( FILE: src/transformers/models/sew_d/modeling_sew_d.py function _compute_mask_indices (line 40) | def _compute_mask_indices( function make_log_bucket_position (line 159) | def make_log_bucket_position(relative_pos, bucket_size, max_position): function build_relative_position (line 174) | def build_relative_position(query_size, key_size, bucket_size=-1, max_po... function c2p_dynamic_expand (line 205) | def c2p_dynamic_expand(c2p_pos, query_layer, relative_pos): function p2c_dynamic_expand (line 210) | def p2c_dynamic_expand(c2p_pos, query_layer, key_layer): function pos_dynamic_expand (line 215) | def pos_dynamic_expand(pos_index, p2c_att, key_layer): function get_mask (line 219) | def get_mask(input, local_context): class SEWDNoLayerNormConvLayer (line 239) | class SEWDNoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 240) | def __init__(self, config, layer_id=0): method forward (line 254) | def forward(self, hidden_states): class SEWDLayerNormConvLayer (line 261) | class SEWDLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 262) | def __init__(self, config, layer_id=0): method forward (line 277) | def forward(self, hidden_states): class SEWDGroupNormConvLayer (line 289) | class SEWDGroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 290) | def __init__(self, config, layer_id=0): method forward (line 306) | def forward(self, hidden_states): class SEWDPositionalConvEmbedding (line 314) | class SEWDPositionalConvEmbedding(nn.Module): method __init__ (line 315) | def __init__(self, config): method forward (line 349) | def forward(self, hidden_states): class SEWDSamePadLayer (line 358) | class SEWDSamePadLayer(nn.Module): method __init__ (line 359) | def __init__(self, num_conv_pos_embeddings): method forward (line 363) | def forward(self, hidden_states): class SEWDUpsampling (line 370) | class SEWDUpsampling(nn.Module): method __init__ (line 371) | def __init__(self, config): method forward (line 377) | def forward(self, hidden_states): class SEWDFeatureEncoder (line 393) | class SEWDFeatureEncoder(nn.Module): method __init__ (line 396) | def __init__(self, config): method _freeze_parameters (line 413) | def _freeze_parameters(self): method forward (line 418) | def forward(self, input_values): class ContextPooler (line 431) | class ContextPooler(nn.Module): method __init__ (line 432) | def __init__(self, config): method forward (line 438) | def forward(self, hidden_states): method output_dim (line 449) | def output_dim(self): class XSoftmax (line 453) | class XSoftmax(torch.autograd.Function): method forward (line 482) | def forward(ctx, input, mask, dim): method backward (line 493) | def backward(ctx, grad_output): method symbolic (line 499) | def symbolic(g, self, mask, dim): class DropoutContext (line 516) | class DropoutContext: method __init__ (line 517) | def __init__(self): class XDropout (line 524) | class XDropout(torch.autograd.Function): method forward (line 528) | def forward(ctx, input, local_ctx): method backward (line 538) | def backward(ctx, grad_output): method symbolic (line 546) | def symbolic(g: torch._C.Graph, input: torch._C.Value, local_ctx: floa... class StableDropout (line 563) | class StableDropout(nn.Module): method __init__ (line 571) | def __init__(self, drop_prob): method forward (line 577) | def forward(self, x): method clear_context (line 588) | def clear_context(self): method init_context (line 592) | def init_context(self, reuse_mask=True, scale=1): method get_context (line 600) | def get_context(self): class SEWDSelfOutput (line 612) | class SEWDSelfOutput(nn.Module): method __init__ (line 613) | def __init__(self, config): method forward (line 619) | def forward(self, hidden_states, input_tensor): class DisentangledSelfAttention (line 626) | class DisentangledSelfAttention(nn.Module): method __init__ (line 637) | def __init__(self, config): method transpose_for_scores (line 675) | def transpose_for_scores(self, x, attention_heads): method forward (line 680) | def forward( method disentangled_attention_bias (line 763) | def disentangled_attention_bias(self, query_layer, key_layer, relative... class SEWDAttention (line 842) | class SEWDAttention(nn.Module): method __init__ (line 843) | def __init__(self, config): method forward (line 849) | def forward( class SEWDIntermediate (line 879) | class SEWDIntermediate(nn.Module): method __init__ (line 880) | def __init__(self, config): method forward (line 888) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SEWDOutput (line 894) | class SEWDOutput(nn.Module): method __init__ (line 895) | def __init__(self, config): method forward (line 902) | def forward(self, hidden_states, input_tensor): class SEWDLayer (line 909) | class SEWDLayer(GradientCheckpointingLayer): method __init__ (line 910) | def __init__(self, config): method forward (line 916) | def forward( class ConvLayer (line 943) | class ConvLayer(nn.Module): method __init__ (line 944) | def __init__(self, config): method forward (line 956) | def forward(self, hidden_states, residual_states, input_mask): class SEWDTransformerEncoder (line 979) | class SEWDTransformerEncoder(nn.Module): method __init__ (line 982) | def __init__(self, config): method get_rel_embedding (line 1009) | def get_rel_embedding(self): method get_attention_mask (line 1015) | def get_attention_mask(self, attention_mask): method get_rel_pos (line 1024) | def get_rel_pos(self, hidden_states, query_states=None, relative_pos=N... method forward (line 1036) | def forward( class SEWDEncoder (line 1101) | class SEWDEncoder(nn.Module): method __init__ (line 1102) | def __init__(self, config): method forward (line 1111) | def forward( class SEWDPreTrainedModel (line 1166) | class SEWDPreTrainedModel(PreTrainedModel): method _init_weights (line 1174) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 1209) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 1224) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... class SEWDModel (line 1239) | class SEWDModel(SEWDPreTrainedModel): method __init__ (line 1240) | def __init__(self, config: SEWDConfig): method _mask_hidden_states (line 1260) | def _mask_hidden_states( method forward (line 1307) | def forward( class SEWDForCTC (line 1368) | class SEWDForCTC(SEWDPreTrainedModel): method __init__ (line 1369) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 1398) | def tie_weights(self, **kwargs): method freeze_feature_encoder (line 1422) | def freeze_feature_encoder(self): method freeze_base_model (line 1429) | def freeze_base_model(self): method forward (line 1438) | def forward( class SEWDForSequenceClassification (line 1517) | class SEWDForSequenceClassification(SEWDPreTrainedModel): method __init__ (line 1518) | def __init__(self, config): method freeze_feature_encoder (line 1535) | def freeze_feature_encoder(self): method freeze_base_model (line 1542) | def freeze_base_model(self): method forward (line 1551) | def forward( FILE: src/transformers/models/shieldgemma2/configuration_shieldgemma2.py class ShieldGemma2Config (line 26) | class ShieldGemma2Config(PreTrainedConfig): method __post_init__ (line 74) | def __post_init__(self, **kwargs): FILE: src/transformers/models/shieldgemma2/convert_shieldgemma2_weights_orbax_to_hf.py function convert_siglip_weight (line 135) | def convert_siglip_weight( function convert_transformer_weights (line 224) | def convert_transformer_weights( function transpose_reshape (line 331) | def transpose_reshape(x: torch.Tensor) -> torch.Tensor: class ConversionResult (line 337) | class ConversionResult: function convert (line 342) | def convert( function main (line 380) | def main(*args): FILE: src/transformers/models/shieldgemma2/modeling_shieldgemma2.py class ShieldGemma2ImageClassifierOutputWithNoAttention (line 34) | class ShieldGemma2ImageClassifierOutputWithNoAttention(ImageClassifierOu... class ShieldGemma2ForImageClassification (line 43) | class ShieldGemma2ForImageClassification(PreTrainedModel): method __init__ (line 48) | def __init__(self, config: ShieldGemma2Config): method get_input_embeddings (line 55) | def get_input_embeddings(self): method set_input_embeddings (line 58) | def set_input_embeddings(self, value): method get_output_embeddings (line 61) | def get_output_embeddings(self): method set_output_embeddings (line 64) | def set_output_embeddings(self, new_embeddings): method forward (line 68) | def forward( FILE: src/transformers/models/shieldgemma2/processing_shieldgemma2.py class ShieldGemma2ProcessorKwargs (line 47) | class ShieldGemma2ProcessorKwargs(Gemma3ProcessorKwargs, total=False): class ShieldGemma2Processor (line 60) | class ShieldGemma2Processor(Gemma3Processor): method __init__ (line 61) | def __init__( method __call__ (line 84) | def __call__( FILE: src/transformers/models/siglip/configuration_siglip.py class SiglipTextConfig (line 27) | class SiglipTextConfig(PreTrainedConfig): method __post_init__ (line 63) | def __post_init__(self, **kwargs): class SiglipVisionConfig (line 70) | class SiglipVisionConfig(PreTrainedConfig): class SiglipConfig (line 104) | class SiglipConfig(PreTrainedConfig): method __post_init__ (line 137) | def __post_init__(self, **kwargs): FILE: src/transformers/models/siglip/convert_siglip_to_hf.py function get_image_size_from_model_name (line 113) | def get_image_size_from_model_name(model_name: str) -> int: function get_patch_size_from_model_name (line 121) | def get_patch_size_from_model_name(model_name: str) -> int: function get_vocab_size_from_model_name (line 126) | def get_vocab_size_from_model_name(model_name: str) -> int: function get_vocab_file_from_model_name (line 136) | def get_vocab_file_from_model_name(model_name: str) -> str: function get_text_and_vision_vit_variants (line 145) | def get_text_and_vision_vit_variants(model_name: str) -> tuple[str, str]: function get_siglip_config (line 156) | def get_siglip_config(model_name): function get_tokenizer (line 176) | def get_tokenizer(model_name: str) -> GemmaTokenizerFast: function get_image_processor (line 195) | def get_image_processor(model_name: str) -> SiglipImageProcessor: function split_encoderblock_layers (line 210) | def split_encoderblock_layers(state_dict: dict) -> dict: function create_rename_keys (line 228) | def create_rename_keys(config): function rename_key (line 305) | def rename_key(dct, old, new, config): function read_in_q_k_v_head (line 329) | def read_in_q_k_v_head(state_dict, config): function prepare_img (line 360) | def prepare_img(): function flatten_nested_dict (line 367) | def flatten_nested_dict(params, parent_key="", sep="/"): function convert_siglip_checkpoint (line 381) | def convert_siglip_checkpoint(model_name, pytorch_dump_folder_path, veri... FILE: src/transformers/models/siglip/image_processing_pil_siglip.py class SiglipImageProcessorPil (line 26) | class SiglipImageProcessorPil(PilBackend): FILE: src/transformers/models/siglip/image_processing_siglip.py class SiglipImageProcessor (line 26) | class SiglipImageProcessor(TorchvisionBackend): FILE: src/transformers/models/siglip/modeling_siglip.py class SiglipVisionModelOutput (line 50) | class SiglipVisionModelOutput(ModelOutput): class SiglipTextModelOutput (line 69) | class SiglipTextModelOutput(ModelOutput): class SiglipOutput (line 84) | class SiglipOutput(ModelOutput): method to_tuple (line 112) | def to_tuple(self) -> tuple[Any]: class SiglipVisionEmbeddings (line 116) | class SiglipVisionEmbeddings(nn.Module): method __init__ (line 117) | def __init__(self, config: SiglipVisionConfig): method interpolate_pos_encoding (line 137) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 175) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class SiglipTextEmbeddings (line 189) | class SiglipTextEmbeddings(nn.Module): method __init__ (line 190) | def __init__(self, config: SiglipTextConfig): method forward (line 202) | def forward( function eager_attention_forward (line 229) | def eager_attention_forward( class SiglipAttention (line 252) | class SiglipAttention(nn.Module): method __init__ (line 255) | def __init__(self, config): method forward (line 275) | def forward( class SiglipMLP (line 315) | class SiglipMLP(nn.Module): method __init__ (line 316) | def __init__(self, config): method forward (line 323) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SiglipEncoderLayer (line 330) | class SiglipEncoderLayer(GradientCheckpointingLayer): method __init__ (line 331) | def __init__(self, config: SiglipVisionConfig | SiglipTextConfig): method forward (line 340) | def forward( class SiglipPreTrainedModel (line 365) | class SiglipPreTrainedModel(PreTrainedModel): method _init_weights (line 388) | def _init_weights(self, module): class SiglipEncoder (line 439) | class SiglipEncoder(nn.Module): method __init__ (line 448) | def __init__(self, config: SiglipConfig): method forward (line 456) | def forward( class SiglipTextTransformer (line 473) | class SiglipTextTransformer(SiglipPreTrainedModel): method __init__ (line 476) | def __init__(self, config: SiglipTextConfig): method forward (line 489) | def forward( class SiglipTextModel (line 535) | class SiglipTextModel(SiglipPreTrainedModel): method __init__ (line 539) | def __init__(self, config: SiglipTextConfig): method get_input_embeddings (line 545) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 548) | def set_input_embeddings(self, value): method forward (line 554) | def forward( class SiglipVisionTransformer (line 586) | class SiglipVisionTransformer(SiglipPreTrainedModel): method __init__ (line 589) | def __init__(self, config: SiglipVisionConfig): method forward (line 604) | def forward( class SiglipMultiheadAttentionPoolingHead (line 628) | class SiglipMultiheadAttentionPoolingHead(nn.Module): method __init__ (line 631) | def __init__(self, config: SiglipVisionConfig): method forward (line 639) | def forward(self, hidden_state): class SiglipVisionModel (line 657) | class SiglipVisionModel(SiglipPreTrainedModel): method __init__ (line 662) | def __init__(self, config: SiglipVisionConfig): method get_input_embeddings (line 670) | def get_input_embeddings(self) -> nn.Module: method forward (line 676) | def forward( class SiglipModel (line 713) | class SiglipModel(SiglipPreTrainedModel): method __init__ (line 716) | def __init__(self, config: SiglipConfig): method get_input_embeddings (line 748) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 751) | def set_input_embeddings(self, value: nn.Module): method get_text_features (line 756) | def get_text_features( method get_image_features (line 787) | def get_image_features( method forward (line 821) | def forward( class SiglipForImageClassification (line 917) | class SiglipForImageClassification(SiglipPreTrainedModel): method __init__ (line 921) | def __init__(self, config: SiglipConfig) -> None: method get_input_embeddings (line 939) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 942) | def set_input_embeddings(self, value: nn.Module): method forward (line 948) | def forward( FILE: src/transformers/models/siglip/processing_siglip.py class SiglipProcessor (line 23) | class SiglipProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, image_processor, tokenizer): FILE: src/transformers/models/siglip/tokenization_siglip.py class SiglipTokenizer (line 44) | class SiglipTokenizer(SentencePieceBackend): method __init__ (line 88) | def __init__( method vocab_size (line 134) | def vocab_size(self): method get_vocab (line 137) | def get_vocab(self): method get_special_tokens_mask (line 142) | def get_special_tokens_mask( method _add_eos_if_not_present (line 170) | def _add_eos_if_not_present(self, token_ids: list[int]) -> list[int]: method create_token_type_ids_from_sequences (line 181) | def create_token_type_ids_from_sequences( method build_inputs_with_special_tokens (line 203) | def build_inputs_with_special_tokens( method __getstate__ (line 229) | def __getstate__(self): method __setstate__ (line 234) | def __setstate__(self, d): method remove_punctuation (line 244) | def remove_punctuation(self, text: str) -> str: method canonicalize_text (line 248) | def canonicalize_text(self, text, *, keep_punctuation_exact_string=None): method tokenize (line 272) | def tokenize(self, text: "TextInput", add_special_tokens=False, **kwar... method unk_token_length (line 283) | def unk_token_length(self): method _tokenize (line 286) | def _tokenize(self, text, **kwargs): method _convert_token_to_id (line 306) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 310) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 315) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 334) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/siglip2/configuration_siglip2.py class Siglip2TextConfig (line 33) | class Siglip2TextConfig(PreTrainedConfig): method __post_init__ (line 69) | def __post_init__(self, **kwargs): class Siglip2VisionConfig (line 76) | class Siglip2VisionConfig(PreTrainedConfig): class Siglip2Config (line 117) | class Siglip2Config(PreTrainedConfig): method __post_init__ (line 150) | def __post_init__(self, **kwargs): FILE: src/transformers/models/siglip2/convert_siglip2_to_hf.py function get_siglip2_config (line 150) | def get_siglip2_config(model_name: str) -> Siglip2Config: function get_siglip2_tokenizer (line 176) | def get_siglip2_tokenizer() -> Siglip2Tokenizer: function get_siglip2_image_processor (line 195) | def get_siglip2_image_processor(patch_size: int, max_num_patches: int) -... function flatten_nested_dict (line 215) | def flatten_nested_dict(params: dict, parent_key: str = "", sep: str = "... function split_encoderblock_layers (line 229) | def split_encoderblock_layers(state_dict: dict) -> dict: function merge_qkv_for_head (line 247) | def merge_qkv_for_head(state_dict: dict, config: Siglip2Config) -> dict: function convert_old_keys_to_new_keys (line 268) | def convert_old_keys_to_new_keys(state_dict_keys: list) -> dict: function create_image (line 291) | def create_image(width, height): function prepare_inputs (line 309) | def prepare_inputs(): function convert_siglip2_checkpoint (line 336) | def convert_siglip2_checkpoint(model_name, pytorch_dump_folder_path, ver... FILE: src/transformers/models/siglip2/image_processing_pil_siglip2.py function convert_image_to_patches (line 28) | def convert_image_to_patches(image: np.ndarray, patch_size: int) -> np.n... function pad_along_first_dim (line 42) | def pad_along_first_dim(array: np.ndarray, target_length: int, pad_value... class Siglip2ImageProcessorKwargs (line 57) | class Siglip2ImageProcessorKwargs(ImagesKwargs, total=False): function get_image_size_for_max_num_patches (line 71) | def get_image_size_for_max_num_patches( class Siglip2ImageProcessorPil (line 120) | class Siglip2ImageProcessorPil(PilBackend): method __init__ (line 132) | def __init__(self, **kwargs: Unpack[Siglip2ImageProcessorKwargs]): method preprocess (line 136) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Siglip2Image... method _validate_preprocess_kwargs (line 139) | def _validate_preprocess_kwargs(self, **kwargs) -> tuple: method _preprocess (line 144) | def _preprocess( FILE: src/transformers/models/siglip2/image_processing_siglip2.py class Siglip2ImageProcessorKwargs (line 29) | class Siglip2ImageProcessorKwargs(ImagesKwargs, total=False): function get_image_size_for_max_num_patches (line 42) | def get_image_size_for_max_num_patches( function convert_image_to_patches (line 90) | def convert_image_to_patches(image: "torch.Tensor", patch_size: int) -> ... function pad_along_first_dim (line 104) | def pad_along_first_dim( class Siglip2ImageProcessor (line 121) | class Siglip2ImageProcessor(TorchvisionBackend): method __init__ (line 133) | def __init__(self, **kwargs: Unpack[Siglip2ImageProcessorKwargs]): method preprocess (line 137) | def preprocess(self, images: ImageInput, **kwargs: Unpack[Siglip2Image... method _validate_preprocess_kwargs (line 140) | def _validate_preprocess_kwargs(self, **kwargs) -> tuple: method _preprocess (line 145) | def _preprocess( FILE: src/transformers/models/siglip2/modeling_siglip2.py class Siglip2VisionOutput (line 50) | class Siglip2VisionOutput(ModelOutput): class Siglip2TextOutput (line 68) | class Siglip2TextOutput(ModelOutput): class Siglip2Output (line 82) | class Siglip2Output(ModelOutput): method to_tuple (line 110) | def to_tuple(self) -> tuple[Any]: class Siglip2VisionEmbeddings (line 114) | class Siglip2VisionEmbeddings(nn.Module): method __init__ (line 115) | def __init__(self, config: Siglip2VisionConfig): method resize_positional_embeddings (line 131) | def resize_positional_embeddings( method forward (line 192) | def forward(self, pixel_values: torch.FloatTensor, spatial_shapes: tor... class Siglip2TextEmbeddings (line 218) | class Siglip2TextEmbeddings(nn.Module): method __init__ (line 219) | def __init__(self, config: Siglip2TextConfig): method forward (line 231) | def forward( function eager_attention_forward (line 258) | def eager_attention_forward( class Siglip2Attention (line 281) | class Siglip2Attention(nn.Module): method __init__ (line 284) | def __init__(self, config): method forward (line 304) | def forward( class Siglip2MLP (line 343) | class Siglip2MLP(nn.Module): method __init__ (line 344) | def __init__(self, config): method forward (line 351) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Siglip2EncoderLayer (line 358) | class Siglip2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 359) | def __init__(self, config: Siglip2VisionConfig | Siglip2TextConfig): method forward (line 368) | def forward( class Siglip2PreTrainedModel (line 393) | class Siglip2PreTrainedModel(PreTrainedModel): method _init_weights (line 417) | def _init_weights(self, module): class Siglip2Encoder (line 467) | class Siglip2Encoder(nn.Module): method __init__ (line 476) | def __init__(self, config: Siglip2Config): method forward (line 484) | def forward( class Siglip2VisionTransformer (line 501) | class Siglip2VisionTransformer(Siglip2PreTrainedModel): method __init__ (line 504) | def __init__(self, config: Siglip2VisionConfig): method forward (line 521) | def forward( class Siglip2TextTransformer (line 557) | class Siglip2TextTransformer(Siglip2PreTrainedModel): method __init__ (line 560) | def __init__(self, config: Siglip2TextConfig): method forward (line 573) | def forward( class Siglip2TextModel (line 619) | class Siglip2TextModel(Siglip2PreTrainedModel): method __init__ (line 623) | def __init__(self, config: Siglip2TextConfig): method get_input_embeddings (line 629) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 632) | def set_input_embeddings(self, value): method forward (line 638) | def forward( class Siglip2MultiheadAttentionPoolingHead (line 670) | class Siglip2MultiheadAttentionPoolingHead(nn.Module): method __init__ (line 673) | def __init__(self, config: Siglip2VisionConfig): method forward (line 684) | def forward(self, hidden_state: torch.Tensor, attention_mask: torch.Te... class Siglip2VisionModel (line 722) | class Siglip2VisionModel(Siglip2PreTrainedModel): method __init__ (line 727) | def __init__(self, config: Siglip2VisionConfig): method get_input_embeddings (line 735) | def get_input_embeddings(self) -> nn.Module: method forward (line 740) | def forward( class Siglip2Model (line 783) | class Siglip2Model(Siglip2PreTrainedModel): method __init__ (line 786) | def __init__(self, config: Siglip2Config): method get_input_embeddings (line 818) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 821) | def set_input_embeddings(self, value: nn.Module): method get_text_features (line 826) | def get_text_features( method get_image_features (line 857) | def get_image_features( method forward (line 899) | def forward( class Siglip2ForImageClassification (line 1002) | class Siglip2ForImageClassification(Siglip2PreTrainedModel): method __init__ (line 1006) | def __init__(self, config: Siglip2Config) -> None: method get_input_embeddings (line 1024) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1027) | def set_input_embeddings(self, value: nn.Module): method forward (line 1032) | def forward( FILE: src/transformers/models/siglip2/modular_siglip2.py class Siglip2Tokenizer (line 51) | class Siglip2Tokenizer(GemmaTokenizer): method __init__ (line 56) | def __init__( class Siglip2TextConfig (line 89) | class Siglip2TextConfig(SiglipTextConfig): class Siglip2VisionConfig (line 95) | class Siglip2VisionConfig(SiglipVisionConfig): class Siglip2Config (line 124) | class Siglip2Config(SiglipConfig): class Siglip2VisionOutput (line 128) | class Siglip2VisionOutput(SiglipVisionModelOutput): class Siglip2TextOutput (line 132) | class Siglip2TextOutput(SiglipTextModelOutput): class Siglip2Output (line 136) | class Siglip2Output(SiglipOutput): class Siglip2VisionEmbeddings (line 140) | class Siglip2VisionEmbeddings(nn.Module): method __init__ (line 141) | def __init__(self, config: Siglip2VisionConfig): method resize_positional_embeddings (line 157) | def resize_positional_embeddings( method forward (line 218) | def forward(self, pixel_values: torch.FloatTensor, spatial_shapes: tor... class Siglip2PreTrainedModel (line 244) | class Siglip2PreTrainedModel(SiglipPreTrainedModel): class Siglip2VisionTransformer (line 250) | class Siglip2VisionTransformer(SiglipVisionTransformer): method __init__ (line 251) | def __init__(self, config: Siglip2VisionConfig): method forward (line 257) | def forward( class Siglip2TextModel (line 293) | class Siglip2TextModel(SiglipTextModel): class Siglip2MultiheadAttentionPoolingHead (line 297) | class Siglip2MultiheadAttentionPoolingHead(SiglipMultiheadAttentionPooli... method __init__ (line 298) | def __init__(self, config: Siglip2VisionConfig): method forward (line 304) | def forward(self, hidden_state: torch.Tensor, attention_mask: torch.Te... class Siglip2VisionModel (line 337) | class Siglip2VisionModel(SiglipVisionModel): method forward (line 340) | def forward( class Siglip2Model (line 382) | class Siglip2Model(SiglipModel): method get_image_features (line 386) | def get_image_features( method forward (line 428) | def forward( class Siglip2ForImageClassification (line 525) | class Siglip2ForImageClassification(SiglipForImageClassification): method forward (line 529) | def forward( FILE: src/transformers/models/siglip2/processing_siglip2.py class Siglip2ProcessorKwargs (line 22) | class Siglip2ProcessorKwargs(ProcessingKwargs, total=False): class Siglip2Processor (line 37) | class Siglip2Processor(ProcessorMixin): method __init__ (line 40) | def __init__(self, image_processor, tokenizer): FILE: src/transformers/models/siglip2/tokenization_siglip2.py class Siglip2Tokenizer (line 31) | class Siglip2Tokenizer(TokenizersBackend): method __init__ (line 41) | def __init__( FILE: src/transformers/models/slanext/configuration_slanext.py class SLANeXtVisionConfig (line 30) | class SLANeXtVisionConfig(PreTrainedConfig): class SLANeXtConfig (line 68) | class SLANeXtConfig(PreTrainedConfig): method __post_init__ (line 95) | def __post_init__(self, **kwargs): FILE: src/transformers/models/slanext/image_processing_slanext.py class SLANeXtImageProcessor (line 40) | class SLANeXtImageProcessor(TorchvisionBackend): method _resize (line 52) | def _resize( method _preprocess (line 118) | def _preprocess( method __init__ (line 168) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method init_decoder (line 172) | def init_decoder(self): method post_process_table_recognition (line 208) | def post_process_table_recognition(self, outputs): FILE: src/transformers/models/slanext/modeling_slanext.py class SLANeXtVisionAttention (line 43) | class SLANeXtVisionAttention(nn.Module): method __init__ (line 46) | def __init__(self, config, window_size): method get_rel_pos (line 71) | def get_rel_pos(self, q_size: int, k_size: int, rel_pos: torch.Tensor)... method get_decomposed_rel_pos (line 103) | def get_decomposed_rel_pos( method forward (line 145) | def forward(self, hidden_states: torch.Tensor, output_attentions=None)... class SLANeXtAttentionGRUCell (line 176) | class SLANeXtAttentionGRUCell(nn.Module): method __init__ (line 177) | def __init__(self, input_size, hidden_size, num_embeddings): method forward (line 186) | def forward( class SLANeXtMLP (line 209) | class SLANeXtMLP(nn.Module): method __init__ (line 210) | def __init__(self, hidden_size, out_channels, activation=None): method forward (line 216) | def forward(self, hidden_states): class SLANeXtPreTrainedModel (line 223) | class SLANeXtPreTrainedModel(PreTrainedModel): method _init_weights (line 232) | def _init_weights(self, module): class SLANeXtMLPBlock (line 269) | class SLANeXtMLPBlock(nn.Module): method __init__ (line 270) | def __init__(self, config): method forward (line 276) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SLANeXtVisionLayer (line 283) | class SLANeXtVisionLayer(GradientCheckpointingLayer): method __init__ (line 284) | def __init__(self, config, window_size): method window_partition (line 292) | def window_partition(self, hidden_states: torch.Tensor, window_size: i... method window_unpartition (line 316) | def window_unpartition( method forward (line 346) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.FloatTen... class SLANeXtVisionEncoderOutput (line 374) | class SLANeXtVisionEncoderOutput(ModelOutput): class SLANeXtPatchEmbeddings (line 386) | class SLANeXtPatchEmbeddings(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 407) | def forward(self, pixel_values): class SLANeXtLayerNorm (line 421) | class SLANeXtLayerNorm(nn.LayerNorm): method __init__ (line 427) | def __init__(self, normalized_shape, *, eps=1e-6, data_format="channel... method forward (line 433) | def forward(self, features: torch.Tensor) -> torch.Tensor: class SLANeXtVisionNeck (line 447) | class SLANeXtVisionNeck(nn.Module): method __init__ (line 448) | def __init__(self, config: SLANeXtVisionConfig): method forward (line 457) | def forward(self, hidden_states): class SLANeXtVisionEncoder (line 467) | class SLANeXtVisionEncoder(SLANeXtPreTrainedModel): method __init__ (line 471) | def __init__(self, config: SLANeXtVisionConfig): method get_input_embeddings (line 502) | def get_input_embeddings(self): method forward (line 507) | def forward( class SLANeXtBackbone (line 524) | class SLANeXtBackbone(SLANeXtPreTrainedModel): method __init__ (line 525) | def __init__( method forward (line 537) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class SLANeXtSLAHead (line 548) | class SLANeXtSLAHead(SLANeXtPreTrainedModel): method __init__ (line 553) | def __init__( method forward (line 570) | def forward( class SLANeXtForTableRecognitionOutput (line 602) | class SLANeXtForTableRecognitionOutput(BaseModelOutput): class SLANeXtForTableRecognition (line 620) | class SLANeXtForTableRecognition(SLANeXtPreTrainedModel): method __init__ (line 621) | def __init__(self, config: SLANeXtConfig): method forward (line 629) | def forward( FILE: src/transformers/models/slanext/modular_slanext.py class SLANeXtVisionConfig (line 52) | class SLANeXtVisionConfig(GotOcr2VisionConfig): class SLANeXtVisionAttention (line 56) | class SLANeXtVisionAttention(GotOcr2VisionAttention): class SLANeXtConfig (line 62) | class SLANeXtConfig(PreTrainedConfig): method __post_init__ (line 89) | def __post_init__(self, **kwargs): class SLANeXtAttentionGRUCell (line 97) | class SLANeXtAttentionGRUCell(nn.Module): method __init__ (line 98) | def __init__(self, input_size, hidden_size, num_embeddings): method forward (line 107) | def forward( class SLANeXtMLP (line 130) | class SLANeXtMLP(nn.Module): method __init__ (line 131) | def __init__(self, hidden_size, out_channels, activation=None): method forward (line 137) | def forward(self, hidden_states): class SLANeXtPreTrainedModel (line 144) | class SLANeXtPreTrainedModel(PreTrainedModel): method _init_weights (line 153) | def _init_weights(self, module): class SLANeXtVisionEncoder (line 190) | class SLANeXtVisionEncoder(GotOcr2VisionEncoder): class SLANeXtBackbone (line 194) | class SLANeXtBackbone(SLANeXtPreTrainedModel): method __init__ (line 195) | def __init__( method forward (line 207) | def forward(self, hidden_states: torch.Tensor, **kwargs: Unpack[Transf... class SLANeXtSLAHead (line 218) | class SLANeXtSLAHead(SLANeXtPreTrainedModel): method __init__ (line 223) | def __init__( method forward (line 240) | def forward( class SLANeXtForTableRecognitionOutput (line 272) | class SLANeXtForTableRecognitionOutput(BaseModelOutput): class SLANeXtForTableRecognition (line 290) | class SLANeXtForTableRecognition(SLANeXtPreTrainedModel): method __init__ (line 291) | def __init__(self, config: SLANeXtConfig): method forward (line 299) | def forward( class SLANeXtImageProcessor (line 315) | class SLANeXtImageProcessor(TorchvisionBackend): method _resize (line 327) | def _resize( method _preprocess (line 393) | def _preprocess( method __init__ (line 443) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method init_decoder (line 447) | def init_decoder(self): method post_process_table_recognition (line 483) | def post_process_table_recognition(self, outputs): FILE: src/transformers/models/smollm3/configuration_smollm3.py class SmolLM3Config (line 30) | class SmolLM3Config(PreTrainedConfig): method __post_init__ (line 97) | def __post_init__(self, **kwargs): FILE: src/transformers/models/smollm3/modeling_smollm3.py class SmolLM3RotaryEmbedding (line 49) | class SmolLM3RotaryEmbedding(nn.Module): method __init__ (line 52) | def __init__(self, config: SmolLM3Config, device=None): method compute_default_rope_parameters (line 69) | def compute_default_rope_parameters( method forward (line 100) | def forward(self, x, position_ids): function rotate_half (line 114) | def rotate_half(x): function apply_rotary_pos_emb (line 122) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 147) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 159) | def eager_attention_forward( class SmolLM3Attention (line 185) | class SmolLM3Attention(nn.Module): method __init__ (line 188) | def __init__(self, config: SmolLM3Config, layer_idx: int): method forward (line 218) | def forward( class SmolLM3RMSNorm (line 262) | class SmolLM3RMSNorm(nn.Module): method __init__ (line 263) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 271) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 278) | def extra_repr(self): class SmolLM3MLP (line 282) | class SmolLM3MLP(nn.Module): method __init__ (line 283) | def __init__(self, config): method forward (line 293) | def forward(self, x): class SmolLM3DecoderLayer (line 298) | class SmolLM3DecoderLayer(GradientCheckpointingLayer): method __init__ (line 299) | def __init__(self, config: SmolLM3Config, layer_idx: int): method forward (line 309) | def forward( class SmolLM3PreTrainedModel (line 342) | class SmolLM3PreTrainedModel(PreTrainedModel): class SmolLM3Model (line 361) | class SmolLM3Model(SmolLM3PreTrainedModel): method __init__ (line 362) | def __init__(self, config: SmolLM3Config): method forward (line 382) | def forward( class SmolLM3ForCausalLM (line 446) | class SmolLM3ForCausalLM(SmolLM3PreTrainedModel, GenerationMixin): method __init__ (line 451) | def __init__(self, config): method forward (line 462) | def forward( class SmolLM3ForSequenceClassification (line 519) | class SmolLM3ForSequenceClassification(GenericForSequenceClassification,... class SmolLM3ForTokenClassification (line 523) | class SmolLM3ForTokenClassification(GenericForTokenClassification, SmolL... class SmolLM3ForQuestionAnswering (line 527) | class SmolLM3ForQuestionAnswering(GenericForQuestionAnswering, SmolLM3Pr... FILE: src/transformers/models/smollm3/modular_smollm3.py class SmolLM3Config (line 46) | class SmolLM3Config(PreTrainedConfig): method __post_init__ (line 113) | def __post_init__(self, **kwargs): class SmolLM3RotaryEmbedding (line 134) | class SmolLM3RotaryEmbedding(Qwen2RotaryEmbedding): class SmolLM3Attention (line 138) | class SmolLM3Attention(LlamaAttention): method __init__ (line 139) | def __init__(self, config: SmolLM3Config, layer_idx: int): method forward (line 149) | def forward( class SmolLM3DecoderLayer (line 192) | class SmolLM3DecoderLayer(LlamaDecoderLayer): class SmolLM3PreTrainedModel (line 196) | class SmolLM3PreTrainedModel(LlamaPreTrainedModel): class SmolLM3Model (line 200) | class SmolLM3Model(Qwen2Model): class SmolLM3ForCausalLM (line 204) | class SmolLM3ForCausalLM(LlamaForCausalLM): class SmolLM3ForSequenceClassification (line 208) | class SmolLM3ForSequenceClassification(LlamaForSequenceClassification): class SmolLM3ForTokenClassification (line 212) | class SmolLM3ForTokenClassification(LlamaForTokenClassification): class SmolLM3ForQuestionAnswering (line 216) | class SmolLM3ForQuestionAnswering(LlamaForQuestionAnswering): FILE: src/transformers/models/smolvlm/configuration_smolvlm.py class SmolVLMVisionConfig (line 35) | class SmolVLMVisionConfig(PreTrainedConfig): class SmolVLMConfig (line 71) | class SmolVLMConfig(PreTrainedConfig): method __post_init__ (line 98) | def __post_init__(self, **kwargs): FILE: src/transformers/models/smolvlm/image_processing_pil_smolvlm.py class SmolVLMImageProcessorKwargs (line 42) | class SmolVLMImageProcessorKwargs(ImagesKwargs, total=False): function _make_pixel_mask (line 58) | def _make_pixel_mask(image: np.ndarray, output_size: tuple[int, int]) ->... function _resize_output_size_rescale_to_max_len (line 71) | def _resize_output_size_rescale_to_max_len( function _resize_output_size_scale_below_upper_bound (line 109) | def _resize_output_size_scale_below_upper_bound( function get_max_height_width (line 140) | def get_max_height_width(images_list: list[list[np.ndarray]]) -> tuple[i... function get_num_channels (line 154) | def get_num_channels(images_list: list[list[np.ndarray]]) -> int: function get_resize_output_image_size (line 165) | def get_resize_output_image_size( class SmolVLMImageProcessorPil (line 190) | class SmolVLMImageProcessorPil(PilBackend): method __init__ (line 206) | def __init__(self, **kwargs: Unpack[SmolVLMImageProcessorKwargs]): method preprocess (line 210) | def preprocess(self, images: ImageInput, **kwargs: Unpack[SmolVLMImage... method _prepare_images_structure (line 213) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method resize (line 217) | def resize( method split_images (line 232) | def split_images( method resize_for_vision_encoder (line 267) | def resize_for_vision_encoder( method pad (line 287) | def pad( method _preprocess (line 320) | def _preprocess( method to_dict (line 433) | def to_dict(self): method get_number_of_image_patches (line 439) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/smolvlm/image_processing_smolvlm.py class SmolVLMImageProcessorKwargs (line 44) | class SmolVLMImageProcessorKwargs(ImagesKwargs, total=False): function _resize_output_size_rescale_to_max_len (line 63) | def _resize_output_size_rescale_to_max_len( function _resize_output_size_scale_below_upper_bound (line 100) | def _resize_output_size_scale_below_upper_bound( function get_resize_output_image_size (line 131) | def get_resize_output_image_size( function get_max_height_width (line 155) | def get_max_height_width(images_list: list[list["torch.Tensor|np.ndarray... function get_num_channels (line 169) | def get_num_channels(images_list: list[list["torch.Tensor|np.ndarray"]])... function get_device_from_images (line 180) | def get_device_from_images(images_list: list[list["torch.Tensor"]]) -> "... class SmolVLMImageProcessor (line 191) | class SmolVLMImageProcessor(TorchvisionBackend): method __init__ (line 207) | def __init__(self, **kwargs: Unpack[SmolVLMImageProcessorKwargs]): method preprocess (line 211) | def preprocess(self, images: ImageInput, **kwargs: Unpack[SmolVLMImage... method _prepare_images_structure (line 214) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method resize (line 222) | def resize( method split_images (line 249) | def split_images( method resize_for_vision_encoder (line 308) | def resize_for_vision_encoder( method pad (line 339) | def pad( method _preprocess (line 369) | def _preprocess( method to_dict (line 491) | def to_dict(self): method get_number_of_image_patches (line 497) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/smolvlm/modeling_smolvlm.py class SmolVLMPreTrainedModel (line 49) | class SmolVLMPreTrainedModel(PreTrainedModel): class SmolVLMVisionEmbeddings (line 62) | class SmolVLMVisionEmbeddings(nn.Module): method __init__ (line 73) | def __init__(self, config: SmolVLMVisionConfig): method forward (line 92) | def forward(self, pixel_values: torch.FloatTensor, patch_attention_mas... function eager_attention_forward (line 138) | def eager_attention_forward( class SmolVLMVisionAttention (line 161) | class SmolVLMVisionAttention(nn.Module): method __init__ (line 164) | def __init__(self, config): method forward (line 186) | def forward( class SmolVLMVisionMLP (line 225) | class SmolVLMVisionMLP(nn.Module): method __init__ (line 226) | def __init__(self, config): method forward (line 233) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SmolVLMEncoderLayer (line 240) | class SmolVLMEncoderLayer(GradientCheckpointingLayer): method __init__ (line 241) | def __init__(self, config: SmolVLMVisionConfig): method forward (line 250) | def forward( class SmolVLMEncoder (line 274) | class SmolVLMEncoder(nn.Module): method __init__ (line 283) | def __init__(self, config: SmolVLMConfig): method forward (line 291) | def forward( class SmolVLMVisionTransformer (line 313) | class SmolVLMVisionTransformer(SmolVLMPreTrainedModel): method __init__ (line 321) | def __init__(self, config: SmolVLMVisionConfig): method get_input_embeddings (line 332) | def get_input_embeddings(self): method set_input_embeddings (line 335) | def set_input_embeddings(self, value): method forward (line 340) | def forward( class SmolVLMBaseModelOutputWithPast (line 387) | class SmolVLMBaseModelOutputWithPast(ModelOutput): class SmolVLMSimpleMLP (line 412) | class SmolVLMSimpleMLP(nn.Module): method __init__ (line 413) | def __init__(self, config): method forward (line 419) | def forward(self, x): class SmolVLMConnector (line 423) | class SmolVLMConnector(nn.Module): method __init__ (line 424) | def __init__(self, config): method pixel_shuffle (line 429) | def pixel_shuffle(self, x, scale_factor=2): method forward (line 440) | def forward(self, image_hidden_states): class SmolVLMModel (line 451) | class SmolVLMModel(SmolVLMPreTrainedModel): method __init__ (line 457) | def __init__(self, config: SmolVLMConfig): method get_input_embeddings (line 473) | def get_input_embeddings(self): method set_input_embeddings (line 476) | def set_input_embeddings(self, value): method inputs_merger (line 479) | def inputs_merger( method get_image_features (line 525) | def get_image_features( method forward (line 590) | def forward( class SmolVLMCausalLMOutputWithPast (line 670) | class SmolVLMCausalLMOutputWithPast(ModelOutput): class SmolVLMForConditionalGeneration (line 700) | class SmolVLMForConditionalGeneration(SmolVLMPreTrainedModel, Generation... method __init__ (line 703) | def __init__(self, config): method get_input_embeddings (line 714) | def get_input_embeddings(self): method set_input_embeddings (line 717) | def set_input_embeddings(self, value): method get_image_features (line 721) | def get_image_features( method forward (line 739) | def forward( method prepare_inputs_for_generation (line 838) | def prepare_inputs_for_generation( FILE: src/transformers/models/smolvlm/modular_smolvlm.py class SmolVLMVisionConfig (line 44) | class SmolVLMVisionConfig(Idefics3VisionConfig): class SmolVLMPreTrainedModel (line 65) | class SmolVLMPreTrainedModel(Idefics3PreTrainedModel): class SmolVLMVisionTransformer (line 69) | class SmolVLMVisionTransformer(Idefics3VisionTransformer): class SmolVLMConfig (line 75) | class SmolVLMConfig(Idefics3Config): class SmolVLMImageProcessorKwargs (line 94) | class SmolVLMImageProcessorKwargs(ImagesKwargs, total=False): class SmolVLMImageProcessor (line 110) | class SmolVLMImageProcessor(Idefics3ImageProcessor): class SmolVLMImageProcessorPil (line 114) | class SmolVLMImageProcessorPil(Idefics3ImageProcessorPil): class SmolVLMBaseModelOutputWithPast (line 118) | class SmolVLMBaseModelOutputWithPast(Idefics3BaseModelOutputWithPast): class SmolVLMModel (line 122) | class SmolVLMModel(Idefics3Model): method inputs_merger (line 128) | def inputs_merger( method get_image_features (line 165) | def get_image_features( method forward (line 230) | def forward( class SmolVLMForConditionalGeneration (line 298) | class SmolVLMForConditionalGeneration(Idefics3ForConditionalGeneration): method __init__ (line 301) | def __init__(self, config): method forward (line 308) | def forward(self, **super_kwargs): FILE: src/transformers/models/smolvlm/processing_smolvlm.py function _prompt_split_image (line 54) | def _prompt_split_image( function _prompt_single_image (line 75) | def _prompt_single_image(image_seq_len, fake_token_around_image, image_t... function get_image_prompt_string (line 85) | def get_image_prompt_string( class SmolVLMProcessorKwargs (line 100) | class SmolVLMProcessorKwargs(ProcessingKwargs, total=False): class SmolVLMProcessor (line 117) | class SmolVLMProcessor(ProcessorMixin): method __init__ (line 118) | def __init__( method expand_text_with_image_tokens (line 148) | def expand_text_with_image_tokens(self, text, image_rows, image_cols): method expand_text_with_video_tokens (line 176) | def expand_text_with_video_tokens(self, text, video_inputs): method __call__ (line 214) | def __call__( method apply_chat_template (line 293) | def apply_chat_template( FILE: src/transformers/models/smolvlm/video_processing_smolvlm.py function get_max_height_width (line 43) | def get_max_height_width(videos: list["torch.Tensor"]) -> list[int]: function get_resize_output_image_size (line 55) | def get_resize_output_image_size( class SmolVLMVideoProcessorInitKwargs (line 95) | class SmolVLMVideoProcessorInitKwargs(VideosKwargs, total=False): class SmolVLMVideoProcessor (line 99) | class SmolVLMVideoProcessor(BaseVideoProcessor): method __init__ (line 114) | def __init__(self, **kwargs: Unpack[SmolVLMVideoProcessorInitKwargs]): method resize (line 126) | def resize( method pad (line 175) | def pad( method sample_frames (line 218) | def sample_frames( method _preprocess (line 283) | def _preprocess( FILE: src/transformers/models/solar_open/configuration_solar_open.py class SolarOpenConfig (line 30) | class SolarOpenConfig(PreTrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): FILE: src/transformers/models/solar_open/modeling_solar_open.py class SolarOpenDecoderLayer (line 49) | class SolarOpenDecoderLayer(GradientCheckpointingLayer): method __init__ (line 50) | def __init__(self, config: SolarOpenConfig, layer_idx: int): method forward (line 59) | def forward( class SolarOpenMLP (line 91) | class SolarOpenMLP(nn.Module): method __init__ (line 92) | def __init__(self, config, intermediate_size=None): method forward (line 102) | def forward(self, x): class SolarOpenTopkRouter (line 107) | class SolarOpenTopkRouter(nn.Module): method __init__ (line 108) | def __init__(self, config: SolarOpenConfig): method forward (line 121) | def forward(self, hidden_states): class SolarOpenNaiveMoe (line 128) | class SolarOpenNaiveMoe(nn.Module): method __init__ (line 131) | def __init__(self, config): method forward (line 140) | def forward( class SolarOpenMoE (line 167) | class SolarOpenMoE(nn.Module): method __init__ (line 172) | def __init__(self, config): method route_tokens_to_experts (line 187) | def route_tokens_to_experts(self, router_logits): method forward (line 212) | def forward(self, hidden_states): function rotate_half (line 223) | def rotate_half(x): function apply_rotary_pos_emb (line 231) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 256) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 268) | def eager_attention_forward( class SolarOpenAttention (line 294) | class SolarOpenAttention(nn.Module): method __init__ (line 297) | def __init__(self, config: SolarOpenConfig, layer_idx: int): method forward (line 318) | def forward( class SolarOpenRMSNorm (line 360) | class SolarOpenRMSNorm(nn.Module): method __init__ (line 361) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 369) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 376) | def extra_repr(self): class SolarOpenPreTrainedModel (line 381) | class SolarOpenPreTrainedModel(PreTrainedModel): method _init_weights (line 401) | def _init_weights(self, module): class SolarOpenRotaryEmbedding (line 411) | class SolarOpenRotaryEmbedding(nn.Module): method __init__ (line 414) | def __init__(self, config: SolarOpenConfig, device=None): method compute_default_rope_parameters (line 431) | def compute_default_rope_parameters( method forward (line 464) | def forward(self, x, position_ids): class SolarOpenModel (line 479) | class SolarOpenModel(SolarOpenPreTrainedModel): method __init__ (line 480) | def __init__(self, config: SolarOpenConfig): method forward (line 499) | def forward( class SolarOpenForCausalLM (line 553) | class SolarOpenForCausalLM(SolarOpenPreTrainedModel, GenerationMixin): method __init__ (line 558) | def __init__(self, config): method forward (line 569) | def forward( FILE: src/transformers/models/solar_open/modular_solar_open.py class SolarOpenConfig (line 36) | class SolarOpenConfig(Glm4MoeConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): class SolarOpenDecoderLayer (line 71) | class SolarOpenDecoderLayer(LlamaDecoderLayer): method __init__ (line 72) | def __init__(self, config: SolarOpenConfig, layer_idx: int): class SolarOpenMoE (line 77) | class SolarOpenMoE(Glm4MoeMoE): class SolarOpenAttention (line 81) | class SolarOpenAttention(LlamaAttention): method __init__ (line 82) | def __init__(self, config: SolarOpenConfig, layer_idx: int): class SolarOpenRMSNorm (line 87) | class SolarOpenRMSNorm(Glm4MoeRMSNorm): class SolarOpenPreTrainedModel (line 91) | class SolarOpenPreTrainedModel(Glm4MoePreTrainedModel): class SolarOpenModel (line 95) | class SolarOpenModel(Glm4MoeModel): class SolarOpenForCausalLM (line 99) | class SolarOpenForCausalLM(Glm4MoeForCausalLM): FILE: src/transformers/models/speech_encoder_decoder/configuration_speech_encoder_decoder.py class SpeechEncoderDecoderConfig (line 29) | class SpeechEncoderDecoderConfig(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): method from_encoder_decoder_configs (line 83) | def from_encoder_decoder_configs( FILE: src/transformers/models/speech_encoder_decoder/convert_mbart_wav2vec2_seq2seq_original_to_pytorch.py function set_recursively (line 67) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights_wav2vec2 (line 95) | def recursively_load_weights_wav2vec2(fairseq_model, hf_model): function load_conv_layer (line 141) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function load_adapter (line 181) | def load_adapter(full_name, value, adapter, unused_weights): function make_linear_from_emb (line 235) | def make_linear_from_emb(emb): function convert_wav2vec2_checkpoint (line 243) | def convert_wav2vec2_checkpoint( FILE: src/transformers/models/speech_encoder_decoder/convert_speech_to_text_wav2vec2_seq2seq_original_to_pytorch.py function set_recursively (line 69) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights_wav2vec2 (line 97) | def recursively_load_weights_wav2vec2(fairseq_model, hf_model): function load_conv_layer (line 147) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function make_linear_from_emb (line 187) | def make_linear_from_emb(emb): function create_vocab_dict (line 194) | def create_vocab_dict(dict_path): function convert_wav2vec2_checkpoint (line 213) | def convert_wav2vec2_checkpoint( FILE: src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py function shift_tokens_right (line 35) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class SpeechEncoderDecoderModel (line 54) | class SpeechEncoderDecoderModel(PreTrainedModel, GenerationMixin): method __init__ (line 70) | def __init__( method get_input_embeddings (line 147) | def get_input_embeddings(self): method get_output_embeddings (line 150) | def get_output_embeddings(self): method set_output_embeddings (line 153) | def set_output_embeddings(self, new_embeddings): method freeze_feature_encoder (line 156) | def freeze_feature_encoder(self): method from_encoder_decoder_pretrained (line 164) | def from_encoder_decoder_pretrained( method forward (line 309) | def forward( method prepare_decoder_input_ids_from_labels (line 485) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method resize_token_embeddings (line 488) | def resize_token_embeddings(self, *args, **kwargs): FILE: src/transformers/models/speech_to_text/configuration_speech_to_text.py class Speech2TextConfig (line 24) | class Speech2TextConfig(PreTrainedConfig): method validate_architecture (line 97) | def validate_architecture(self): FILE: src/transformers/models/speech_to_text/convert_s2t_fairseq_to_tfms.py function remove_ignore_keys_ (line 23) | def remove_ignore_keys_(state_dict): function rename_keys (line 38) | def rename_keys(s_dict): function make_linear_from_emb (line 47) | def make_linear_from_emb(emb): function convert_fairseq_s2t_checkpoint_to_tfms (line 54) | def convert_fairseq_s2t_checkpoint_to_tfms(checkpoint_path, pytorch_dump... FILE: src/transformers/models/speech_to_text/feature_extraction_speech_to_text.py class Speech2TextFeatureExtractor (line 33) | class Speech2TextFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 69) | def __init__( method _extract_fbank_features (line 104) | def _extract_fbank_features( method utterance_cmvn (line 142) | def utterance_cmvn( method normalize (line 165) | def normalize( method __call__ (line 174) | def __call__( FILE: src/transformers/models/speech_to_text/modeling_speech_to_text.py function shift_tokens_right (line 52) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class Conv1dSubsampler (line 68) | class Conv1dSubsampler(nn.Module): method __init__ (line 74) | def __init__(self, config): method forward (line 94) | def forward(self, input_features): class Speech2TextSinusoidalPositionalEmbedding (line 103) | class Speech2TextSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 106) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 114) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 123) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 141) | def forward(self, input_ids: torch.Tensor, past_key_values_length: int... method create_position_ids_from_input_ids (line 155) | def create_position_ids_from_input_ids( function eager_attention_forward (line 173) | def eager_attention_forward( class Speech2TextAttention (line 202) | class Speech2TextAttention(nn.Module): method __init__ (line 205) | def __init__( method forward (line 238) | def forward( class Speech2TextEncoderLayer (line 316) | class Speech2TextEncoderLayer(GradientCheckpointingLayer): method __init__ (line 317) | def __init__(self, config: Speech2TextConfig): method forward (line 335) | def forward( class Speech2TextDecoderLayer (line 374) | class Speech2TextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 375) | def __init__(self, config: Speech2TextConfig, layer_idx=None): method forward (line 407) | def forward( class Speech2TextPreTrainedModel (line 469) | class Speech2TextPreTrainedModel(PreTrainedModel): method _init_weights (line 481) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 489) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 498) | def _get_feature_vector_attention_mask(self, feature_vector_length, at... class Speech2TextEncoder (line 517) | class Speech2TextEncoder(Speech2TextPreTrainedModel): method __init__ (line 533) | def __init__(self, config: Speech2TextConfig): method forward (line 561) | def forward( class Speech2TextDecoder (line 610) | class Speech2TextDecoder(Speech2TextPreTrainedModel): method __init__ (line 625) | def __init__(self, config: Speech2TextConfig): method forward (line 654) | def forward( class Speech2TextModel (line 721) | class Speech2TextModel(Speech2TextPreTrainedModel): method __init__ (line 722) | def __init__(self, config: Speech2TextConfig): method get_input_embeddings (line 731) | def get_input_embeddings(self): method set_input_embeddings (line 734) | def set_input_embeddings(self, value): method forward (line 740) | def forward( class Speech2TextForConditionalGeneration (line 843) | class Speech2TextForConditionalGeneration(Speech2TextPreTrainedModel, Ge... method __init__ (line 848) | def __init__(self, config: Speech2TextConfig): method forward (line 859) | def forward( FILE: src/transformers/models/speech_to_text/processing_speech_to_text.py class Speech2TextProcessor (line 23) | class Speech2TextProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 28) | def __call__(self, *args, **kwargs): FILE: src/transformers/models/speech_to_text/tokenization_speech_to_text.py class Speech2TextTokenizer (line 49) | class Speech2TextTokenizer(PreTrainedTokenizer): method __init__ (line 101) | def __init__( method vocab_size (line 157) | def vocab_size(self) -> int: method get_vocab (line 160) | def get_vocab(self) -> dict: method tgt_lang (line 166) | def tgt_lang(self) -> str: method tgt_lang (line 170) | def tgt_lang(self, new_tgt_lang) -> None: method set_tgt_lang_special_tokens (line 174) | def set_tgt_lang_special_tokens(self, tgt_lang: str) -> None: method _tokenize (line 179) | def _tokenize(self, text: str) -> list[str]: method _convert_token_to_id (line 182) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 185) | def _convert_id_to_token(self, index: int) -> str: method convert_tokens_to_string (line 189) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method build_inputs_with_special_tokens (line 205) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method get_special_tokens_mask (line 212) | def get_special_tokens_mask( method __getstate__ (line 242) | def __getstate__(self) -> dict: method __setstate__ (line 247) | def __setstate__(self, d: dict) -> None: method save_vocabulary (line 256) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... function load_spm (line 278) | def load_spm(path: str, sp_model_kwargs: dict[str, Any]) -> sentencepiec... function load_json (line 284) | def load_json(path: str) -> dict | list: function save_json (line 289) | def save_json(data, path: str) -> None: FILE: src/transformers/models/speecht5/configuration_speecht5.py class SpeechT5Config (line 27) | class SpeechT5Config(PreTrainedConfig): method __post_init__ (line 201) | def __post_init__(self, **kwargs): method validate_architecture (line 205) | def validate_architecture(self): method inputs_to_logits_ratio (line 219) | def inputs_to_logits_ratio(self): class SpeechT5HifiGanConfig (line 225) | class SpeechT5HifiGanConfig(PreTrainedConfig): FILE: src/transformers/models/speecht5/convert_hifigan.py function load_weights (line 28) | def load_weights(checkpoint, hf_model, config): function convert_hifigan_checkpoint (line 58) | def convert_hifigan_checkpoint( FILE: src/transformers/models/speecht5/convert_speecht5_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 153) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function should_ignore (line 188) | def should_ignore(name, ignore_keys): function recursively_load_weights (line 202) | def recursively_load_weights(fairseq_dict, hf_model, task): function load_conv_layer (line 274) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_speecht5_checkpoint (line 319) | def convert_speecht5_checkpoint( FILE: src/transformers/models/speecht5/feature_extraction_speecht5.py class SpeechT5FeatureExtractor (line 29) | class SpeechT5FeatureExtractor(SequenceFeatureExtractor): method __init__ (line 72) | def __init__( method zero_mean_unit_var_norm (line 119) | def zero_mean_unit_var_norm( method _extract_mel_features (line 140) | def _extract_mel_features( method __call__ (line 159) | def __call__( method _process_audio (line 275) | def _process_audio( method to_dict (line 362) | def to_dict(self) -> dict[str, Any]: FILE: src/transformers/models/speecht5/modeling_speecht5.py function shift_tokens_right (line 52) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... function shift_spectrograms_right (line 68) | def shift_spectrograms_right( function _compute_mask_indices (line 90) | def _compute_mask_indices( class SpeechT5NoLayerNormConvLayer (line 210) | class SpeechT5NoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 211) | def __init__(self, config, layer_id=0): method forward (line 225) | def forward(self, hidden_states): class SpeechT5LayerNormConvLayer (line 232) | class SpeechT5LayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 233) | def __init__(self, config, layer_id=0): method forward (line 248) | def forward(self, hidden_states): class SpeechT5GroupNormConvLayer (line 260) | class SpeechT5GroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 261) | def __init__(self, config, layer_id=0): method forward (line 277) | def forward(self, hidden_states): class SpeechT5SinusoidalPositionalEmbedding (line 285) | class SpeechT5SinusoidalPositionalEmbedding(nn.Module): method __init__ (line 288) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 296) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 305) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 323) | def forward(self, input_ids: torch.Tensor, past_key_values_length: int... method create_position_ids_from_input_ids (line 337) | def create_position_ids_from_input_ids( class SpeechT5PositionalConvEmbedding (line 355) | class SpeechT5PositionalConvEmbedding(nn.Module): method __init__ (line 356) | def __init__(self, config): method forward (line 389) | def forward(self, hidden_states): class SpeechT5ScaledPositionalEncoding (line 400) | class SpeechT5ScaledPositionalEncoding(nn.Module): method __init__ (line 405) | def __init__(self, dropout, dim, max_len=5000): method forward (line 419) | def forward(self, emb): class SpeechT5RelativePositionalEncoding (line 425) | class SpeechT5RelativePositionalEncoding(torch.nn.Module): method __init__ (line 426) | def __init__(self, dim, max_length=1000): method forward (line 432) | def forward(self, hidden_states): class SpeechT5SamePadLayer (line 445) | class SpeechT5SamePadLayer(nn.Module): method __init__ (line 446) | def __init__(self, num_conv_pos_embeddings): method forward (line 450) | def forward(self, hidden_states): class SpeechT5FeatureEncoder (line 457) | class SpeechT5FeatureEncoder(nn.Module): method __init__ (line 460) | def __init__(self, config): method _freeze_parameters (line 479) | def _freeze_parameters(self): method forward (line 484) | def forward(self, input_values): class SpeechT5FeatureProjection (line 498) | class SpeechT5FeatureProjection(nn.Module): method __init__ (line 499) | def __init__(self, config): method forward (line 505) | def forward(self, hidden_states): class SpeechT5SpeechEncoderPrenet (line 513) | class SpeechT5SpeechEncoderPrenet(nn.Module): method __init__ (line 514) | def __init__(self, config): method freeze_feature_encoder (line 531) | def freeze_feature_encoder(self): method forward (line 534) | def forward( method _get_feature_vector_attention_mask (line 569) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... method _get_feat_extract_output_lengths (line 585) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _mask_hidden_states (line 601) | def _mask_hidden_states( class SpeechT5SpeechDecoderPrenet (line 648) | class SpeechT5SpeechDecoderPrenet(nn.Module): method __init__ (line 649) | def __init__(self, config): method _consistent_dropout (line 671) | def _consistent_dropout(self, inputs_embeds, p): method forward (line 676) | def forward( class SpeechT5BatchNormConvLayer (line 700) | class SpeechT5BatchNormConvLayer(nn.Module): method __init__ (line 701) | def __init__(self, config, layer_id=0): method forward (line 731) | def forward(self, hidden_states): class SpeechT5SpeechDecoderPostnet (line 740) | class SpeechT5SpeechDecoderPostnet(nn.Module): method __init__ (line 741) | def __init__(self, config): method forward (line 752) | def forward(self, hidden_states: torch.Tensor): method postnet (line 758) | def postnet(self, hidden_states: torch.Tensor): class SpeechT5TextEncoderPrenet (line 765) | class SpeechT5TextEncoderPrenet(nn.Module, EmbeddingAccessMixin): method __init__ (line 766) | def __init__(self, config): method forward (line 776) | def forward(self, input_ids: torch.Tensor): class SpeechT5TextDecoderPrenet (line 782) | class SpeechT5TextDecoderPrenet(nn.Module, EmbeddingAccessMixin): method __init__ (line 783) | def __init__(self, config): method forward (line 797) | def forward( class SpeechT5TextDecoderPostnet (line 819) | class SpeechT5TextDecoderPostnet(nn.Module, EmbeddingAccessMixin): method __init__ (line 820) | def __init__(self, config): method forward (line 825) | def forward(self, hidden_states: torch.Tensor): method get_output_embeddings (line 828) | def get_output_embeddings(self): method set_output_embeddings (line 833) | def set_output_embeddings(self, new_embeddings): class SpeechT5Attention (line 837) | class SpeechT5Attention(nn.Module): method __init__ (line 843) | def __init__( method forward (line 872) | def forward( class SpeechT5FeedForward (line 989) | class SpeechT5FeedForward(nn.Module): method __init__ (line 990) | def __init__(self, config, intermediate_size): method forward (line 1003) | def forward(self, hidden_states): class SpeechT5EncoderLayer (line 1013) | class SpeechT5EncoderLayer(GradientCheckpointingLayer): method __init__ (line 1014) | def __init__(self, config: SpeechT5Config): method forward (line 1027) | def forward( class SpeechT5DecoderLayer (line 1070) | class SpeechT5DecoderLayer(GradientCheckpointingLayer): method __init__ (line 1071) | def __init__(self, config: SpeechT5Config, layer_idx=None): method forward (line 1095) | def forward( class SpeechT5PreTrainedModel (line 1162) | class SpeechT5PreTrainedModel(PreTrainedModel): method _init_weights (line 1170) | def _init_weights(self, module: nn.Module): class SpeechT5Encoder (line 1228) | class SpeechT5Encoder(SpeechT5PreTrainedModel): method __init__ (line 1233) | def __init__(self, config: SpeechT5Config): method forward (line 1250) | def forward( class SpeechT5EncoderWithSpeechPrenet (line 1341) | class SpeechT5EncoderWithSpeechPrenet(SpeechT5PreTrainedModel): method __init__ (line 1347) | def __init__(self, config: SpeechT5Config): method forward (line 1355) | def forward( class SpeechT5EncoderWithTextPrenet (line 1377) | class SpeechT5EncoderWithTextPrenet(SpeechT5PreTrainedModel): method __init__ (line 1382) | def __init__(self, config: SpeechT5Config): method get_input_embeddings (line 1390) | def get_input_embeddings(self): method set_input_embeddings (line 1393) | def set_input_embeddings(self, value): method forward (line 1396) | def forward( class SpeechT5EncoderWithoutPrenet (line 1418) | class SpeechT5EncoderWithoutPrenet(SpeechT5PreTrainedModel): method __init__ (line 1424) | def __init__(self, config: SpeechT5Config): method forward (line 1431) | def forward( class SpeechT5Decoder (line 1449) | class SpeechT5Decoder(SpeechT5PreTrainedModel): method __init__ (line 1454) | def __init__(self, config: SpeechT5Config): method forward (line 1465) | def forward( class SpeechT5DecoderWithSpeechPrenet (line 1609) | class SpeechT5DecoderWithSpeechPrenet(SpeechT5PreTrainedModel): method __init__ (line 1615) | def __init__(self, config: SpeechT5Config): method forward (line 1623) | def forward( class SpeechT5DecoderWithTextPrenet (line 1654) | class SpeechT5DecoderWithTextPrenet(SpeechT5PreTrainedModel): method __init__ (line 1659) | def __init__(self, config: SpeechT5Config): method get_input_embeddings (line 1667) | def get_input_embeddings(self): method set_input_embeddings (line 1670) | def set_input_embeddings(self, value): method forward (line 1673) | def forward( class SpeechT5DecoderWithoutPrenet (line 1703) | class SpeechT5DecoderWithoutPrenet(SpeechT5PreTrainedModel): method __init__ (line 1709) | def __init__(self, config: SpeechT5Config): method forward (line 1716) | def forward( class SpeechT5GuidedMultiheadAttentionLoss (line 1743) | class SpeechT5GuidedMultiheadAttentionLoss(nn.Module): method __init__ (line 1749) | def __init__(self, config: SpeechT5Config): method forward (line 1754) | def forward( method _make_guided_attention_masks (line 1779) | def _make_guided_attention_masks(self, input_masks, output_masks, devi... method _make_guided_attention_mask (line 1791) | def _make_guided_attention_mask(input_length, output_length, sigma, de... class SpeechT5SpectrogramLoss (line 1802) | class SpeechT5SpectrogramLoss(nn.Module): method __init__ (line 1807) | def __init__(self, config: SpeechT5Config): method forward (line 1819) | def forward( class SpeechT5Model (line 1868) | class SpeechT5Model(SpeechT5PreTrainedModel): method __init__ (line 1869) | def __init__( method get_input_embeddings (line 1889) | def get_input_embeddings(self): method set_input_embeddings (line 1896) | def set_input_embeddings(self, value): method freeze_feature_encoder (line 1902) | def freeze_feature_encoder(self): method forward (line 1911) | def forward( class SpeechT5ForSpeechToText (line 2014) | class SpeechT5ForSpeechToText(SpeechT5PreTrainedModel, GenerationMixin): method __init__ (line 2017) | def __init__(self, config: SpeechT5Config): method freeze_feature_encoder (line 2037) | def freeze_feature_encoder(self): method get_output_embeddings (line 2044) | def get_output_embeddings(self): method set_output_embeddings (line 2047) | def set_output_embeddings(self, new_embeddings): method forward (line 2051) | def forward( function _generate_speech (line 2178) | def _generate_speech( class SpeechT5ForTextToSpeech (line 2326) | class SpeechT5ForTextToSpeech(SpeechT5PreTrainedModel): method __init__ (line 2330) | def __init__(self, config: SpeechT5Config): method can_generate (line 2351) | def can_generate(cls) -> bool: method forward (line 2358) | def forward( method generate (line 2481) | def generate( method generate_speech (line 2573) | def generate_speech( class SpeechT5ForSpeechToSpeech (line 2674) | class SpeechT5ForSpeechToSpeech(SpeechT5PreTrainedModel): method __init__ (line 2675) | def __init__(self, config: SpeechT5Config): method freeze_feature_encoder (line 2687) | def freeze_feature_encoder(self): method forward (line 2695) | def forward( method generate_speech (line 2813) | def generate_speech( class HifiGanResidualBlock (line 2903) | class HifiGanResidualBlock(nn.Module): method __init__ (line 2904) | def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_... method get_padding (line 2935) | def get_padding(self, kernel_size, dilation=1): method apply_weight_norm (line 2938) | def apply_weight_norm(self): method remove_weight_norm (line 2948) | def remove_weight_norm(self): method forward (line 2954) | def forward(self, hidden_states): class SpeechT5HifiGan (line 2970) | class SpeechT5HifiGan(PreTrainedModel): method __init__ (line 2974) | def __init__(self, config: SpeechT5HifiGanConfig): method _init_weights (line 3012) | def _init_weights(self, module): method apply_weight_norm (line 3018) | def apply_weight_norm(self): method remove_weight_norm (line 3030) | def remove_weight_norm(self): method forward (line 3045) | def forward(self, spectrogram: torch.FloatTensor, **kwargs) -> torch.F... FILE: src/transformers/models/speecht5/number_normalizer.py class EnglishNumberNormalizer (line 19) | class EnglishNumberNormalizer: method __init__ (line 20) | def __init__(self): method spell_number (line 75) | def spell_number(self, num): method convert (line 109) | def convert(self, number): method __call__ (line 177) | def __call__(self, text): FILE: src/transformers/models/speecht5/processing_speecht5.py class SpeechT5Processor (line 21) | class SpeechT5Processor(ProcessorMixin): method __init__ (line 22) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 26) | def __call__(self, *args, **kwargs): method pad (line 74) | def pad(self, *args, **kwargs): FILE: src/transformers/models/speecht5/tokenization_speecht5.py class SpeechT5Tokenizer (line 30) | class SpeechT5Tokenizer(SentencePieceBackend): method __init__ (line 77) | def __init__( method prepare_for_tokenization (line 106) | def prepare_for_tokenization(self, text, is_split_into_words=False, **... method normalizer (line 115) | def normalizer(self): method normalizer (line 121) | def normalizer(self, value): method build_inputs_with_special_tokens (line 124) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method get_special_tokens_mask (line 131) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 144) | def create_token_type_ids_from_sequences( FILE: src/transformers/models/splinter/configuration_splinter.py class SplinterConfig (line 24) | class SplinterConfig(PreTrainedConfig): FILE: src/transformers/models/splinter/modeling_splinter.py class SplinterEmbeddings (line 39) | class SplinterEmbeddings(nn.Module): method __init__ (line 42) | def __init__(self, config): method forward (line 56) | def forward( function eager_attention_forward (line 90) | def eager_attention_forward( class SplinterSelfAttention (line 113) | class SplinterSelfAttention(nn.Module): method __init__ (line 114) | def __init__(self, config): method forward (line 135) | def forward( class SplinterSelfOutput (line 168) | class SplinterSelfOutput(nn.Module): method __init__ (line 169) | def __init__(self, config): method forward (line 175) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class SplinterAttention (line 183) | class SplinterAttention(nn.Module): method __init__ (line 184) | def __init__(self, config): method forward (line 189) | def forward( class SplinterIntermediate (line 206) | class SplinterIntermediate(nn.Module): method __init__ (line 207) | def __init__(self, config): method forward (line 215) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SplinterOutput (line 222) | class SplinterOutput(nn.Module): method __init__ (line 223) | def __init__(self, config): method forward (line 229) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class SplinterLayer (line 237) | class SplinterLayer(GradientCheckpointingLayer): method __init__ (line 238) | def __init__(self, config): method forward (line 246) | def forward( method feed_forward_chunk (line 264) | def feed_forward_chunk(self, attention_output): class SplinterEncoder (line 271) | class SplinterEncoder(nn.Module): method __init__ (line 272) | def __init__(self, config): method forward (line 278) | def forward( class SplinterPreTrainedModel (line 297) | class SplinterPreTrainedModel(PreTrainedModel): method _init_weights (line 306) | def _init_weights(self, module): class SplinterModel (line 313) | class SplinterModel(SplinterPreTrainedModel): method __init__ (line 320) | def __init__(self, config): method get_input_embeddings (line 330) | def get_input_embeddings(self): method set_input_embeddings (line 333) | def set_input_embeddings(self, value): method forward (line 339) | def forward( class SplinterFullyConnectedLayer (line 403) | class SplinterFullyConnectedLayer(nn.Module): method __init__ (line 404) | def __init__(self, input_dim, output_dim, hidden_act="gelu"): method forward (line 414) | def forward(self, inputs: torch.Tensor) -> torch.Tensor: class QuestionAwareSpanSelectionHead (line 421) | class QuestionAwareSpanSelectionHead(nn.Module): method __init__ (line 427) | def __init__(self, config): method forward (line 438) | def forward(self, inputs, positions): class SplinterForQuestionAnswering (line 460) | class SplinterForQuestionAnswering(SplinterPreTrainedModel): method __init__ (line 461) | def __init__(self, config): method forward (line 473) | def forward( class SplinterForPreTrainingOutput (line 569) | class SplinterForPreTrainingOutput(ModelOutput): class SplinterForPreTraining (line 593) | class SplinterForPreTraining(SplinterPreTrainedModel): method __init__ (line 594) | def __init__(self, config): method forward (line 606) | def forward( method _prepare_question_positions (line 718) | def _prepare_question_positions(self, input_ids: torch.Tensor) -> torc... FILE: src/transformers/models/splinter/tokenization_splinter.py function load_vocab (line 31) | def load_vocab(vocab_file): class SplinterTokenizer (line 41) | class SplinterTokenizer(TokenizersBackend): method __init__ (line 81) | def __init__( method question_token_id (line 142) | def question_token_id(self): method update_post_processor (line 145) | def update_post_processor(self): FILE: src/transformers/models/squeezebert/configuration_squeezebert.py class SqueezeBertConfig (line 24) | class SqueezeBertConfig(PreTrainedConfig): FILE: src/transformers/models/squeezebert/modeling_squeezebert.py class SqueezeBertEmbeddings (line 44) | class SqueezeBertEmbeddings(nn.Module): method __init__ (line 47) | def __init__(self, config): method forward (line 61) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class MatMulWrapper (line 86) | class MatMulWrapper(nn.Module): method __init__ (line 92) | def __init__(self): method forward (line 95) | def forward(self, mat1, mat2): class SqueezeBertLayerNorm (line 106) | class SqueezeBertLayerNorm(nn.LayerNorm): method __init__ (line 113) | def __init__(self, hidden_size, eps=1e-12): method forward (line 116) | def forward(self, x): class ConvDropoutLayerNorm (line 122) | class ConvDropoutLayerNorm(nn.Module): method __init__ (line 127) | def __init__(self, cin, cout, groups, dropout_prob): method forward (line 134) | def forward(self, hidden_states, input_tensor): class ConvActivation (line 142) | class ConvActivation(nn.Module): method __init__ (line 147) | def __init__(self, cin, cout, groups, act): method forward (line 152) | def forward(self, x): class SqueezeBertSelfAttention (line 157) | class SqueezeBertSelfAttention(nn.Module): method __init__ (line 158) | def __init__(self, config, cin, q_groups=1, k_groups=1, v_groups=1): method transpose_for_scores (line 182) | def transpose_for_scores(self, x): method transpose_key_for_scores (line 191) | def transpose_key_for_scores(self, x): method transpose_output (line 201) | def transpose_output(self, x): method forward (line 211) | def forward(self, hidden_states, attention_mask, output_attentions): class SqueezeBertModule (line 247) | class SqueezeBertModule(nn.Module): method __init__ (line 248) | def __init__(self, config): method forward (line 274) | def forward(self, hidden_states, attention_mask, output_attentions): class SqueezeBertEncoder (line 289) | class SqueezeBertEncoder(nn.Module): method __init__ (line 290) | def __init__(self, config): method forward (line 301) | def forward( class SqueezeBertPooler (line 341) | class SqueezeBertPooler(nn.Module): method __init__ (line 342) | def __init__(self, config): method forward (line 347) | def forward(self, hidden_states): class SqueezeBertPredictionHeadTransform (line 356) | class SqueezeBertPredictionHeadTransform(nn.Module): method __init__ (line 357) | def __init__(self, config): method forward (line 366) | def forward(self, hidden_states): class SqueezeBertLMPredictionHead (line 373) | class SqueezeBertLMPredictionHead(nn.Module): method __init__ (line 374) | def __init__(self, config): method forward (line 386) | def forward(self, hidden_states): class SqueezeBertOnlyMLMHead (line 392) | class SqueezeBertOnlyMLMHead(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 397) | def forward(self, sequence_output): class SqueezeBertPreTrainedModel (line 403) | class SqueezeBertPreTrainedModel(PreTrainedModel): method _init_weights (line 408) | def _init_weights(self, module): class SqueezeBertModel (line 418) | class SqueezeBertModel(SqueezeBertPreTrainedModel): method __init__ (line 419) | def __init__(self, config): method get_input_embeddings (line 429) | def get_input_embeddings(self): method set_input_embeddings (line 432) | def set_input_embeddings(self, new_embeddings): method forward (line 436) | def forward( class SqueezeBertForMaskedLM (line 498) | class SqueezeBertForMaskedLM(SqueezeBertPreTrainedModel): method __init__ (line 504) | def __init__(self, config): method get_output_embeddings (line 513) | def get_output_embeddings(self): method set_output_embeddings (line 516) | def set_output_embeddings(self, new_embeddings): method forward (line 521) | def forward( class SqueezeBertForSequenceClassification (line 579) | class SqueezeBertForSequenceClassification(SqueezeBertPreTrainedModel): method __init__ (line 580) | def __init__(self, config): method forward (line 593) | def forward( class SqueezeBertForMultipleChoice (line 666) | class SqueezeBertForMultipleChoice(SqueezeBertPreTrainedModel): method __init__ (line 667) | def __init__(self, config): method forward (line 678) | def forward( class SqueezeBertForTokenClassification (line 769) | class SqueezeBertForTokenClassification(SqueezeBertPreTrainedModel): method __init__ (line 770) | def __init__(self, config): method forward (line 782) | def forward( class SqueezeBertForQuestionAnswering (line 835) | class SqueezeBertForQuestionAnswering(SqueezeBertPreTrainedModel): method __init__ (line 836) | def __init__(self, config): method forward (line 847) | def forward( FILE: src/transformers/models/stablelm/configuration_stablelm.py class StableLmConfig (line 25) | class StableLmConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/stablelm/modeling_stablelm.py class StableLmRotaryEmbedding (line 56) | class StableLmRotaryEmbedding(nn.Module): method __init__ (line 59) | def __init__(self, config: StableLmConfig, device=None): method compute_default_rope_parameters (line 77) | def compute_default_rope_parameters( method forward (line 110) | def forward(self, x, position_ids): function rotate_half (line 125) | def rotate_half(x): function apply_rotary_pos_emb (line 133) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class StableLmMLP (line 159) | class StableLmMLP(nn.Module): method __init__ (line 160) | def __init__(self, config): method forward (line 170) | def forward(self, x): class StableLmLayerNormPerHead (line 175) | class StableLmLayerNormPerHead(nn.Module): method __init__ (line 176) | def __init__(self, dim, num_heads, eps=1e-5, bias=False): method forward (line 182) | def forward(self, hidden_states: torch.Tensor): function repeat_kv (line 191) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 204) | def eager_attention_forward( class StableLmAttention (line 229) | class StableLmAttention(nn.Module): method __init__ (line 232) | def __init__(self, config: StableLmConfig, layer_idx: int | None = None): method forward (line 272) | def forward( class StableLmDecoderLayer (line 338) | class StableLmDecoderLayer(GradientCheckpointingLayer): method __init__ (line 339) | def __init__(self, config: StableLmConfig, layer_idx: int): method forward (line 351) | def forward( class StableLmPreTrainedModel (line 395) | class StableLmPreTrainedModel(PreTrainedModel): class StableLmModel (line 411) | class StableLmModel(StableLmPreTrainedModel): method __init__ (line 419) | def __init__(self, config: StableLmConfig): method forward (line 440) | def forward( class StableLmForCausalLM (line 495) | class StableLmForCausalLM(StableLmPreTrainedModel, GenerationMixin): method __init__ (line 499) | def __init__(self, config): method forward (line 511) | def forward( class StableLmForSequenceClassification (line 572) | class StableLmForSequenceClassification(GenericForSequenceClassification... class StableLmForTokenClassification (line 575) | class StableLmForTokenClassification(GenericForTokenClassification, Stab... FILE: src/transformers/models/starcoder2/configuration_starcoder2.py class Starcoder2Config (line 25) | class Starcoder2Config(PreTrainedConfig): FILE: src/transformers/models/starcoder2/modeling_starcoder2.py class Starcoder2MLP (line 53) | class Starcoder2MLP(nn.Module): method __init__ (line 54) | def __init__(self, config: Starcoder2Config): method forward (line 62) | def forward(self, hidden_states: tuple[torch.FloatTensor] | None) -> t... function rotate_half (line 70) | def rotate_half(x): function apply_rotary_pos_emb (line 78) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 103) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 115) | def eager_attention_forward( class Starcoder2Attention (line 141) | class Starcoder2Attention(nn.Module): method __init__ (line 144) | def __init__(self, config: Starcoder2Config, layer_idx: int | None = N... method forward (line 159) | def forward( class Starcoder2DecoderLayer (line 205) | class Starcoder2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 206) | def __init__(self, config: Starcoder2Config, layer_idx: int): method forward (line 214) | def forward( class Starcoder2PreTrainedModel (line 247) | class Starcoder2PreTrainedModel(PreTrainedModel): class Starcoder2RotaryEmbedding (line 265) | class Starcoder2RotaryEmbedding(nn.Module): method __init__ (line 268) | def __init__(self, config: Starcoder2Config, device=None): method compute_default_rope_parameters (line 285) | def compute_default_rope_parameters( method forward (line 316) | def forward(self, x, position_ids): class Starcoder2Model (line 331) | class Starcoder2Model(Starcoder2PreTrainedModel): method __init__ (line 332) | def __init__(self, config: Starcoder2Config): method forward (line 351) | def forward( class Starcoder2ForCausalLM (line 410) | class Starcoder2ForCausalLM(Starcoder2PreTrainedModel, GenerationMixin): method __init__ (line 415) | def __init__(self, config): method forward (line 426) | def forward( class Starcoder2ForSequenceClassification (line 483) | class Starcoder2ForSequenceClassification(GenericForSequenceClassificati... class Starcoder2ForTokenClassification (line 487) | class Starcoder2ForTokenClassification(GenericForTokenClassification, St... FILE: src/transformers/models/starcoder2/modular_starcoder2.py class Starcoder2MLP (line 52) | class Starcoder2MLP(nn.Module): method __init__ (line 53) | def __init__(self, config: Starcoder2Config): method forward (line 61) | def forward(self, hidden_states: tuple[torch.FloatTensor] | None) -> t... class Starcoder2Attention (line 69) | class Starcoder2Attention(MistralAttention): method __init__ (line 70) | def __init__(self, config: Starcoder2Config, layer_idx: int | None = N... method forward (line 78) | def forward( class Starcoder2DecoderLayer (line 124) | class Starcoder2DecoderLayer(MistralDecoderLayer): method __init__ (line 125) | def __init__(self, config: Starcoder2Config, layer_idx: int): class Starcoder2Model (line 133) | class Starcoder2Model(MistralModel): method __init__ (line 134) | def __init__(self, config: Starcoder2Config): method forward (line 144) | def forward( class Starcoder2ForCausalLM (line 202) | class Starcoder2ForCausalLM(MistralForCausalLM): class Starcoder2ForSequenceClassification (line 206) | class Starcoder2ForSequenceClassification(MistralForSequenceClassificati... class Starcoder2ForTokenClassification (line 210) | class Starcoder2ForTokenClassification(MistralForTokenClassification): FILE: src/transformers/models/superglue/configuration_superglue.py class SuperGlueConfig (line 24) | class SuperGlueConfig(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): method validate_architecture (line 82) | def validate_architecture(self): FILE: src/transformers/models/superglue/convert_superglue_to_hf.py function prepare_imgs (line 30) | def prepare_imgs(): function verify_model_outputs (line 38) | def verify_model_outputs(model, model_name, device): function convert_old_keys_to_new_keys (line 100) | def convert_old_keys_to_new_keys(state_dict_keys: list[str], conversion_... function replace_state_dict_keys (line 118) | def replace_state_dict_keys(all_keys, new_keys, original_state_dict): function convert_state_dict (line 126) | def convert_state_dict(state_dict, config): function add_keypoint_detector_state_dict (line 214) | def add_keypoint_detector_state_dict(superglue_state_dict): function write_model (line 223) | def write_model( function write_image_processor (line 302) | def write_image_processor(save_dir, model_name, organization, push_to_hu... FILE: src/transformers/models/superglue/image_processing_pil_superglue.py function is_grayscale (line 44) | def is_grayscale(image: np.ndarray): function convert_to_grayscale (line 50) | def convert_to_grayscale(image: ImageInput) -> ImageInput: function validate_and_format_image_pairs (line 79) | def validate_and_format_image_pairs(images: ImageInput): class SuperGlueImageProcessorKwargs (line 107) | class SuperGlueImageProcessorKwargs(ImagesKwargs, total=False): class SuperGlueImageProcessorPil (line 117) | class SuperGlueImageProcessorPil(PilBackend): method __init__ (line 128) | def __init__(self, **kwargs: Unpack[SuperGlueImageProcessorKwargs]): method preprocess (line 132) | def preprocess(self, images: ImageInput, **kwargs: Unpack[SuperGlueIma... method _prepare_images_structure (line 135) | def _prepare_images_structure(self, images: ImageInput, **kwargs) -> I... method _preprocess (line 140) | def _preprocess( method post_process_keypoint_matching (line 173) | def post_process_keypoint_matching( method visualize_keypoint_matching (line 243) | def visualize_keypoint_matching( method _get_color (line 291) | def _get_color(self, score): FILE: src/transformers/models/superglue/image_processing_superglue.py function _is_valid_image (line 50) | def _is_valid_image(image): function validate_and_format_image_pairs (line 56) | def validate_and_format_image_pairs(images: ImageInput): function is_grayscale (line 84) | def is_grayscale( function convert_to_grayscale (line 95) | def convert_to_grayscale( class SuperGlueImageProcessorKwargs (line 114) | class SuperGlueImageProcessorKwargs(ImagesKwargs, total=False): class SuperGlueImageProcessor (line 124) | class SuperGlueImageProcessor(TorchvisionBackend): method __init__ (line 135) | def __init__(self, **kwargs: Unpack[SuperGlueImageProcessorKwargs]): method preprocess (line 139) | def preprocess(self, images: ImageInput, **kwargs: Unpack[SuperGlueIma... method _prepare_images_structure (line 142) | def _prepare_images_structure( method _preprocess (line 151) | def _preprocess( method post_process_keypoint_matching (line 194) | def post_process_keypoint_matching( method visualize_keypoint_matching (line 262) | def visualize_keypoint_matching( method _get_color (line 317) | def _get_color(self, score): FILE: src/transformers/models/superglue/modeling_superglue.py function concat_pairs (line 33) | def concat_pairs(tensor_tuple0: tuple[torch.Tensor], tensor_tuple1: tupl... function normalize_keypoints (line 49) | def normalize_keypoints(keypoints: torch.Tensor, height: int, width: int... function log_sinkhorn_iterations (line 70) | def log_sinkhorn_iterations( function log_optimal_transport (line 99) | def log_optimal_transport(scores: torch.Tensor, reg_param: torch.Tensor,... function arange_like (line 144) | def arange_like(x, dim: int) -> torch.Tensor: class SuperGlueKeypointMatchingOutput (line 158) | class SuperGlueKeypointMatchingOutput(ModelOutput): class SuperGlueMultiLayerPerceptron (line 188) | class SuperGlueMultiLayerPerceptron(nn.Module): method __init__ (line 189) | def __init__(self, config: SuperGlueConfig, in_channels: int, out_chan... method forward (line 195) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class SuperGlueKeypointEncoder (line 204) | class SuperGlueKeypointEncoder(nn.Module): method __init__ (line 205) | def __init__(self, config: SuperGlueConfig) -> None: method forward (line 219) | def forward( class SuperGlueSelfAttention (line 235) | class SuperGlueSelfAttention(nn.Module): method __init__ (line 236) | def __init__(self, config): method forward (line 256) | def forward( class SuperGlueSelfOutput (line 316) | class SuperGlueSelfOutput(nn.Module): method __init__ (line 317) | def __init__(self, config: SuperGlueConfig): method forward (line 321) | def forward(self, hidden_states: torch.Tensor, *args) -> torch.Tensor: class SuperGlueAttention (line 331) | class SuperGlueAttention(nn.Module): method __init__ (line 332) | def __init__(self, config): method forward (line 337) | def forward( class SuperGlueAttentionalPropagation (line 357) | class SuperGlueAttentionalPropagation(nn.Module): method __init__ (line 358) | def __init__(self, config: SuperGlueConfig) -> None: method forward (line 370) | def forward( class SuperGlueAttentionalGNN (line 400) | class SuperGlueAttentionalGNN(nn.Module): method __init__ (line 401) | def __init__(self, config: SuperGlueConfig) -> None: method forward (line 407) | def forward( class SuperGlueFinalProjection (line 455) | class SuperGlueFinalProjection(nn.Module): method __init__ (line 456) | def __init__(self, config: SuperGlueConfig) -> None: method forward (line 461) | def forward(self, descriptors: torch.Tensor) -> torch.Tensor: class SuperGluePreTrainedModel (line 466) | class SuperGluePreTrainedModel(PreTrainedModel): method _init_weights (line 473) | def _init_weights(self, module: nn.Module) -> None: class SuperGlueForKeypointMatching (line 485) | class SuperGlueForKeypointMatching(SuperGluePreTrainedModel): method __init__ (line 503) | def __init__(self, config: SuperGlueConfig) -> None: method _match_image_pair (line 517) | def _match_image_pair( method forward (line 665) | def forward( FILE: src/transformers/models/superpoint/configuration_superpoint.py class SuperPointConfig (line 24) | class SuperPointConfig(PreTrainedConfig): FILE: src/transformers/models/superpoint/convert_superpoint_to_pytorch.py function get_superpoint_config (line 25) | def get_superpoint_config(): function create_rename_keys (line 41) | def create_rename_keys(config, state_dict): function rename_key (line 77) | def rename_key(dct, old, new): function prepare_imgs (line 82) | def prepare_imgs(): function convert_superpoint_checkpoint (line 93) | def convert_superpoint_checkpoint(checkpoint_url, pytorch_dump_folder_pa... FILE: src/transformers/models/superpoint/image_processing_pil_superpoint.py function is_grayscale (line 34) | def is_grayscale(image: np.ndarray) -> bool: function convert_to_grayscale (line 41) | def convert_to_grayscale(image: np.ndarray) -> np.ndarray: class SuperPointImageProcessorKwargs (line 62) | class SuperPointImageProcessorKwargs(ImagesKwargs, total=False): class SuperPointImageProcessorPil (line 72) | class SuperPointImageProcessorPil(PilBackend): method __init__ (line 83) | def __init__(self, **kwargs: Unpack[SuperPointImageProcessorKwargs]): method _preprocess (line 86) | def _preprocess( method post_process_keypoint_detection (line 114) | def post_process_keypoint_detection( FILE: src/transformers/models/superpoint/image_processing_superpoint.py class SuperPointImageProcessorKwargs (line 34) | class SuperPointImageProcessorKwargs(ImagesKwargs, total=False): function is_grayscale (line 43) | def is_grayscale(image: "torch.Tensor") -> bool: function convert_to_grayscale (line 52) | def convert_to_grayscale(image: "torch.Tensor") -> "torch.Tensor": class SuperPointImageProcessor (line 70) | class SuperPointImageProcessor(TorchvisionBackend): method __init__ (line 81) | def __init__(self, **kwargs: Unpack[SuperPointImageProcessorKwargs]): method _preprocess (line 84) | def _preprocess( method post_process_keypoint_detection (line 114) | def post_process_keypoint_detection( FILE: src/transformers/models/superpoint/modeling_superpoint.py function remove_keypoints_from_borders (line 37) | def remove_keypoints_from_borders( function top_k_keypoints (line 47) | def top_k_keypoints(keypoints: torch.Tensor, scores: torch.Tensor, k: in... function simple_nms (line 55) | def simple_nms(scores: torch.Tensor, nms_radius: int) -> torch.Tensor: class SuperPointKeypointDescriptionOutput (line 83) | class SuperPointKeypointDescriptionOutput(ModelOutput): class SuperPointConvBlock (line 110) | class SuperPointConvBlock(nn.Module): method __init__ (line 111) | def __init__( method forward (line 132) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SuperPointEncoder (line 140) | class SuperPointEncoder(nn.Module): method __init__ (line 146) | def __init__(self, config: SuperPointConfig) -> None: method forward (line 168) | def forward( class SuperPointInterestPointDecoder (line 190) | class SuperPointInterestPointDecoder(nn.Module): method __init__ (line 199) | def __init__(self, config: SuperPointConfig) -> None: method forward (line 219) | def forward(self, encoded: torch.Tensor) -> tuple[torch.Tensor, torch.... method _get_pixel_scores (line 225) | def _get_pixel_scores(self, encoded: torch.Tensor) -> torch.Tensor: method _extract_keypoints (line 236) | def _extract_keypoints(self, scores: torch.Tensor) -> tuple[torch.Tens... class SuperPointDescriptorDecoder (line 262) | class SuperPointDescriptorDecoder(nn.Module): method __init__ (line 271) | def __init__(self, config: SuperPointConfig) -> None: method forward (line 291) | def forward(self, encoded: torch.Tensor, keypoints: torch.Tensor) -> t... method _sample_descriptors (line 304) | def _sample_descriptors(keypoints, descriptors, scale: int = 8) -> tor... class SuperPointPreTrainedModel (line 323) | class SuperPointPreTrainedModel(PreTrainedModel): method extract_one_channel_pixel_values (line 330) | def extract_one_channel_pixel_values(self, pixel_values: torch.FloatTe... class SuperPointForKeypointDetection (line 352) | class SuperPointForKeypointDetection(SuperPointPreTrainedModel): method __init__ (line 362) | def __init__(self, config: SuperPointConfig) -> None: method forward (line 374) | def forward( FILE: src/transformers/models/swiftformer/configuration_swiftformer.py class SwiftFormerConfig (line 24) | class SwiftFormerConfig(PreTrainedConfig): FILE: src/transformers/models/swiftformer/convert_swiftformer_original_to_hf.py function prepare_img (line 41) | def prepare_img(): function get_expected_output (line 48) | def get_expected_output(swiftformer_name): function rename_key (line 62) | def rename_key(dct, old, new): function create_rename_keys (line 67) | def create_rename_keys(state_dict): function convert_swiftformer_checkpoint (line 90) | def convert_swiftformer_checkpoint(swiftformer_name, pytorch_dump_folder... FILE: src/transformers/models/swiftformer/modeling_swiftformer.py class SwiftFormerPatchEmbedding (line 33) | class SwiftFormerPatchEmbedding(nn.Module): method __init__ (line 42) | def __init__(self, config: SwiftFormerConfig): method forward (line 56) | def forward(self, x): function drop_path (line 61) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class SwiftFormerDropPath (line 76) | class SwiftFormerDropPath(nn.Module): method __init__ (line 79) | def __init__(self, config: SwiftFormerConfig) -> None: method forward (line 83) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 86) | def extra_repr(self) -> str: class SwiftFormerEmbeddings (line 90) | class SwiftFormerEmbeddings(nn.Module): method __init__ (line 99) | def __init__(self, config: SwiftFormerConfig, index: int): method forward (line 117) | def forward(self, x): class SwiftFormerConvEncoder (line 123) | class SwiftFormerConvEncoder(nn.Module): method __init__ (line 132) | def __init__(self, config: SwiftFormerConfig, dim: int): method forward (line 144) | def forward(self, x): class SwiftFormerMlp (line 155) | class SwiftFormerMlp(nn.Module): method __init__ (line 164) | def __init__(self, config: SwiftFormerConfig, in_features: int): method forward (line 174) | def forward(self, x): class SwiftFormerEfficientAdditiveAttention (line 184) | class SwiftFormerEfficientAdditiveAttention(nn.Module): method __init__ (line 193) | def __init__(self, config: SwiftFormerConfig, dim: int = 512): method forward (line 204) | def forward(self, x): class SwiftFormerLocalRepresentation (line 224) | class SwiftFormerLocalRepresentation(nn.Module): method __init__ (line 233) | def __init__(self, config: SwiftFormerConfig, dim: int): method forward (line 244) | def forward(self, x): class SwiftFormerEncoderBlock (line 255) | class SwiftFormerEncoderBlock(nn.Module): method __init__ (line 265) | def __init__(self, config: SwiftFormerConfig, dim: int, drop_path: flo... method forward (line 284) | def forward(self, x): class SwiftFormerStage (line 298) | class SwiftFormerStage(GradientCheckpointingLayer): method __init__ (line 308) | def __init__(self, config: SwiftFormerConfig, index: int) -> None: method forward (line 326) | def forward(self, input): class SwiftFormerEncoder (line 332) | class SwiftFormerEncoder(nn.Module): method __init__ (line 333) | def __init__(self, config: SwiftFormerConfig) -> None: method forward (line 355) | def forward( class SwiftFormerPreTrainedModel (line 383) | class SwiftFormerPreTrainedModel(PreTrainedModel): method _init_weights (line 392) | def _init_weights(self, module: nn.Module) -> None: class SwiftFormerModel (line 416) | class SwiftFormerModel(SwiftFormerPreTrainedModel): method __init__ (line 417) | def __init__(self, config: SwiftFormerConfig): method forward (line 428) | def forward( class SwiftFormerForImageClassification (line 460) | class SwiftFormerForImageClassification(SwiftFormerPreTrainedModel): method __init__ (line 461) | def __init__(self, config: SwiftFormerConfig) -> None: method forward (line 478) | def forward( FILE: src/transformers/models/swin/configuration_swin.py class SwinConfig (line 25) | class SwinConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 78) | def __post_init__(self, **kwargs): FILE: src/transformers/models/swin/convert_swin_simmim_to_pytorch.py function get_swin_config (line 28) | def get_swin_config(model_name): function rename_key (line 52) | def rename_key(name): function convert_state_dict (line 85) | def convert_state_dict(orig_state_dict, model): function convert_swin_checkpoint (line 123) | def convert_swin_checkpoint(model_name, checkpoint_path, pytorch_dump_fo... FILE: src/transformers/models/swin/convert_swin_timm_to_pytorch.py function get_swin_config (line 14) | def get_swin_config(swin_name): function rename_key (line 60) | def rename_key(name): function convert_state_dict (line 93) | def convert_state_dict(orig_state_dict, model): function convert_swin_checkpoint (line 131) | def convert_swin_checkpoint(swin_name, pytorch_dump_folder_path): FILE: src/transformers/models/swin/modeling_swin.py class SwinEncoderOutput (line 46) | class SwinEncoderOutput(ModelOutput): class SwinModelOutput (line 68) | class SwinModelOutput(ModelOutput): class SwinMaskedImageModelingOutput (line 93) | class SwinMaskedImageModelingOutput(ModelOutput): class SwinImageClassifierOutput (line 120) | class SwinImageClassifierOutput(ModelOutput): function window_partition (line 141) | def window_partition(input_feature, window_size): function window_reverse (line 153) | def window_reverse(windows, window_size, height, width): class SwinEmbeddings (line 163) | class SwinEmbeddings(nn.Module): method __init__ (line 168) | def __init__(self, config, use_mask_token=False): method interpolate_pos_encoding (line 187) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 227) | def forward( class SwinPatchEmbeddings (line 255) | class SwinPatchEmbeddings(nn.Module): method __init__ (line 262) | def __init__(self, config): method maybe_pad (line 277) | def maybe_pad(self, pixel_values, height, width): method forward (line 286) | def forward(self, pixel_values: torch.FloatTensor | None) -> tuple[tor... class SwinPatchMerging (line 298) | class SwinPatchMerging(nn.Module): method __init__ (line 311) | def __init__(self, input_resolution: tuple[int], dim: int, norm_layer:... method maybe_pad (line 318) | def maybe_pad(self, input_feature, height, width): method forward (line 326) | def forward(self, input_feature: torch.Tensor, input_dimensions: tuple... function drop_path (line 353) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class SwinDropPath (line 369) | class SwinDropPath(nn.Module): method __init__ (line 372) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 376) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 379) | def extra_repr(self) -> str: class SwinSelfAttention (line 383) | class SwinSelfAttention(nn.Module): method __init__ (line 384) | def __init__(self, config, dim, num_heads, window_size): method forward (line 410) | def forward( method create_relative_position_index (line 461) | def create_relative_position_index(self): class SwinSelfOutput (line 476) | class SwinSelfOutput(nn.Module): method __init__ (line 477) | def __init__(self, config, dim): method forward (line 482) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class SwinAttention (line 489) | class SwinAttention(nn.Module): method __init__ (line 490) | def __init__(self, config, dim, num_heads, window_size): method forward (line 495) | def forward( class SwinIntermediate (line 507) | class SwinIntermediate(nn.Module): method __init__ (line 508) | def __init__(self, config, dim): method forward (line 516) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SwinOutput (line 522) | class SwinOutput(nn.Module): method __init__ (line 523) | def __init__(self, config, dim): method forward (line 528) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SwinLayer (line 534) | class SwinLayer(nn.Module): method __init__ (line 535) | def __init__(self, config, dim, input_resolution, num_heads, drop_path... method set_shift_and_window_size (line 548) | def set_shift_and_window_size(self, input_resolution): method get_attn_mask (line 556) | def get_attn_mask(self, height, width, dtype, device): method maybe_pad (line 584) | def maybe_pad(self, hidden_states, height, width): method forward (line 591) | def forward( class SwinStage (line 656) | class SwinStage(GradientCheckpointingLayer): method __init__ (line 657) | def __init__(self, config, dim, input_resolution, depth, num_heads, dr... method forward (line 683) | def forward( class SwinEncoder (line 711) | class SwinEncoder(nn.Module): method __init__ (line 712) | def __init__(self, config, grid_size): method forward (line 734) | def forward( class SwinPreTrainedModel (line 798) | class SwinPreTrainedModel(PreTrainedModel): method _init_weights (line 807) | def _init_weights(self, module): class SwinModel (line 821) | class SwinModel(SwinPreTrainedModel): method __init__ (line 822) | def __init__(self, config, add_pooling_layer=True, use_mask_token=False): method get_input_embeddings (line 843) | def get_input_embeddings(self): method forward (line 847) | def forward( class SwinForMaskedImageModeling (line 916) | class SwinForMaskedImageModeling(SwinPreTrainedModel): method __init__ (line 917) | def __init__(self, config): method forward (line 934) | def forward( class SwinForImageClassification (line 1034) | class SwinForImageClassification(SwinPreTrainedModel): method __init__ (line 1035) | def __init__(self, config): method forward (line 1050) | def forward( class SwinBackbone (line 1102) | class SwinBackbone(BackboneMixin, SwinPreTrainedModel): method __init__ (line 1103) | def __init__(self, config: SwinConfig): method get_input_embeddings (line 1119) | def get_input_embeddings(self): method forward (line 1124) | def forward( FILE: src/transformers/models/swin2sr/configuration_swin2sr.py class Swin2SRConfig (line 24) | class Swin2SRConfig(PreTrainedConfig): method __post_init__ (line 89) | def __post_init__(self, **kwargs): FILE: src/transformers/models/swin2sr/convert_swin2sr_original_to_pytorch.py function get_config (line 27) | def get_config(checkpoint_url): function rename_key (line 55) | def rename_key(name, config): function convert_state_dict (line 126) | def convert_state_dict(orig_state_dict, config): function convert_swin2sr_checkpoint (line 162) | def convert_swin2sr_checkpoint(checkpoint_url, pytorch_dump_folder_path,... FILE: src/transformers/models/swin2sr/image_processing_pil_swin2sr.py class Swin2SRImageProcessorKwargs (line 32) | class Swin2SRImageProcessorKwargs(ImagesKwargs, total=False): class Swin2SRImageProcessorPil (line 42) | class Swin2SRImageProcessorPil(PilBackend): method __init__ (line 52) | def __init__(self, **kwargs: Unpack[Swin2SRImageProcessorKwargs]): method preprocess (line 60) | def preprocess( method pad (line 67) | def pad( method _preprocess (line 86) | def _preprocess( FILE: src/transformers/models/swin2sr/image_processing_swin2sr.py class Swin2SRImageProcessorKwargs (line 31) | class Swin2SRImageProcessorKwargs(ImagesKwargs, total=False): class Swin2SRImageProcessor (line 41) | class Swin2SRImageProcessor(TorchvisionBackend): method __init__ (line 51) | def __init__(self, **kwargs: Unpack[Swin2SRImageProcessorKwargs]): method preprocess (line 59) | def preprocess( method pad (line 66) | def pad( method _preprocess (line 79) | def _preprocess( FILE: src/transformers/models/swin2sr/modeling_swin2sr.py class Swin2SREncoderOutput (line 41) | class Swin2SREncoderOutput(ModelOutput): function window_partition (line 48) | def window_partition(input_feature, window_size): function window_reverse (line 61) | def window_reverse(windows, window_size, height, width): function drop_path (line 72) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class Swin2SRDropPath (line 88) | class Swin2SRDropPath(nn.Module): method __init__ (line 91) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 95) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 98) | def extra_repr(self) -> str: class Swin2SREmbeddings (line 102) | class Swin2SREmbeddings(nn.Module): method __init__ (line 107) | def __init__(self, config): method forward (line 121) | def forward(self, pixel_values: torch.FloatTensor | None) -> tuple[tor... class Swin2SRPatchEmbeddings (line 132) | class Swin2SRPatchEmbeddings(nn.Module): method __init__ (line 133) | def __init__(self, config, normalize_patches=True): method forward (line 147) | def forward(self, embeddings: torch.FloatTensor | None) -> tuple[torch... class Swin2SRPatchUnEmbeddings (line 159) | class Swin2SRPatchUnEmbeddings(nn.Module): method __init__ (line 162) | def __init__(self, config): method forward (line 167) | def forward(self, embeddings, x_size): class Swin2SRPatchMerging (line 174) | class Swin2SRPatchMerging(nn.Module): method __init__ (line 187) | def __init__(self, input_resolution: tuple[int], dim: int, norm_layer:... method maybe_pad (line 194) | def maybe_pad(self, input_feature, height, width): method forward (line 202) | def forward(self, input_feature: torch.Tensor, input_dimensions: tuple... class Swin2SRSelfAttention (line 229) | class Swin2SRSelfAttention(nn.Module): method __init__ (line 230) | def __init__(self, config, dim, num_heads, window_size, pretrained_win... method forward (line 259) | def forward( method create_coords_table_and_index (line 327) | def create_coords_table_and_index(self): class Swin2SRSelfOutput (line 366) | class Swin2SRSelfOutput(nn.Module): method __init__ (line 367) | def __init__(self, config, dim): method forward (line 372) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Swin2SRAttention (line 380) | class Swin2SRAttention(nn.Module): method __init__ (line 381) | def __init__(self, config, dim, num_heads, window_size, pretrained_win... method forward (line 394) | def forward( class Swin2SRIntermediate (line 407) | class Swin2SRIntermediate(nn.Module): method __init__ (line 408) | def __init__(self, config, dim): method forward (line 416) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Swin2SROutput (line 423) | class Swin2SROutput(nn.Module): method __init__ (line 424) | def __init__(self, config, dim): method forward (line 429) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Swin2SRLayer (line 436) | class Swin2SRLayer(nn.Module): method __init__ (line 437) | def __init__( method _compute_window_shift (line 462) | def _compute_window_shift(self, target_window_size, target_shift_size)... method get_attn_mask (line 467) | def get_attn_mask(self, height, width, dtype): method maybe_pad (line 495) | def maybe_pad(self, hidden_states, height, width): method forward (line 502) | def forward( class Swin2SRStage (line 558) | class Swin2SRStage(GradientCheckpointingLayer): method __init__ (line 563) | def __init__(self, config, dim, input_resolution, depth, num_heads, dr... method forward (line 597) | def forward( class Swin2SREncoder (line 626) | class Swin2SREncoder(nn.Module): method __init__ (line 627) | def __init__(self, config, grid_size): method forward (line 649) | def forward( class Swin2SRPreTrainedModel (line 690) | class Swin2SRPreTrainedModel(PreTrainedModel): method _init_weights (line 698) | def _init_weights(self, module): class Swin2SRModel (line 721) | class Swin2SRModel(Swin2SRPreTrainedModel): method __init__ (line 722) | def __init__(self, config): method get_input_embeddings (line 745) | def get_input_embeddings(self): method pad_and_normalize (line 748) | def pad_and_normalize(self, pixel_values): method forward (line 764) | def forward( class Upsample (line 812) | class Upsample(nn.Module): method __init__ (line 822) | def __init__(self, scale, num_features): method forward (line 837) | def forward(self, hidden_state): class UpsampleOneStep (line 850) | class UpsampleOneStep(nn.Module): method __init__ (line 864) | def __init__(self, scale, in_channels, out_channels): method forward (line 870) | def forward(self, x): class PixelShuffleUpsampler (line 877) | class PixelShuffleUpsampler(nn.Module): method __init__ (line 878) | def __init__(self, config, num_features): method forward (line 885) | def forward(self, sequence_output): class NearestConvUpsampler (line 894) | class NearestConvUpsampler(nn.Module): method __init__ (line 895) | def __init__(self, config, num_features): method forward (line 908) | def forward(self, sequence_output): class PixelShuffleAuxUpsampler (line 921) | class PixelShuffleAuxUpsampler(nn.Module): method __init__ (line 922) | def __init__(self, config, num_features): method forward (line 934) | def forward(self, sequence_output, bicubic, height, width): class Swin2SRForImageSuperResolution (line 954) | class Swin2SRForImageSuperResolution(Swin2SRPreTrainedModel): method __init__ (line 955) | def __init__(self, config): method forward (line 982) | def forward( FILE: src/transformers/models/swinv2/configuration_swinv2.py class Swinv2Config (line 25) | class Swinv2Config(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): FILE: src/transformers/models/swinv2/convert_swinv2_timm_to_pytorch.py function get_swinv2_config (line 29) | def get_swinv2_config(swinv2_name): function rename_key (line 91) | def rename_key(name): function convert_state_dict (line 131) | def convert_state_dict(orig_state_dict, model): function convert_swinv2_checkpoint (line 169) | def convert_swinv2_checkpoint(swinv2_name, pytorch_dump_folder_path): FILE: src/transformers/models/swinv2/modeling_swinv2.py class Swinv2EncoderOutput (line 47) | class Swinv2EncoderOutput(ModelOutput): class Swinv2ModelOutput (line 70) | class Swinv2ModelOutput(ModelOutput): class Swinv2MaskedImageModelingOutput (line 96) | class Swinv2MaskedImageModelingOutput(ModelOutput): class Swinv2ImageClassifierOutput (line 124) | class Swinv2ImageClassifierOutput(ModelOutput): function window_partition (line 146) | def window_partition(input_feature, window_size): function window_reverse (line 159) | def window_reverse(windows, window_size, height, width): function drop_path (line 170) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class Swinv2DropPath (line 186) | class Swinv2DropPath(nn.Module): method __init__ (line 189) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 193) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 196) | def extra_repr(self) -> str: class Swinv2Embeddings (line 201) | class Swinv2Embeddings(nn.Module): method __init__ (line 206) | def __init__(self, config, use_mask_token=False): method interpolate_pos_encoding (line 225) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 265) | def forward( class Swinv2PatchEmbeddings (line 294) | class Swinv2PatchEmbeddings(nn.Module): method __init__ (line 301) | def __init__(self, config): method maybe_pad (line 316) | def maybe_pad(self, pixel_values, height, width): method forward (line 325) | def forward(self, pixel_values: torch.FloatTensor | None) -> tuple[tor... class Swinv2PatchMerging (line 337) | class Swinv2PatchMerging(nn.Module): method __init__ (line 350) | def __init__(self, input_resolution: tuple[int], dim: int, norm_layer:... method maybe_pad (line 357) | def maybe_pad(self, input_feature, height, width): method forward (line 365) | def forward(self, input_feature: torch.Tensor, input_dimensions: tuple... class Swinv2SelfAttention (line 391) | class Swinv2SelfAttention(nn.Module): method __init__ (line 392) | def __init__(self, config, dim, num_heads, window_size, pretrained_win... method forward (line 421) | def forward( method create_coords_table_and_index (line 489) | def create_coords_table_and_index(self): class Swinv2SelfOutput (line 528) | class Swinv2SelfOutput(nn.Module): method __init__ (line 529) | def __init__(self, config, dim): method forward (line 534) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class Swinv2Attention (line 541) | class Swinv2Attention(nn.Module): method __init__ (line 542) | def __init__(self, config, dim, num_heads, window_size, pretrained_win... method forward (line 555) | def forward( class Swinv2Intermediate (line 568) | class Swinv2Intermediate(nn.Module): method __init__ (line 569) | def __init__(self, config, dim): method forward (line 577) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Swinv2Output (line 584) | class Swinv2Output(nn.Module): method __init__ (line 585) | def __init__(self, config, dim): method forward (line 590) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Swinv2Layer (line 596) | class Swinv2Layer(nn.Module): method __init__ (line 597) | def __init__( method _compute_window_shift (line 622) | def _compute_window_shift(self, target_window_size, target_shift_size)... method get_attn_mask (line 627) | def get_attn_mask(self, height, width, dtype): method maybe_pad (line 655) | def maybe_pad(self, hidden_states, height, width): method forward (line 662) | def forward( class Swinv2Stage (line 718) | class Swinv2Stage(GradientCheckpointingLayer): method __init__ (line 719) | def __init__( method forward (line 747) | def forward( class Swinv2Encoder (line 778) | class Swinv2Encoder(nn.Module): method __init__ (line 779) | def __init__(self, config, grid_size, pretrained_window_sizes=(0, 0, 0... method forward (line 804) | def forward( class Swinv2PreTrainedModel (line 875) | class Swinv2PreTrainedModel(PreTrainedModel): method _init_weights (line 884) | def _init_weights(self, module): class Swinv2Model (line 907) | class Swinv2Model(Swinv2PreTrainedModel): method __init__ (line 908) | def __init__(self, config, add_pooling_layer=True, use_mask_token=False): method get_input_embeddings (line 929) | def get_input_embeddings(self): method forward (line 933) | def forward( class Swinv2ForMaskedImageModeling (line 1004) | class Swinv2ForMaskedImageModeling(Swinv2PreTrainedModel): method __init__ (line 1005) | def __init__(self, config): method forward (line 1022) | def forward( class Swinv2ForImageClassification (line 1123) | class Swinv2ForImageClassification(Swinv2PreTrainedModel): method __init__ (line 1124) | def __init__(self, config): method forward (line 1139) | def forward( class Swinv2Backbone (line 1191) | class Swinv2Backbone(BackboneMixin, Swinv2PreTrainedModel): method __init__ (line 1192) | def __init__(self, config): method get_input_embeddings (line 1202) | def get_input_embeddings(self): method forward (line 1208) | def forward( FILE: src/transformers/models/switch_transformers/configuration_switch_transformers.py class SwitchTransformersConfig (line 26) | class SwitchTransformersConfig(PreTrainedConfig): method __post_init__ (line 91) | def __post_init__(self, **kwargs): FILE: src/transformers/models/switch_transformers/convert_big_switch.py function rename_base_flax_keys (line 18) | def rename_base_flax_keys(flax_key_tuple, flax_tensor): function get_key_and_tensorstore_dict (line 36) | def get_key_and_tensorstore_dict(layer, checkpoint_info, switch_checkpoi... function rename_and_save_block (line 61) | def rename_and_save_block(current_block, save_path): function shard_on_the_fly (line 70) | def shard_on_the_fly(switch_checkpoint_path, dump_path, max_shard_size, ... function sanity_check (line 180) | def sanity_check(): FILE: src/transformers/models/switch_transformers/convert_switch_transformers_original_flax_checkpoint_to_pytorch.py function load_flax_weights_in_pytorch_model (line 34) | def load_flax_weights_in_pytorch_model(pt_model, flax_state): function rename_keys (line 196) | def rename_keys(s_dict): function convert_gin_to_config (line 263) | def convert_gin_to_config(gin_file, num_experts): function convert_flax_checkpoint_to_pytorch (line 284) | def convert_flax_checkpoint_to_pytorch( FILE: src/transformers/models/switch_transformers/modeling_switch_transformers.py class SwitchTransformersTop1Router (line 51) | class SwitchTransformersTop1Router(nn.Module): method __init__ (line 62) | def __init__(self, config: SwitchTransformersConfig): method forward (line 71) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class SwitchTransformersLayerNorm (line 108) | class SwitchTransformersLayerNorm(nn.Module): method __init__ (line 109) | def __init__(self, hidden_size, eps=1e-6): method forward (line 117) | def forward(self, hidden_states): class SwitchTransformersDenseActDense (line 133) | class SwitchTransformersDenseActDense(nn.Module): method __init__ (line 134) | def __init__(self, config: SwitchTransformersConfig): method forward (line 141) | def forward(self, hidden_states): class SwitchTransformersExperts (line 155) | class SwitchTransformersExperts(nn.ModuleDict): method __init__ (line 156) | def __init__(self, config: SwitchTransformersConfig): method forward (line 162) | def forward( class SwitchTransformersSparseMLP (line 177) | class SwitchTransformersSparseMLP(nn.Module): # inherit from mixtral method __init__ (line 178) | def __init__(self, config: SwitchTransformersConfig): method forward (line 183) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SwitchTransformersLayerFF (line 192) | class SwitchTransformersLayerFF(nn.Module): method __init__ (line 204) | def __init__(self, config: SwitchTransformersConfig, is_sparse=False): method forward (line 217) | def forward(self, hidden_states, **kwargs): class SwitchTransformersAttention (line 224) | class SwitchTransformersAttention(nn.Module): method __init__ (line 225) | def __init__( method _relative_position_bucket (line 260) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 307) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 324) | def forward( class SwitchTransformersLayerSelfAttention (line 418) | class SwitchTransformersLayerSelfAttention(nn.Module): method __init__ (line 419) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 427) | def forward( class SwitchTransformersLayerCrossAttention (line 451) | class SwitchTransformersLayerCrossAttention(nn.Module): method __init__ (line 452) | def __init__(self, config, layer_idx: int | None = None): method forward (line 460) | def forward( class SwitchTransformersBlock (line 484) | class SwitchTransformersBlock(GradientCheckpointingLayer): method __init__ (line 485) | def __init__(self, config, has_relative_attention_bias=False, is_spars... method forward (line 500) | def forward( class SwitchTransformersPreTrainedModel (line 549) | class SwitchTransformersPreTrainedModel(PreTrainedModel): method _init_weights (line 557) | def _init_weights(self, module): method _shift_right (line 595) | def _shift_right(self, input_ids): class SwitchTransformersStack (line 617) | class SwitchTransformersStack(SwitchTransformersPreTrainedModel): method __init__ (line 625) | def __init__(self, config): method forward (line 651) | def forward( class SwitchTransformersModel (line 746) | class SwitchTransformersModel(SwitchTransformersPreTrainedModel): method __init__ (line 753) | def __init__(self, config: SwitchTransformersConfig): method set_input_embeddings (line 769) | def set_input_embeddings(self, new_embeddings): method forward (line 776) | def forward( function router_z_loss_func (line 824) | def router_z_loss_func(router_logits: torch.Tensor) -> float: function load_balancing_loss_func (line 844) | def load_balancing_loss_func(router_probs: torch.Tensor, expert_indices:... class SwitchTransformersForConditionalGeneration (line 888) | class SwitchTransformersForConditionalGeneration(SwitchTransformersPreTr... method __init__ (line 895) | def __init__(self, config: SwitchTransformersConfig): method get_input_embeddings (line 917) | def get_input_embeddings(self): method set_input_embeddings (line 920) | def set_input_embeddings(self, new_embeddings): method forward (line 927) | def forward( method _unpack_router_logits (line 1032) | def _unpack_router_logits(self, router_outputs): method prepare_decoder_input_ids_from_labels (line 1042) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class SwitchTransformersEncoderModel (line 1046) | class SwitchTransformersEncoderModel(SwitchTransformersPreTrainedModel): method __init__ (line 1051) | def __init__(self, config: SwitchTransformersConfig): method get_input_embeddings (line 1061) | def get_input_embeddings(self): method set_input_embeddings (line 1064) | def set_input_embeddings(self, new_embeddings): method forward (line 1070) | def forward( FILE: src/transformers/models/switch_transformers/modular_switch_transformers.py function router_z_loss_func (line 59) | def router_z_loss_func(router_logits: torch.Tensor) -> float: function load_balancing_loss_func (line 79) | def load_balancing_loss_func(router_probs: torch.Tensor, expert_indices:... class SwitchTransformersTop1Router (line 118) | class SwitchTransformersTop1Router(nn.Module): method __init__ (line 129) | def __init__(self, config: SwitchTransformersConfig): method forward (line 138) | def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, ... class SwitchTransformersLayerNorm (line 175) | class SwitchTransformersLayerNorm(T5LayerNorm): class SwitchTransformersDenseActDense (line 179) | class SwitchTransformersDenseActDense(T5DenseActDense): class SwitchTransformersExperts (line 183) | class SwitchTransformersExperts(nn.ModuleDict): method __init__ (line 184) | def __init__(self, config: SwitchTransformersConfig): method forward (line 190) | def forward( class SwitchTransformersSparseMLP (line 205) | class SwitchTransformersSparseMLP(nn.Module): # inherit from mixtral method __init__ (line 206) | def __init__(self, config: SwitchTransformersConfig): method forward (line 211) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class SwitchTransformersLayerFF (line 220) | class SwitchTransformersLayerFF(nn.Module): method __init__ (line 232) | def __init__(self, config: SwitchTransformersConfig, is_sparse=False): method forward (line 245) | def forward(self, hidden_states, **kwargs): class SwitchTransformersAttention (line 252) | class SwitchTransformersAttention(T5Attention): class SwitchTransformersLayerSelfAttention (line 256) | class SwitchTransformersLayerSelfAttention(T5LayerSelfAttention): class SwitchTransformersLayerCrossAttention (line 260) | class SwitchTransformersLayerCrossAttention(T5LayerCrossAttention): class SwitchTransformersBlock (line 264) | class SwitchTransformersBlock(GradientCheckpointingLayer): method __init__ (line 265) | def __init__(self, config, has_relative_attention_bias=False, is_spars... method forward (line 280) | def forward( class SwitchTransformersPreTrainedModel (line 329) | class SwitchTransformersPreTrainedModel(PreTrainedModel): method _init_weights (line 337) | def _init_weights(self, module): method _shift_right (line 375) | def _shift_right(self, input_ids): class SwitchTransformersStack (line 397) | class SwitchTransformersStack(SwitchTransformersPreTrainedModel): method __init__ (line 405) | def __init__(self, config): method forward (line 431) | def forward( class SwitchTransformersModel (line 526) | class SwitchTransformersModel(SwitchTransformersPreTrainedModel): method __init__ (line 533) | def __init__(self, config: SwitchTransformersConfig): method set_input_embeddings (line 549) | def set_input_embeddings(self, new_embeddings): method forward (line 556) | def forward( class SwitchTransformersForConditionalGeneration (line 603) | class SwitchTransformersForConditionalGeneration(SwitchTransformersPreTr... method __init__ (line 610) | def __init__(self, config: SwitchTransformersConfig): method get_input_embeddings (line 632) | def get_input_embeddings(self): method set_input_embeddings (line 635) | def set_input_embeddings(self, new_embeddings): method forward (line 642) | def forward( method _unpack_router_logits (line 747) | def _unpack_router_logits(self, router_outputs): method prepare_decoder_input_ids_from_labels (line 757) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class SwitchTransformersEncoderModel (line 761) | class SwitchTransformersEncoderModel(SwitchTransformersPreTrainedModel): method __init__ (line 766) | def __init__(self, config: SwitchTransformersConfig): method get_input_embeddings (line 776) | def get_input_embeddings(self): method set_input_embeddings (line 779) | def set_input_embeddings(self, new_embeddings): method forward (line 785) | def forward( FILE: src/transformers/models/t5/configuration_t5.py class T5Config (line 24) | class T5Config(PreTrainedConfig): method __post_init__ (line 64) | def __post_init__(self, **kwargs): method validate_architecture (line 87) | def validate_architecture(self): FILE: src/transformers/models/t5/convert_t5_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_t5 (line 29) | def load_tf_weights_in_t5(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 134) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, py... FILE: src/transformers/models/t5/convert_t5x_checkpoint_to_pytorch.py function t5x_attention_lookup (line 44) | def t5x_attention_lookup(params, i, prefix, layer_name="attention"): function t5x_mlp_lookup (line 53) | def t5x_mlp_lookup(params, i, prefix, split_mlp_wi=False): function t5x_layer_norm_lookup (line 66) | def t5x_layer_norm_lookup(params, i, prefix, layer_name): function convert_t5x_to_pytorch (line 71) | def convert_t5x_to_pytorch(variables: dict, *, num_layers: int, num_deco... function make_state_dict (line 156) | def make_state_dict(converted_params, is_encoder_only: bool): function load_t5x_weights_in_t5 (line 176) | def load_t5x_weights_in_t5(model, config, t5x_checkpoint_path, is_encode... function convert_t5x_checkpoint_to_pytorch (line 189) | def convert_t5x_checkpoint_to_pytorch( FILE: src/transformers/models/t5/modeling_t5.py class T5LayerNorm (line 46) | class T5LayerNorm(nn.Module): method __init__ (line 47) | def __init__(self, hidden_size, eps=1e-6): method forward (line 55) | def forward(self, hidden_states): class T5DenseActDense (line 84) | class T5DenseActDense(nn.Module): method __init__ (line 85) | def __init__(self, config: T5Config): method forward (line 92) | def forward(self, hidden_states): class T5DenseGatedActDense (line 106) | class T5DenseGatedActDense(nn.Module): method __init__ (line 107) | def __init__(self, config: T5Config): method forward (line 115) | def forward(self, hidden_states): class T5LayerFF (line 135) | class T5LayerFF(nn.Module): method __init__ (line 136) | def __init__(self, config: T5Config): method forward (line 146) | def forward(self, hidden_states): class T5Attention (line 153) | class T5Attention(nn.Module): method __init__ (line 154) | def __init__( method _relative_position_bucket (line 189) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 236) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 253) | def forward( class T5LayerSelfAttention (line 347) | class T5LayerSelfAttention(nn.Module): method __init__ (line 348) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 356) | def forward( class T5LayerCrossAttention (line 380) | class T5LayerCrossAttention(nn.Module): method __init__ (line 381) | def __init__(self, config, layer_idx: int | None = None): method forward (line 387) | def forward( class T5Block (line 411) | class T5Block(GradientCheckpointingLayer): method __init__ (line 412) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 424) | def forward( class T5ClassificationHead (line 501) | class T5ClassificationHead(nn.Module): method __init__ (line 504) | def __init__(self, config: T5Config): method forward (line 510) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class T5PreTrainedModel (line 520) | class T5PreTrainedModel(PreTrainedModel): method dummy_inputs (line 530) | def dummy_inputs(self): method _init_weights (line 541) | def _init_weights(self, module): method _shift_right (line 595) | def _shift_right(self, input_ids): class T5Stack (line 617) | class T5Stack(T5PreTrainedModel): method __init__ (line 618) | def __init__(self, config): method set_input_embeddings (line 634) | def set_input_embeddings(self, new_embeddings): method forward (line 637) | def forward( class T5Model (line 796) | class T5Model(T5PreTrainedModel): method __init__ (line 805) | def __init__(self, config: T5Config): method get_input_embeddings (line 822) | def get_input_embeddings(self): method set_input_embeddings (line 825) | def set_input_embeddings(self, new_embeddings): method forward (line 831) | def forward( class T5ForConditionalGeneration (line 952) | class T5ForConditionalGeneration(T5PreTrainedModel, GenerationMixin): method __init__ (line 962) | def __init__(self, config: T5Config): method get_input_embeddings (line 983) | def get_input_embeddings(self): method set_input_embeddings (line 986) | def set_input_embeddings(self, new_embeddings): method forward (line 992) | def forward( method prepare_decoder_input_ids_from_labels (line 1135) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class T5EncoderModel (line 1140) | class T5EncoderModel(T5PreTrainedModel): method __init__ (line 1144) | def __init__(self, config: T5Config): method get_input_embeddings (line 1156) | def get_input_embeddings(self): method set_input_embeddings (line 1159) | def set_input_embeddings(self, new_embeddings): method forward (line 1164) | def forward( class T5ForSequenceClassification (line 1217) | class T5ForSequenceClassification(T5PreTrainedModel): method __init__ (line 1220) | def __init__(self, config: T5Config): method forward (line 1229) | def forward( class T5ForTokenClassification (line 1362) | class T5ForTokenClassification(T5PreTrainedModel): method __init__ (line 1363) | def __init__(self, config: T5Config): method forward (line 1375) | def forward( class T5ForQuestionAnswering (line 1433) | class T5ForQuestionAnswering(T5PreTrainedModel): method __init__ (line 1440) | def __init__(self, config: T5Config): method get_input_embeddings (line 1462) | def get_input_embeddings(self): method set_input_embeddings (line 1465) | def set_input_embeddings(self, new_embeddings): method forward (line 1471) | def forward( FILE: src/transformers/models/t5/tokenization_t5.py class T5Tokenizer (line 30) | class T5Tokenizer(TokenizersBackend): method __init__ (line 71) | def __init__( method get_sentinel_tokens (line 148) | def get_sentinel_tokens(self): method get_sentinel_token_ids (line 154) | def get_sentinel_token_ids(self): FILE: src/transformers/models/t5gemma/configuration_t5gemma.py class T5GemmaModuleConfig (line 32) | class T5GemmaModuleConfig(PreTrainedConfig): method __post_init__ (line 95) | def __post_init__(self, **kwargs): method validate_architecture (line 103) | def validate_architecture(self): class T5GemmaConfig (line 114) | class T5GemmaConfig(PreTrainedConfig): method __post_init__ (line 142) | def __post_init__(self, **kwargs): FILE: src/transformers/models/t5gemma/modeling_t5gemma.py class T5GemmaRMSNorm (line 60) | class T5GemmaRMSNorm(nn.Module): method __init__ (line 61) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 66) | def _norm(self, x): method forward (line 69) | def forward(self, x): method extra_repr (line 76) | def extra_repr(self): class T5GemmaMLP (line 80) | class T5GemmaMLP(nn.Module): method __init__ (line 81) | def __init__(self, config): method forward (line 92) | def forward(self, x): class T5GemmaRotaryEmbedding (line 99) | class T5GemmaRotaryEmbedding(nn.Module): method __init__ (line 102) | def __init__(self, config: T5GemmaConfig, device=None): method compute_default_rope_parameters (line 119) | def compute_default_rope_parameters( method forward (line 150) | def forward(self, x, position_ids): function rotate_half (line 164) | def rotate_half(x): function apply_rotary_pos_emb (line 172) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 197) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 209) | def eager_attention_forward( class T5GemmaSelfAttention (line 244) | class T5GemmaSelfAttention(nn.Module): method __init__ (line 247) | def __init__(self, config: T5GemmaModuleConfig, layer_idx: int): method forward (line 274) | def forward( class T5GemmaCrossAttention (line 318) | class T5GemmaCrossAttention(nn.Module): method __init__ (line 321) | def __init__(self, config: T5GemmaModuleConfig, layer_idx: int): method forward (line 349) | def forward( class T5GemmaEncoderLayer (line 403) | class T5GemmaEncoderLayer(GradientCheckpointingLayer): method __init__ (line 406) | def __init__(self, config, layer_idx: int): method forward (line 426) | def forward( class T5GemmaDecoderLayer (line 455) | class T5GemmaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 458) | def __init__(self, config, layer_idx: int): method forward (line 481) | def forward( class T5GemmaClassificationHead (line 528) | class T5GemmaClassificationHead(nn.Module): method __init__ (line 531) | def __init__(self, hidden_size: int, num_labels: int, classifier_dropo... method forward (line 536) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class T5GemmaLMHead (line 542) | class T5GemmaLMHead(nn.Module): method __init__ (line 545) | def __init__(self, hidden_size: int, vocab_size: int, bias: bool = Fal... method forward (line 549) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class T5GemmaPreTrainedModel (line 555) | class T5GemmaPreTrainedModel(PreTrainedModel): method _init_weights (line 577) | def _init_weights(self, module): method _shift_right (line 594) | def _shift_right(self, input_ids): function make_default_2d_attention_mask (line 621) | def make_default_2d_attention_mask( class T5GemmaEncoder (line 638) | class T5GemmaEncoder(T5GemmaPreTrainedModel): method __init__ (line 644) | def __init__(self, config): method forward (line 664) | def forward( class T5GemmaDecoder (line 721) | class T5GemmaDecoder(T5GemmaPreTrainedModel): method __init__ (line 728) | def __init__(self, config): method forward (line 748) | def forward( class T5GemmaModel (line 832) | class T5GemmaModel(T5GemmaPreTrainedModel): method __init__ (line 833) | def __init__(self, config: T5GemmaConfig): method get_input_embeddings (line 844) | def get_input_embeddings(self): method set_input_embeddings (line 847) | def set_input_embeddings(self, new_embeddings): method forward (line 852) | def forward( class T5GemmaEncoderModel (line 910) | class T5GemmaEncoderModel(T5GemmaPreTrainedModel): method __init__ (line 911) | def __init__(self, config: T5GemmaConfig): method get_input_embeddings (line 920) | def get_input_embeddings(self): method set_input_embeddings (line 923) | def set_input_embeddings(self, new_embeddings): method forward (line 928) | def forward( class T5GemmaForConditionalGeneration (line 946) | class T5GemmaForConditionalGeneration(T5GemmaPreTrainedModel, Generation... method __init__ (line 951) | def __init__(self, config: T5GemmaConfig): method set_output_embeddings (line 962) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 965) | def get_output_embeddings(self): method forward (line 970) | def forward( method prepare_decoder_input_ids_from_labels (line 1043) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class T5GemmaForSequenceClassification (line 1048) | class T5GemmaForSequenceClassification(T5GemmaPreTrainedModel): method __init__ (line 1049) | def __init__(self, config: T5GemmaConfig, is_encoder_decoder: bool | N... method get_input_embeddings (line 1072) | def get_input_embeddings(self): method set_input_embeddings (line 1075) | def set_input_embeddings(self, value): method forward (line 1080) | def forward( class T5GemmaForTokenClassification (line 1189) | class T5GemmaForTokenClassification(T5GemmaPreTrainedModel): method __init__ (line 1190) | def __init__(self, config: T5GemmaConfig, is_encoder_decoder: bool | N... method get_input_embeddings (line 1214) | def get_input_embeddings(self): method set_input_embeddings (line 1217) | def set_input_embeddings(self, value): method forward (line 1222) | def forward( FILE: src/transformers/models/t5gemma/modular_t5gemma.py class T5GemmaModuleConfig (line 68) | class T5GemmaModuleConfig(Gemma2Config): class T5GemmaConfig (line 93) | class T5GemmaConfig(PreTrainedConfig): method __post_init__ (line 121) | def __post_init__(self, **kwargs): class T5GemmaRMSNorm (line 151) | class T5GemmaRMSNorm(Gemma2RMSNorm): class T5GemmaMLP (line 155) | class T5GemmaMLP(Gemma2MLP): method __init__ (line 156) | def __init__(self, config): method forward (line 160) | def forward(self, x): class T5GemmaRotaryEmbedding (line 167) | class T5GemmaRotaryEmbedding(Gemma2RotaryEmbedding): class T5GemmaSelfAttention (line 171) | class T5GemmaSelfAttention(Gemma2Attention): method __init__ (line 172) | def __init__(self, config: T5GemmaModuleConfig, layer_idx: int): class T5GemmaCrossAttention (line 178) | class T5GemmaCrossAttention(Gemma2Attention): method __init__ (line 179) | def __init__(self, config: T5GemmaModuleConfig, layer_idx: int): method forward (line 195) | def forward( class T5GemmaEncoderLayer (line 249) | class T5GemmaEncoderLayer(GradientCheckpointingLayer): method __init__ (line 252) | def __init__(self, config, layer_idx: int): method forward (line 272) | def forward( class T5GemmaDecoderLayer (line 301) | class T5GemmaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 304) | def __init__(self, config, layer_idx: int): method forward (line 327) | def forward( class T5GemmaClassificationHead (line 374) | class T5GemmaClassificationHead(nn.Module): method __init__ (line 377) | def __init__(self, hidden_size: int, num_labels: int, classifier_dropo... method forward (line 382) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class T5GemmaLMHead (line 388) | class T5GemmaLMHead(nn.Module): method __init__ (line 391) | def __init__(self, hidden_size: int, vocab_size: int, bias: bool = Fal... method forward (line 395) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class T5GemmaPreTrainedModel (line 401) | class T5GemmaPreTrainedModel(Gemma2PreTrainedModel): method _init_weights (line 416) | def _init_weights(self, module): method _shift_right (line 433) | def _shift_right(self, input_ids): function make_default_2d_attention_mask (line 460) | def make_default_2d_attention_mask( class T5GemmaEncoder (line 477) | class T5GemmaEncoder(T5GemmaPreTrainedModel): method __init__ (line 483) | def __init__(self, config): method forward (line 503) | def forward( class T5GemmaDecoder (line 560) | class T5GemmaDecoder(T5GemmaPreTrainedModel): method __init__ (line 567) | def __init__(self, config): method forward (line 587) | def forward( class T5GemmaModel (line 671) | class T5GemmaModel(T5GemmaPreTrainedModel): method __init__ (line 672) | def __init__(self, config: T5GemmaConfig): method get_input_embeddings (line 683) | def get_input_embeddings(self): method set_input_embeddings (line 686) | def set_input_embeddings(self, new_embeddings): method forward (line 691) | def forward( class T5GemmaEncoderModel (line 749) | class T5GemmaEncoderModel(T5GemmaPreTrainedModel): method __init__ (line 750) | def __init__(self, config: T5GemmaConfig): method get_input_embeddings (line 759) | def get_input_embeddings(self): method set_input_embeddings (line 762) | def set_input_embeddings(self, new_embeddings): method forward (line 767) | def forward( class T5GemmaForConditionalGeneration (line 785) | class T5GemmaForConditionalGeneration(T5GemmaPreTrainedModel, Generation... method __init__ (line 790) | def __init__(self, config: T5GemmaConfig): method set_output_embeddings (line 801) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 804) | def get_output_embeddings(self): method forward (line 809) | def forward( method prepare_decoder_input_ids_from_labels (line 882) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class T5GemmaForSequenceClassification (line 887) | class T5GemmaForSequenceClassification(T5GemmaPreTrainedModel): method __init__ (line 888) | def __init__(self, config: T5GemmaConfig, is_encoder_decoder: bool | N... method get_input_embeddings (line 911) | def get_input_embeddings(self): method set_input_embeddings (line 914) | def set_input_embeddings(self, value): method forward (line 919) | def forward( class T5GemmaForTokenClassification (line 1028) | class T5GemmaForTokenClassification(T5GemmaPreTrainedModel): method __init__ (line 1029) | def __init__(self, config: T5GemmaConfig, is_encoder_decoder: bool | N... method get_input_embeddings (line 1053) | def get_input_embeddings(self): method set_input_embeddings (line 1056) | def set_input_embeddings(self, value): method forward (line 1061) | def forward( FILE: src/transformers/models/t5gemma2/configuration_t5gemma2.py class T5Gemma2TextConfig (line 35) | class T5Gemma2TextConfig(PreTrainedConfig): method __post_init__ (line 90) | def __post_init__(self, **kwargs): method validate_architecture (line 101) | def validate_architecture(self): method convert_rope_params_to_dict (line 109) | def convert_rope_params_to_dict(self, **kwargs): class T5Gemma2EncoderConfig (line 141) | class T5Gemma2EncoderConfig(PreTrainedConfig): method __post_init__ (line 192) | def __post_init__(self, **kwargs): class T5Gemma2DecoderConfig (line 210) | class T5Gemma2DecoderConfig(PreTrainedConfig): method __post_init__ (line 265) | def __post_init__(self, **kwargs): method validate_architecture (line 276) | def validate_architecture(self): method convert_rope_params_to_dict (line 284) | def convert_rope_params_to_dict(self, **kwargs): class T5Gemma2Config (line 316) | class T5Gemma2Config(PreTrainedConfig): method __post_init__ (line 357) | def __post_init__(self, **kwargs): method validate_architecture (line 385) | def validate_architecture(self): FILE: src/transformers/models/t5gemma2/modeling_t5gemma2.py class T5Gemma2RMSNorm (line 55) | class T5Gemma2RMSNorm(nn.Module): method __init__ (line 56) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 61) | def _norm(self, x): method forward (line 64) | def forward(self, x): method extra_repr (line 71) | def extra_repr(self): class T5Gemma2MLP (line 75) | class T5Gemma2MLP(nn.Module): method __init__ (line 76) | def __init__(self, config: T5Gemma2TextConfig): method forward (line 87) | def forward(self, x): class T5Gemma2RotaryEmbedding (line 94) | class T5Gemma2RotaryEmbedding(nn.Module): method __init__ (line 97) | def __init__(self, config: T5Gemma2TextConfig, device=None): method compute_default_rope_parameters (line 121) | def compute_default_rope_parameters( method forward (line 158) | def forward(self, x, position_ids, layer_type=None): function rotate_half (line 175) | def rotate_half(x): function apply_rotary_pos_emb (line 183) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 208) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 220) | def eager_attention_forward( class T5Gemma2SelfAttention (line 255) | class T5Gemma2SelfAttention(nn.Module): method __init__ (line 258) | def __init__(self, config: T5Gemma2TextConfig, layer_idx: int): method forward (line 288) | def forward( class T5Gemma2MergedAttention (line 334) | class T5Gemma2MergedAttention(nn.Module): method __init__ (line 337) | def __init__(self, config: T5Gemma2TextConfig, layer_idx: int): method forward (line 367) | def forward( class T5Gemma2EncoderLayer (line 454) | class T5Gemma2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 457) | def __init__(self, config, layer_idx: int): method forward (line 477) | def forward( class T5Gemma2DecoderLayer (line 506) | class T5Gemma2DecoderLayer(GradientCheckpointingLayer): method __init__ (line 509) | def __init__(self, config, layer_idx: int): method forward (line 530) | def forward( class T5Gemma2LMHead (line 565) | class T5Gemma2LMHead(nn.Module): method __init__ (line 568) | def __init__(self, hidden_size: int, vocab_size: int, bias: bool = Fal... method forward (line 572) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class T5Gemma2ClassificationHead (line 577) | class T5Gemma2ClassificationHead(nn.Module): method __init__ (line 580) | def __init__(self, hidden_size: int, num_labels: int, classifier_dropo... method forward (line 585) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class T5Gemma2MultiModalProjector (line 591) | class T5Gemma2MultiModalProjector(nn.Module): method __init__ (line 592) | def __init__(self, config: T5Gemma2EncoderConfig): method forward (line 608) | def forward(self, vision_outputs: torch.Tensor): class T5Gemma2TextScaledWordEmbedding (line 627) | class T5Gemma2TextScaledWordEmbedding(nn.Embedding): method __init__ (line 630) | def __init__( method forward (line 644) | def forward(self, input_ids: torch.Tensor): class T5Gemma2PreTrainedModel (line 651) | class T5Gemma2PreTrainedModel(PreTrainedModel): method _init_weights (line 685) | def _init_weights(self, module): method prepare_decoder_input_ids_from_labels (line 709) | def prepare_decoder_input_ids_from_labels(self, input_ids): function sliding_window_mask_function (line 737) | def sliding_window_mask_function(sliding_window: int, is_causal=True) ->... class T5Gemma2TextEncoder (line 756) | class T5Gemma2TextEncoder(T5Gemma2PreTrainedModel): method __init__ (line 763) | def __init__( method forward (line 794) | def forward( class T5Gemma2Encoder (line 857) | class T5Gemma2Encoder(T5Gemma2PreTrainedModel): method __init__ (line 860) | def __init__( method get_input_embeddings (line 874) | def get_input_embeddings(self): method set_input_embeddings (line 877) | def set_input_embeddings(self, new_embeddings): method get_image_features (line 882) | def get_image_features( method get_image_placeholder_mask (line 894) | def get_image_placeholder_mask( method forward (line 925) | def forward( class T5Gemma2Decoder (line 961) | class T5Gemma2Decoder(T5Gemma2PreTrainedModel): method __init__ (line 969) | def __init__(self, config: T5Gemma2DecoderConfig, eoi_token_index: int... method forward (line 994) | def forward( class T5Gemma2Model (line 1091) | class T5Gemma2Model(T5Gemma2PreTrainedModel): method __init__ (line 1097) | def __init__(self, config: T5Gemma2Config): method get_encoder (line 1106) | def get_encoder(self): method get_decoder (line 1109) | def get_decoder(self): method get_input_embeddings (line 1112) | def get_input_embeddings(self): method set_input_embeddings (line 1115) | def set_input_embeddings(self, new_embeddings): method forward (line 1120) | def forward( class T5Gemma2ForConditionalGeneration (line 1184) | class T5Gemma2ForConditionalGeneration(T5Gemma2PreTrainedModel, Generati... method __init__ (line 1191) | def __init__(self, config: T5Gemma2Config): method set_output_embeddings (line 1201) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 1204) | def get_output_embeddings(self): method get_input_embeddings (line 1207) | def get_input_embeddings(self): method set_input_embeddings (line 1210) | def set_input_embeddings(self, value): method get_encoder (line 1213) | def get_encoder(self): method get_decoder (line 1216) | def get_decoder(self): method get_image_features (line 1221) | def get_image_features( method vision_tower (line 1227) | def vision_tower(self): method forward (line 1232) | def forward( method _prepare_cache_for_generation (line 1311) | def _prepare_cache_for_generation( class T5Gemma2ForSequenceClassification (line 1388) | class T5Gemma2ForSequenceClassification(T5Gemma2PreTrainedModel): method __init__ (line 1389) | def __init__(self, config: T5Gemma2Config): method get_input_embeddings (line 1400) | def get_input_embeddings(self): method set_input_embeddings (line 1403) | def set_input_embeddings(self, value): method forward (line 1408) | def forward( class T5Gemma2ForTokenClassification (line 1486) | class T5Gemma2ForTokenClassification(T5Gemma2PreTrainedModel): method __init__ (line 1487) | def __init__(self, config: T5Gemma2Config): method get_input_embeddings (line 1499) | def get_input_embeddings(self): method set_input_embeddings (line 1502) | def set_input_embeddings(self, value): method forward (line 1507) | def forward( FILE: src/transformers/models/t5gemma2/modular_t5gemma2.py class T5Gemma2TextConfig (line 78) | class T5Gemma2TextConfig(Gemma3TextConfig, PreTrainedConfig): method __post_init__ (line 91) | def __post_init__(self, **kwargs): class T5Gemma2EncoderConfig (line 105) | class T5Gemma2EncoderConfig(Gemma3Config): class T5Gemma2DecoderConfig (line 116) | class T5Gemma2DecoderConfig(Gemma3TextConfig, PreTrainedConfig): method __post_init__ (line 129) | def __post_init__(self, **kwargs): class T5Gemma2Config (line 143) | class T5Gemma2Config(PreTrainedConfig): method __post_init__ (line 184) | def __post_init__(self, **kwargs): method validate_architecture (line 212) | def validate_architecture(self): class T5Gemma2RMSNorm (line 230) | class T5Gemma2RMSNorm(Gemma3RMSNorm): class T5Gemma2MLP (line 234) | class T5Gemma2MLP(Gemma3MLP): method __init__ (line 235) | def __init__(self, config: T5Gemma2TextConfig): method forward (line 239) | def forward(self, x): class T5Gemma2RotaryEmbedding (line 246) | class T5Gemma2RotaryEmbedding(Gemma3RotaryEmbedding): method __init__ (line 247) | def __init__(self, config: T5Gemma2TextConfig, device=None): method compute_default_rope_parameters (line 251) | def compute_default_rope_parameters( class T5Gemma2SelfAttention (line 260) | class T5Gemma2SelfAttention(Gemma3Attention): method __init__ (line 261) | def __init__(self, config: T5Gemma2TextConfig, layer_idx: int): class T5Gemma2MergedAttention (line 266) | class T5Gemma2MergedAttention(Gemma3Attention): method __init__ (line 269) | def __init__(self, config: T5Gemma2TextConfig, layer_idx: int): method forward (line 273) | def forward( function sliding_window_mask_function (line 360) | def sliding_window_mask_function(sliding_window: int, is_causal=True) ->... class T5Gemma2EncoderLayer (line 379) | class T5Gemma2EncoderLayer(T5GemmaEncoderLayer): class T5Gemma2DecoderLayer (line 383) | class T5Gemma2DecoderLayer(T5GemmaEncoderLayer): method __init__ (line 386) | def __init__(self, config, layer_idx: int): method forward (line 395) | def forward( class T5Gemma2LMHead (line 430) | class T5Gemma2LMHead(T5GemmaLMHead): class T5Gemma2ClassificationHead (line 434) | class T5Gemma2ClassificationHead(T5GemmaClassificationHead): class T5Gemma2MultiModalProjector (line 438) | class T5Gemma2MultiModalProjector(Gemma3MultiModalProjector): method __init__ (line 439) | def __init__(self, config: T5Gemma2EncoderConfig): class T5Gemma2TextScaledWordEmbedding (line 443) | class T5Gemma2TextScaledWordEmbedding(Gemma3TextScaledWordEmbedding): method __init__ (line 446) | def __init__( method forward (line 458) | def forward(self, input_ids: torch.Tensor): class T5Gemma2PreTrainedModel (line 465) | class T5Gemma2PreTrainedModel(Gemma3PreTrainedModel): method _init_weights (line 492) | def _init_weights(self, module): method prepare_decoder_input_ids_from_labels (line 516) | def prepare_decoder_input_ids_from_labels(self, input_ids): class T5Gemma2TextEncoder (line 544) | class T5Gemma2TextEncoder(T5Gemma2PreTrainedModel): method __init__ (line 551) | def __init__( method forward (line 582) | def forward( class T5Gemma2Encoder (line 645) | class T5Gemma2Encoder(T5Gemma2PreTrainedModel): method __init__ (line 648) | def __init__( method get_input_embeddings (line 662) | def get_input_embeddings(self): method set_input_embeddings (line 665) | def set_input_embeddings(self, new_embeddings): method get_image_features (line 670) | def get_image_features( method get_image_placeholder_mask (line 682) | def get_image_placeholder_mask( method forward (line 713) | def forward( class T5Gemma2Decoder (line 749) | class T5Gemma2Decoder(T5Gemma2PreTrainedModel): method __init__ (line 757) | def __init__(self, config: T5Gemma2DecoderConfig, eoi_token_index: int... method forward (line 782) | def forward( class T5Gemma2Model (line 879) | class T5Gemma2Model(T5Gemma2PreTrainedModel): method __init__ (line 885) | def __init__(self, config: T5Gemma2Config): method get_encoder (line 894) | def get_encoder(self): method get_decoder (line 897) | def get_decoder(self): method get_input_embeddings (line 900) | def get_input_embeddings(self): method set_input_embeddings (line 903) | def set_input_embeddings(self, new_embeddings): method forward (line 908) | def forward( class T5Gemma2ForConditionalGeneration (line 972) | class T5Gemma2ForConditionalGeneration(T5Gemma2PreTrainedModel, Generati... method __init__ (line 979) | def __init__(self, config: T5Gemma2Config): method set_output_embeddings (line 989) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 992) | def get_output_embeddings(self): method get_input_embeddings (line 995) | def get_input_embeddings(self): method set_input_embeddings (line 998) | def set_input_embeddings(self, value): method get_encoder (line 1001) | def get_encoder(self): method get_decoder (line 1004) | def get_decoder(self): method get_image_features (line 1009) | def get_image_features( method vision_tower (line 1015) | def vision_tower(self): method forward (line 1020) | def forward( method _prepare_cache_for_generation (line 1099) | def _prepare_cache_for_generation( class T5Gemma2ForSequenceClassification (line 1176) | class T5Gemma2ForSequenceClassification(T5Gemma2PreTrainedModel): method __init__ (line 1177) | def __init__(self, config: T5Gemma2Config): method get_input_embeddings (line 1188) | def get_input_embeddings(self): method set_input_embeddings (line 1191) | def set_input_embeddings(self, value): method forward (line 1196) | def forward( class T5Gemma2ForTokenClassification (line 1274) | class T5Gemma2ForTokenClassification(T5Gemma2PreTrainedModel): method __init__ (line 1275) | def __init__(self, config: T5Gemma2Config): method get_input_embeddings (line 1287) | def get_input_embeddings(self): method set_input_embeddings (line 1290) | def set_input_embeddings(self, value): method forward (line 1295) | def forward( FILE: src/transformers/models/table_transformer/configuration_table_transformer.py class TableTransformerConfig (line 26) | class TableTransformerConfig(PreTrainedConfig): method __post_init__ (line 94) | def __post_init__(self, **kwargs): FILE: src/transformers/models/table_transformer/convert_table_transformer_to_hf.py function rename_key (line 113) | def rename_key(state_dict, old, new): function rename_backbone_keys (line 118) | def rename_backbone_keys(state_dict): function read_in_q_k_v (line 130) | def read_in_q_k_v(state_dict): function resize (line 171) | def resize(image, checkpoint_url): function normalize (line 181) | def normalize(image): function convert_table_transformer_checkpoint (line 188) | def convert_table_transformer_checkpoint(checkpoint_url, pytorch_dump_fo... FILE: src/transformers/models/table_transformer/convert_table_transformer_to_hf_no_timm.py function create_rename_keys (line 35) | def create_rename_keys(config): function rename_key (line 236) | def rename_key(state_dict, old, new): function read_in_q_k_v (line 241) | def read_in_q_k_v(state_dict, is_panoptic=False): function resize (line 284) | def resize(image, checkpoint_url): function normalize (line 294) | def normalize(image): function convert_table_transformer_checkpoint (line 301) | def convert_table_transformer_checkpoint(checkpoint_url, pytorch_dump_fo... FILE: src/transformers/models/table_transformer/modeling_table_transformer.py class TableTransformerDecoderOutput (line 49) | class TableTransformerDecoderOutput(BaseModelOutputWithCrossAttentions): class TableTransformerModelOutput (line 72) | class TableTransformerModelOutput(Seq2SeqModelOutput): class TableTransformerObjectDetectionOutput (line 91) | class TableTransformerObjectDetectionOutput(ModelOutput): class TableTransformerFrozenBatchNorm2d (line 129) | class TableTransformerFrozenBatchNorm2d(nn.Module): method __init__ (line 137) | def __init__(self, n): method _load_from_state_dict (line 144) | def _load_from_state_dict( method forward (line 155) | def forward(self, x): function replace_batch_norm (line 169) | def replace_batch_norm(model): class TableTransformerConvEncoder (line 194) | class TableTransformerConvEncoder(nn.Module): method __init__ (line 202) | def __init__(self, config): method forward (line 232) | def forward(self, pixel_values: torch.Tensor, pixel_mask: torch.Tensor): class TableTransformerConvModel (line 247) | class TableTransformerConvModel(nn.Module): method __init__ (line 252) | def __init__(self, conv_encoder, position_embedding): method forward (line 257) | def forward(self, pixel_values, pixel_mask): class TableTransformerSinePositionEmbedding (line 269) | class TableTransformerSinePositionEmbedding(nn.Module): method __init__ (line 275) | def __init__(self, embedding_dim=64, temperature=10000, normalize=Fals... method forward (line 286) | def forward(self, pixel_values, pixel_mask): class TableTransformerLearnedPositionEmbedding (line 307) | class TableTransformerLearnedPositionEmbedding(nn.Module): method __init__ (line 312) | def __init__(self, embedding_dim=256): method forward (line 317) | def forward(self, pixel_values, pixel_mask=None): function build_position_encoding (line 331) | def build_position_encoding(config): class TableTransformerAttention (line 345) | class TableTransformerAttention(nn.Module): method __init__ (line 352) | def __init__( method _shape (line 376) | def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): method with_pos_embed (line 379) | def with_pos_embed(self, tensor: torch.Tensor, object_queries: Tensor ... method forward (line 382) | def forward( class TableTransformerEncoderLayer (line 478) | class TableTransformerEncoderLayer(nn.Module): method __init__ (line 480) | def __init__(self, config: TableTransformerConfig): method forward (line 496) | def forward( class TableTransformerDecoderLayer (line 551) | class TableTransformerDecoderLayer(GradientCheckpointingLayer): method __init__ (line 553) | def __init__(self, config: TableTransformerConfig): method forward (line 577) | def forward( class TableTransformerPreTrainedModel (line 659) | class TableTransformerPreTrainedModel(PreTrainedModel): method _init_weights (line 671) | def _init_weights(self, module): class TableTransformerEncoder (line 688) | class TableTransformerEncoder(TableTransformerPreTrainedModel): method __init__ (line 703) | def __init__(self, config: TableTransformerConfig): method forward (line 716) | def forward( class TableTransformerDecoder (line 809) | class TableTransformerDecoder(TableTransformerPreTrainedModel): method __init__ (line 824) | def __init__(self, config: TableTransformerConfig): method forward (line 837) | def forward( class TableTransformerModel (line 982) | class TableTransformerModel(TableTransformerPreTrainedModel): method __init__ (line 984) | def __init__(self, config: TableTransformerConfig): method freeze_backbone (line 1003) | def freeze_backbone(self): method unfreeze_backbone (line 1007) | def unfreeze_backbone(self): method forward (line 1012) | def forward( class TableTransformerForObjectDetection (line 1151) | class TableTransformerForObjectDetection(TableTransformerPreTrainedModel): method __init__ (line 1153) | def __init__(self, config: TableTransformerConfig): method forward (line 1171) | def forward( class TableTransformerMLPPredictionHead (line 1287) | class TableTransformerMLPPredictionHead(nn.Module): method __init__ (line 1296) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 1302) | def forward(self, x): FILE: src/transformers/models/tapas/configuration_tapas.py class TapasConfig (line 32) | class TapasConfig(PreTrainedConfig): method __post_init__ (line 149) | def __post_init__(self, **kwargs): FILE: src/transformers/models/tapas/convert_tapas_original_tf_checkpoint_to_pytorch.py function load_tf_weights_in_tapas (line 36) | def load_tf_weights_in_tapas(model, config, tf_checkpoint_path): function convert_tf_checkpoint_to_pytorch (line 170) | def convert_tf_checkpoint_to_pytorch( FILE: src/transformers/models/tapas/modeling_tapas.py class TableQuestionAnsweringOutput (line 48) | class TableQuestionAnsweringOutput(ModelOutput): class TapasEmbeddings (line 66) | class TapasEmbeddings(nn.Module): method __init__ (line 72) | def __init__(self, config): method forward (line 91) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class TapasSelfAttention (line 143) | class TapasSelfAttention(nn.Module): method __init__ (line 144) | def __init__(self, config, layer_idx=None): method forward (line 164) | def forward( class TapasSelfOutput (line 244) | class TapasSelfOutput(nn.Module): method __init__ (line 245) | def __init__(self, config): method forward (line 251) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class TapasAttention (line 258) | class TapasAttention(nn.Module): method __init__ (line 259) | def __init__(self, config, layer_idx=None): method forward (line 265) | def forward( class TapasIntermediate (line 287) | class TapasIntermediate(nn.Module): method __init__ (line 288) | def __init__(self, config): method forward (line 296) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TapasOutput (line 303) | class TapasOutput(nn.Module): method __init__ (line 304) | def __init__(self, config): method forward (line 310) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class TapasLayer (line 317) | class TapasLayer(GradientCheckpointingLayer): method __init__ (line 318) | def __init__(self, config, layer_idx=None): method forward (line 333) | def forward( method feed_forward_chunk (line 377) | def feed_forward_chunk(self, attention_output): class TapasEncoder (line 383) | class TapasEncoder(nn.Module): method __init__ (line 384) | def __init__(self, config): method forward (line 390) | def forward( class TapasPooler (line 435) | class TapasPooler(nn.Module): method __init__ (line 436) | def __init__(self, config): method forward (line 441) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TapasPredictionHeadTransform (line 451) | class TapasPredictionHeadTransform(nn.Module): method __init__ (line 452) | def __init__(self, config): method forward (line 461) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TapasLMPredictionHead (line 469) | class TapasLMPredictionHead(nn.Module): method __init__ (line 470) | def __init__(self, config): method forward (line 479) | def forward(self, hidden_states): class TapasOnlyMLMHead (line 486) | class TapasOnlyMLMHead(nn.Module): method __init__ (line 487) | def __init__(self, config): method forward (line 491) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class TapasPreTrainedModel (line 497) | class TapasPreTrainedModel(PreTrainedModel): method _init_weights (line 503) | def _init_weights(self, module): class TapasModel (line 520) | class TapasModel(TapasPreTrainedModel): method __init__ (line 531) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 547) | def get_input_embeddings(self): method set_input_embeddings (line 550) | def set_input_embeddings(self, value): method forward (line 554) | def forward( class TapasForMaskedLM (line 670) | class TapasForMaskedLM(TapasPreTrainedModel): method __init__ (line 678) | def __init__(self, config): method get_output_embeddings (line 687) | def get_output_embeddings(self): method set_output_embeddings (line 690) | def set_output_embeddings(self, new_embeddings): method forward (line 695) | def forward( class TapasForQuestionAnswering (line 795) | class TapasForQuestionAnswering(TapasPreTrainedModel): method __init__ (line 796) | def __init__(self, config: TapasConfig): method forward (line 819) | def forward( class TapasForSequenceClassification (line 1133) | class TapasForSequenceClassification(TapasPreTrainedModel): method __init__ (line 1134) | def __init__(self, config): method forward (line 1146) | def forward( class AverageApproximationFunction (line 1260) | class AverageApproximationFunction(str, enum.Enum): class IndexMap (line 1269) | class IndexMap: method __init__ (line 1272) | def __init__(self, indices, num_segments, batch_dims=0): method batch_shape (line 1291) | def batch_shape(self): class ProductIndexMap (line 1295) | class ProductIndexMap(IndexMap): method __init__ (line 1298) | def __init__(self, outer_index, inner_index): method project_outer (line 1323) | def project_outer(self, index): method project_inner (line 1328) | def project_inner(self, index): function gather (line 1340) | def gather(values, index, name="segmented_gather"): function flatten (line 1373) | def flatten(index, name="segmented_flatten"): function range_index_map (line 1402) | def range_index_map(batch_shape, num_segments, name="range_index_map"): function _segment_reduce (line 1446) | def _segment_reduce(values, index, segment_reduce_fn, name): function reduce_sum (line 1495) | def reduce_sum(values, index, name="segmented_reduce_sum"): function reduce_mean (line 1522) | def reduce_mean(values, index, name="segmented_reduce_mean"): function reduce_max (line 1551) | def reduce_max(values, index, name="segmented_reduce_max"): function reduce_min (line 1578) | def reduce_min(values, index, name="segmented_reduce_min"): function compute_column_logits (line 1608) | def compute_column_logits( function _single_column_cell_selection_loss (line 1660) | def _single_column_cell_selection_loss(token_logits, column_logits, labe... function compute_token_logits (line 1767) | def compute_token_logits(sequence_output, temperature, output_weights, o... function _calculate_aggregate_mask (line 1789) | def _calculate_aggregate_mask(answer, pooled_output, cell_selection_pref... function _calculate_aggregation_loss_known (line 1838) | def _calculate_aggregation_loss_known( function _calculate_aggregation_loss_unknown (line 1884) | def _calculate_aggregation_loss_unknown(logits_aggregation, aggregate_ma... function _calculate_aggregation_loss (line 1908) | def _calculate_aggregation_loss( function _calculate_expected_result (line 1946) | def _calculate_expected_result( function huber_loss (line 2034) | def huber_loss(input, target, delta: float = 1.0): function _calculate_regression_loss (line 2039) | def _calculate_regression_loss( FILE: src/transformers/models/tapas/tokenization_tapas.py class TapasTruncationStrategy (line 51) | class TapasTruncationStrategy(ExplicitEnum): class TokenCoordinates (line 64) | class TokenCoordinates: class TokenizedTable (line 71) | class TokenizedTable: class SerializedExample (line 77) | class SerializedExample: function _is_inner_wordpiece (line 84) | def _is_inner_wordpiece(token: str): function load_vocab (line 88) | def load_vocab(vocab_file): function whitespace_tokenize (line 99) | def whitespace_tokenize(text): class TapasTokenizer (line 149) | class TapasTokenizer(PreTrainedTokenizer): method __init__ (line 235) | def __init__( method do_lower_case (line 348) | def do_lower_case(self): method vocab_size (line 352) | def vocab_size(self): method get_vocab (line 355) | def get_vocab(self): method _tokenize (line 358) | def _tokenize(self, text): method _convert_token_to_id (line 373) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 377) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 381) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 386) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method create_attention_mask_from_sequences (line 406) | def create_attention_mask_from_sequences(self, query_ids: list[int], t... method create_segment_token_type_ids_from_sequences (line 420) | def create_segment_token_type_ids_from_sequences( method create_column_token_type_ids_from_sequences (line 437) | def create_column_token_type_ids_from_sequences( method create_row_token_type_ids_from_sequences (line 454) | def create_row_token_type_ids_from_sequences( method build_inputs_with_special_tokens (line 471) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 490) | def get_special_tokens_mask( method __call__ (line 519) | def __call__( method batch_encode_plus (line 642) | def batch_encode_plus( method _get_question_tokens (line 734) | def _get_question_tokens(self, query): method _batch_encode_plus (line 747) | def _batch_encode_plus( method _batch_prepare_for_model (line 802) | def _batch_prepare_for_model( method encode (line 873) | def encode( method encode_plus (line 917) | def encode_plus( method _encode_plus (line 1003) | def _encode_plus( method prepare_for_model (line 1057) | def prepare_for_model( method _get_truncated_table_rows (line 1247) | def _get_truncated_table_rows( method _tokenize_table (line 1304) | def _tokenize_table( method _question_encoding_cost (line 1349) | def _question_encoding_cost(self, question_tokens): method _get_token_budget (line 1353) | def _get_token_budget(self, question_tokens, max_length=None): method _get_table_values (line 1367) | def _get_table_values(self, table, num_columns, num_rows, num_tokens) ... method _get_table_boundaries (line 1386) | def _get_table_boundaries(self, table): method _get_table_cost (line 1399) | def _get_table_cost(self, table, num_columns, num_rows, num_tokens): method _get_max_num_tokens (line 1402) | def _get_max_num_tokens(self, question_tokens, tokenized_table, num_co... method _get_num_columns (line 1421) | def _get_num_columns(self, table): method _get_num_rows (line 1427) | def _get_num_rows(self, table, drop_rows_to_fit): method _serialize_text (line 1436) | def _serialize_text(self, question_tokens): method _serialize (line 1457) | def _serialize( method _get_column_values (line 1487) | def _get_column_values(self, table, col_index): method _get_cell_token_indexes (line 1495) | def _get_cell_token_indexes(self, column_ids, row_ids, column_id, row_... method _get_numeric_column_ranks (line 1500) | def _get_numeric_column_ranks(self, column_ids, row_ids, table): method _get_numeric_sort_key_fn (line 1535) | def _get_numeric_sort_key_fn(self, table_numeric_values, value): method _get_numeric_relations (line 1556) | def _get_numeric_relations(self, question, column_ids, row_ids, table): method _get_numeric_values (line 1597) | def _get_numeric_values(self, table, column_ids, row_ids): method _get_numeric_values_scale (line 1620) | def _get_numeric_values_scale(self, table, column_ids, row_ids): method _pad_to_seq_length (line 1641) | def _pad_to_seq_length(self, inputs): method _get_all_answer_ids_from_coordinates (line 1647) | def _get_all_answer_ids_from_coordinates( method _get_all_answer_ids (line 1667) | def _get_all_answer_ids(self, column_ids, row_ids, answer_coordinates): method _find_tokens (line 1682) | def _find_tokens(self, text, segment): method _find_answer_coordinates_from_answer_text (line 1693) | def _find_answer_coordinates_from_answer_text( method _find_answer_ids_from_answer_texts (line 1713) | def _find_answer_ids_from_answer_texts( method _get_answer_ids (line 1751) | def _get_answer_ids(self, column_ids, row_ids, answer_coordinates): method get_answer_ids (line 1759) | def get_answer_ids(self, column_ids, row_ids, tokenized_table, answer_... method _pad (line 1769) | def _pad( method _get_cell_token_probs (line 1868) | def _get_cell_token_probs(self, probabilities, segment_ids, row_ids, c... method _get_mean_cell_probs (line 1876) | def _get_mean_cell_probs(self, probabilities, segment_ids, row_ids, co... method convert_logits_to_predictions (line 1885) | def convert_logits_to_predictions(self, data, logits, logits_agg=None,... class BasicTokenizer (line 1985) | class BasicTokenizer: method __init__ (line 2008) | def __init__( method tokenize (line 2024) | def tokenize(self, text, never_split=None): method _run_strip_accents (line 2062) | def _run_strip_accents(self, text): method _run_split_on_punc (line 2073) | def _run_split_on_punc(self, text, never_split=None): method _tokenize_chinese_chars (line 2095) | def _tokenize_chinese_chars(self, text): method _is_chinese_char (line 2108) | def _is_chinese_char(self, cp): method _clean_text (line 2132) | def _clean_text(self, text): class WordpieceTokenizer (line 2146) | class WordpieceTokenizer: method __init__ (line 2149) | def __init__(self, vocab, unk_token, max_input_chars_per_word=100): method tokenize (line 2154) | def tokenize(self, text): class Relation (line 2212) | class Relation(enum.Enum): class Date (line 2225) | class Date: class NumericValue (line 2232) | class NumericValue: class NumericValueSpan (line 2238) | class NumericValueSpan: class Cell (line 2245) | class Cell: class Question (line 2251) | class Question: function _process_date_pattern (line 2310) | def _process_date_pattern(dp): function _process_date_patterns (line 2324) | def _process_date_patterns(): function _get_numeric_value_from_date (line 2378) | def _get_numeric_value_from_date(date, mask): function _get_span_length_key (line 2393) | def _get_span_length_key(span): function _get_numeric_value_from_float (line 2398) | def _get_numeric_value_from_float(value): function _parse_date (line 2404) | def _parse_date(text): function _parse_number (line 2421) | def _parse_number(text): function get_all_spans (line 2439) | def get_all_spans(text, max_ngram_length): function normalize_for_match (line 2460) | def normalize_for_match(text): function format_text (line 2464) | def format_text(text): function parse_text (line 2478) | def parse_text(text): function _get_value_type (line 2552) | def _get_value_type(numeric_value): function _get_value_as_primitive_value (line 2560) | def _get_value_as_primitive_value(numeric_value): function _get_all_types (line 2578) | def _get_all_types(numeric_values): function get_numeric_sort_key_fn (line 2582) | def get_numeric_sort_key_fn(numeric_values): function _consolidate_numeric_values (line 2629) | def _consolidate_numeric_values(row_index_to_values, min_consolidation_f... function _get_numeric_values (line 2676) | def _get_numeric_values(text): function _get_column_values (line 2682) | def _get_column_values(table, col_index): function get_numeric_relation (line 2698) | def get_numeric_relation(value, other_value, sort_key_fn): function add_numeric_values_to_question (line 2711) | def add_numeric_values_to_question(question): function filter_invalid_unicode (line 2719) | def filter_invalid_unicode(text): function filter_invalid_unicode_from_table (line 2724) | def filter_invalid_unicode_from_table(table): function add_numeric_table_values (line 2750) | def add_numeric_table_values(table, min_consolidation_fraction=0.7, debu... FILE: src/transformers/models/textnet/configuration_textnet.py class TextNetConfig (line 25) | class TextNetConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 75) | def __post_init__(self, **kwargs): FILE: src/transformers/models/textnet/convert_textnet_to_hf.py function prepare_config (line 43) | def prepare_config(size_config_url, size): function convert_textnet_checkpoint (line 116) | def convert_textnet_checkpoint(checkpoint_url, checkpoint_config_filenam... FILE: src/transformers/models/textnet/image_processing_pil_textnet.py class TextNetImageProcessorKwargs (line 35) | class TextNetImageProcessorKwargs(ImagesKwargs, total=False): class TextNetImageProcessorPil (line 45) | class TextNetImageProcessorPil(PilBackend): method __init__ (line 63) | def __init__(self, **kwargs: Unpack[TextNetImageProcessorKwargs]): method preprocess (line 67) | def preprocess(self, images: ImageInput, **kwargs: Unpack[TextNetImage... method resize (line 70) | def resize( method _preprocess (line 100) | def _preprocess( FILE: src/transformers/models/textnet/image_processing_textnet.py class TextNetImageProcessorKwargs (line 34) | class TextNetImageProcessorKwargs(ImagesKwargs, total=False): class TextNetImageProcessor (line 44) | class TextNetImageProcessor(TorchvisionBackend): method __init__ (line 62) | def __init__(self, **kwargs: Unpack[TextNetImageProcessorKwargs]): method preprocess (line 66) | def preprocess(self, images: ImageInput, **kwargs: Unpack[TextNetImage... method resize (line 69) | def resize( method _preprocess (line 99) | def _preprocess( FILE: src/transformers/models/textnet/modeling_textnet.py class TextNetConvLayer (line 39) | class TextNetConvLayer(nn.Module): method __init__ (line 40) | def __init__(self, config: TextNetConfig): method forward (line 67) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TextNetRepConvLayer (line 73) | class TextNetRepConvLayer(nn.Module): method __init__ (line 83) | def __init__(self, config: TextNetConfig, in_channels: int, out_channe... method forward (line 140) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TextNetStage (line 163) | class TextNetStage(nn.Module): method __init__ (line 164) | def __init__(self, config: TextNetConfig, depth: int): method forward (line 181) | def forward(self, hidden_state): class TextNetEncoder (line 187) | class TextNetEncoder(nn.Module): method __init__ (line 188) | def __init__(self, config: TextNetConfig): method forward (line 198) | def forward( class TextNetPreTrainedModel (line 217) | class TextNetPreTrainedModel(PreTrainedModel): class TextNetModel (line 224) | class TextNetModel(TextNetPreTrainedModel): method __init__ (line 225) | def __init__(self, config): method forward (line 233) | def forward( class TextNetForImageClassification (line 271) | class TextNetForImageClassification(TextNetPreTrainedModel): method __init__ (line 272) | def __init__(self, config): method forward (line 287) | def forward( class TextNetBackbone (line 346) | class TextNetBackbone(BackboneMixin, TextNetPreTrainedModel): method __init__ (line 349) | def __init__(self, config): method forward (line 361) | def forward( FILE: src/transformers/models/time_series_transformer/configuration_time_series_transformer.py class TimeSeriesTransformerConfig (line 24) | class TimeSeriesTransformerConfig(PreTrainedConfig): method __post_init__ (line 114) | def __post_init__(self, **kwargs): method validate_architecture (line 125) | def validate_architecture(self): method _number_of_features (line 140) | def _number_of_features(self) -> int: FILE: src/transformers/models/time_series_transformer/modeling_time_series_transformer.py class TimeSeriesFeatureEmbedder (line 48) | class TimeSeriesFeatureEmbedder(nn.Module): method __init__ (line 59) | def __init__(self, cardinalities: list[int], embedding_dims: list[int]... method forward (line 65) | def forward(self, features: torch.Tensor) -> torch.Tensor: class TimeSeriesStdScaler (line 82) | class TimeSeriesStdScaler(nn.Module): method __init__ (line 88) | def __init__(self, config: TimeSeriesTransformerConfig): method forward (line 94) | def forward( class TimeSeriesMeanScaler (line 117) | class TimeSeriesMeanScaler(nn.Module): method __init__ (line 123) | def __init__(self, config: TimeSeriesTransformerConfig): method forward (line 130) | def forward( class TimeSeriesNOPScaler (line 171) | class TimeSeriesNOPScaler(nn.Module): method __init__ (line 176) | def __init__(self, config: TimeSeriesTransformerConfig): method forward (line 181) | def forward( function nll (line 198) | def nll(input: torch.distributions.Distribution, target: torch.Tensor) -... function weighted_average (line 205) | def weighted_average(input_tensor: torch.Tensor, weights: torch.Tensor |... class TimeSeriesSinusoidalPositionalEmbedding (line 230) | class TimeSeriesSinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 233) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method create_weight (line 236) | def create_weight(self): method forward (line 252) | def forward( class TimeSeriesValueEmbedding (line 264) | class TimeSeriesValueEmbedding(nn.Module): method __init__ (line 265) | def __init__(self, feature_size, d_model): method forward (line 269) | def forward(self, x): function eager_attention_forward (line 274) | def eager_attention_forward( class TimeSeriesTransformerAttention (line 303) | class TimeSeriesTransformerAttention(nn.Module): method __init__ (line 306) | def __init__( method forward (line 345) | def forward( class TimeSeriesTransformerEncoderLayer (line 422) | class TimeSeriesTransformerEncoderLayer(GradientCheckpointingLayer): method __init__ (line 423) | def __init__(self, config: TimeSeriesTransformerConfig, layer_idx: int... method forward (line 442) | def forward( class TimeSeriesTransformerDecoderLayer (line 474) | class TimeSeriesTransformerDecoderLayer(GradientCheckpointingLayer): method __init__ (line 475) | def __init__(self, config: TimeSeriesTransformerConfig, layer_idx: int... method forward (line 506) | def forward( class TimeSeriesTransformerPreTrainedModel (line 557) | class TimeSeriesTransformerPreTrainedModel(PreTrainedModel): method _init_weights (line 570) | def _init_weights(self, module): class TimeSeriesTransformerEncoder (line 576) | class TimeSeriesTransformerEncoder(TimeSeriesTransformerPreTrainedModel): method __init__ (line 590) | def __init__(self, config: TimeSeriesTransformerConfig): method forward (line 612) | def forward( class TimeSeriesTransformerDecoder (line 650) | class TimeSeriesTransformerDecoder(TimeSeriesTransformerPreTrainedModel): method __init__ (line 665) | def __init__(self, config: TimeSeriesTransformerConfig): method forward (line 687) | def forward( class TimeSeriesTransformerModel (line 783) | class TimeSeriesTransformerModel(TimeSeriesTransformerPreTrainedModel): method __init__ (line 784) | def __init__(self, config: TimeSeriesTransformerConfig): method _past_length (line 808) | def _past_length(self) -> int: method get_lagged_subsequences (line 811) | def get_lagged_subsequences( method create_network_inputs (line 843) | def create_network_inputs( method forward (line 924) | def forward( class TimeSeriesTransformerForPrediction (line 1115) | class TimeSeriesTransformerForPrediction(TimeSeriesTransformerPreTrained... method __init__ (line 1116) | def __init__(self, config: TimeSeriesTransformerConfig): method output_params (line 1139) | def output_params(self, dec_output): method output_distribution (line 1143) | def output_distribution(self, params, loc=None, scale=None, trailing_n... method forward (line 1152) | def forward( method generate (line 1362) | def generate( FILE: src/transformers/models/timesfm/configuration_timesfm.py class TimesFmConfig (line 24) | class TimesFmConfig(PreTrainedConfig): FILE: src/transformers/models/timesfm/convert_timesfm_orignal_to_hf.py function get_nested_attr (line 23) | def get_nested_attr(obj, key): function write_model (line 36) | def write_model(model_path, huggingface_repo_id="google/timesfm-2.0-500m... function check_outputs (line 150) | def check_outputs(model_path, huggingface_repo_id): function main (line 244) | def main(): FILE: src/transformers/models/timesfm/modeling_timesfm.py class TimesFmOutput (line 46) | class TimesFmOutput(BaseModelOutput): class TimesFmOutputForPrediction (line 60) | class TimesFmOutputForPrediction(BaseModelOutput): class TimesFmMLP (line 75) | class TimesFmMLP(nn.Module): method __init__ (line 78) | def __init__(self, config: TimesFmConfig): method forward (line 87) | def forward(self, x, paddings=None): class TimesFmResidualBlock (line 97) | class TimesFmResidualBlock(nn.Module): method __init__ (line 100) | def __init__(self, input_dims, hidden_dims, output_dims): method forward (line 111) | def forward(self, x): class TimesFmRMSNorm (line 120) | class TimesFmRMSNorm(nn.Module): method __init__ (line 121) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 129) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 136) | def extra_repr(self): class TimesFmPositionalEmbedding (line 140) | class TimesFmPositionalEmbedding(nn.Module): method __init__ (line 143) | def __init__(self, config: TimesFmConfig): method forward (line 157) | def forward(self, seq_length=None, position=None): function simple_eager_attention_forward (line 186) | def simple_eager_attention_forward( class TimesFmAttention (line 208) | class TimesFmAttention(nn.Module): method __init__ (line 211) | def __init__(self, config: TimesFmConfig, layer_idx: int): method _scale_query (line 231) | def _scale_query(self, query: torch.Tensor) -> torch.Tensor: method forward (line 235) | def forward( class TimesFmDecoderLayer (line 268) | class TimesFmDecoderLayer(nn.Module): method __init__ (line 271) | def __init__(self, config: TimesFmConfig, layer_idx: int): method forward (line 278) | def forward( class TimesFmPreTrainedModel (line 301) | class TimesFmPreTrainedModel(PreTrainedModel): method _init_weights (line 314) | def _init_weights(self, module): class TimesFmModel (line 333) | class TimesFmModel(TimesFmPreTrainedModel): method __init__ (line 334) | def __init__(self, config: TimesFmConfig): method _forward_transform (line 353) | def _forward_transform( method forward (line 372) | def forward( method _prepare_4d_attention_mask (line 445) | def _prepare_4d_attention_mask( method _timesfm_masked_mean_std (line 491) | def _timesfm_masked_mean_std(inputs: torch.Tensor, padding: torch.Tens... method _timesfm_shift_padded_seq (line 538) | def _timesfm_shift_padded_seq(mask: torch.Tensor, seq: torch.Tensor) -... class TimesFmModelForPrediction (line 570) | class TimesFmModelForPrediction(TimesFmPreTrainedModel): method __init__ (line 573) | def __init__(self, config: TimesFmConfig): method _preprocess (line 592) | def _preprocess( method _postprocess_output (line 629) | def _postprocess_output( method _quantile_loss (line 644) | def _quantile_loss(self, predictions: torch.Tensor, targets: torch.Ten... method forward (line 654) | def forward( method _timesfm_moving_average (line 797) | def _timesfm_moving_average(arr: torch.Tensor, window_size: int) -> li... FILE: src/transformers/models/timesfm/modular_timesfm.py class TimesFmOutput (line 42) | class TimesFmOutput(BaseModelOutput): class TimesFmOutputForPrediction (line 56) | class TimesFmOutputForPrediction(BaseModelOutput): class TimesFmMLP (line 71) | class TimesFmMLP(nn.Module): method __init__ (line 74) | def __init__(self, config: TimesFmConfig): method forward (line 83) | def forward(self, x, paddings=None): class TimesFmResidualBlock (line 93) | class TimesFmResidualBlock(nn.Module): method __init__ (line 96) | def __init__(self, input_dims, hidden_dims, output_dims): method forward (line 107) | def forward(self, x): class TimesFmRMSNorm (line 115) | class TimesFmRMSNorm(LlamaRMSNorm): class TimesFmPositionalEmbedding (line 119) | class TimesFmPositionalEmbedding(nn.Module): method __init__ (line 122) | def __init__(self, config: TimesFmConfig): method forward (line 136) | def forward(self, seq_length=None, position=None): class TimesFmAttention (line 165) | class TimesFmAttention(nn.Module): method __init__ (line 168) | def __init__(self, config: TimesFmConfig, layer_idx: int): method _scale_query (line 188) | def _scale_query(self, query: torch.Tensor) -> torch.Tensor: method forward (line 192) | def forward( class TimesFmDecoderLayer (line 225) | class TimesFmDecoderLayer(nn.Module): method __init__ (line 228) | def __init__(self, config: TimesFmConfig, layer_idx: int): method forward (line 235) | def forward( class TimesFmPreTrainedModel (line 258) | class TimesFmPreTrainedModel(PreTrainedModel): method _init_weights (line 271) | def _init_weights(self, module): class TimesFmModel (line 290) | class TimesFmModel(TimesFmPreTrainedModel): method __init__ (line 291) | def __init__(self, config: TimesFmConfig): method _forward_transform (line 310) | def _forward_transform( method forward (line 329) | def forward( method _prepare_4d_attention_mask (line 402) | def _prepare_4d_attention_mask( method _timesfm_masked_mean_std (line 448) | def _timesfm_masked_mean_std(inputs: torch.Tensor, padding: torch.Tens... method _timesfm_shift_padded_seq (line 495) | def _timesfm_shift_padded_seq(mask: torch.Tensor, seq: torch.Tensor) -... class TimesFmModelForPrediction (line 527) | class TimesFmModelForPrediction(TimesFmPreTrainedModel): method __init__ (line 530) | def __init__(self, config: TimesFmConfig): method _preprocess (line 549) | def _preprocess( method _postprocess_output (line 586) | def _postprocess_output( method _quantile_loss (line 601) | def _quantile_loss(self, predictions: torch.Tensor, targets: torch.Ten... method forward (line 611) | def forward( method _timesfm_moving_average (line 754) | def _timesfm_moving_average(arr: torch.Tensor, window_size: int) -> li... FILE: src/transformers/models/timesfm2_5/configuration_timesfm2_5.py class TimesFm2_5Config (line 30) | class TimesFm2_5Config(PreTrainedConfig): FILE: src/transformers/models/timesfm2_5/convert_timesfm2_5_original_to_hf.py function get_nested_attr (line 38) | def get_nested_attr(obj, key): function download_checkpoint_from_hub (line 51) | def download_checkpoint_from_hub(huggingface_repo_id: str) -> str: function write_model (line 63) | def write_model(model_path, huggingface_repo_id="google/timesfm-2.5-200m... function check_outputs (line 230) | def check_outputs(model_path, huggingface_repo_id="google/timesfm-2.5-20... function main (line 324) | def main(): FILE: src/transformers/models/timesfm2_5/modeling_timesfm2_5.py class TimesFm2_5Output (line 47) | class TimesFm2_5Output(BaseModelOutput): class TimesFm2_5OutputForPrediction (line 64) | class TimesFm2_5OutputForPrediction(BaseModelOutput): class TimesFm2_5MLP (line 79) | class TimesFm2_5MLP(nn.Module): method __init__ (line 80) | def __init__(self, config: TimesFm2_5Config): method forward (line 87) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TimesFm2_5ResidualBlock (line 94) | class TimesFm2_5ResidualBlock(nn.Module): method __init__ (line 97) | def __init__(self, config, input_dims: int, hidden_dims: int, output_d... method forward (line 108) | def forward(self, x): class TimesFm2_5RMSNorm (line 119) | class TimesFm2_5RMSNorm(nn.Module): method __init__ (line 120) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 128) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 135) | def extra_repr(self): class TimesFm2_5RotaryEmbedding (line 139) | class TimesFm2_5RotaryEmbedding(nn.Module): method __init__ (line 142) | def __init__(self, config: TimesFm2_5Config, device=None): method compute_default_rope_parameters (line 159) | def compute_default_rope_parameters( method forward (line 190) | def forward(self, x, position_ids): function rotate_half (line 204) | def rotate_half(x): function apply_rotary_pos_emb (line 212) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 237) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 249) | def eager_attention_forward( class TimesFm2_5Attention (line 275) | class TimesFm2_5Attention(nn.Module): method __init__ (line 278) | def __init__(self, config: TimesFm2_5Config, layer_idx: int): method forward (line 303) | def forward( class TimesFm2_5DecoderLayer (line 351) | class TimesFm2_5DecoderLayer(GradientCheckpointingLayer): method __init__ (line 354) | def __init__(self, config: TimesFm2_5Config, layer_idx: int): method forward (line 366) | def forward( class TimesFm2_5PositionalEmbedding (line 393) | class TimesFm2_5PositionalEmbedding(nn.Module): method __init__ (line 396) | def __init__(self, config: TimesFm2_5Config): method forward (line 410) | def forward(self, seq_length=None, position=None): class TimesFm2_5PreTrainedModel (line 440) | class TimesFm2_5PreTrainedModel(PreTrainedModel): method _init_weights (line 456) | def _init_weights(self, module): class TimesFm2_5Model (line 474) | class TimesFm2_5Model(TimesFm2_5PreTrainedModel): method __init__ (line 475) | def __init__(self, config: TimesFm2_5Config): method _revin (line 496) | def _revin( method _update_running_stats (line 529) | def _update_running_stats( method forward (line 573) | def forward( class TimesFm2_5ModelForPrediction (line 656) | class TimesFm2_5ModelForPrediction(TimesFm2_5PreTrainedModel): method __init__ (line 659) | def __init__(self, config: TimesFm2_5Config): method _preprocess (line 684) | def _preprocess( method _postprocess_output (line 721) | def _postprocess_output( method _quantile_loss (line 736) | def _quantile_loss(self, predictions: torch.Tensor, targets: torch.Ten... method forward (line 746) | def forward( method _timesfm2_5_moving_average (line 867) | def _timesfm2_5_moving_average(arr: torch.Tensor, window_size: int) ->... method _decode_and_project (line 877) | def _decode_and_project( FILE: src/transformers/models/timesfm2_5/modular_timesfm2_5.py class TimesFm2_5Config (line 56) | class TimesFm2_5Config(TimesFmConfig): class TimesFm2_5Output (line 114) | class TimesFm2_5Output(TimesFmOutput): class TimesFm2_5OutputForPrediction (line 128) | class TimesFm2_5OutputForPrediction(TimesFmOutputForPrediction): class TimesFm2_5MLP (line 141) | class TimesFm2_5MLP(CLIPMLP): method __init__ (line 142) | def __init__(self, config: TimesFm2_5Config): class TimesFm2_5ResidualBlock (line 149) | class TimesFm2_5ResidualBlock(TimesFmResidualBlock): method __init__ (line 152) | def __init__(self, config, input_dims: int, hidden_dims: int, output_d... method forward (line 160) | def forward(self, x): class TimesFm2_5RMSNorm (line 166) | class TimesFm2_5RMSNorm(LlamaRMSNorm): class TimesFm2_5RotaryEmbedding (line 170) | class TimesFm2_5RotaryEmbedding(LlamaRotaryEmbedding): class TimesFm2_5Attention (line 174) | class TimesFm2_5Attention(ApertusAttention): method __init__ (line 177) | def __init__(self, config: TimesFm2_5Config, layer_idx: int): method forward (line 181) | def forward( class TimesFm2_5DecoderLayer (line 229) | class TimesFm2_5DecoderLayer(LlamaDecoderLayer): method __init__ (line 232) | def __init__(self, config: TimesFm2_5Config, layer_idx: int): method forward (line 237) | def forward( class TimesFm2_5PreTrainedModel (line 265) | class TimesFm2_5PreTrainedModel(TimesFmPreTrainedModel): class TimesFm2_5Model (line 277) | class TimesFm2_5Model(TimesFm2_5PreTrainedModel): method __init__ (line 278) | def __init__(self, config: TimesFm2_5Config): method _revin (line 299) | def _revin( method _update_running_stats (line 332) | def _update_running_stats( method forward (line 376) | def forward( class TimesFm2_5ModelForPrediction (line 459) | class TimesFm2_5ModelForPrediction(TimesFmModelForPrediction): method __init__ (line 460) | def __init__(self, config: TimesFm2_5Config): method _decode_and_project (line 488) | def _decode_and_project( method forward (line 533) | def forward( FILE: src/transformers/models/timesformer/configuration_timesformer.py class TimesformerConfig (line 24) | class TimesformerConfig(PreTrainedConfig): FILE: src/transformers/models/timesformer/convert_timesformer_to_pytorch.py function get_timesformer_config (line 27) | def get_timesformer_config(model_name): function rename_key (line 57) | def rename_key(name): function convert_state_dict (line 102) | def convert_state_dict(orig_state_dict, config): function prepare_video (line 129) | def prepare_video(): function convert_timesformer_checkpoint (line 137) | def convert_timesformer_checkpoint(checkpoint_url, pytorch_dump_folder_p... FILE: src/transformers/models/timesformer/modeling_timesformer.py class TimesformerPatchEmbeddings (line 38) | class TimesformerPatchEmbeddings(nn.Module): method __init__ (line 41) | def __init__(self, config): method forward (line 57) | def forward(self, pixel_values): class TimesformerEmbeddings (line 67) | class TimesformerEmbeddings(nn.Module): method __init__ (line 72) | def __init__(self, config): method forward (line 92) | def forward(self, pixel_values): function drop_path (line 148) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class TimeSformerDropPath (line 164) | class TimeSformerDropPath(nn.Module): method __init__ (line 167) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 171) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 174) | def extra_repr(self) -> str: class TimesformerSelfAttention (line 179) | class TimesformerSelfAttention(nn.Module): method __init__ (line 180) | def __init__(self, config: TimesformerConfig): method forward (line 193) | def forward(self, hidden_states, output_attentions: bool = False): class TimesformerSelfOutput (line 213) | class TimesformerSelfOutput(nn.Module): method __init__ (line 219) | def __init__(self, config: TimesformerConfig) -> None: method forward (line 224) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TimeSformerAttention (line 231) | class TimeSformerAttention(nn.Module): method __init__ (line 232) | def __init__(self, config: TimesformerConfig) -> None: method forward (line 237) | def forward( class TimesformerIntermediate (line 251) | class TimesformerIntermediate(nn.Module): method __init__ (line 252) | def __init__(self, config: TimesformerConfig) -> None: method forward (line 262) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TimesformerOutput (line 270) | class TimesformerOutput(nn.Module): method __init__ (line 271) | def __init__(self, config: TimesformerConfig) -> None: method forward (line 276) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TimesformerLayer (line 284) | class TimesformerLayer(GradientCheckpointingLayer): method __init__ (line 285) | def __init__(self, config: TimesformerConfig, layer_index: int) -> None: method forward (line 313) | def forward(self, hidden_states: torch.Tensor, output_attentions: bool... class TimesformerEncoder (line 407) | class TimesformerEncoder(nn.Module): method __init__ (line 408) | def __init__(self, config: TimesformerConfig) -> None: method forward (line 414) | def forward( class TimesformerPreTrainedModel (line 448) | class TimesformerPreTrainedModel(PreTrainedModel): method _init_weights (line 457) | def _init_weights(self, module): class TimesformerModel (line 471) | class TimesformerModel(TimesformerPreTrainedModel): method __init__ (line 472) | def __init__(self, config): method get_input_embeddings (line 484) | def get_input_embeddings(self): method forward (line 488) | def forward( class TimesformerForVideoClassification (line 604) | class TimesformerForVideoClassification(TimesformerPreTrainedModel): method __init__ (line 605) | def __init__(self, config): method forward (line 618) | def forward( FILE: src/transformers/models/timm_backbone/configuration_timm_backbone.py class TimmBackboneConfig (line 26) | class TimmBackboneConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 59) | def __post_init__(self, **kwargs): method out_indices (line 64) | def out_indices(self): method out_indices (line 68) | def out_indices(self, out_indices: tuple[int, ...] | list[int]): method out_features (line 77) | def out_features(self): method out_features (line 81) | def out_features(self, out_features: list[str]): FILE: src/transformers/models/timm_backbone/modeling_timm_backbone.py class TimmBackbone (line 32) | class TimmBackbone(BackboneMixin, PreTrainedModel): method __init__ (line 43) | def __init__(self, config, **kwargs): method from_pretrained (line 85) | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, *... method freeze_batch_norm_2d (line 100) | def freeze_batch_norm_2d(self): method unfreeze_batch_norm_2d (line 103) | def unfreeze_batch_norm_2d(self): method _init_weights (line 107) | def _init_weights(self, module): method forward (line 122) | def forward( FILE: src/transformers/models/timm_wrapper/configuration_timm_wrapper.py class TimmWrapperConfig (line 31) | class TimmWrapperConfig(PreTrainedConfig): method from_dict (line 61) | def from_dict(cls, config_dict: dict[str, Any], **kwargs): method to_dict (line 103) | def to_dict(self) -> dict[str, Any]: FILE: src/transformers/models/timm_wrapper/image_processing_timm_wrapper.py class TimmWrapperImageProcessor (line 38) | class TimmWrapperImageProcessor(BaseImageProcessor): method __init__ (line 52) | def __init__( method to_dict (line 74) | def to_dict(self) -> dict[str, Any]: method get_image_processor_dict (line 85) | def get_image_processor_dict( method preprocess (line 96) | def preprocess( method save_pretrained (line 129) | def save_pretrained(self, *args, **kwargs): FILE: src/transformers/models/timm_wrapper/modeling_timm_wrapper.py class TimmWrapperModelOutput (line 38) | class TimmWrapperModelOutput(ModelOutput): function _create_timm_model_with_error_handling (line 57) | def _create_timm_model_with_error_handling(config: "TimmWrapperConfig", ... class TimmWrapperPreTrainedModel (line 80) | class TimmWrapperPreTrainedModel(PreTrainedModel): method post_init (line 92) | def post_init(self): method load_state_dict (line 96) | def load_state_dict(self, state_dict, *args, **kwargs): method _init_weights (line 105) | def _init_weights(self, module): method _timm_model_supports_gradient_checkpointing (line 137) | def _timm_model_supports_gradient_checkpointing(self): method _set_gradient_checkpointing (line 152) | def _set_gradient_checkpointing(self, enable: bool = True, *args, **kw... method get_input_embeddings (line 155) | def get_input_embeddings(self): method set_input_embeddings (line 159) | def set_input_embeddings(self, value): class TimmWrapperModel (line 163) | class TimmWrapperModel(TimmWrapperPreTrainedModel): method __init__ (line 168) | def __init__(self, config: TimmWrapperConfig): method forward (line 178) | def forward( class TimmWrapperForImageClassification (line 280) | class TimmWrapperForImageClassification(TimmWrapperPreTrainedModel): method __init__ (line 285) | def __init__(self, config: TimmWrapperConfig): method forward (line 304) | def forward( FILE: src/transformers/models/trocr/configuration_trocr.py class TrOCRConfig (line 24) | class TrOCRConfig(PreTrainedConfig): FILE: src/transformers/models/trocr/convert_trocr_unilm_to_pytorch.py function create_rename_keys (line 42) | def create_rename_keys(encoder_config, decoder_config): function read_in_q_k_v (line 87) | def read_in_q_k_v(state_dict, encoder_config): function rename_key (line 103) | def rename_key(dct, old, new): function prepare_img (line 109) | def prepare_img(checkpoint_url): function convert_tr_ocr_checkpoint (line 124) | def convert_tr_ocr_checkpoint(checkpoint_url, pytorch_dump_folder_path): FILE: src/transformers/models/trocr/modeling_trocr.py class TrOCRLearnedPositionalEmbedding (line 37) | class TrOCRLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 42) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 48) | def forward( class TrOCRScaledWordEmbedding (line 65) | class TrOCRScaledWordEmbedding(nn.Embedding): method __init__ (line 70) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 74) | def forward(self, input_ids: torch.Tensor): class TrOCRSinusoidalPositionalEmbedding (line 78) | class TrOCRSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 81) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method get_embedding (line 89) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 108) | def forward(self, input_ids: torch.Tensor, past_key_values_length: int... method create_position_ids_from_input_ids (line 125) | def create_position_ids_from_input_ids( class TrOCRAttention (line 138) | class TrOCRAttention(nn.Module): method __init__ (line 141) | def __init__( method forward (line 176) | def forward( class TrOCRDecoderLayer (line 279) | class TrOCRDecoderLayer(GradientCheckpointingLayer): method __init__ (line 280) | def __init__(self, config: TrOCRConfig, layer_idx=None): method forward (line 316) | def forward( class TrOCRPreTrainedModel (line 391) | class TrOCRPreTrainedModel(PreTrainedModel): class TrOCRDecoder (line 398) | class TrOCRDecoder(TrOCRPreTrainedModel): method __init__ (line 406) | def __init__(self, config: TrOCRConfig): method forward (line 437) | def forward( class TrOCRDecoderWrapper (line 623) | class TrOCRDecoderWrapper(TrOCRPreTrainedModel): method __init__ (line 624) | def __init__(self, config): method forward (line 629) | def forward(self, *args, **kwargs): class TrOCRForCausalLM (line 638) | class TrOCRForCausalLM(TrOCRPreTrainedModel, GenerationMixin): method __init__ (line 641) | def __init__(self, config): method get_input_embeddings (line 652) | def get_input_embeddings(self): method set_input_embeddings (line 655) | def set_input_embeddings(self, value): method get_output_embeddings (line 658) | def get_output_embeddings(self): method set_output_embeddings (line 661) | def set_output_embeddings(self, new_embeddings): method forward (line 665) | def forward( FILE: src/transformers/models/trocr/processing_trocr.py class TrOCRProcessorKwargs (line 25) | class TrOCRProcessorKwargs(ProcessingKwargs, total=False): class TrOCRProcessor (line 30) | class TrOCRProcessor(ProcessorMixin): method __init__ (line 31) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method __call__ (line 35) | def __call__( method model_input_names (line 64) | def model_input_names(self): FILE: src/transformers/models/tvp/configuration_tvp.py class TvpConfig (line 26) | class TvpConfig(PreTrainedConfig): method __post_init__ (line 80) | def __post_init__(self, **kwargs): FILE: src/transformers/models/tvp/image_processing_pil_tvp.py function get_resize_output_image_size (line 40) | def get_resize_output_image_size( class TvpImageProcessorKwargs (line 60) | class TvpImageProcessorKwargs(ImagesKwargs, total=False): class TvpImageProcessorPil (line 76) | class TvpImageProcessorPil(PilBackend): method __init__ (line 95) | def __init__(self, **kwargs: Unpack[TvpImageProcessorKwargs]): method preprocess (line 99) | def preprocess( method _prepare_images_structure (line 110) | def _prepare_images_structure( method resize (line 128) | def resize( method pad_image (line 156) | def pad_image( method _flip_channel_order (line 196) | def _flip_channel_order(self, image: np.ndarray) -> np.ndarray: method _preprocess (line 202) | def _preprocess( FILE: src/transformers/models/tvp/image_processing_tvp.py class TvpImageProcessorKwargs (line 34) | class TvpImageProcessorKwargs(ImagesKwargs, total=False): class TvpImageProcessor (line 50) | class TvpImageProcessor(TorchvisionBackend): method __init__ (line 69) | def __init__(self, **kwargs: Unpack[TvpImageProcessorKwargs]): method preprocess (line 73) | def preprocess( method _prepare_images_structure (line 84) | def _prepare_images_structure( method resize (line 102) | def resize( method _flip_channel_order (line 150) | def _flip_channel_order(self, frames: "torch.Tensor") -> "torch.Tensor": method _preprocess (line 168) | def _preprocess( FILE: src/transformers/models/tvp/modeling_tvp.py class TvpVideoGroundingOutput (line 37) | class TvpVideoGroundingOutput(ModelOutput): class TvpLoss (line 55) | class TvpLoss(nn.Module): method __init__ (line 66) | def __init__(self, losses): method loss_iou (line 79) | def loss_iou(self, start_time, end_time, candidates_start_time, candid... method loss_distance (line 89) | def loss_distance(self, start_time, end_time, candidates_start_time, c... method loss_duration (line 101) | def loss_duration(self, start_time, end_time, candidates_start_time, c... method forward (line 112) | def forward(self, logits, labels): class TvpVisionModel (line 135) | class TvpVisionModel(nn.Module): method __init__ (line 136) | def __init__(self, config): method forward (line 159) | def forward(self, pixel_values): class TvpVisualInputEmbedding (line 175) | class TvpVisualInputEmbedding(nn.Module): method __init__ (line 180) | def __init__(self, config): method interpolate_pos_encoding (line 192) | def interpolate_pos_encoding(self, embedding: torch.Tensor, height: in... method add_2d_positional_embeddings (line 215) | def add_2d_positional_embeddings(self, grid, interpolate_pos_encoding:... method forward (line 256) | def forward(self, grid, interpolate_pos_encoding: bool = False): class TvpTextInputEmbeddings (line 288) | class TvpTextInputEmbeddings(nn.Module): method __init__ (line 291) | def __init__(self, config): method forward (line 299) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class TvpAttention (line 324) | class TvpAttention(nn.Module): method __init__ (line 325) | def __init__(self, config): method _reshape (line 345) | def _reshape(self, tensor: torch.Tensor, sequence_length: int, batch_s... method forward (line 352) | def forward( class TvpIntermediate (line 394) | class TvpIntermediate(nn.Module): method __init__ (line 395) | def __init__(self, config): method forward (line 403) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TvpOutputLayer (line 409) | class TvpOutputLayer(nn.Module): method __init__ (line 410) | def __init__(self, config): method forward (line 416) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class TvpEncodeLayer (line 423) | class TvpEncodeLayer(GradientCheckpointingLayer): method __init__ (line 424) | def __init__(self, config): method forward (line 430) | def forward( class TvpEncoder (line 449) | class TvpEncoder(nn.Module): method __init__ (line 450) | def __init__(self, config): method forward (line 456) | def forward( class TvpPooler (line 502) | class TvpPooler(nn.Module): method __init__ (line 503) | def __init__(self, config): method forward (line 508) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class TvpPreTrainedModel (line 518) | class TvpPreTrainedModel(PreTrainedModel): method _init_weights (line 525) | def _init_weights(self, module: nn.Module): class TvpFrameDownPadPrompter (line 551) | class TvpFrameDownPadPrompter(nn.Module): method __init__ (line 556) | def __init__(self, config): method forward (line 570) | def forward(self, pixel_values): class TvpFramePadPrompter (line 588) | class TvpFramePadPrompter(nn.Module): method __init__ (line 593) | def __init__(self, config): method interpolate_pad_encoding (line 631) | def interpolate_pad_encoding(self, prompt: torch.Tensor, height: int, ... method forward (line 655) | def forward(self, pixel_values, interpolate_pad_encoding: bool = False): class TvpModel (line 689) | class TvpModel(TvpPreTrainedModel): method __init__ (line 690) | def __init__(self, config): method get_input_embeddings (line 706) | def get_input_embeddings(self): method set_input_embeddings (line 709) | def set_input_embeddings(self, value): method forward (line 713) | def forward( class TvpVideoGroundingHead (line 785) | class TvpVideoGroundingHead(nn.Module): method __init__ (line 786) | def __init__(self, config): method forward (line 793) | def forward(self, pooler_output): class TvpForVideoGrounding (line 804) | class TvpForVideoGrounding(TvpPreTrainedModel): method __init__ (line 805) | def __init__(self, config): method forward (line 814) | def forward( FILE: src/transformers/models/tvp/processing_tvp.py class TvpProcessorKwargs (line 22) | class TvpProcessorKwargs(ProcessingKwargs, total=False): class TvpProcessor (line 34) | class TvpProcessor(ProcessorMixin): method __init__ (line 35) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): method post_process_video_grounding (line 39) | def post_process_video_grounding(self, logits, video_durations): FILE: src/transformers/models/udop/configuration_udop.py class UdopConfig (line 24) | class UdopConfig(PreTrainedConfig): method __post_init__ (line 69) | def __post_init__(self, **kwargs): method validate_architecture (line 85) | def validate_architecture(self): FILE: src/transformers/models/udop/convert_udop_to_hf.py function original_transform (line 33) | def original_transform(image, image_size=224): function get_image (line 46) | def get_image(): function prepare_dummy_inputs (line 55) | def prepare_dummy_inputs(tokenizer, image_processor): function convert_udop_checkpoint (line 90) | def convert_udop_checkpoint(model_name, pytorch_dump_folder_path=None, p... FILE: src/transformers/models/udop/modeling_udop.py class BaseModelOutputWithAttentionMask (line 60) | class BaseModelOutputWithAttentionMask(ModelOutput): function get_visual_bbox (line 98) | def get_visual_bbox(image_size=224, patch_size=16): function pad_sequence (line 121) | def pad_sequence(seq, target_len, pad_value=0): function combine_image_text_embeddings (line 134) | def combine_image_text_embeddings( class UdopPatchEmbeddings (line 217) | class UdopPatchEmbeddings(nn.Module): method __init__ (line 220) | def __init__(self, config): method forward (line 235) | def forward(self, pixel_values): class UdopPreTrainedModel (line 247) | class UdopPreTrainedModel(PreTrainedModel): method _init_weights (line 257) | def _init_weights(self, module): method _shift_right (line 309) | def _shift_right(self, input_ids): class UdopLayerNorm (line 333) | class UdopLayerNorm(nn.Module): method __init__ (line 334) | def __init__(self, hidden_size, eps=1e-6): method forward (line 342) | def forward(self, hidden_states): class UdopDenseActDense (line 359) | class UdopDenseActDense(nn.Module): method __init__ (line 360) | def __init__(self, config: UdopConfig): method forward (line 367) | def forward(self, hidden_states): class UdopDenseGatedActDense (line 382) | class UdopDenseGatedActDense(nn.Module): method __init__ (line 383) | def __init__(self, config: UdopConfig): method forward (line 391) | def forward(self, hidden_states): class UdopLayerFF (line 412) | class UdopLayerFF(nn.Module): method __init__ (line 413) | def __init__(self, config: UdopConfig): method forward (line 423) | def forward(self, hidden_states): class UdopAttention (line 431) | class UdopAttention(nn.Module): method __init__ (line 432) | def __init__( method _relative_position_bucket (line 467) | def _relative_position_bucket(relative_position, bidirectional=True, n... method compute_bias (line 514) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 531) | def forward( class UdopLayerSelfAttention (line 626) | class UdopLayerSelfAttention(nn.Module): method __init__ (line 627) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 635) | def forward( class UdopLayerCrossAttention (line 660) | class UdopLayerCrossAttention(nn.Module): method __init__ (line 661) | def __init__(self, config, layer_idx: int | None = None): method forward (line 667) | def forward( class UdopBlock (line 692) | class UdopBlock(GradientCheckpointingLayer): method __init__ (line 693) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method forward (line 707) | def forward( class UdopCellEmbeddings (line 784) | class UdopCellEmbeddings(nn.Module): method __init__ (line 785) | def __init__(self, max_2d_position_embeddings=501, hidden_size=1024): method forward (line 792) | def forward(self, bbox): class RelativePositionBiasBase (line 816) | class RelativePositionBiasBase(nn.Module, ABC): method __init__ (line 838) | def __init__( method prepare_input (line 864) | def prepare_input( method get_bucket (line 871) | def get_bucket(self, attention_mask: Tensor | None = None, bbox: dict[... method get_relative_position (line 881) | def get_relative_position(self, positions): method forward (line 891) | def forward(self, attention_mask: Tensor | None = None, bbox: dict[str... class RelativePositionBias1D (line 920) | class RelativePositionBias1D(RelativePositionBiasBase): method __init__ (line 921) | def __init__(self, scaling_factor=1, max_distance=128, **kwargs): method prepare_input (line 928) | def prepare_input(self, attention_mask: Tensor | None = None, bbox: di... class RelativePositionBiasHorizontal (line 938) | class RelativePositionBiasHorizontal(RelativePositionBiasBase): method __init__ (line 939) | def __init__(self, scaling_factor=100, max_distance=100, **kwargs): method prepare_input (line 946) | def prepare_input(self, attention_mask: Tensor | None = None, bbox: di... class RelativePositionBiasVertical (line 957) | class RelativePositionBiasVertical(RelativePositionBiasBase): method __init__ (line 958) | def __init__(self, scaling_factor=100, max_distance=100, **kwargs): method prepare_input (line 965) | def prepare_input(self, attention_mask: Tensor | None = None, bbox: di... class RelativePositionBiasAggregated (line 976) | class RelativePositionBiasAggregated(nn.Module): method __init__ (line 977) | def __init__(self, modules: Sequence[RelativePositionBiasBase]): method forward (line 988) | def forward(self, attention_mask: Tensor | None = None, bbox: dict[str... function create_relative_bias (line 1003) | def create_relative_bias(config: UdopConfig) -> Sequence[RelativePositio... class UdopStack (line 1025) | class UdopStack(UdopPreTrainedModel): method __init__ (line 1031) | def __init__(self, config): method _get_relative_bias (line 1054) | def _get_relative_bias(config: UdopConfig) -> RelativePositionBiasAggr... method get_output_embeddings (line 1058) | def get_output_embeddings(self): method set_input_embeddings (line 1061) | def set_input_embeddings(self, new_embeddings): method forward (line 1064) | def forward( class UdopModel (line 1260) | class UdopModel(UdopPreTrainedModel): method __init__ (line 1268) | def __init__(self, config): method get_input_embeddings (line 1288) | def get_input_embeddings(self): method set_input_embeddings (line 1291) | def set_input_embeddings(self, new_embeddings): method forward (line 1297) | def forward( class UdopForConditionalGeneration (line 1428) | class UdopForConditionalGeneration(UdopPreTrainedModel, GenerationMixin): method __init__ (line 1439) | def __init__(self, config): method get_input_embeddings (line 1462) | def get_input_embeddings(self): method set_input_embeddings (line 1465) | def set_input_embeddings(self, new_embeddings): method forward (line 1471) | def forward( class UdopEncoderModel (line 1615) | class UdopEncoderModel(UdopPreTrainedModel): method __init__ (line 1623) | def __init__(self, config: UdopConfig): method get_input_embeddings (line 1639) | def get_input_embeddings(self): method set_input_embeddings (line 1642) | def set_input_embeddings(self, new_embeddings): method forward (line 1647) | def forward( FILE: src/transformers/models/udop/processing_udop.py class UdopTextKwargs (line 30) | class UdopTextKwargs(TextKwargs, total=False): class UdopProcessorKwargs (line 35) | class UdopProcessorKwargs(ProcessingKwargs, total=False): class UdopProcessor (line 53) | class UdopProcessor(ProcessorMixin): method __init__ (line 69) | def __init__(self, image_processor, tokenizer): method __call__ (line 73) | def __call__( method get_overflowing_images (line 146) | def get_overflowing_images(self, images, overflow_to_sample_mapping): method model_input_names (line 161) | def model_input_names(self): FILE: src/transformers/models/udop/tokenization_udop.py class UdopTokenizer (line 139) | class UdopTokenizer(TokenizersBackend): method __init__ (line 185) | def __init__( method __call__ (line 261) | def __call__( method call_boxes (line 300) | def call_boxes( method tokenize (line 451) | def tokenize(self, text: str, pair: str | None = None, add_special_tok... method batch_encode_plus_boxes (line 462) | def batch_encode_plus_boxes( method _batch_encode_plus_boxes (line 536) | def _batch_encode_plus_boxes( method _encode_plus_boxes (line 694) | def _encode_plus_boxes( method encode_boxes (line 762) | def encode_boxes( method encode_plus_boxes (line 805) | def encode_plus_boxes( method _pad (line 883) | def _pad( method build_inputs_with_special_tokens (line 972) | def build_inputs_with_special_tokens( method create_token_type_ids_from_sequences (line 997) | def create_token_type_ids_from_sequences( method save_vocabulary (line 1021) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/umt5/configuration_umt5.py class UMT5Config (line 24) | class UMT5Config(PreTrainedConfig): method __post_init__ (line 64) | def __post_init__(self, **kwargs): method validate_architecture (line 80) | def validate_architecture(self): FILE: src/transformers/models/umt5/convert_umt5_checkpoint_to_pytorch.py function t5x_relpos_bias_lookup (line 45) | def t5x_relpos_bias_lookup(params, i, prefix): function t5x_attention_lookup (line 50) | def t5x_attention_lookup(params, i, prefix, layer_name="attention"): function t5x_mlp_lookup (line 63) | def t5x_mlp_lookup(params, i, prefix, split_mlp_wi=False): function t5x_layer_norm_lookup (line 76) | def t5x_layer_norm_lookup(params, i, prefix, layer_name): function convert_t5x_to_pytorch (line 81) | def convert_t5x_to_pytorch( function make_state_dict (line 181) | def make_state_dict(converted_params, is_encoder_only: bool): function load_t5x_weights_in_t5 (line 201) | def load_t5x_weights_in_t5(model, config, t5x_checkpoint_path, is_encode... function convert_t5x_checkpoint_to_pytorch (line 211) | def convert_t5x_checkpoint_to_pytorch( FILE: src/transformers/models/umt5/modeling_umt5.py class UMT5LayerNorm (line 54) | class UMT5LayerNorm(nn.Module): method __init__ (line 55) | def __init__(self, hidden_size, eps=1e-6): method forward (line 63) | def forward(self, hidden_states): class UMT5DenseActDense (line 80) | class UMT5DenseActDense(nn.Module): method __init__ (line 81) | def __init__(self, config: UMT5Config): method forward (line 88) | def forward(self, hidden_states): class UMT5DenseGatedActDense (line 103) | class UMT5DenseGatedActDense(nn.Module): method __init__ (line 104) | def __init__(self, config: UMT5Config): method forward (line 112) | def forward(self, hidden_states): class UMT5LayerFF (line 133) | class UMT5LayerFF(nn.Module): method __init__ (line 134) | def __init__(self, config: UMT5Config): method forward (line 144) | def forward(self, hidden_states): class UMT5Attention (line 151) | class UMT5Attention(nn.Module): method __init__ (line 156) | def __init__(self, config, has_relative_attention_bias=False, layer_id... method _shape (line 183) | def _shape(self, projection: torch.Tensor) -> torch.Tensor: method _relative_position_bucket (line 189) | def _relative_position_bucket(self, relative_position): method compute_bias (line 236) | def compute_bias(self, query_length, key_length, device=None, past_see... method forward (line 248) | def forward( class UMT5LayerSelfAttention (line 329) | class UMT5LayerSelfAttention(nn.Module): method __init__ (line 330) | def __init__(self, config, layer_idx: int | None = None): method forward (line 336) | def forward( class UMT5LayerCrossAttention (line 354) | class UMT5LayerCrossAttention(nn.Module): method __init__ (line 355) | def __init__(self, config, layer_idx: int | None = None): method forward (line 361) | def forward( class UMT5Block (line 381) | class UMT5Block(GradientCheckpointingLayer): method __init__ (line 382) | def __init__(self, config, layer_idx: int | None = None): method forward (line 392) | def forward( class UMT5ClassificationHead (line 449) | class UMT5ClassificationHead(nn.Module): method __init__ (line 452) | def __init__(self, config: UMT5Config): method forward (line 458) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UMT5PreTrainedModel (line 468) | class UMT5PreTrainedModel(PreTrainedModel): method dummy_inputs (line 478) | def dummy_inputs(self): method _init_weights (line 489) | def _init_weights(self, module): method _shift_right (line 555) | def _shift_right(self, input_ids): class UMT5Stack (line 577) | class UMT5Stack(UMT5PreTrainedModel): method __init__ (line 578) | def __init__(self, config): method set_input_embeddings (line 590) | def set_input_embeddings(self, new_embeddings): method forward (line 593) | def forward( class UMT5Model (line 747) | class UMT5Model(UMT5PreTrainedModel): method __init__ (line 772) | def __init__(self, config): method get_input_embeddings (line 790) | def get_input_embeddings(self): method set_input_embeddings (line 794) | def set_input_embeddings(self, new_embeddings): method forward (line 800) | def forward( class UMT5ForConditionalGeneration (line 921) | class UMT5ForConditionalGeneration(UMT5PreTrainedModel, GenerationMixin): method __init__ (line 945) | def __init__(self, config): method get_input_embeddings (line 967) | def get_input_embeddings(self): method set_input_embeddings (line 971) | def set_input_embeddings(self, new_embeddings): method forward (line 977) | def forward( method prepare_decoder_input_ids_from_labels (line 1120) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): class UMT5EncoderModel (line 1125) | class UMT5EncoderModel(UMT5PreTrainedModel): method __init__ (line 1146) | def __init__(self, config): method get_input_embeddings (line 1159) | def get_input_embeddings(self): method set_input_embeddings (line 1163) | def set_input_embeddings(self, new_embeddings): method forward (line 1169) | def forward( class UMT5ForSequenceClassification (line 1222) | class UMT5ForSequenceClassification(UMT5PreTrainedModel): method __init__ (line 1226) | def __init__(self, config: UMT5Config): method forward (line 1235) | def forward( class UMT5ForTokenClassification (line 1368) | class UMT5ForTokenClassification(UMT5PreTrainedModel): method __init__ (line 1372) | def __init__(self, config: UMT5Config): method forward (line 1385) | def forward( class UMT5ForQuestionAnswering (line 1443) | class UMT5ForQuestionAnswering(UMT5PreTrainedModel): method __init__ (line 1449) | def __init__(self, config): method get_input_embeddings (line 1472) | def get_input_embeddings(self): method set_input_embeddings (line 1476) | def set_input_embeddings(self, new_embeddings): method forward (line 1482) | def forward( FILE: src/transformers/models/unispeech/configuration_unispeech.py class UniSpeechConfig (line 27) | class UniSpeechConfig(PreTrainedConfig): method __post_init__ (line 186) | def __post_init__(self, **kwargs): method validate_architecture (line 190) | def validate_architecture(self): method inputs_to_logits_ratio (line 205) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/unispeech/convert_unispeech_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 67) | def set_recursively(hf_pointer, key, value, full_name, weight_type, is_f... function recursively_load_weights (line 104) | def recursively_load_weights(fairseq_model, hf_model, is_finetuned): function load_conv_layer (line 148) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_unispeech_checkpoint (line 189) | def convert_unispeech_checkpoint( FILE: src/transformers/models/unispeech/modeling_unispeech.py class UniSpeechForPreTrainingOutput (line 59) | class UniSpeechForPreTrainingOutput(ModelOutput): class UniSpeechSamePadLayer (line 82) | class UniSpeechSamePadLayer(nn.Module): method __init__ (line 83) | def __init__(self, num_conv_pos_embeddings): method forward (line 87) | def forward(self, hidden_states): class UniSpeechPositionalConvEmbedding (line 93) | class UniSpeechPositionalConvEmbedding(nn.Module): method __init__ (line 94) | def __init__(self, config): method forward (line 127) | def forward(self, hidden_states): class UniSpeechNoLayerNormConvLayer (line 138) | class UniSpeechNoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 139) | def __init__(self, config, layer_id=0): method forward (line 153) | def forward(self, hidden_states): class UniSpeechLayerNormConvLayer (line 159) | class UniSpeechLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 160) | def __init__(self, config, layer_id=0): method forward (line 175) | def forward(self, hidden_states): class UniSpeechGroupNormConvLayer (line 186) | class UniSpeechGroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 187) | def __init__(self, config, layer_id=0): method forward (line 203) | def forward(self, hidden_states): class UniSpeechFeatureEncoder (line 210) | class UniSpeechFeatureEncoder(nn.Module): method __init__ (line 213) | def __init__(self, config): method _freeze_parameters (line 233) | def _freeze_parameters(self): method forward (line 238) | def forward(self, input_values): class UniSpeechFeatureProjection (line 251) | class UniSpeechFeatureProjection(nn.Module): method __init__ (line 252) | def __init__(self, config): method forward (line 258) | def forward(self, hidden_states): function eager_attention_forward (line 266) | def eager_attention_forward( class UniSpeechAttention (line 294) | class UniSpeechAttention(nn.Module): method __init__ (line 297) | def __init__( method forward (line 328) | def forward( class UniSpeechFeedForward (line 380) | class UniSpeechFeedForward(nn.Module): method __init__ (line 381) | def __init__(self, config): method forward (line 394) | def forward(self, hidden_states): class UniSpeechEncoderLayer (line 404) | class UniSpeechEncoderLayer(GradientCheckpointingLayer): method __init__ (line 405) | def __init__(self, config): method forward (line 420) | def forward(self, hidden_states, attention_mask=None, output_attention... class UniSpeechEncoder (line 440) | class UniSpeechEncoder(nn.Module): method __init__ (line 441) | def __init__(self, config): method forward (line 450) | def forward( class UniSpeechAttnAdapterLayer (line 512) | class UniSpeechAttnAdapterLayer(nn.Module): method __init__ (line 513) | def __init__(self, config): method forward (line 527) | def forward(self, hidden_states: torch.FloatTensor): class UniSpeechEncoderLayerStableLayerNorm (line 537) | class UniSpeechEncoderLayerStableLayerNorm(GradientCheckpointingLayer): method __init__ (line 538) | def __init__(self, config): method forward (line 557) | def forward( class UniSpeechEncoderStableLayerNorm (line 583) | class UniSpeechEncoderStableLayerNorm(nn.Module): method __init__ (line 584) | def __init__(self, config): method forward (line 595) | def forward( class UniSpeechGumbelVectorQuantizer (line 659) | class UniSpeechGumbelVectorQuantizer(nn.Module): method __init__ (line 665) | def __init__(self, config): method _compute_perplexity (line 686) | def _compute_perplexity(probs): method forward (line 691) | def forward(self, hidden_states): class UniSpeechPreTrainedModel (line 730) | class UniSpeechPreTrainedModel(PreTrainedModel): method _init_weights (line 741) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 774) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 789) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... function _compute_mask_indices (line 805) | def _compute_mask_indices( class UniSpeechModel (line 928) | class UniSpeechModel(UniSpeechPreTrainedModel): method __init__ (line 929) | def __init__(self, config: UniSpeechConfig): method _mask_hidden_states (line 946) | def _mask_hidden_states( method forward (line 993) | def forward( class UniSpeechForPreTraining (line 1052) | class UniSpeechForPreTraining(UniSpeechPreTrainedModel): method __init__ (line 1053) | def __init__(self, config: UniSpeechConfig): method set_gumbel_temperature (line 1068) | def set_gumbel_temperature(self, temperature: int): method freeze_feature_encoder (line 1074) | def freeze_feature_encoder(self): method compute_contrastive_logits (line 1082) | def compute_contrastive_logits( method forward (line 1102) | def forward( class UniSpeechForCTC (line 1182) | class UniSpeechForCTC(UniSpeechPreTrainedModel): method __init__ (line 1183) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 1212) | def tie_weights(self, **kwargs): method freeze_feature_encoder (line 1236) | def freeze_feature_encoder(self): method freeze_base_model (line 1243) | def freeze_base_model(self): method forward (line 1252) | def forward( class UniSpeechForSequenceClassification (line 1330) | class UniSpeechForSequenceClassification(UniSpeechPreTrainedModel): method __init__ (line 1331) | def __init__(self, config): method freeze_feature_encoder (line 1348) | def freeze_feature_encoder(self): method freeze_base_model (line 1355) | def freeze_base_model(self): method forward (line 1364) | def forward( FILE: src/transformers/models/unispeech/modular_unispeech.py class UniSpeechForPreTrainingOutput (line 49) | class UniSpeechForPreTrainingOutput(ModelOutput): class UniSpeechPositionalConvEmbedding (line 72) | class UniSpeechPositionalConvEmbedding(Wav2Vec2PositionalConvEmbedding): class UniSpeechFeatureEncoder (line 76) | class UniSpeechFeatureEncoder(Wav2Vec2FeatureEncoder): class UniSpeechFeatureProjection (line 80) | class UniSpeechFeatureProjection(Wav2Vec2FeatureProjection): class UniSpeechEncoder (line 84) | class UniSpeechEncoder(Wav2Vec2Encoder): class UniSpeechEncoderStableLayerNorm (line 88) | class UniSpeechEncoderStableLayerNorm(Wav2Vec2EncoderStableLayerNorm): class UniSpeechGumbelVectorQuantizer (line 92) | class UniSpeechGumbelVectorQuantizer(Wav2Vec2GumbelVectorQuantizer): method _compute_perplexity (line 94) | def _compute_perplexity(probs): method forward (line 99) | def forward(self, hidden_states): class UniSpeechPreTrainedModel (line 138) | class UniSpeechPreTrainedModel(PreTrainedModel): method _init_weights (line 149) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 182) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 197) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... class UniSpeechModel (line 216) | class UniSpeechModel(UniSpeechPreTrainedModel, Wav2Vec2Model): method __init__ (line 217) | def __init__(self, config: UniSpeechConfig): method freeze_feature_encoder (line 234) | def freeze_feature_encoder(self): method forward (line 237) | def forward( class UniSpeechForPreTraining (line 296) | class UniSpeechForPreTraining(UniSpeechPreTrainedModel): method __init__ (line 297) | def __init__(self, config: UniSpeechConfig): method set_gumbel_temperature (line 312) | def set_gumbel_temperature(self, temperature: int): method freeze_feature_encoder (line 318) | def freeze_feature_encoder(self): method compute_contrastive_logits (line 326) | def compute_contrastive_logits( method forward (line 346) | def forward( class UniSpeechForCTC (line 418) | class UniSpeechForCTC(Wav2Vec2ForCTC): class UniSpeechForSequenceClassification (line 422) | class UniSpeechForSequenceClassification(Wav2Vec2ForSequenceClassificati... FILE: src/transformers/models/unispeech_sat/configuration_unispeech_sat.py class UniSpeechSatConfig (line 27) | class UniSpeechSatConfig(PreTrainedConfig): method __post_init__ (line 198) | def __post_init__(self, **kwargs): method validate_architecture (line 202) | def validate_architecture(self): method inputs_to_logits_ratio (line 217) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/unispeech_sat/convert_unispeech_original_s3prl_checkpoint_to_pytorch.py function convert_classification (line 34) | def convert_classification(base_model_name, hf_config, downstream_dict): function convert_diarization (line 43) | def convert_diarization(base_model_name, hf_config, downstream_dict): function convert_xvector (line 50) | def convert_xvector(base_model_name, hf_config, downstream_dict): function convert_s3prl_checkpoint (line 69) | def convert_s3prl_checkpoint(base_model_name, config_path, checkpoint_pa... FILE: src/transformers/models/unispeech_sat/convert_unispeech_sat_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 62) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 91) | def recursively_load_weights(fairseq_model, hf_model): function load_conv_layer (line 138) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_unispeech_sat_checkpoint (line 183) | def convert_unispeech_sat_checkpoint( FILE: src/transformers/models/unispeech_sat/modeling_unispeech_sat.py class UniSpeechSatForPreTrainingOutput (line 62) | class UniSpeechSatForPreTrainingOutput(ModelOutput): class UniSpeechSatSamePadLayer (line 88) | class UniSpeechSatSamePadLayer(nn.Module): method __init__ (line 89) | def __init__(self, num_conv_pos_embeddings): method forward (line 93) | def forward(self, hidden_states): class UniSpeechSatPositionalConvEmbedding (line 99) | class UniSpeechSatPositionalConvEmbedding(nn.Module): method __init__ (line 100) | def __init__(self, config): method forward (line 133) | def forward(self, hidden_states): class UniSpeechSatNoLayerNormConvLayer (line 144) | class UniSpeechSatNoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 145) | def __init__(self, config, layer_id=0): method forward (line 159) | def forward(self, hidden_states): class UniSpeechSatLayerNormConvLayer (line 165) | class UniSpeechSatLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 166) | def __init__(self, config, layer_id=0): method forward (line 181) | def forward(self, hidden_states): class UniSpeechSatGroupNormConvLayer (line 192) | class UniSpeechSatGroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 193) | def __init__(self, config, layer_id=0): method forward (line 209) | def forward(self, hidden_states): class UniSpeechSatFeatureEncoder (line 216) | class UniSpeechSatFeatureEncoder(nn.Module): method __init__ (line 219) | def __init__(self, config): method _freeze_parameters (line 239) | def _freeze_parameters(self): method forward (line 244) | def forward(self, input_values): class UniSpeechSatFeatureProjection (line 257) | class UniSpeechSatFeatureProjection(nn.Module): method __init__ (line 258) | def __init__(self, config): method forward (line 264) | def forward(self, hidden_states): function eager_attention_forward (line 272) | def eager_attention_forward( class UniSpeechSatAttention (line 300) | class UniSpeechSatAttention(nn.Module): method __init__ (line 303) | def __init__( method forward (line 334) | def forward( class UniSpeechSatFeedForward (line 386) | class UniSpeechSatFeedForward(nn.Module): method __init__ (line 387) | def __init__(self, config): method forward (line 400) | def forward(self, hidden_states): class UniSpeechSatEncoderLayer (line 410) | class UniSpeechSatEncoderLayer(GradientCheckpointingLayer): method __init__ (line 411) | def __init__(self, config): method forward (line 426) | def forward(self, hidden_states, attention_mask=None, output_attention... class UniSpeechSatEncoder (line 446) | class UniSpeechSatEncoder(nn.Module): method __init__ (line 447) | def __init__(self, config): method forward (line 456) | def forward( class UniSpeechSatAttnAdapterLayer (line 518) | class UniSpeechSatAttnAdapterLayer(nn.Module): method __init__ (line 519) | def __init__(self, config): method forward (line 533) | def forward(self, hidden_states: torch.FloatTensor): class UniSpeechSatEncoderLayerStableLayerNorm (line 543) | class UniSpeechSatEncoderLayerStableLayerNorm(GradientCheckpointingLayer): method __init__ (line 544) | def __init__(self, config): method forward (line 563) | def forward( class UniSpeechSatEncoderStableLayerNorm (line 589) | class UniSpeechSatEncoderStableLayerNorm(nn.Module): method __init__ (line 590) | def __init__(self, config): method forward (line 601) | def forward( class UniSpeechSatGumbelVectorQuantizer (line 665) | class UniSpeechSatGumbelVectorQuantizer(nn.Module): method __init__ (line 671) | def __init__(self, config): method _compute_perplexity (line 692) | def _compute_perplexity(probs, mask=None): method forward (line 697) | def forward(self, hidden_states): class UniSpeechSatPreTrainedModel (line 736) | class UniSpeechSatPreTrainedModel(PreTrainedModel): method _init_weights (line 747) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 780) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 795) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... function _compute_mask_indices (line 811) | def _compute_mask_indices( class UniSpeechSatModel (line 934) | class UniSpeechSatModel(UniSpeechSatPreTrainedModel): method __init__ (line 935) | def __init__(self, config: UniSpeechSatConfig): method _mask_hidden_states (line 951) | def _mask_hidden_states( method forward (line 998) | def forward( class UniSpeechSatForPreTraining (line 1057) | class UniSpeechSatForPreTraining(UniSpeechSatPreTrainedModel): method __init__ (line 1058) | def __init__(self, config: UniSpeechSatConfig): method set_gumbel_temperature (line 1080) | def set_gumbel_temperature(self, temperature: int): method freeze_feature_encoder (line 1086) | def freeze_feature_encoder(self): method compute_contrastive_logits (line 1094) | def compute_contrastive_logits( method forward (line 1114) | def forward( class UniSpeechSatForCTC (line 1178) | class UniSpeechSatForCTC(UniSpeechSatPreTrainedModel): method __init__ (line 1179) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 1208) | def tie_weights(self, **kwargs): method freeze_feature_encoder (line 1232) | def freeze_feature_encoder(self): method freeze_base_model (line 1239) | def freeze_base_model(self): method forward (line 1248) | def forward( class UniSpeechSatForSequenceClassification (line 1326) | class UniSpeechSatForSequenceClassification(UniSpeechSatPreTrainedModel): method __init__ (line 1327) | def __init__(self, config): method freeze_feature_encoder (line 1344) | def freeze_feature_encoder(self): method freeze_base_model (line 1351) | def freeze_base_model(self): method forward (line 1360) | def forward( class UniSpeechSatForAudioFrameClassification (line 1431) | class UniSpeechSatForAudioFrameClassification(UniSpeechSatPreTrainedModel): method __init__ (line 1432) | def __init__(self, config): method freeze_feature_encoder (line 1448) | def freeze_feature_encoder(self): method freeze_base_model (line 1455) | def freeze_base_model(self): method forward (line 1464) | def forward( class AMSoftmaxLoss (line 1525) | class AMSoftmaxLoss(nn.Module): method __init__ (line 1526) | def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4): method forward (line 1534) | def forward(self, hidden_states, labels): class TDNNLayer (line 1548) | class TDNNLayer(nn.Module): method __init__ (line 1549) | def __init__(self, config, layer_id=0): method forward (line 1559) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UniSpeechSatForXVector (line 1585) | class UniSpeechSatForXVector(UniSpeechSatPreTrainedModel): method __init__ (line 1586) | def __init__(self, config): method freeze_feature_encoder (line 1605) | def freeze_feature_encoder(self): method freeze_base_model (line 1612) | def freeze_base_model(self): method _get_tdnn_output_lengths (line 1620) | def _get_tdnn_output_lengths(self, input_lengths: torch.LongTensor | i... method forward (line 1636) | def forward( FILE: src/transformers/models/unispeech_sat/modular_unispeech_sat.py class UniSpeechSatForPreTrainingOutput (line 54) | class UniSpeechSatForPreTrainingOutput(ModelOutput): class UniSpeechSatPositionalConvEmbedding (line 80) | class UniSpeechSatPositionalConvEmbedding(Wav2Vec2PositionalConvEmbedding): class UniSpeechSatFeatureEncoder (line 84) | class UniSpeechSatFeatureEncoder(Wav2Vec2FeatureEncoder): class UniSpeechSatFeatureProjection (line 88) | class UniSpeechSatFeatureProjection(Wav2Vec2FeatureProjection): class UniSpeechSatEncoder (line 92) | class UniSpeechSatEncoder(Wav2Vec2Encoder): class UniSpeechSatEncoderStableLayerNorm (line 96) | class UniSpeechSatEncoderStableLayerNorm(Wav2Vec2EncoderStableLayerNorm): class UniSpeechSatGumbelVectorQuantizer (line 100) | class UniSpeechSatGumbelVectorQuantizer(Wav2Vec2GumbelVectorQuantizer): method __init__ (line 101) | def __init__(self, config): method _compute_perplexity (line 106) | def _compute_perplexity(probs, mask=None): method forward (line 111) | def forward(self, hidden_states): class UniSpeechSatPreTrainedModel (line 150) | class UniSpeechSatPreTrainedModel(PreTrainedModel): method _init_weights (line 161) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 194) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 209) | def _get_feature_vector_attention_mask(self, feature_vector_length: in... class UniSpeechSatModel (line 228) | class UniSpeechSatModel(UniSpeechSatPreTrainedModel, Wav2Vec2Model): method __init__ (line 229) | def __init__(self, config: UniSpeechSatConfig): method freeze_feature_encoder (line 245) | def freeze_feature_encoder(self): method forward (line 248) | def forward( class UniSpeechSatForPreTraining (line 307) | class UniSpeechSatForPreTraining(UniSpeechSatPreTrainedModel): method __init__ (line 308) | def __init__(self, config: UniSpeechSatConfig): method set_gumbel_temperature (line 330) | def set_gumbel_temperature(self, temperature: int): method freeze_feature_encoder (line 336) | def freeze_feature_encoder(self): method compute_contrastive_logits (line 344) | def compute_contrastive_logits( method forward (line 364) | def forward( class UniSpeechSatForCTC (line 420) | class UniSpeechSatForCTC(Wav2Vec2ForCTC): class UniSpeechSatForSequenceClassification (line 424) | class UniSpeechSatForSequenceClassification(Wav2Vec2ForSequenceClassific... class UniSpeechSatForAudioFrameClassification (line 428) | class UniSpeechSatForAudioFrameClassification(Wav2Vec2ForAudioFrameClass... class UniSpeechSatForXVector (line 432) | class UniSpeechSatForXVector(Wav2Vec2ForXVector): FILE: src/transformers/models/univnet/configuration_univnet.py class UnivNetConfig (line 24) | class UnivNetConfig(PreTrainedConfig): method validate_architecture (line 90) | def validate_architecture(self): FILE: src/transformers/models/univnet/convert_univnet.py function get_kernel_predictor_key_mapping (line 26) | def get_kernel_predictor_key_mapping(config: UnivNetConfig, old_prefix: ... function get_key_mapping (line 56) | def get_key_mapping(config: UnivNetConfig): function rename_state_dict (line 88) | def rename_state_dict(state_dict, keys_to_modify, keys_to_remove): function convert_univnet_checkpoint (line 102) | def convert_univnet_checkpoint( function main (line 135) | def main(): FILE: src/transformers/models/univnet/feature_extraction_univnet.py class UnivNetFeatureExtractor (line 29) | class UnivNetFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 101) | def __init__( method normalize (line 177) | def normalize(self, spectrogram): method denormalize (line 180) | def denormalize(self, spectrogram): method mel_spectrogram (line 183) | def mel_spectrogram(self, waveform: np.ndarray) -> np.ndarray: method generate_noise (line 231) | def generate_noise( method batch_decode (line 263) | def batch_decode(self, waveforms, waveform_lengths=None) -> list[np.nd... method __call__ (line 286) | def __call__( method to_dict (line 446) | def to_dict(self) -> dict[str, Any]: FILE: src/transformers/models/univnet/modeling_univnet.py class UnivNetModelOutput (line 37) | class UnivNetModelOutput(ModelOutput): class UnivNetKernelPredictorResidualBlock (line 49) | class UnivNetKernelPredictorResidualBlock(nn.Module): method __init__ (line 59) | def __init__( method forward (line 75) | def forward(self, hidden_states: torch.FloatTensor): method apply_weight_norm (line 85) | def apply_weight_norm(self): method remove_weight_norm (line 93) | def remove_weight_norm(self): class UnivNetKernelPredictor (line 98) | class UnivNetKernelPredictor(nn.Module): method __init__ (line 115) | def __init__( method forward (line 153) | def forward(self, spectrogram: torch.FloatTensor): method apply_weight_norm (line 199) | def apply_weight_norm(self): method remove_weight_norm (line 210) | def remove_weight_norm(self): class UnivNetLvcResidualBlock (line 218) | class UnivNetLvcResidualBlock(nn.Module): method __init__ (line 231) | def __init__( method forward (line 253) | def forward(self, hidden_states, kernel, bias, hop_size=256): method location_variable_convolution (line 269) | def location_variable_convolution( method apply_weight_norm (line 334) | def apply_weight_norm(self): method remove_weight_norm (line 341) | def remove_weight_norm(self): class UnivNetLvcBlock (line 345) | class UnivNetLvcBlock(nn.Module): method __init__ (line 363) | def __init__( method forward (line 393) | def forward(self, hidden_states: torch.FloatTensor, spectrogram: torch... method apply_weight_norm (line 408) | def apply_weight_norm(self): method remove_weight_norm (line 418) | def remove_weight_norm(self): class UnivNetModel (line 426) | class UnivNetModel(PreTrainedModel): method __init__ (line 431) | def __init__(self, config: UnivNetConfig): method forward (line 471) | def forward( method apply_weight_norm (line 594) | def apply_weight_norm(self): method remove_weight_norm (line 604) | def remove_weight_norm(self): FILE: src/transformers/models/upernet/configuration_upernet.py class UperNetConfig (line 26) | class UperNetConfig(PreTrainedConfig): method __post_init__ (line 75) | def __post_init__(self, **kwargs): FILE: src/transformers/models/upernet/convert_convnext_upernet_to_pytorch.py function get_upernet_config (line 28) | def get_upernet_config(model_name): function create_rename_keys (line 72) | def create_rename_keys(config): function rename_key (line 116) | def rename_key(dct, old, new): function convert_upernet_checkpoint (line 121) | def convert_upernet_checkpoint(model_name, pytorch_dump_folder_path, pus... FILE: src/transformers/models/upernet/convert_swin_upernet_to_pytorch.py function get_upernet_config (line 31) | def get_upernet_config(model_name): function create_rename_keys (line 82) | def create_rename_keys(config): function rename_key (line 128) | def rename_key(dct, old, new): function read_in_q_k_v (line 134) | def read_in_q_k_v(state_dict, backbone_config): function correct_unfold_reduction_order (line 159) | def correct_unfold_reduction_order(x): function reverse_correct_unfold_reduction_order (line 166) | def reverse_correct_unfold_reduction_order(x): function correct_unfold_norm_order (line 174) | def correct_unfold_norm_order(x): function reverse_correct_unfold_norm_order (line 184) | def reverse_correct_unfold_norm_order(x): function convert_upernet_checkpoint (line 191) | def convert_upernet_checkpoint(model_name, pytorch_dump_folder_path, pus... FILE: src/transformers/models/upernet/modeling_upernet.py class UperNetConvModule (line 27) | class UperNetConvModule(nn.Module): method __init__ (line 33) | def __init__( method forward (line 54) | def forward(self, input: torch.Tensor) -> torch.Tensor: class UperNetPyramidPoolingBlock (line 62) | class UperNetPyramidPoolingBlock(nn.Module): method __init__ (line 63) | def __init__(self, pool_scale: int, in_channels: int, channels: int) -... method forward (line 72) | def forward(self, input: torch.Tensor) -> torch.Tensor: class UperNetPyramidPoolingModule (line 79) | class UperNetPyramidPoolingModule(nn.Module): method __init__ (line 94) | def __init__(self, pool_scales: tuple[int, ...], in_channels: int, cha... method forward (line 106) | def forward(self, x: torch.Tensor) -> list[torch.Tensor]: class UperNetHead (line 117) | class UperNetHead(nn.Module): method __init__ (line 123) | def __init__(self, config, in_channels): method psp_forward (line 162) | def psp_forward(self, inputs): method forward (line 171) | def forward(self, encoder_hidden_states: torch.Tensor) -> torch.Tensor: class UperNetFCNHead (line 201) | class UperNetFCNHead(nn.Module): method __init__ (line 217) | def __init__( method forward (line 255) | def forward(self, encoder_hidden_states: torch.Tensor) -> torch.Tensor: class UperNetPreTrainedModel (line 266) | class UperNetPreTrainedModel(PreTrainedModel): class UperNetForSemanticSegmentation (line 278) | class UperNetForSemanticSegmentation(UperNetPreTrainedModel): method __init__ (line 279) | def __init__(self, config): method forward (line 294) | def forward( FILE: src/transformers/models/uvdoc/configuration_uvdoc.py class UVDocBackboneConfig (line 34) | class UVDocBackboneConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 103) | def __post_init__(self, **kwargs): class UVDocConfig (line 114) | class UVDocConfig(PreTrainedConfig): method __post_init__ (line 136) | def __post_init__(self, **kwargs): FILE: src/transformers/models/uvdoc/image_processing_uvdoc.py class UVDocImageProcessor (line 36) | class UVDocImageProcessor(TorchvisionBackend): method _preprocess (line 42) | def _preprocess( method post_process_document_rectification (line 91) | def post_process_document_rectification( FILE: src/transformers/models/uvdoc/modeling_uvdoc.py class UVDocConvLayer (line 38) | class UVDocConvLayer(nn.Module): method __init__ (line 41) | def __init__( method forward (line 68) | def forward(self, input: Tensor) -> Tensor: class UVDocResidualBlock (line 75) | class UVDocResidualBlock(nn.Module): method __init__ (line 78) | def __init__( method forward (line 128) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocResNetStage (line 137) | class UVDocResNetStage(nn.Module): method __init__ (line 140) | def __init__(self, config, stage_index): method forward (line 158) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocResNet (line 164) | class UVDocResNet(nn.Module): method __init__ (line 167) | def __init__(self, config): method forward (line 186) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocBridgeBlock (line 194) | class UVDocBridgeBlock(GradientCheckpointingLayer): method __init__ (line 197) | def __init__(self, config, bridge_index): method forward (line 204) | def forward( class UVDocPointPositions2D (line 214) | class UVDocPointPositions2D(nn.Module): method __init__ (line 217) | def __init__(self, config): method forward (line 239) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocPreTrainedModel (line 246) | class UVDocPreTrainedModel(PreTrainedModel): method _init_weights (line 263) | def _init_weights(self, module): class UVDocBridge (line 270) | class UVDocBridge(UVDocPreTrainedModel): method __init__ (line 271) | def __init__(self, config): method forward (line 280) | def forward( class UVDocBackbone (line 295) | class UVDocBackbone(BackboneMixin, UVDocPreTrainedModel): method __init__ (line 299) | def __init__(self, config: UVDocBackboneConfig): method forward (line 315) | def forward( class UVDocHead (line 335) | class UVDocHead(nn.Module): method __init__ (line 336) | def __init__(self, config): method forward (line 351) | def forward( class UVDocModel (line 367) | class UVDocModel(UVDocPreTrainedModel): method __init__ (line 368) | def __init__(self, config: UVDocConfig): method forward (line 377) | def forward( FILE: src/transformers/models/uvdoc/modular_uvdoc.py class UVDocBackboneConfig (line 50) | class UVDocBackboneConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 119) | def __post_init__(self, **kwargs): class UVDocConfig (line 130) | class UVDocConfig(PreTrainedConfig): method __post_init__ (line 152) | def __post_init__(self, **kwargs): class UVDocImageProcessor (line 163) | class UVDocImageProcessor(TorchvisionBackend): method _preprocess (line 169) | def _preprocess( method post_process_document_rectification (line 218) | def post_process_document_rectification( class UVDocConvLayer (line 274) | class UVDocConvLayer(PPLCNetConvLayer): method __init__ (line 277) | def __init__( class UVDocResidualBlock (line 303) | class UVDocResidualBlock(nn.Module): method __init__ (line 306) | def __init__( method forward (line 356) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocResNetStage (line 365) | class UVDocResNetStage(nn.Module): method __init__ (line 368) | def __init__(self, config, stage_index): method forward (line 386) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocResNet (line 392) | class UVDocResNet(nn.Module): method __init__ (line 395) | def __init__(self, config): method forward (line 414) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocBridgeBlock (line 422) | class UVDocBridgeBlock(GradientCheckpointingLayer): method __init__ (line 425) | def __init__(self, config, bridge_index): method forward (line 432) | def forward( class UVDocPointPositions2D (line 442) | class UVDocPointPositions2D(nn.Module): method __init__ (line 445) | def __init__(self, config): method forward (line 467) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class UVDocPreTrainedModel (line 474) | class UVDocPreTrainedModel(PPOCRV5ServerDetPreTrainedModel): method _init_weights (line 481) | def _init_weights(self, module): class UVDocBridge (line 488) | class UVDocBridge(UVDocPreTrainedModel): method __init__ (line 489) | def __init__(self, config): method forward (line 498) | def forward( class UVDocBackbone (line 513) | class UVDocBackbone(BackboneMixin, UVDocPreTrainedModel): method __init__ (line 517) | def __init__(self, config: UVDocBackboneConfig): method forward (line 533) | def forward( class UVDocHead (line 553) | class UVDocHead(nn.Module): method __init__ (line 554) | def __init__(self, config): method forward (line 569) | def forward( class UVDocModel (line 585) | class UVDocModel(UVDocPreTrainedModel): method __init__ (line 586) | def __init__(self, config: UVDocConfig): method forward (line 595) | def forward( FILE: src/transformers/models/vaultgemma/configuration_vaultgemma.py class VaultGemmaConfig (line 31) | class VaultGemmaConfig(PreTrainedConfig): method __post_init__ (line 92) | def __post_init__(self, **kwargs): method validate_architecture (line 100) | def validate_architecture(self): FILE: src/transformers/models/vaultgemma/modeling_vaultgemma.py class VaultGemmaRMSNorm (line 46) | class VaultGemmaRMSNorm(nn.Module): method __init__ (line 47) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 52) | def _norm(self, x): method forward (line 55) | def forward(self, x): method extra_repr (line 62) | def extra_repr(self): class VaultGemmaMLP (line 66) | class VaultGemmaMLP(nn.Module): method __init__ (line 67) | def __init__(self, config): method forward (line 77) | def forward(self, x): function rotate_half (line 82) | def rotate_half(x): function apply_rotary_pos_emb (line 90) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 115) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 127) | def eager_attention_forward( class VaultGemmaAttention (line 162) | class VaultGemmaAttention(nn.Module): method __init__ (line 165) | def __init__(self, config: VaultGemmaConfig, layer_idx: int): method forward (line 191) | def forward( class VaultGemmaDecoderLayer (line 234) | class VaultGemmaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 235) | def __init__(self, config: VaultGemmaConfig, layer_idx: int): method forward (line 245) | def forward( class VaultGemmaRotaryEmbedding (line 275) | class VaultGemmaRotaryEmbedding(nn.Module): method __init__ (line 278) | def __init__(self, config: VaultGemmaConfig, device=None): method compute_default_rope_parameters (line 295) | def compute_default_rope_parameters( method forward (line 326) | def forward(self, x, position_ids): class VaultGemmaTextScaledWordEmbedding (line 340) | class VaultGemmaTextScaledWordEmbedding(nn.Embedding): method __init__ (line 345) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 350) | def forward(self, input_ids: torch.Tensor): class VaultGemmaPreTrainedModel (line 355) | class VaultGemmaPreTrainedModel(PreTrainedModel): method _init_weights (line 373) | def _init_weights(self, module): class VaultGemmaModel (line 383) | class VaultGemmaModel(VaultGemmaPreTrainedModel): method __init__ (line 384) | def __init__(self, config: VaultGemmaConfig): method forward (line 405) | def forward( class VaultGemmaForCausalLM (line 468) | class VaultGemmaForCausalLM(VaultGemmaPreTrainedModel, GenerationMixin): method __init__ (line 473) | def __init__(self, config): method forward (line 484) | def forward( FILE: src/transformers/models/vaultgemma/modular_vaultgemma.py class VaultGemmaConfig (line 27) | class VaultGemmaConfig(Gemma2Config): class VaultGemmaRMSNorm (line 49) | class VaultGemmaRMSNorm(Gemma2RMSNorm): class VaultGemmaMLP (line 53) | class VaultGemmaMLP(Gemma2MLP): class VaultGemmaAttention (line 57) | class VaultGemmaAttention(Gemma2Attention): method __init__ (line 60) | def __init__(self, config: VaultGemmaConfig, layer_idx: int): class VaultGemmaDecoderLayer (line 65) | class VaultGemmaDecoderLayer(Gemma2DecoderLayer): method __init__ (line 66) | def __init__(self, **super_kwargs): method forward (line 71) | def forward( class VaultGemmaForCausalLM (line 101) | class VaultGemmaForCausalLM(Gemma2ForCausalLM): FILE: src/transformers/models/vibevoice_acoustic_tokenizer/configuration_vibevoice_acoustic_tokenizer.py class VibeVoiceAcousticTokenizerConfig (line 26) | class VibeVoiceAcousticTokenizerConfig(PretrainedConfig): method hop_length (line 76) | def hop_length(self): method encoder_config (line 80) | def encoder_config(self): method decoder_config (line 84) | def decoder_config(self): class VibeVoiceAcousticTokenizerEncoderConfig (line 92) | class VibeVoiceAcousticTokenizerEncoderConfig(VibeVoiceAcousticTokenizer... method encoder_config (line 116) | def encoder_config(self): class VibeVoiceAcousticTokenizerDecoderConfig (line 122) | class VibeVoiceAcousticTokenizerDecoderConfig(VibeVoiceAcousticTokenizer... method encoder_config (line 146) | def encoder_config(self): method decoder_config (line 150) | def decoder_config(self): method upsampling_ratios (line 154) | def upsampling_ratios(self): FILE: src/transformers/models/vibevoice_acoustic_tokenizer/convert_vibevoice_acoustic_tokenizer_to_hf.py function map_old_key_to_new (line 61) | def map_old_key_to_new(old_key: str) -> str: function convert_state_dict (line 88) | def convert_state_dict(original_state_dict: dict[str, Any]) -> dict[str,... function convert_checkpoint (line 100) | def convert_checkpoint(checkpoint, config_path, push_to_hub, bfloat16, p... FILE: src/transformers/models/vibevoice_acoustic_tokenizer/feature_extraction_vibevoice_acoustic_tokenizer.py class VibeVoiceAcousticTokenizerFeatureExtractor (line 29) | class VibeVoiceAcousticTokenizerFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 51) | def __init__( method __call__ (line 67) | def __call__( FILE: src/transformers/models/vibevoice_acoustic_tokenizer/modeling_vibevoice_acoustic_tokenizer.py class VibeVoiceAcousticTokenizerOutput (line 42) | class VibeVoiceAcousticTokenizerOutput(ModelOutput): class VibeVoiceAcousticTokenizerEncoderOutput (line 60) | class VibeVoiceAcousticTokenizerEncoderOutput(ModelOutput): class VibeVoiceAcousticTokenizerDecoderOutput (line 75) | class VibeVoiceAcousticTokenizerDecoderOutput(ModelOutput): class VibeVoiceAcousticTokenizerRMSNorm (line 89) | class VibeVoiceAcousticTokenizerRMSNorm(nn.Module): method __init__ (line 90) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 98) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 105) | def extra_repr(self): class VibeVoiceAcousticTokenizerFeedForward (line 109) | class VibeVoiceAcousticTokenizerFeedForward(nn.Module): method __init__ (line 110) | def __init__(self, config, hidden_size): method forward (line 116) | def forward(self, hidden_states): class VibeVoiceAcousticTokenizerConv1dCacheLayer (line 120) | class VibeVoiceAcousticTokenizerConv1dCacheLayer: method __init__ (line 121) | def __init__(self): method lazy_initialization (line 125) | def lazy_initialization(self, hidden_states, conv_module): method update (line 141) | def update(self, hidden_states, conv_module=None): class VibeVoiceAcousticTokenizerConv1dPaddingCache (line 167) | class VibeVoiceAcousticTokenizerConv1dPaddingCache: method __init__ (line 168) | def __init__(self): method update (line 171) | def update(self, hidden_states, cache_key, conv_module): class VibeVoiceAcousticTokenizerCausalConv1d (line 181) | class VibeVoiceAcousticTokenizerCausalConv1d(nn.Module): method __init__ (line 184) | def __init__( method forward (line 206) | def forward( class VibeVoiceAcousticTokenizerCausalConvTranspose1d (line 219) | class VibeVoiceAcousticTokenizerCausalConvTranspose1d(nn.Module): method __init__ (line 222) | def __init__( method forward (line 240) | def forward( class VibeVoiceAcousticTokenizerConvNext1dLayer (line 263) | class VibeVoiceAcousticTokenizerConvNext1dLayer(nn.Module): method __init__ (line 266) | def __init__(self, config, hidden_size, dilation=1, stride=1, layer_id... method forward (line 284) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerEncoderStem (line 300) | class VibeVoiceAcousticTokenizerEncoderStem(nn.Module): method __init__ (line 301) | def __init__(self, config): method forward (line 321) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerEncoderLayer (line 328) | class VibeVoiceAcousticTokenizerEncoderLayer(nn.Module): method __init__ (line 329) | def __init__(self, config, stage_idx): method forward (line 352) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerPreTrainedModel (line 360) | class VibeVoiceAcousticTokenizerPreTrainedModel(PreTrainedModel): method _init_weights (line 366) | def _init_weights(self, module): class VibeVoiceAcousticTokenizerEncoderModel (line 373) | class VibeVoiceAcousticTokenizerEncoderModel(VibeVoiceAcousticTokenizerP... method __init__ (line 376) | def __init__(self, config): method forward (line 394) | def forward(self, hidden_states, padding_cache=None, use_cache=False, ... class VibeVoiceAcousticTokenizerDecoderStem (line 406) | class VibeVoiceAcousticTokenizerDecoderStem(nn.Module): method __init__ (line 407) | def __init__(self, config): method forward (line 428) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerDecoderLayer (line 435) | class VibeVoiceAcousticTokenizerDecoderLayer(nn.Module): method __init__ (line 436) | def __init__(self, config, stage_idx): method forward (line 459) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerDecoderModel (line 466) | class VibeVoiceAcousticTokenizerDecoderModel(VibeVoiceAcousticTokenizerP... method __init__ (line 469) | def __init__(self, config): method forward (line 487) | def forward(self, hidden_states, padding_cache=None, use_cache=False, ... class VibeVoiceAcousticTokenizerModel (line 503) | class VibeVoiceAcousticTokenizerModel(VibeVoiceAcousticTokenizerPreTrain... method __init__ (line 504) | def __init__(self, config): method encode (line 512) | def encode(self, input_values, padding_cache=None, use_cache=None, sam... method decode (line 538) | def decode(self, latents, padding_cache=None, use_cache=False): method forward (line 552) | def forward(self, input_values, padding_cache=None, use_cache=False, s... FILE: src/transformers/models/vibevoice_acoustic_tokenizer/modular_vibevoice_acoustic_tokenizer.py class VibeVoiceAcousticTokenizerOutput (line 37) | class VibeVoiceAcousticTokenizerOutput(ModelOutput): class VibeVoiceAcousticTokenizerEncoderOutput (line 55) | class VibeVoiceAcousticTokenizerEncoderOutput(ModelOutput): class VibeVoiceAcousticTokenizerDecoderOutput (line 70) | class VibeVoiceAcousticTokenizerDecoderOutput(ModelOutput): class VibeVoiceAcousticTokenizerRMSNorm (line 83) | class VibeVoiceAcousticTokenizerRMSNorm(LlamaRMSNorm): class VibeVoiceAcousticTokenizerFeedForward (line 87) | class VibeVoiceAcousticTokenizerFeedForward(nn.Module): method __init__ (line 88) | def __init__(self, config, hidden_size): method forward (line 94) | def forward(self, hidden_states): class VibeVoiceAcousticTokenizerConv1dPaddingCache (line 98) | class VibeVoiceAcousticTokenizerConv1dPaddingCache(VoxtralRealtimeConv1d... class VibeVoiceAcousticTokenizerCausalConv1d (line 103) | class VibeVoiceAcousticTokenizerCausalConv1d(nn.Module): method __init__ (line 106) | def __init__( method forward (line 128) | def forward( class VibeVoiceAcousticTokenizerCausalConvTranspose1d (line 141) | class VibeVoiceAcousticTokenizerCausalConvTranspose1d(nn.Module): method __init__ (line 144) | def __init__( method forward (line 162) | def forward( class VibeVoiceAcousticTokenizerConvNext1dLayer (line 185) | class VibeVoiceAcousticTokenizerConvNext1dLayer(nn.Module): method __init__ (line 188) | def __init__(self, config, hidden_size, dilation=1, stride=1, layer_id... method forward (line 206) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerEncoderStem (line 222) | class VibeVoiceAcousticTokenizerEncoderStem(nn.Module): method __init__ (line 223) | def __init__(self, config): method forward (line 243) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerEncoderLayer (line 250) | class VibeVoiceAcousticTokenizerEncoderLayer(nn.Module): method __init__ (line 251) | def __init__(self, config, stage_idx): method forward (line 274) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerPreTrainedModel (line 282) | class VibeVoiceAcousticTokenizerPreTrainedModel(PreTrainedModel): method _init_weights (line 288) | def _init_weights(self, module): class VibeVoiceAcousticTokenizerEncoderModel (line 295) | class VibeVoiceAcousticTokenizerEncoderModel(VibeVoiceAcousticTokenizerP... method __init__ (line 298) | def __init__(self, config): method forward (line 316) | def forward(self, hidden_states, padding_cache=None, use_cache=False, ... class VibeVoiceAcousticTokenizerDecoderStem (line 328) | class VibeVoiceAcousticTokenizerDecoderStem(nn.Module): method __init__ (line 329) | def __init__(self, config): method forward (line 350) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerDecoderLayer (line 357) | class VibeVoiceAcousticTokenizerDecoderLayer(nn.Module): method __init__ (line 358) | def __init__(self, config, stage_idx): method forward (line 381) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAcousticTokenizerDecoderModel (line 388) | class VibeVoiceAcousticTokenizerDecoderModel(VibeVoiceAcousticTokenizerP... method __init__ (line 391) | def __init__(self, config): method forward (line 409) | def forward(self, hidden_states, padding_cache=None, use_cache=False, ... class VibeVoiceAcousticTokenizerModel (line 425) | class VibeVoiceAcousticTokenizerModel(VibeVoiceAcousticTokenizerPreTrain... method __init__ (line 426) | def __init__(self, config): method encode (line 434) | def encode(self, input_values, padding_cache=None, use_cache=None, sam... method decode (line 460) | def decode(self, latents, padding_cache=None, use_cache=False): method forward (line 474) | def forward(self, input_values, padding_cache=None, use_cache=False, s... FILE: src/transformers/models/vibevoice_asr/configuration_vibevoice_asr.py class VibeVoiceAsrConfig (line 29) | class VibeVoiceAsrConfig(PretrainedConfig): method __post_init__ (line 79) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vibevoice_asr/convert_vibevoice_asr_to_hf.py function map_old_key_to_new (line 78) | def map_old_key_to_new(old_key: str) -> str: function convert_state_dict (line 96) | def convert_state_dict(original_state_dict: dict[str, Any]) -> dict[str,... function load_original_checkpoint (line 108) | def load_original_checkpoint(checkpoint_path: str | Path) -> dict[str, A... function create_config_from_checkpoint (line 142) | def create_config_from_checkpoint(checkpoint_path: str | Path) -> VibeVo... function create_processor (line 220) | def create_processor(checkpoint_path: str | Path, output_dir: str | Path... function convert_checkpoint (line 258) | def convert_checkpoint(checkpoint_path, output_dir, push_to_hub, bfloat1... function main (line 344) | def main(): FILE: src/transformers/models/vibevoice_asr/modeling_vibevoice_asr.py class VibeVoiceAsrRMSNorm (line 37) | class VibeVoiceAsrRMSNorm(nn.Module): method __init__ (line 38) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 46) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 53) | def extra_repr(self): class VibeVoiceAsrMultiModalProjector (line 57) | class VibeVoiceAsrMultiModalProjector(nn.Module): method __init__ (line 58) | def __init__(self, config: VibeVoiceAsrConfig): method forward (line 74) | def forward(self, acoustic_latents, semantic_latents): class VibeVoiceAsrFeedForward (line 86) | class VibeVoiceAsrFeedForward(nn.Module): method __init__ (line 87) | def __init__(self, config, hidden_size): method forward (line 93) | def forward(self, hidden_states): class VibeVoiceAsrConv1dCacheLayer (line 97) | class VibeVoiceAsrConv1dCacheLayer: method __init__ (line 98) | def __init__(self): method lazy_initialization (line 102) | def lazy_initialization(self, hidden_states, conv_module): method update (line 118) | def update(self, hidden_states, conv_module=None): class VibeVoiceAsrConv1dPaddingCache (line 144) | class VibeVoiceAsrConv1dPaddingCache: method __init__ (line 145) | def __init__(self): method update (line 148) | def update(self, hidden_states, cache_key, conv_module): class VibeVoiceAsrCausalConv1d (line 158) | class VibeVoiceAsrCausalConv1d(nn.Module): method __init__ (line 161) | def __init__( method forward (line 183) | def forward( class VibeVoiceAsrConvNext1dLayer (line 196) | class VibeVoiceAsrConvNext1dLayer(nn.Module): method __init__ (line 199) | def __init__(self, config, hidden_size, dilation=1, stride=1, layer_id... method forward (line 217) | def forward(self, hidden_states, padding_cache=None): class VibeVoiceAsrPreTrainedModel (line 234) | class VibeVoiceAsrPreTrainedModel(PreTrainedModel): method _init_weights (line 245) | def _init_weights(self, module): class VibeVoiceAsrForConditionalGeneration (line 257) | class VibeVoiceAsrForConditionalGeneration(VibeVoiceAsrPreTrainedModel, ... method __init__ (line 262) | def __init__(self, config: VibeVoiceAsrConfig): method get_input_embeddings (line 273) | def get_input_embeddings(self): method set_input_embeddings (line 276) | def set_input_embeddings(self, value): method get_output_embeddings (line 279) | def get_output_embeddings(self): method set_output_embeddings (line 282) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 285) | def set_decoder(self, decoder): method get_decoder (line 288) | def get_decoder(self): method get_audio_features (line 293) | def get_audio_features( method forward (line 367) | def forward( method prepare_inputs_for_generation (line 422) | def prepare_inputs_for_generation(self, *args, is_first_iteration=Fals... FILE: src/transformers/models/vibevoice_asr/modular_vibevoice_asr.py class VibeVoiceAsrConfig (line 36) | class VibeVoiceAsrConfig(PretrainedConfig): method __post_init__ (line 86) | def __post_init__(self, **kwargs): class VibeVoiceAsrRMSNorm (line 118) | class VibeVoiceAsrRMSNorm(Qwen2RMSNorm): class VibeVoiceAsrMultiModalProjector (line 122) | class VibeVoiceAsrMultiModalProjector(nn.Module): method __init__ (line 123) | def __init__(self, config: VibeVoiceAsrConfig): method forward (line 139) | def forward(self, acoustic_latents, semantic_latents): class VibeVoiceAsrPreTrainedModel (line 152) | class VibeVoiceAsrPreTrainedModel(VibeVoiceAcousticTokenizerPreTrainedMo... class VibeVoiceAsrForConditionalGeneration (line 169) | class VibeVoiceAsrForConditionalGeneration(AudioFlamingo3ForConditionalG... method __init__ (line 170) | def __init__(self, config: VibeVoiceAsrConfig): method get_audio_features (line 178) | def get_audio_features( method forward (line 252) | def forward( method prepare_inputs_for_generation (line 307) | def prepare_inputs_for_generation(self, *args, is_first_iteration=Fals... FILE: src/transformers/models/vibevoice_asr/processing_vibevoice_asr.py class VibeVoiceAsrProcessorKwargs (line 34) | class VibeVoiceAsrProcessorKwargs(ProcessingKwargs, total=False): class VibeVoiceAsrProcessor (line 52) | class VibeVoiceAsrProcessor(ProcessorMixin): method __init__ (line 80) | def __init__( method __call__ (line 99) | def __call__( method apply_transcription_request (line 175) | def apply_transcription_request( method decode (line 246) | def decode(self, *args, return_format="raw", **kwargs): method extract_speaker_dict (line 281) | def extract_speaker_dict(self, text: str | list[str]) -> list[dict] | ... method extract_transcription (line 343) | def extract_transcription(self, text: str | list[str]) -> str | list[s... FILE: src/transformers/models/video_llama_3/configuration_video_llama_3.py class VideoLlama3VisionConfig (line 29) | class VideoLlama3VisionConfig(PreTrainedConfig): class VideoLlama3Config (line 63) | class VideoLlama3Config(PreTrainedConfig): method __post_init__ (line 74) | def __post_init__(self, **kwargs): FILE: src/transformers/models/video_llama_3/image_processing_pil_video_llama_3.py class VideoLlama3ImageProcessorKwargs (line 33) | class VideoLlama3ImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 54) | def smart_resize( class VideoLlama3ImageProcessorPil (line 84) | class VideoLlama3ImageProcessorPil(PilBackend): method __init__ (line 104) | def __init__(self, **kwargs: Unpack[VideoLlama3ImageProcessorKwargs]): method _standardize_kwargs (line 121) | def _standardize_kwargs( method preprocess (line 137) | def preprocess( method _preprocess (line 144) | def _preprocess( method get_number_of_image_patches (line 233) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/video_llama_3/image_processing_video_llama_3.py class VideoLlama3ImageProcessorKwargs (line 33) | class VideoLlama3ImageProcessorKwargs(ImagesKwargs, total=False): function smart_resize (line 54) | def smart_resize( class VideoLlama3ImageProcessor (line 84) | class VideoLlama3ImageProcessor(TorchvisionBackend): method __init__ (line 104) | def __init__(self, **kwargs: Unpack[VideoLlama3ImageProcessorKwargs]): method _standardize_kwargs (line 121) | def _standardize_kwargs( method preprocess (line 137) | def preprocess( method _preprocess (line 144) | def _preprocess( method get_number_of_image_patches (line 240) | def get_number_of_image_patches(self, height: int, width: int, images_... FILE: src/transformers/models/video_llama_3/modeling_video_llama_3.py class VideoLlama3VisionRotaryEmbedding (line 43) | class VideoLlama3VisionRotaryEmbedding(nn.Module): method __init__ (line 46) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 53) | def forward(self, grid_thw, merge_sizes) -> tuple[torch.Tensor, torch.... class VideoLlama3VisionEmbeddings (line 88) | class VideoLlama3VisionEmbeddings(nn.Module): method __init__ (line 89) | def __init__(self, config: VideoLlama3VisionConfig) -> None: method forward (line 103) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideoLlama3VisionMLP (line 110) | class VideoLlama3VisionMLP(nn.Module): method __init__ (line 111) | def __init__(self, config): method forward (line 118) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 125) | def eager_attention_forward( function rotate_half (line 150) | def rotate_half(x): function repeat_kv (line 157) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function apply_rotary_pos_emb_vision (line 169) | def apply_rotary_pos_emb_vision( class VideoLlama3VisionAttention (line 183) | class VideoLlama3VisionAttention(nn.Module): method __init__ (line 186) | def __init__(self, config): method forward (line 207) | def forward( class VideoLlama3VisionEncoderLayer (line 288) | class VideoLlama3VisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 289) | def __init__(self, config: VideoLlama3VisionConfig): method forward (line 298) | def forward( class VideoLlama3VisionEncoder (line 330) | class VideoLlama3VisionEncoder(nn.Module): method __init__ (line 339) | def __init__(self, config: VideoLlama3VisionConfig): method forward (line 348) | def forward( class VideoLlama3PreTrainedModel (line 373) | class VideoLlama3PreTrainedModel(PreTrainedModel): method _init_weights (line 386) | def _init_weights(self, module): class VideoLlama3VisionModel (line 393) | class VideoLlama3VisionModel(VideoLlama3PreTrainedModel): method __init__ (line 402) | def __init__(self, config: VideoLlama3VisionConfig): method get_input_embeddings (line 413) | def get_input_embeddings(self) -> VideoLlama3VisionEmbeddings: method pixel_unshuffle (line 416) | def pixel_unshuffle( method forward (line 442) | def forward( class VideoLlama3Projector (line 482) | class VideoLlama3Projector(nn.Module): method __init__ (line 483) | def __init__(self, config: VideoLlama3Config) -> None: method forward (line 493) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideoLlama3ModelOutputWithPast (line 504) | class VideoLlama3ModelOutputWithPast(ModelOutput): class VideoLlama3Model (line 529) | class VideoLlama3Model(VideoLlama3PreTrainedModel): method __init__ (line 535) | def __init__(self, config: VideoLlama3Config): method get_input_embeddings (line 543) | def get_input_embeddings(self): method set_input_embeddings (line 546) | def set_input_embeddings(self, value): method get_video_features (line 551) | def get_video_features( method get_image_features (line 575) | def get_image_features( method get_placeholder_mask (line 606) | def get_placeholder_mask( method forward (line 648) | def forward( class VideoLlama3CausalLMOutputWithPast (line 731) | class VideoLlama3CausalLMOutputWithPast(ModelOutput): class VideoLlama3ForConditionalGeneration (line 760) | class VideoLlama3ForConditionalGeneration(VideoLlama3PreTrainedModel, Ge... method __init__ (line 764) | def __init__(self, config: VideoLlama3Config): method get_input_embeddings (line 771) | def get_input_embeddings(self): method set_input_embeddings (line 774) | def set_input_embeddings(self, value): method get_video_features (line 778) | def get_video_features( method get_image_features (line 795) | def get_image_features( method forward (line 811) | def forward( method prepare_inputs_for_generation (line 883) | def prepare_inputs_for_generation( method _get_image_nums_and_video_nums (line 927) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 1010) | def _expand_inputs_for_generation( FILE: src/transformers/models/video_llama_3/modular_video_llama_3.py class VideoLlama3VisionConfig (line 90) | class VideoLlama3VisionConfig(SiglipVisionConfig): class VideoLlama3Config (line 99) | class VideoLlama3Config(PreTrainedConfig): method __post_init__ (line 110) | def __post_init__(self, **kwargs): class VideoLlama3VisionRotaryEmbedding (line 124) | class VideoLlama3VisionRotaryEmbedding(VisionRotaryEmbedding): method forward (line 125) | def forward(self, grid_thw, merge_sizes) -> tuple[torch.Tensor, torch.... class VideoLlama3VisionEmbeddings (line 160) | class VideoLlama3VisionEmbeddings(nn.Module): method __init__ (line 161) | def __init__(self, config: VideoLlama3VisionConfig) -> None: method forward (line 175) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideoLlama3VisionMLP (line 182) | class VideoLlama3VisionMLP(SiglipMLP): class VideoLlama3VisionAttention (line 186) | class VideoLlama3VisionAttention(SiglipAttention): method __init__ (line 187) | def __init__(self, config): method forward (line 195) | def forward( class VideoLlama3VisionEncoderLayer (line 276) | class VideoLlama3VisionEncoderLayer(SiglipEncoderLayer): method __init__ (line 277) | def __init__(self, config: VideoLlama3VisionConfig): method forward (line 282) | def forward( class VideoLlama3VisionEncoder (line 314) | class VideoLlama3VisionEncoder(SiglipEncoder): method __init__ (line 315) | def __init__(self, config: VideoLlama3VisionConfig): method forward (line 321) | def forward( class VideoLlama3PreTrainedModel (line 345) | class VideoLlama3PreTrainedModel(Qwen2VLPreTrainedModel): method _init_weights (line 349) | def _init_weights(self, module): class VideoLlama3VisionModel (line 356) | class VideoLlama3VisionModel(VideoLlama3PreTrainedModel): method __init__ (line 365) | def __init__(self, config: VideoLlama3VisionConfig): method get_input_embeddings (line 376) | def get_input_embeddings(self) -> VideoLlama3VisionEmbeddings: method pixel_unshuffle (line 379) | def pixel_unshuffle( method forward (line 405) | def forward( class VideoLlama3Projector (line 445) | class VideoLlama3Projector(nn.Module): method __init__ (line 446) | def __init__(self, config: VideoLlama3Config) -> None: method forward (line 456) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideoLlama3ModelOutputWithPast (line 467) | class VideoLlama3ModelOutputWithPast(ModelOutput): class VideoLlama3Model (line 491) | class VideoLlama3Model(Qwen2VLModel): method __init__ (line 494) | def __init__(self, config: VideoLlama3Config): method get_rope_index (line 502) | def get_rope_index(self): method get_vision_position_ids (line 505) | def get_vision_position_ids(self): method compute_3d_position_ids (line 508) | def compute_3d_position_ids(self): method get_video_features (line 513) | def get_video_features( method get_image_features (line 537) | def get_image_features( method forward (line 569) | def forward( class VideoLlama3CausalLMOutputWithPast (line 652) | class VideoLlama3CausalLMOutputWithPast(ModelOutput): class VideoLlama3ForConditionalGeneration (line 681) | class VideoLlama3ForConditionalGeneration(Qwen2VLForConditionalGeneration): method __init__ (line 684) | def __init__(self, config: VideoLlama3Config): method forward (line 689) | def forward( method prepare_inputs_for_generation (line 761) | def prepare_inputs_for_generation( method _prepare_position_ids_for_generation (line 805) | def _prepare_position_ids_for_generation(self): method _get_image_nums_and_video_nums (line 808) | def _get_image_nums_and_video_nums( method _expand_inputs_for_generation (line 891) | def _expand_inputs_for_generation( class VideoLlama3ProcessorKwargs (line 1011) | class VideoLlama3ProcessorKwargs(Qwen2VLProcessorKwargs): class VideoLlama3Processor (line 1021) | class VideoLlama3Processor(Qwen2VLProcessor): method __call__ (line 1022) | def __call__( method model_input_names (line 1106) | def model_input_names(self): class VideoLlama3ImageProcessorKwargs (line 1110) | class VideoLlama3ImageProcessorKwargs(ImagesKwargs, total=False): class VideoLlama3ImageProcessorPil (line 1131) | class VideoLlama3ImageProcessorPil(Qwen2VLImageProcessorPil): method _preprocess (line 1143) | def _preprocess( class VideoLlama3ImageProcessor (line 1233) | class VideoLlama3ImageProcessor(Qwen2VLImageProcessor): method _preprocess (line 1245) | def _preprocess( class VideoLlama3VideoProcessorInitKwargs (line 1342) | class VideoLlama3VideoProcessorInitKwargs(Qwen2VLVideoProcessorInitKwargs): class VideoLlama3VideoProcessor (line 1346) | class VideoLlama3VideoProcessor(Qwen2VLVideoProcessor): method _get_compression_mask (line 1356) | def _get_compression_mask( method _preprocess (line 1400) | def _preprocess( FILE: src/transformers/models/video_llama_3/processing_video_llama_3.py class VideoLlama3ProcessorKwargs (line 31) | class VideoLlama3ProcessorKwargs(ProcessingKwargs, total=False): class VideoLlama3Processor (line 42) | class VideoLlama3Processor(ProcessorMixin): method __init__ (line 43) | def __init__(self, image_processor=None, tokenizer=None, video_process... method __call__ (line 59) | def __call__( method _get_num_multimodal_tokens (line 156) | def _get_num_multimodal_tokens(self, image_sizes=None, video_sizes=Non... method post_process_image_text_to_text (line 194) | def post_process_image_text_to_text( FILE: src/transformers/models/video_llama_3/video_processing_video_llama_3.py class VideoLlama3VideoProcessorInitKwargs (line 41) | class VideoLlama3VideoProcessorInitKwargs(VideosKwargs, total=False): class VideoLlama3VideoProcessor (line 72) | class VideoLlama3VideoProcessor(BaseVideoProcessor): method __init__ (line 92) | def __init__(self, **kwargs: Unpack[VideoLlama3VideoProcessorInitKwarg... method _standardize_kwargs (line 109) | def _standardize_kwargs( method sample_frames (line 124) | def sample_frames( method _preprocess (line 194) | def _preprocess( method get_num_of_video_patches (line 311) | def get_num_of_video_patches(self, num_frames: int, height: int, width... method _get_compression_mask (line 341) | def _get_compression_mask( FILE: src/transformers/models/video_llava/configuration_video_llava.py class VideoLlavaConfig (line 29) | class VideoLlavaConfig(PreTrainedConfig): method __post_init__ (line 71) | def __post_init__(self, **kwargs): FILE: src/transformers/models/video_llava/convert_video_llava_weights_to_hf.py function convert_state_dict_to_hf (line 62) | def convert_state_dict_to_hf(state_dict): function convert_video_llava_llama_to_hf (line 75) | def convert_video_llava_llama_to_hf(text_model_id, vision_model_id, outp... function main (line 131) | def main(): FILE: src/transformers/models/video_llava/image_processing_video_llava.py class VideoLlavaImageProcessor (line 44) | class VideoLlavaImageProcessor(BaseImageProcessor): method __init__ (line 85) | def __init__( method resize (line 118) | def resize( method preprocess (line 168) | def preprocess( method _preprocess_image (line 280) | def _preprocess_image( FILE: src/transformers/models/video_llava/modeling_video_llava.py class VideoLlavaModelOutputWithPast (line 44) | class VideoLlavaModelOutputWithPast(ModelOutput): class VideoLlavaCausalLMOutputWithPast (line 73) | class VideoLlavaCausalLMOutputWithPast(ModelOutput): class VideoLlavaMultiModalProjector (line 102) | class VideoLlavaMultiModalProjector(nn.Module): method __init__ (line 103) | def __init__(self, config: VideoLlavaConfig): method forward (line 117) | def forward(self, image_features): class VideoLlavaPreTrainedModel (line 125) | class VideoLlavaPreTrainedModel(PreTrainedModel): method _init_weights (line 138) | def _init_weights(self, module): class VideoLlavaModel (line 154) | class VideoLlavaModel(VideoLlavaPreTrainedModel): method __init__ (line 155) | def __init__(self, config: VideoLlavaConfig): method get_input_embeddings (line 165) | def get_input_embeddings(self): method set_input_embeddings (line 168) | def set_input_embeddings(self, value): method get_image_features (line 176) | def get_image_features( method get_video_features (line 225) | def get_video_features( method get_placeholder_mask (line 263) | def get_placeholder_mask( method forward (line 307) | def forward( class VideoLlavaForConditionalGeneration (line 380) | class VideoLlavaForConditionalGeneration(VideoLlavaPreTrainedModel, Gene... method __init__ (line 383) | def __init__(self, config: VideoLlavaConfig): method get_input_embeddings (line 389) | def get_input_embeddings(self): method set_input_embeddings (line 392) | def set_input_embeddings(self, value): method get_output_embeddings (line 395) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 401) | def get_image_features( method forward (line 429) | def forward( method prepare_inputs_for_generation (line 556) | def prepare_inputs_for_generation( FILE: src/transformers/models/video_llava/processing_video_llava.py class VideoLlavaProcessor (line 31) | class VideoLlavaProcessor(ProcessorMixin): method __init__ (line 32) | def __init__( method __call__ (line 69) | def __call__( FILE: src/transformers/models/video_llava/video_processing_video_llava.py class VideoLlavaVideoProcessor (line 20) | class VideoLlavaVideoProcessor(BaseVideoProcessor): FILE: src/transformers/models/videomae/configuration_videomae.py class VideoMAEConfig (line 24) | class VideoMAEConfig(PreTrainedConfig): FILE: src/transformers/models/videomae/convert_videomae_to_pytorch.py function get_videomae_config (line 32) | def get_videomae_config(model_name): function set_architecture_configs (line 58) | def set_architecture_configs(model_name, config): function rename_key (line 90) | def rename_key(name): function convert_state_dict (line 137) | def convert_state_dict(orig_state_dict, config): function prepare_video (line 170) | def prepare_video(): function convert_videomae_checkpoint (line 178) | def convert_videomae_checkpoint(checkpoint_url, pytorch_dump_folder_path... FILE: src/transformers/models/videomae/image_processing_pil_videomae.py class VideoMAEImageProcessorPil (line 33) | class VideoMAEImageProcessorPil(PilBackend): method __init__ (line 45) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method _prepare_images_structure (line 48) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method preprocess (line 52) | def preprocess(self, videos: ImageInput, **kwargs: Unpack[ImagesKwargs... method _preprocess (line 61) | def _preprocess( FILE: src/transformers/models/videomae/image_processing_videomae.py class VideoMAEImageProcessor (line 35) | class VideoMAEImageProcessor(TorchvisionBackend): method __init__ (line 47) | def __init__(self, **kwargs: Unpack[ImagesKwargs]): method _prepare_images_structure (line 50) | def _prepare_images_structure(self, images: ImageInput, expected_ndims... method preprocess (line 54) | def preprocess(self, videos: ImageInput, **kwargs: Unpack[ImagesKwargs... method _preprocess (line 63) | def _preprocess( FILE: src/transformers/models/videomae/modeling_videomae.py class VideoMAEDecoderOutput (line 47) | class VideoMAEDecoderOutput(ModelOutput): class VideoMAEForPreTrainingOutput (line 64) | class VideoMAEForPreTrainingOutput(ModelOutput): function get_sinusoid_encoding_table (line 80) | def get_sinusoid_encoding_table(n_position, d_hid): class VideoMAEEmbeddings (line 94) | class VideoMAEEmbeddings(nn.Module): method __init__ (line 100) | def __init__(self, config): method forward (line 109) | def forward(self, pixel_values, bool_masked_pos): class VideoMAEPatchEmbeddings (line 127) | class VideoMAEPatchEmbeddings(nn.Module): method __init__ (line 137) | def __init__(self, config): method forward (line 164) | def forward(self, pixel_values): function eager_attention_forward (line 181) | def eager_attention_forward( class VideoMAESelfAttention (line 209) | class VideoMAESelfAttention(nn.Module): method __init__ (line 210) | def __init__(self, config: VideoMAEConfig) -> None: method forward (line 236) | def forward(self, hidden_states: torch.Tensor | None = None) -> tuple[... class VideoMAESelfOutput (line 270) | class VideoMAESelfOutput(nn.Module): method __init__ (line 276) | def __init__(self, config: VideoMAEConfig): method forward (line 281) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class VideoMAEAttention (line 288) | class VideoMAEAttention(nn.Module): method __init__ (line 289) | def __init__(self, config: VideoMAEConfig): method forward (line 294) | def forward( class VideoMAEIntermediate (line 305) | class VideoMAEIntermediate(nn.Module): method __init__ (line 306) | def __init__(self, config: VideoMAEConfig): method forward (line 314) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideoMAEOutput (line 321) | class VideoMAEOutput(nn.Module): method __init__ (line 322) | def __init__(self, config: VideoMAEConfig): method forward (line 327) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class VideoMAELayer (line 335) | class VideoMAELayer(GradientCheckpointingLayer): method __init__ (line 338) | def __init__(self, config: VideoMAEConfig): method forward (line 348) | def forward( class VideoMAEEncoder (line 370) | class VideoMAEEncoder(nn.Module): method __init__ (line 371) | def __init__(self, config: VideoMAEConfig): method forward (line 377) | def forward( class VideoMAEPreTrainedModel (line 389) | class VideoMAEPreTrainedModel(PreTrainedModel): class VideoMAEModel (line 407) | class VideoMAEModel(VideoMAEPreTrainedModel): method __init__ (line 408) | def __init__(self, config): method get_input_embeddings (line 423) | def get_input_embeddings(self): method forward (line 429) | def forward( class VideoMAEDecoder (line 478) | class VideoMAEDecoder(nn.Module): method __init__ (line 479) | def __init__(self, config: VideoMAEConfig): method forward (line 501) | def forward(self, hidden_states: torch.Tensor, return_token_num: int): class VideoMAEForPreTraining (line 520) | class VideoMAEForPreTraining(VideoMAEPreTrainedModel): method __init__ (line 521) | def __init__(self, config): method forward (line 540) | def forward( class VideoMAEForVideoClassification (line 689) | class VideoMAEForVideoClassification(VideoMAEPreTrainedModel): method __init__ (line 690) | def __init__(self, config): method forward (line 705) | def forward( FILE: src/transformers/models/videomae/video_processing_videomae.py class VideoMAEVideoProcessor (line 20) | class VideoMAEVideoProcessor(BaseVideoProcessor): method preprocess (line 36) | def preprocess(self, videos, **kwargs): FILE: src/transformers/models/videomt/configuration_videomt.py class VideomtConfig (line 29) | class VideomtConfig(PreTrainedConfig): FILE: src/transformers/models/videomt/convert_videomt_to_hf.py function infer_num_attention_heads (line 130) | def infer_num_attention_heads(checkpoint_filename: str, hidden_size: int... function infer_videomt_config (line 142) | def infer_videomt_config( function infer_backbone_model_name (line 170) | def infer_backbone_model_name(checkpoint_filename: str) -> str: function _build_reference_load_dict (line 182) | def _build_reference_load_dict( class _ReferenceLayerScaleAdapter (line 230) | class _ReferenceLayerScaleAdapter(nn.Module): method __init__ (line 231) | def __init__(self, gamma: torch.Tensor): method forward (line 235) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function _prepare_reference_model_for_verify (line 239) | def _prepare_reference_model_for_verify(reference_model: nn.Module) -> N... function load_reference_videomt_class (line 275) | def load_reference_videomt_class(reference_repo_path: Path): function _rename_key (line 336) | def _rename_key(key: str) -> str | None: function _split_qkv (line 344) | def _split_qkv(key: str, tensor: torch.Tensor) -> dict[str, torch.Tensor]: function convert_state_dict (line 349) | def convert_state_dict(state_dict: dict[str, torch.Tensor]) -> tuple[dic... function convert_checkpoint (line 370) | def convert_checkpoint( function verify_conversion_against_github_reference (line 467) | def verify_conversion_against_github_reference( function _resolve_checkpoint_params (line 564) | def _resolve_checkpoint_params( function parse_args (line 582) | def parse_args() -> argparse.Namespace: function main (line 605) | def main() -> None: FILE: src/transformers/models/videomt/modeling_videomt.py class VideomtPatchEmbeddings (line 51) | class VideomtPatchEmbeddings(nn.Module): method __init__ (line 58) | def __init__(self, config): method forward (line 73) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class VideomtEmbeddings (line 86) | class VideomtEmbeddings(nn.Module): method __init__ (line 91) | def __init__(self, config: VideomtConfig) -> None: method forward (line 107) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... class VideomtMLP (line 133) | class VideomtMLP(nn.Module): method __init__ (line 134) | def __init__(self, config) -> None: method forward (line 145) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class VideomtGatedMLP (line 152) | class VideomtGatedMLP(nn.Module): method __init__ (line 153) | def __init__(self, config) -> None: method forward (line 162) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 169) | def eager_attention_forward( class VideomtAttention (line 192) | class VideomtAttention(nn.Module): method __init__ (line 195) | def __init__(self, config): method forward (line 215) | def forward( function drop_path (line 254) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class VideomtDropPath (line 269) | class VideomtDropPath(nn.Module): method __init__ (line 272) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 276) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 279) | def extra_repr(self) -> str: class VideomtSwiGLUFFN (line 283) | class VideomtSwiGLUFFN(nn.Module): method __init__ (line 284) | def __init__(self, config) -> None: method forward (line 293) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class VideomtLayer (line 300) | class VideomtLayer(GradientCheckpointingLayer): method __init__ (line 303) | def __init__(self, config: VideomtConfig) -> None: method forward (line 319) | def forward( class VideomtLayerScale (line 342) | class VideomtLayerScale(nn.Module): method __init__ (line 343) | def __init__(self, config) -> None: method forward (line 347) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class VideomtForUniversalSegmentationOutput (line 362) | class VideomtForUniversalSegmentationOutput(ModelOutput): function sample_point (line 391) | def sample_point( function pair_wise_dice_loss (line 423) | def pair_wise_dice_loss(inputs: Tensor, labels: Tensor) -> Tensor: function pair_wise_sigmoid_cross_entropy_loss (line 445) | def pair_wise_sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: t... class VideomtHungarianMatcher (line 473) | class VideomtHungarianMatcher(nn.Module): method __init__ (line 481) | def __init__( method forward (line 508) | def forward( function dice_loss (line 579) | def dice_loss(inputs: Tensor, labels: Tensor, num_masks: int) -> Tensor: function sigmoid_cross_entropy_loss (line 609) | def sigmoid_cross_entropy_loss(inputs: torch.Tensor, labels: torch.Tenso... class VideomtLoss (line 629) | class VideomtLoss(nn.Module): method __init__ (line 630) | def __init__(self, config: VideomtConfig, weight_dict: dict[str, float]): method _max_by_axis (line 665) | def _max_by_axis(self, sizes: list[list[int]]) -> list[int]: method _pad_images_to_max_in_batch (line 673) | def _pad_images_to_max_in_batch(self, tensors: list[Tensor]) -> tuple[... method loss_labels (line 690) | def loss_labels( method loss_masks (line 724) | def loss_masks( method _get_predictions_permutation_indices (line 786) | def _get_predictions_permutation_indices(self, indices): method _get_targets_permutation_indices (line 792) | def _get_targets_permutation_indices(self, indices): method calculate_uncertainty (line 798) | def calculate_uncertainty(self, logits: torch.Tensor) -> torch.Tensor: method sample_points_using_uncertainty (line 815) | def sample_points_using_uncertainty( method forward (line 870) | def forward( method get_num_masks (line 925) | def get_num_masks(self, class_labels: torch.Tensor, device: torch.devi... class VideomtPreTrainedModel (line 942) | class VideomtPreTrainedModel(PreTrainedModel): method _init_weights (line 961) | def _init_weights(self, module: nn.Module) -> None: class VideomtLayerNorm2d (line 994) | class VideomtLayerNorm2d(nn.LayerNorm): method __init__ (line 995) | def __init__(self, num_channels, eps=1e-6, affine=True): method forward (line 998) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class VideomtScaleLayer (line 1005) | class VideomtScaleLayer(nn.Module): method __init__ (line 1006) | def __init__(self, config: VideomtConfig): method forward (line 1022) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideomtScaleBlock (line 1030) | class VideomtScaleBlock(nn.Module): method __init__ (line 1031) | def __init__(self, config: VideomtConfig): method forward (line 1036) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideomtMaskHead (line 1042) | class VideomtMaskHead(nn.Module): method __init__ (line 1043) | def __init__(self, config: VideomtConfig): method forward (line 1052) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VideomtForUniversalSegmentation (line 1064) | class VideomtForUniversalSegmentation(VideomtPreTrainedModel): method __init__ (line 1067) | def __init__(self, config: VideomtConfig): method get_loss_dict (line 1096) | def get_loss_dict( method get_loss (line 1120) | def get_loss(self, loss_dict: dict[str, Tensor]) -> Tensor: method forward (line 1126) | def forward( method get_input_embeddings (line 1207) | def get_input_embeddings(self): method predict (line 1210) | def predict(self, logits: torch.Tensor): FILE: src/transformers/models/videomt/modular_videomt.py class VideomtConfig (line 39) | class VideomtConfig(EomtConfig): class VideomtPatchEmbeddings (line 43) | class VideomtPatchEmbeddings(EomtPatchEmbeddings): method forward (line 44) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class VideomtEmbeddings (line 57) | class VideomtEmbeddings(EomtEmbeddings): method __init__ (line 58) | def __init__(self, config: VideomtConfig): method forward (line 63) | def forward(self, pixel_values: torch.Tensor, bool_masked_pos: torch.T... class VideomtMLP (line 89) | class VideomtMLP(EomtMLP): class VideomtGatedMLP (line 93) | class VideomtGatedMLP(EomtSwiGLUFFN): class VideomtLayer (line 97) | class VideomtLayer(EomtLayer): class VideomtLayerScale (line 101) | class VideomtLayerScale(EomtLayerScale): class VideomtForUniversalSegmentationOutput (line 116) | class VideomtForUniversalSegmentationOutput(ModelOutput): class VideomtPreTrainedModel (line 144) | class VideomtPreTrainedModel(EomtPreTrainedModel): method _init_weights (line 149) | def _init_weights(self, module: nn.Module) -> None: class VideomtLayerNorm2d (line 155) | class VideomtLayerNorm2d(EomtLayerNorm2d): class VideomtScaleLayer (line 159) | class VideomtScaleLayer(EomtScaleLayer): class VideomtScaleBlock (line 163) | class VideomtScaleBlock(EomtScaleBlock): class VideomtForUniversalSegmentation (line 167) | class VideomtForUniversalSegmentation(EomtForUniversalSegmentation): method __init__ (line 170) | def __init__(self, config: VideomtConfig): method _disable_attention_mask (line 174) | def _disable_attention_mask(attn_mask, prob, num_query_tokens, encoder... method forward (line 177) | def forward( FILE: src/transformers/models/videomt/video_processing_videomt.py function check_segment_validity (line 26) | def check_segment_validity( function compute_segments (line 71) | def compute_segments( class VideomtVideoProcessor (line 145) | class VideomtVideoProcessor(BaseVideoProcessor): method _resize_mask_logits (line 159) | def _resize_mask_logits( method post_process_semantic_segmentation (line 176) | def post_process_semantic_segmentation( method post_process_instance_segmentation (line 213) | def post_process_instance_segmentation( method post_process_panoptic_segmentation (line 284) | def post_process_panoptic_segmentation( FILE: src/transformers/models/vilt/configuration_vilt.py class ViltConfig (line 24) | class ViltConfig(PreTrainedConfig): method __post_init__ (line 76) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vilt/convert_vilt_original_to_pytorch.py function create_rename_keys (line 44) | def create_rename_keys(config, vqa_model=False, nlvr_model=False, irtr_m... function read_in_q_k_v (line 133) | def read_in_q_k_v(state_dict, config): function remove_classification_head_ (line 156) | def remove_classification_head_(state_dict): function rename_key (line 162) | def rename_key(dct, old, new): function convert_vilt_checkpoint (line 168) | def convert_vilt_checkpoint(checkpoint_url, pytorch_dump_folder_path): FILE: src/transformers/models/vilt/image_processing_pil_vilt.py function max_across_indices (line 45) | def max_across_indices(values: Iterable[Any]) -> list[Any]: function make_pixel_mask (line 52) | def make_pixel_mask( function get_resize_output_image_size (line 70) | def get_resize_output_image_size( class ViltImageProcessorKwargs (line 102) | class ViltImageProcessorKwargs(ImagesKwargs, total=False): class ViltImageProcessorPil (line 113) | class ViltImageProcessorPil(PilBackend): method resize (line 127) | def resize( method _pad_batch (line 160) | def _pad_batch( method _preprocess (line 208) | def _preprocess( FILE: src/transformers/models/vilt/image_processing_vilt.py class ViltImageProcessorKwargs (line 41) | class ViltImageProcessorKwargs(ImagesKwargs, total=False): class ViltImageProcessor (line 52) | class ViltImageProcessor(TorchvisionBackend): method resize (line 66) | def resize( method _pad_batch (line 118) | def _pad_batch( method _preprocess (line 178) | def _preprocess( FILE: src/transformers/models/vilt/modeling_vilt.py class ViltForImagesAndTextClassificationOutput (line 49) | class ViltForImagesAndTextClassificationOutput(ModelOutput): class ViltEmbeddings (line 67) | class ViltEmbeddings(nn.Module): method __init__ (line 76) | def __init__(self, config): method visual_embed (line 91) | def visual_embed(self, pixel_values, pixel_mask, max_image_length=200): method forward (line 179) | def forward( class TextEmbeddings (line 221) | class TextEmbeddings(nn.Module): method __init__ (line 224) | def __init__(self, config): method forward (line 240) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class ViltPatchEmbeddings (line 275) | class ViltPatchEmbeddings(nn.Module): method __init__ (line 280) | def __init__(self, config): method forward (line 295) | def forward(self, pixel_values): class ViltSelfAttention (line 306) | class ViltSelfAttention(nn.Module): method __init__ (line 307) | def __init__(self, config): method forward (line 325) | def forward(self, hidden_states, attention_mask=None, output_attention... class ViltSelfOutput (line 369) | class ViltSelfOutput(nn.Module): method __init__ (line 375) | def __init__(self, config: ViltConfig): method forward (line 380) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViltAttention (line 386) | class ViltAttention(nn.Module): method __init__ (line 387) | def __init__(self, config): method forward (line 392) | def forward(self, hidden_states, attention_mask=None, output_attention... class ViltIntermediate (line 402) | class ViltIntermediate(nn.Module): method __init__ (line 403) | def __init__(self, config: ViltConfig): method forward (line 411) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ViltOutput (line 418) | class ViltOutput(nn.Module): method __init__ (line 419) | def __init__(self, config: ViltConfig): method forward (line 424) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViltLayer (line 431) | class ViltLayer(GradientCheckpointingLayer): method __init__ (line 434) | def __init__(self, config): method forward (line 444) | def forward(self, hidden_states, attention_mask=None, output_attention... class ViltEncoder (line 468) | class ViltEncoder(nn.Module): method __init__ (line 469) | def __init__(self, config): method forward (line 475) | def forward( class ViltPreTrainedModel (line 510) | class ViltPreTrainedModel(PreTrainedModel): method _init_weights (line 517) | def _init_weights(self, module): class ViltModel (line 525) | class ViltModel(ViltPreTrainedModel): method __init__ (line 526) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 543) | def get_input_embeddings(self): method set_input_embeddings (line 546) | def set_input_embeddings(self, value): method forward (line 550) | def forward( class ViltPooler (line 663) | class ViltPooler(nn.Module): method __init__ (line 664) | def __init__(self, config): method forward (line 669) | def forward(self, hidden_states): class ViltForMaskedLM (line 683) | class ViltForMaskedLM(ViltPreTrainedModel): method __init__ (line 688) | def __init__(self, config): method get_output_embeddings (line 697) | def get_output_embeddings(self): method set_output_embeddings (line 700) | def set_output_embeddings(self, new_embeddings): method forward (line 705) | def forward( class ViltPredictionHeadTransform (line 820) | class ViltPredictionHeadTransform(nn.Module): method __init__ (line 821) | def __init__(self, config): method forward (line 830) | def forward(self, hidden_states): class ViltMLMHead (line 837) | class ViltMLMHead(nn.Module): method __init__ (line 838) | def __init__(self, config): method forward (line 844) | def forward(self, x): class ViltForQuestionAnswering (line 856) | class ViltForQuestionAnswering(ViltPreTrainedModel): method __init__ (line 857) | def __init__(self, config): method forward (line 875) | def forward( class ViltForImageAndTextRetrieval (line 969) | class ViltForImageAndTextRetrieval(ViltPreTrainedModel): method __init__ (line 970) | def __init__(self, config): method forward (line 982) | def forward( class ViltForImagesAndTextClassification (line 1068) | class ViltForImagesAndTextClassification(ViltPreTrainedModel): method __init__ (line 1069) | def __init__(self, config): method forward (line 1088) | def forward( class ViltForTokenClassification (line 1210) | class ViltForTokenClassification(ViltPreTrainedModel): method __init__ (line 1211) | def __init__(self, config): method forward (line 1224) | def forward( FILE: src/transformers/models/vilt/processing_vilt.py class ViltProcessorKwargs (line 22) | class ViltProcessorKwargs(ProcessingKwargs, total=False): class ViltProcessor (line 38) | class ViltProcessor(ProcessorMixin): method __init__ (line 41) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): FILE: src/transformers/models/vipllava/configuration_vipllava.py class VipLlavaConfig (line 24) | class VipLlavaConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vipllava/convert_vipllava_weights_to_hf.py function convert_state_dict_to_hf (line 46) | def convert_state_dict_to_hf(state_dict): function convert_vipllava_llama_to_hf (line 58) | def convert_vipllava_llama_to_hf(text_model_id, vision_model_id, output_... function main (line 107) | def main(): FILE: src/transformers/models/vipllava/modeling_vipllava.py class VipLlavaModelOutputWithPast (line 44) | class VipLlavaModelOutputWithPast(BaseModelOutputWithPast): class VipLlavaCausalLMOutputWithPast (line 65) | class VipLlavaCausalLMOutputWithPast(ModelOutput): class VipLlavaMultiModalProjector (line 89) | class VipLlavaMultiModalProjector(nn.Module): method __init__ (line 90) | def __init__(self, config: VipLlavaConfig): method forward (line 105) | def forward(self, hidden_states): class VipLlavaPreTrainedModel (line 114) | class VipLlavaPreTrainedModel(PreTrainedModel): class VipLlavaModel (line 134) | class VipLlavaModel(VipLlavaPreTrainedModel): method __init__ (line 135) | def __init__(self, config: VipLlavaConfig): method get_input_embeddings (line 143) | def get_input_embeddings(self): method set_input_embeddings (line 146) | def set_input_embeddings(self, value): method get_image_features (line 153) | def get_image_features( method get_placeholder_mask (line 189) | def get_placeholder_mask( method forward (line 215) | def forward( class VipLlavaForConditionalGeneration (line 276) | class VipLlavaForConditionalGeneration(VipLlavaPreTrainedModel, Generati... method __init__ (line 279) | def __init__(self, config: VipLlavaConfig): method get_input_embeddings (line 285) | def get_input_embeddings(self): method set_input_embeddings (line 288) | def set_input_embeddings(self, value): method get_output_embeddings (line 291) | def get_output_embeddings(self) -> nn.Module: method get_image_features (line 295) | def get_image_features( method forward (line 314) | def forward( method prepare_inputs_for_generation (line 398) | def prepare_inputs_for_generation( FILE: src/transformers/models/vipllava/modular_vipllava.py class VipLlavaModelOutputWithPast (line 38) | class VipLlavaModelOutputWithPast(LlavaModelOutputWithPast): class VipLlavaCausalLMOutputWithPast (line 42) | class VipLlavaCausalLMOutputWithPast(LlavaCausalLMOutputWithPast): class VipLlavaMultiModalProjector (line 46) | class VipLlavaMultiModalProjector(nn.Module): method __init__ (line 47) | def __init__(self, config: VipLlavaConfig): method forward (line 62) | def forward(self, hidden_states): class VipLlavaPreTrainedModel (line 70) | class VipLlavaPreTrainedModel(LlavaPreTrainedModel): class VipLlavaModel (line 74) | class VipLlavaModel(LlavaModel): method get_image_features (line 79) | def get_image_features( method forward (line 117) | def forward( class VipLlavaForConditionalGeneration (line 173) | class VipLlavaForConditionalGeneration(LlavaForConditionalGeneration): method get_image_features (line 175) | def get_image_features( method forward (line 194) | def forward( FILE: src/transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py class VisionEncoderDecoderConfig (line 29) | class VisionEncoderDecoderConfig(PreTrainedConfig): method __post_init__ (line 66) | def __post_init__(self, **kwargs): method from_encoder_decoder_configs (line 83) | def from_encoder_decoder_configs( FILE: src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py function shift_tokens_right (line 32) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class VisionEncoderDecoderModel (line 54) | class VisionEncoderDecoderModel(PreTrainedModel, GenerationMixin): method __init__ (line 70) | def __init__( method get_input_embeddings (line 146) | def get_input_embeddings(self): method get_output_embeddings (line 149) | def get_output_embeddings(self): method set_output_embeddings (line 152) | def set_output_embeddings(self, new_embeddings): method from_encoder_decoder_pretrained (line 156) | def from_encoder_decoder_pretrained( method forward (line 302) | def forward( method prepare_decoder_input_ids_from_labels (line 455) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): FILE: src/transformers/models/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py class VisionTextDualEncoderConfig (line 35) | class VisionTextDualEncoderConfig(PreTrainedConfig): method __post_init__ (line 70) | def __post_init__(self, **kwargs): method from_vision_text_configs (line 94) | def from_vision_text_configs(cls, vision_config: PreTrainedConfig, tex... FILE: src/transformers/models/vision_text_dual_encoder/modeling_vision_text_dual_encoder.py function contrastive_loss (line 33) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function clip_loss (line 38) | def clip_loss(similarity: torch.Tensor) -> torch.Tensor: class VisionTextDualEncoderModel (line 45) | class VisionTextDualEncoderModel(PreTrainedModel): method __init__ (line 52) | def __init__( method get_text_features (line 107) | def get_text_features( method get_image_features (line 144) | def get_image_features( method forward (line 172) | def forward( method from_vision_text_pretrained (line 295) | def from_vision_text_pretrained( FILE: src/transformers/models/vision_text_dual_encoder/processing_vision_text_dual_encoder.py class VisionTextDualEncoderProcessorKwargs (line 22) | class VisionTextDualEncoderProcessorKwargs(ProcessingKwargs, total=False): class VisionTextDualEncoderProcessor (line 27) | class VisionTextDualEncoderProcessor(ProcessorMixin): method __init__ (line 28) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): FILE: src/transformers/models/visual_bert/configuration_visual_bert.py class VisualBertConfig (line 24) | class VisualBertConfig(PreTrainedConfig): FILE: src/transformers/models/visual_bert/convert_visual_bert_original_pytorch_checkpoint_to_pytorch.py function load_state_dict (line 57) | def load_state_dict(checkpoint_path): function get_new_dict (line 62) | def get_new_dict(d, config, rename_keys_prefix=rename_keys_prefix): function convert_visual_bert_checkpoint (line 81) | def convert_visual_bert_checkpoint(checkpoint_path, pytorch_dump_folder_... FILE: src/transformers/models/visual_bert/modeling_visual_bert.py class VisualBertEmbeddings (line 41) | class VisualBertEmbeddings(nn.Module): method __init__ (line 44) | def __init__(self, config): method forward (line 73) | def forward( class VisualBertSelfAttention (line 172) | class VisualBertSelfAttention(nn.Module): method __init__ (line 173) | def __init__(self, config): method forward (line 191) | def forward( class VisualBertSelfOutput (line 241) | class VisualBertSelfOutput(nn.Module): method __init__ (line 242) | def __init__(self, config): method forward (line 248) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class VisualBertAttention (line 255) | class VisualBertAttention(nn.Module): method __init__ (line 256) | def __init__(self, config): method forward (line 261) | def forward( class VisualBertIntermediate (line 278) | class VisualBertIntermediate(nn.Module): method __init__ (line 279) | def __init__(self, config): method forward (line 287) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VisualBertOutput (line 294) | class VisualBertOutput(nn.Module): method __init__ (line 295) | def __init__(self, config): method forward (line 301) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class VisualBertLayer (line 308) | class VisualBertLayer(GradientCheckpointingLayer): method __init__ (line 309) | def __init__(self, config): method forward (line 317) | def forward( method feed_forward_chunk (line 339) | def feed_forward_chunk(self, attention_output): class VisualBertEncoder (line 345) | class VisualBertEncoder(nn.Module): method __init__ (line 346) | def __init__(self, config): method forward (line 352) | def forward( class VisualBertPooler (line 392) | class VisualBertPooler(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 398) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VisualBertPredictionHeadTransform (line 408) | class VisualBertPredictionHeadTransform(nn.Module): method __init__ (line 409) | def __init__(self, config): method forward (line 418) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VisualBertLMPredictionHead (line 426) | class VisualBertLMPredictionHead(nn.Module): method __init__ (line 427) | def __init__(self, config): method forward (line 436) | def forward(self, hidden_states): class VisualBertPreTrainingHeads (line 443) | class VisualBertPreTrainingHeads(nn.Module): method __init__ (line 444) | def __init__(self, config): method forward (line 449) | def forward(self, sequence_output, pooled_output): class VisualBertPreTrainedModel (line 456) | class VisualBertPreTrainedModel(PreTrainedModel): method _init_weights (line 463) | def _init_weights(self, module): class VisualBertForPreTrainingOutput (line 484) | class VisualBertForPreTrainingOutput(ModelOutput): class VisualBertModel (line 510) | class VisualBertModel(VisualBertPreTrainedModel): method __init__ (line 511) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 532) | def get_input_embeddings(self): method set_input_embeddings (line 535) | def set_input_embeddings(self, value): method forward (line 539) | def forward( class VisualBertForPreTraining (line 700) | class VisualBertForPreTraining(VisualBertPreTrainedModel): method __init__ (line 706) | def __init__(self, config): method get_output_embeddings (line 715) | def get_output_embeddings(self): method set_output_embeddings (line 718) | def set_output_embeddings(self, new_embeddings): method forward (line 723) | def forward( class VisualBertForMultipleChoice (line 855) | class VisualBertForMultipleChoice(VisualBertPreTrainedModel): method __init__ (line 856) | def __init__(self, config): method forward (line 867) | def forward( class VisualBertForQuestionAnswering (line 1041) | class VisualBertForQuestionAnswering(VisualBertPreTrainedModel): method __init__ (line 1042) | def __init__(self, config): method forward (line 1054) | def forward( class VisualBertForVisualReasoning (line 1178) | class VisualBertForVisualReasoning(VisualBertPreTrainedModel): method __init__ (line 1179) | def __init__(self, config): method forward (line 1191) | def forward( class VisualBertRegionToPhraseAttention (line 1299) | class VisualBertRegionToPhraseAttention(nn.Module): method __init__ (line 1300) | def __init__(self, config): method forward (line 1317) | def forward(self, query, key, attention_mask): class VisualBertForRegionToPhraseAlignment (line 1346) | class VisualBertForRegionToPhraseAlignment(VisualBertPreTrainedModel): method __init__ (line 1352) | def __init__(self, config): method forward (line 1364) | def forward( FILE: src/transformers/models/vit/configuration_vit.py class ViTConfig (line 24) | class ViTConfig(PreTrainedConfig): method __post_init__ (line 67) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vit/convert_dino_to_pytorch.py function create_rename_keys (line 35) | def create_rename_keys(config, base_model=False): function read_in_q_k_v (line 86) | def read_in_q_k_v(state_dict, config, base_model=False): function remove_classification_head_ (line 112) | def remove_classification_head_(state_dict): function rename_key (line 118) | def rename_key(dct, old, new): function prepare_img (line 124) | def prepare_img(): function convert_vit_checkpoint (line 132) | def convert_vit_checkpoint(model_name, pytorch_dump_folder_path, base_mo... FILE: src/transformers/models/vit/convert_vit_timm_to_pytorch.py function create_rename_keys (line 35) | def create_rename_keys(config, base_model=False): function read_in_q_k_v (line 86) | def read_in_q_k_v(state_dict, config, base_model=False): function remove_classification_head_ (line 112) | def remove_classification_head_(state_dict): function rename_key (line 118) | def rename_key(dct, old, new): function prepare_img (line 124) | def prepare_img(): function convert_vit_checkpoint (line 132) | def convert_vit_checkpoint(vit_name, pytorch_dump_folder_path): FILE: src/transformers/models/vit/image_processing_pil_vit.py class ViTImageProcessorPil (line 20) | class ViTImageProcessorPil(PilBackend): FILE: src/transformers/models/vit/image_processing_vit.py class ViTImageProcessor (line 20) | class ViTImageProcessor(TorchvisionBackend): FILE: src/transformers/models/vit/modeling_vit.py class ViTEmbeddings (line 43) | class ViTEmbeddings(nn.Module): method __init__ (line 48) | def __init__(self, config: ViTConfig, use_mask_token: bool = False): method interpolate_pos_encoding (line 60) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 100) | def forward( class ViTPatchEmbeddings (line 131) | class ViTPatchEmbeddings(nn.Module): method __init__ (line 138) | def __init__(self, config: ViTConfig): method forward (line 153) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... function eager_attention_forward (line 171) | def eager_attention_forward( class ViTSelfAttention (line 199) | class ViTSelfAttention(nn.Module): method __init__ (line 200) | def __init__(self, config: ViTConfig): method forward (line 220) | def forward( class ViTSelfOutput (line 254) | class ViTSelfOutput(nn.Module): method __init__ (line 260) | def __init__(self, config: ViTConfig): method forward (line 265) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViTAttention (line 271) | class ViTAttention(nn.Module): method __init__ (line 272) | def __init__(self, config: ViTConfig): method forward (line 277) | def forward( class ViTIntermediate (line 287) | class ViTIntermediate(nn.Module): method __init__ (line 288) | def __init__(self, config: ViTConfig): method forward (line 296) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ViTOutput (line 302) | class ViTOutput(nn.Module): method __init__ (line 303) | def __init__(self, config: ViTConfig): method forward (line 308) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViTLayer (line 315) | class ViTLayer(GradientCheckpointingLayer): method __init__ (line 318) | def __init__(self, config: ViTConfig): method forward (line 328) | def forward( class ViTEncoder (line 349) | class ViTEncoder(nn.Module): method __init__ (line 350) | def __init__(self, config: ViTConfig): method forward (line 356) | def forward( class ViTPreTrainedModel (line 368) | class ViTPreTrainedModel(PreTrainedModel): method _init_weights (line 385) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm): class ViTModel (line 402) | class ViTModel(ViTPreTrainedModel): method __init__ (line 403) | def __init__(self, config: ViTConfig, add_pooling_layer: bool = True, ... method get_input_embeddings (line 422) | def get_input_embeddings(self) -> ViTPatchEmbeddings: method forward (line 428) | def forward( class ViTPooler (line 461) | class ViTPooler(nn.Module): method __init__ (line 462) | def __init__(self, config: ViTConfig): method forward (line 467) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ViTForMaskedImageModeling (line 488) | class ViTForMaskedImageModeling(ViTPreTrainedModel): method __init__ (line 489) | def __init__(self, config: ViTConfig): method forward (line 508) | def forward( class ViTForImageClassification (line 605) | class ViTForImageClassification(ViTPreTrainedModel): method __init__ (line 606) | def __init__(self, config: ViTConfig): method forward (line 620) | def forward( FILE: src/transformers/models/vit_mae/configuration_vit_mae.py class ViTMAEConfig (line 24) | class ViTMAEConfig(PreTrainedConfig): FILE: src/transformers/models/vit_mae/convert_vit_mae_to_pytorch.py function rename_key (line 26) | def rename_key(name): function convert_state_dict (line 69) | def convert_state_dict(orig_state_dict, config): function convert_vit_mae_checkpoint (line 105) | def convert_vit_mae_checkpoint(checkpoint_url, pytorch_dump_folder_path): FILE: src/transformers/models/vit_mae/modeling_vit_mae.py class ViTMAEModelOutput (line 46) | class ViTMAEModelOutput(ModelOutput): class ViTMAEDecoderOutput (line 67) | class ViTMAEDecoderOutput(ModelOutput): class ViTMAEForPreTrainingOutput (line 84) | class ViTMAEForPreTrainingOutput(ModelOutput): function get_2d_sincos_pos_embed (line 104) | def get_2d_sincos_pos_embed(embed_dim, grid_size, add_cls_token=False): function get_2d_sincos_pos_embed_from_grid (line 132) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_1d_sincos_pos_embed_from_grid (line 144) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): class ViTMAEEmbeddings (line 165) | class ViTMAEEmbeddings(nn.Module): method __init__ (line 171) | def __init__(self, config): method initialize_weights (line 184) | def initialize_weights(self): method interpolate_pos_encoding (line 201) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method random_masking (line 241) | def random_masking(self, sequence, noise=None): method forward (line 273) | def forward(self, pixel_values, noise=None, interpolate_pos_encoding: ... class ViTMAEPatchEmbeddings (line 295) | class ViTMAEPatchEmbeddings(nn.Module): method __init__ (line 302) | def __init__(self, config): method forward (line 316) | def forward(self, pixel_values, interpolate_pos_encoding: bool = False): function eager_attention_forward (line 332) | def eager_attention_forward( class ViTMAESelfAttention (line 361) | class ViTMAESelfAttention(nn.Module): method __init__ (line 362) | def __init__(self, config: ViTMAEConfig): method forward (line 382) | def forward( class ViTMAESelfOutput (line 417) | class ViTMAESelfOutput(nn.Module): method __init__ (line 423) | def __init__(self, config: ViTMAEConfig): method forward (line 428) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViTMAEAttention (line 435) | class ViTMAEAttention(nn.Module): method __init__ (line 436) | def __init__(self, config: ViTMAEConfig): method forward (line 441) | def forward( class ViTMAEIntermediate (line 452) | class ViTMAEIntermediate(nn.Module): method __init__ (line 453) | def __init__(self, config: ViTMAEConfig): method forward (line 461) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ViTMAEOutput (line 468) | class ViTMAEOutput(nn.Module): method __init__ (line 469) | def __init__(self, config: ViTMAEConfig): method forward (line 474) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViTMAELayer (line 482) | class ViTMAELayer(GradientCheckpointingLayer): method __init__ (line 485) | def __init__(self, config: ViTMAEConfig): method forward (line 495) | def forward( class ViTMAEEncoder (line 517) | class ViTMAEEncoder(nn.Module): method __init__ (line 518) | def __init__(self, config: ViTMAEConfig): method forward (line 524) | def forward( class ViTMAEPreTrainedModel (line 536) | class ViTMAEPreTrainedModel(PreTrainedModel): method _init_weights (line 552) | def _init_weights(self, module): class ViTMAEModel (line 569) | class ViTMAEModel(ViTMAEPreTrainedModel): method __init__ (line 570) | def __init__(self, config): method get_input_embeddings (line 582) | def get_input_embeddings(self): method forward (line 588) | def forward( class ViTMAEDecoder (line 636) | class ViTMAEDecoder(nn.Module): method __init__ (line 637) | def __init__(self, config: ViTMAEConfig, num_patches: int): method interpolate_pos_encoding (line 662) | def interpolate_pos_encoding(self, embeddings: torch.Tensor) -> torch.... method initialize_weights (line 702) | def initialize_weights(self, num_patches): method forward (line 712) | def forward(self, hidden_states: torch.Tensor, ids_restore: torch.Tens... class ViTMAEForPreTraining (line 758) | class ViTMAEForPreTraining(ViTMAEPreTrainedModel): method __init__ (line 759) | def __init__(self, config: ViTMAEConfig): method get_input_embeddings (line 769) | def get_input_embeddings(self): method patchify (line 772) | def patchify(self, pixel_values, interpolate_pos_encoding: bool = False): method unpatchify (line 808) | def unpatchify(self, patchified_pixel_values, original_image_size: tup... method forward_loss (line 854) | def forward_loss(self, pixel_values, pred, mask, interpolate_pos_encod... method forward (line 882) | def forward( FILE: src/transformers/models/vit_msn/configuration_vit_msn.py class ViTMSNConfig (line 24) | class ViTMSNConfig(PreTrainedConfig): FILE: src/transformers/models/vit_msn/convert_msn_to_pytorch.py function create_rename_keys (line 33) | def create_rename_keys(config, base_model=False): function read_in_q_k_v (line 86) | def read_in_q_k_v(state_dict, config, base_model=False): function remove_classification_head_ (line 112) | def remove_classification_head_(state_dict): function remove_projection_head (line 118) | def remove_projection_head(state_dict): function rename_key (line 143) | def rename_key(dct, old, new): function convert_vit_msn_checkpoint (line 148) | def convert_vit_msn_checkpoint(checkpoint_url, pytorch_dump_folder_path): FILE: src/transformers/models/vit_msn/modeling_vit_msn.py class ViTMSNEmbeddings (line 37) | class ViTMSNEmbeddings(nn.Module): method __init__ (line 42) | def __init__(self, config: ViTMSNConfig, use_mask_token: bool = False)... method interpolate_pos_encoding (line 55) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 95) | def forward( class ViTMSNPatchEmbeddings (line 127) | class ViTMSNPatchEmbeddings(nn.Module): method __init__ (line 134) | def __init__(self, config: ViTMSNConfig): method forward (line 149) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... function eager_attention_forward (line 167) | def eager_attention_forward( class ViTMSNSelfAttention (line 196) | class ViTMSNSelfAttention(nn.Module): method __init__ (line 197) | def __init__(self, config: ViTMSNConfig): method forward (line 217) | def forward( class ViTMSNSelfOutput (line 252) | class ViTMSNSelfOutput(nn.Module): method __init__ (line 258) | def __init__(self, config: ViTMSNConfig): method forward (line 263) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViTMSNAttention (line 270) | class ViTMSNAttention(nn.Module): method __init__ (line 271) | def __init__(self, config: ViTMSNConfig): method forward (line 276) | def forward( class ViTMSNIntermediate (line 287) | class ViTMSNIntermediate(nn.Module): method __init__ (line 288) | def __init__(self, config: ViTMSNConfig): method forward (line 296) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class ViTMSNOutput (line 303) | class ViTMSNOutput(nn.Module): method __init__ (line 304) | def __init__(self, config: ViTMSNConfig): method forward (line 309) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class ViTMSNLayer (line 317) | class ViTMSNLayer(GradientCheckpointingLayer): method __init__ (line 320) | def __init__(self, config: ViTMSNConfig): method forward (line 330) | def forward( class ViTMSNEncoder (line 352) | class ViTMSNEncoder(nn.Module): method __init__ (line 353) | def __init__(self, config: ViTMSNConfig): method forward (line 359) | def forward( class ViTMSNPreTrainedModel (line 371) | class ViTMSNPreTrainedModel(PreTrainedModel): method _init_weights (line 390) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class ViTMSNModel (line 407) | class ViTMSNModel(ViTMSNPreTrainedModel): method __init__ (line 408) | def __init__(self, config: ViTMSNConfig, use_mask_token: bool = False): method get_input_embeddings (line 424) | def get_input_embeddings(self) -> ViTMSNPatchEmbeddings: method forward (line 430) | def forward( class ViTMSNForImageClassification (line 478) | class ViTMSNForImageClassification(ViTMSNPreTrainedModel): method __init__ (line 479) | def __init__(self, config: ViTMSNConfig) -> None: method forward (line 493) | def forward( FILE: src/transformers/models/vitdet/configuration_vitdet.py class VitDetConfig (line 25) | class VitDetConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vitdet/modeling_vitdet.py class VitDetEmbeddings (line 36) | class VitDetEmbeddings(nn.Module): method __init__ (line 42) | def __init__(self, config): method get_absolute_positions (line 64) | def get_absolute_positions(self, abs_pos_embeddings, has_cls_token, he... method forward (line 102) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function get_rel_pos (line 125) | def get_rel_pos(q_size, k_size, rel_pos): function add_decomposed_relative_positions (line 161) | def add_decomposed_relative_positions(attn, queries, rel_pos_h, rel_pos_... class VitDetAttention (line 202) | class VitDetAttention(nn.Module): method __init__ (line 205) | def __init__(self, config, input_size=None): method forward (line 231) | def forward(self, hidden_state, output_attentions=False): function drop_path (line 265) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class VitDetDropPath (line 281) | class VitDetDropPath(nn.Module): method __init__ (line 284) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 288) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 291) | def extra_repr(self) -> str: class VitDetLayerNorm (line 295) | class VitDetLayerNorm(nn.Module): method __init__ (line 302) | def __init__(self, normalized_shape, eps=1e-6): method forward (line 309) | def forward(self, x): class VitDetResBottleneckBlock (line 317) | class VitDetResBottleneckBlock(nn.Module): method __init__ (line 323) | def __init__(self, config, in_channels, out_channels, bottleneck_chann... method forward (line 347) | def forward(self, x): class VitDetMlp (line 356) | class VitDetMlp(nn.Module): method __init__ (line 357) | def __init__(self, config, in_features: int, hidden_features: int) -> ... method forward (line 364) | def forward(self, x: torch.Tensor) -> torch.Tensor: function window_partition (line 374) | def window_partition(hidden_state, window_size): function window_unpartition (line 406) | def window_unpartition(windows, window_size, pad_height_width, height_wi... class VitDetLayer (line 437) | class VitDetLayer(GradientCheckpointingLayer): method __init__ (line 440) | def __init__( method forward (line 475) | def forward( class VitDetEncoder (line 517) | class VitDetEncoder(nn.Module): method __init__ (line 518) | def __init__(self, config: VitDetConfig) -> None: method forward (line 540) | def forward( class VitDetPreTrainedModel (line 574) | class VitDetPreTrainedModel(PreTrainedModel): method _init_weights (line 583) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm) ... class VitDetModel (line 611) | class VitDetModel(VitDetPreTrainedModel): method __init__ (line 612) | def __init__(self, config: VitDetConfig): method get_input_embeddings (line 622) | def get_input_embeddings(self) -> VitDetEmbeddings: method forward (line 626) | def forward( class VitDetBackbone (line 687) | class VitDetBackbone(BackboneMixin, VitDetPreTrainedModel): method __init__ (line 688) | def __init__(self, config): method get_input_embeddings (line 698) | def get_input_embeddings(self) -> VitDetEmbeddings: method forward (line 704) | def forward( FILE: src/transformers/models/vitmatte/configuration_vitmatte.py class VitMatteConfig (line 26) | class VitMatteConfig(PreTrainedConfig): method __post_init__ (line 60) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vitmatte/convert_vitmatte_to_hf.py function get_config (line 30) | def get_config(model_name): function create_rename_keys (line 54) | def create_rename_keys(config): function rename_key (line 67) | def rename_key(dct, old, new): function convert_vitmatte_checkpoint (line 72) | def convert_vitmatte_checkpoint(model_name, pytorch_dump_folder_path, pu... FILE: src/transformers/models/vitmatte/image_processing_pil_vitmatte.py class VitMatteImageProcessorKwargs (line 38) | class VitMatteImageProcessorKwargs(ImagesKwargs, total=False): class VitMatteImageProcessorPil (line 48) | class VitMatteImageProcessorPil(PilBackend): method __init__ (line 58) | def __init__(self, **kwargs: Unpack[VitMatteImageProcessorKwargs]) -> ... method pad_image (line 64) | def pad_image( method preprocess (line 94) | def preprocess( method _preprocess_image_like_inputs (line 106) | def _preprocess_image_like_inputs( method _preprocess (line 125) | def _preprocess( FILE: src/transformers/models/vitmatte/image_processing_vitmatte.py class VitMatteImageProcessorKwargs (line 35) | class VitMatteImageProcessorKwargs(ImagesKwargs, total=False): class VitMatteImageProcessor (line 45) | class VitMatteImageProcessor(TorchvisionBackend): method __init__ (line 55) | def __init__(self, **kwargs: Unpack[VitMatteImageProcessorKwargs]) -> ... method _pad_image (line 62) | def _pad_image( method preprocess (line 88) | def preprocess( method _preprocess_image_like_inputs (line 100) | def _preprocess_image_like_inputs( method _preprocess (line 119) | def _preprocess( FILE: src/transformers/models/vitmatte/modeling_vitmatte.py class ImageMattingOutput (line 34) | class ImageMattingOutput(ModelOutput): class VitMattePreTrainedModel (line 53) | class VitMattePreTrainedModel(PreTrainedModel): method _init_weights (line 61) | def _init_weights(self, module: nn.Module): class VitMatteBasicConv3x3 (line 72) | class VitMatteBasicConv3x3(nn.Module): method __init__ (line 77) | def __init__(self, config, in_channels, out_channels, stride=2, paddin... method forward (line 90) | def forward(self, hidden_state): class VitMatteConvStream (line 98) | class VitMatteConvStream(nn.Module): method __init__ (line 103) | def __init__(self, config): method forward (line 122) | def forward(self, pixel_values): class VitMatteFusionBlock (line 133) | class VitMatteFusionBlock(nn.Module): method __init__ (line 138) | def __init__(self, config, in_channels, out_channels): method forward (line 142) | def forward(self, features, detailed_feature_map): class VitMatteHead (line 150) | class VitMatteHead(nn.Module): method __init__ (line 155) | def __init__(self, config): method forward (line 168) | def forward(self, hidden_state): class VitMatteDetailCaptureModule (line 174) | class VitMatteDetailCaptureModule(nn.Module): method __init__ (line 179) | def __init__(self, config): method forward (line 204) | def forward(self, features, pixel_values): class VitMatteForImageMatting (line 220) | class VitMatteForImageMatting(VitMattePreTrainedModel): method __init__ (line 221) | def __init__(self, config): method forward (line 232) | def forward( FILE: src/transformers/models/vitpose/configuration_vitpose.py class VitPoseConfig (line 26) | class VitPoseConfig(PreTrainedConfig): method __post_init__ (line 56) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vitpose/convert_vitpose_to_hf.py function get_config (line 62) | def get_config(model_name): function convert_old_keys_to_new_keys (line 163) | def convert_old_keys_to_new_keys(state_dict_keys: dict | None = None): function prepare_img (line 182) | def prepare_img(): function write_model (line 190) | def write_model(model_name, model_path, push_to_hub, check_logits=True): function main (line 399) | def main(): FILE: src/transformers/models/vitpose/image_processing_pil_vitpose.py class VitPoseImageProcessorKwargs (line 49) | class VitPoseImageProcessorKwargs(ImagesKwargs, total=False): function box_to_center_and_scale (line 63) | def box_to_center_and_scale( function coco_to_pascal_voc (line 108) | def coco_to_pascal_voc(bboxes: np.ndarray) -> np.ndarray: function get_keypoint_predictions (line 129) | def get_keypoint_predictions(heatmaps: np.ndarray) -> tuple[np.ndarray, ... function get_warp_matrix (line 163) | def get_warp_matrix(theta: float, size_input: np.ndarray, size_dst: np.n... function post_dark_unbiased_data_processing (line 201) | def post_dark_unbiased_data_processing(coords: np.ndarray, batch_heatmap... function scipy_warp_affine (line 262) | def scipy_warp_affine(src, M, size): function transform_preds (line 289) | def transform_preds(coords: np.ndarray, center: np.ndarray, scale: np.nd... class VitPoseImageProcessorPil (line 338) | class VitPoseImageProcessorPil(PilBackend): method __init__ (line 352) | def __init__(self, **kwargs: Unpack[VitPoseImageProcessorKwargs]): method preprocess (line 356) | def preprocess( method _preprocess_image_like_inputs (line 369) | def _preprocess_image_like_inputs( method affine_transform (line 386) | def affine_transform( method _preprocess (line 401) | def _preprocess( method keypoints_from_heatmaps (line 443) | def keypoints_from_heatmaps(self, heatmaps: np.ndarray, center: np.nda... method post_process_pose_estimation (line 453) | def post_process_pose_estimation( FILE: src/transformers/models/vitpose/image_processing_vitpose.py class VitPoseImageProcessorKwargs (line 55) | class VitPoseImageProcessorKwargs(ImagesKwargs, total=False): function box_to_center_and_scale (line 68) | def box_to_center_and_scale( function get_warp_matrix (line 112) | def get_warp_matrix(theta: float, size_input: np.ndarray, size_dst: np.n... function scipy_warp_affine (line 149) | def scipy_warp_affine(src, M, size): function get_keypoint_predictions (line 175) | def get_keypoint_predictions(heatmaps: np.ndarray) -> tuple[np.ndarray, ... function post_dark_unbiased_data_processing (line 208) | def post_dark_unbiased_data_processing(coords: np.ndarray, batch_heatmap... function transform_preds (line 268) | def transform_preds(coords: np.ndarray, center: np.ndarray, scale: np.nd... function coco_to_pascal_voc (line 316) | def coco_to_pascal_voc(bboxes: np.ndarray) -> np.ndarray: class VitPoseImageProcessor (line 337) | class VitPoseImageProcessor(TorchvisionBackend): method __init__ (line 351) | def __init__(self, **kwargs: Unpack[VitPoseImageProcessorKwargs]): method preprocess (line 355) | def preprocess( method _preprocess_image_like_inputs (line 368) | def _preprocess_image_like_inputs( method affine_transform (line 386) | def affine_transform( method _preprocess (line 403) | def _preprocess( method keypoints_from_heatmaps (line 450) | def keypoints_from_heatmaps( method post_process_pose_estimation (line 465) | def post_process_pose_estimation( FILE: src/transformers/models/vitpose/modeling_vitpose.py class VitPoseEstimatorOutput (line 42) | class VitPoseEstimatorOutput(ModelOutput): class VitPosePreTrainedModel (line 61) | class VitPosePreTrainedModel(PreTrainedModel): method _init_weights (line 69) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm): function flip_back (line 80) | def flip_back(output_flipped, flip_pairs, target_type="gaussian-heatmap"): class VitPoseSimpleDecoder (line 120) | class VitPoseSimpleDecoder(nn.Module): method __init__ (line 126) | def __init__(self, config: VitPoseConfig): method forward (line 135) | def forward(self, hidden_state: torch.Tensor, flip_pairs: torch.Tensor... class VitPoseClassicDecoder (line 147) | class VitPoseClassicDecoder(nn.Module): method __init__ (line 153) | def __init__(self, config: VitPoseConfig): method forward (line 168) | def forward(self, hidden_state: torch.Tensor, flip_pairs: torch.Tensor... class VitPoseForPoseEstimation (line 190) | class VitPoseForPoseEstimation(VitPosePreTrainedModel): method __init__ (line 191) | def __init__(self, config: VitPoseConfig): method forward (line 211) | def forward( FILE: src/transformers/models/vitpose_backbone/configuration_vitpose_backbone.py class VitPoseBackboneConfig (line 25) | class VitPoseBackboneConfig(BackboneConfigMixin, PreTrainedConfig): method __post_init__ (line 65) | def __post_init__(self, **kwargs): FILE: src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py class VitPoseBackbonePatchEmbeddings (line 43) | class VitPoseBackbonePatchEmbeddings(nn.Module): method __init__ (line 46) | def __init__(self, config): method forward (line 63) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class VitPoseBackboneEmbeddings (line 75) | class VitPoseBackboneEmbeddings(nn.Module): method __init__ (line 80) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 88) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 100) | def eager_attention_forward( class VitPoseBackboneSelfAttention (line 129) | class VitPoseBackboneSelfAttention(nn.Module): method __init__ (line 130) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 150) | def forward( class VitPoseBackboneSelfOutput (line 185) | class VitPoseBackboneSelfOutput(nn.Module): method __init__ (line 191) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 196) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class VitPoseBackboneAttention (line 203) | class VitPoseBackboneAttention(nn.Module): method __init__ (line 204) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 209) | def forward( class VitPoseNaiveMoe (line 219) | class VitPoseNaiveMoe(nn.ModuleList): method __init__ (line 220) | def __init__(self, config): method forward (line 231) | def forward(self, hidden_state, indices): class VitPoseBackboneMoeMLP (line 241) | class VitPoseBackboneMoeMLP(nn.Module): method __init__ (line 242) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 259) | def forward(self, hidden_state: torch.Tensor, indices: torch.Tensor) -... class VitPoseBackboneMLP (line 271) | class VitPoseBackboneMLP(nn.Module): method __init__ (line 272) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 280) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class VitPoseBackboneLayer (line 287) | class VitPoseBackboneLayer(GradientCheckpointingLayer): method __init__ (line 288) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 296) | def forward( class VitPoseBackbonePreTrainedModel (line 329) | class VitPoseBackbonePreTrainedModel(PreTrainedModel): method _init_weights (line 344) | def _init_weights(self, module: nn.Linear | nn.Conv2d | nn.LayerNorm |... class VitPoseBackboneEncoder (line 357) | class VitPoseBackboneEncoder(VitPoseBackbonePreTrainedModel): method __init__ (line 358) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 365) | def forward( class VitPoseBackbone (line 382) | class VitPoseBackbone(BackboneMixin, VitPoseBackbonePreTrainedModel): method __init__ (line 383) | def __init__(self, config: VitPoseBackboneConfig): method forward (line 398) | def forward( FILE: src/transformers/models/vits/configuration_vits.py class VitsConfig (line 24) | class VitsConfig(PreTrainedConfig): method validate_architecture (line 159) | def validate_architecture(self): FILE: src/transformers/models/vits/convert_original_checkpoint.py function set_recursively (line 155) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function should_ignore (line 194) | def should_ignore(name, ignore_keys): function recursively_load_weights (line 208) | def recursively_load_weights(fairseq_dict, hf_model): function convert_checkpoint (line 265) | def convert_checkpoint( FILE: src/transformers/models/vits/modeling_vits.py class VitsModelOutput (line 45) | class VitsModelOutput(ModelOutput): class VitsTextEncoderOutput (line 69) | class VitsTextEncoderOutput(ModelOutput): function fused_add_tanh_sigmoid_multiply (line 85) | def fused_add_tanh_sigmoid_multiply(input_a, input_b, num_channels): function _unconstrained_rational_quadratic_spline (line 93) | def _unconstrained_rational_quadratic_spline( function _rational_quadratic_spline (line 167) | def _rational_quadratic_spline( class VitsWaveNet (line 305) | class VitsWaveNet(torch.nn.Module): method __init__ (line 306) | def __init__(self, config: VitsConfig, num_layers: int): method forward (line 347) | def forward(self, inputs, padding_mask, global_conditioning=None): method remove_weight_norm (line 376) | def remove_weight_norm(self): class VitsPosteriorEncoder (line 385) | class VitsPosteriorEncoder(nn.Module): method __init__ (line 386) | def __init__(self, config: VitsConfig): method forward (line 394) | def forward(self, inputs, padding_mask, global_conditioning=None): class HifiGanResidualBlock (line 404) | class HifiGanResidualBlock(nn.Module): method __init__ (line 405) | def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_... method get_padding (line 436) | def get_padding(self, kernel_size, dilation=1): method apply_weight_norm (line 439) | def apply_weight_norm(self): method remove_weight_norm (line 449) | def remove_weight_norm(self): method forward (line 455) | def forward(self, hidden_states): class VitsHifiGan (line 466) | class VitsHifiGan(nn.Module): method __init__ (line 467) | def __init__(self, config: VitsConfig): method apply_weight_norm (line 503) | def apply_weight_norm(self): method remove_weight_norm (line 513) | def remove_weight_norm(self): method forward (line 519) | def forward( class VitsResidualCouplingLayer (line 554) | class VitsResidualCouplingLayer(nn.Module): method __init__ (line 555) | def __init__(self, config: VitsConfig): method forward (line 563) | def forward(self, inputs, padding_mask, global_conditioning=None, reve... class VitsResidualCouplingBlock (line 581) | class VitsResidualCouplingBlock(nn.Module): method __init__ (line 582) | def __init__(self, config: VitsConfig): method forward (line 588) | def forward(self, inputs, padding_mask, global_conditioning=None, reve... class VitsDilatedDepthSeparableConv (line 600) | class VitsDilatedDepthSeparableConv(nn.Module): method __init__ (line 601) | def __init__(self, config: VitsConfig, dropout_rate=0.0): method forward (line 629) | def forward(self, inputs, padding_mask, global_conditioning=None): class VitsConvFlow (line 646) | class VitsConvFlow(nn.Module): method __init__ (line 647) | def __init__(self, config: VitsConfig): method forward (line 658) | def forward(self, inputs, padding_mask, global_conditioning=None, reve... class VitsElementwiseAffine (line 689) | class VitsElementwiseAffine(nn.Module): method __init__ (line 690) | def __init__(self, config: VitsConfig): method forward (line 696) | def forward(self, inputs, padding_mask, global_conditioning=None, reve... class VitsStochasticDurationPredictor (line 707) | class VitsStochasticDurationPredictor(nn.Module): method __init__ (line 708) | def __init__(self, config): method forward (line 740) | def forward(self, inputs, padding_mask, global_conditioning=None, dura... class VitsDurationPredictor (line 807) | class VitsDurationPredictor(nn.Module): method __init__ (line 808) | def __init__(self, config): method forward (line 823) | def forward(self, inputs, padding_mask, global_conditioning=None): class VitsAttention (line 844) | class VitsAttention(nn.Module): method __init__ (line 847) | def __init__(self, config: VitsConfig): method _shape (line 872) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 875) | def forward( method _get_relative_embeddings (line 963) | def _get_relative_embeddings(self, relative_embeddings, length): method _relative_position_to_absolute_position (line 972) | def _relative_position_to_absolute_position(self, x): method _absolute_position_to_relative_position (line 987) | def _absolute_position_to_relative_position(self, x): class VitsFeedForward (line 1000) | class VitsFeedForward(nn.Module): method __init__ (line 1001) | def __init__(self, config): method forward (line 1019) | def forward(self, hidden_states, padding_mask): class VitsEncoderLayer (line 1042) | class VitsEncoderLayer(GradientCheckpointingLayer): method __init__ (line 1043) | def __init__(self, config: VitsConfig): method forward (line 1051) | def forward( class VitsEncoder (line 1081) | class VitsEncoder(nn.Module): method __init__ (line 1082) | def __init__(self, config: VitsConfig): method forward (line 1089) | def forward( class VitsTextEncoder (line 1150) | class VitsTextEncoder(nn.Module): method __init__ (line 1155) | def __init__(self, config: VitsConfig): method forward (line 1162) | def forward( class VitsPreTrainedModel (line 1201) | class VitsPreTrainedModel(PreTrainedModel): method _init_weights (line 1208) | def _init_weights(self, module: nn.Module): class VitsModel (line 1243) | class VitsModel(VitsPreTrainedModel): method __init__ (line 1244) | def __init__(self, config: VitsConfig): method forward (line 1271) | def forward( FILE: src/transformers/models/vits/tokenization_vits.py function has_non_roman_characters (line 36) | def has_non_roman_characters(input_string): class VitsTokenizer (line 46) | class VitsTokenizer(PreTrainedTokenizer): method __init__ (line 71) | def __init__( method vocab_size (line 107) | def vocab_size(self): method get_vocab (line 110) | def get_vocab(self): method normalize_text (line 115) | def normalize_text(self, input_string): method _preprocess_char (line 136) | def _preprocess_char(self, text): method prepare_for_tokenization (line 142) | def prepare_for_tokenization( method _tokenize (line 207) | def _tokenize(self, text: str) -> list[str]: method convert_tokens_to_string (line 218) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method _convert_token_to_id (line 223) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 229) | def _convert_id_to_token(self, index): method save_vocabulary (line 233) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/vivit/configuration_vivit.py class VivitConfig (line 24) | class VivitConfig(PreTrainedConfig): FILE: src/transformers/models/vivit/convert_vivit_flax_to_pytorch.py function download_checkpoint (line 33) | def download_checkpoint(path): function get_vivit_config (line 42) | def get_vivit_config() -> VivitConfig: function prepare_video (line 59) | def prepare_video(): function transform_attention (line 67) | def transform_attention(current: np.ndarray): function transform_attention_bias (line 78) | def transform_attention_bias(current: np.ndarray): function transform_attention_kernel (line 82) | def transform_attention_kernel(current: np.ndarray): function transform_attention_output_weight (line 86) | def transform_attention_output_weight(current: np.ndarray): function transform_state_encoder_block (line 90) | def transform_state_encoder_block(state_dict, i): function get_n_layers (line 130) | def get_n_layers(state_dict): function transform_state (line 134) | def transform_state(state_dict, classification_head=False): function get_processor (line 167) | def get_processor() -> VivitImageProcessor: function convert (line 189) | def convert(output_path: str): FILE: src/transformers/models/vivit/image_processing_vivit.py function make_batched (line 50) | def make_batched(videos) -> list[list[ImageInput]]: class VivitImageProcessor (line 63) | class VivitImageProcessor(BaseImageProcessor): method __init__ (line 106) | def __init__( method resize (line 139) | def resize( method rescale (line 183) | def rescale( method _preprocess_image (line 223) | def _preprocess_image( method preprocess (line 286) | def preprocess( FILE: src/transformers/models/vivit/modeling_vivit.py class VivitTubeletEmbeddings (line 36) | class VivitTubeletEmbeddings(nn.Module): method __init__ (line 47) | def __init__(self, config: VivitConfig): method forward (line 63) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... class VivitEmbeddings (line 80) | class VivitEmbeddings(nn.Module): method __init__ (line 87) | def __init__(self, config: VivitConfig): method interpolate_pos_encoding (line 101) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 141) | def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding... function eager_attention_forward (line 160) | def eager_attention_forward( class VivitSelfAttention (line 189) | class VivitSelfAttention(nn.Module): method __init__ (line 190) | def __init__(self, config: VivitConfig): method forward (line 210) | def forward( class VivitSelfOutput (line 245) | class VivitSelfOutput(nn.Module): method __init__ (line 251) | def __init__(self, config: VivitConfig): method forward (line 256) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class VivitAttention (line 263) | class VivitAttention(nn.Module): method __init__ (line 264) | def __init__(self, config: VivitConfig): method forward (line 269) | def forward( class VivitIntermediate (line 279) | class VivitIntermediate(nn.Module): method __init__ (line 280) | def __init__(self, config: VivitConfig): method forward (line 289) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VivitOutput (line 297) | class VivitOutput(nn.Module): method __init__ (line 298) | def __init__(self, config: VivitConfig): method forward (line 303) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class VivitLayer (line 310) | class VivitLayer(GradientCheckpointingLayer): method __init__ (line 313) | def __init__(self, config: VivitConfig): method forward (line 323) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VivitEncoder (line 340) | class VivitEncoder(nn.Module): method __init__ (line 341) | def __init__(self, config: VivitConfig): method forward (line 347) | def forward(self, hidden_states: torch.Tensor) -> BaseModelOutput: class VivitPooler (line 354) | class VivitPooler(nn.Module): method __init__ (line 355) | def __init__(self, config: VivitConfig): method forward (line 360) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class VivitPreTrainedModel (line 370) | class VivitPreTrainedModel(PreTrainedModel): method _init_weights (line 387) | def _init_weights(self, module): class VivitModel (line 396) | class VivitModel(VivitPreTrainedModel): method __init__ (line 397) | def __init__(self, config: VivitConfig, add_pooling_layer: bool = True): method get_input_embeddings (line 414) | def get_input_embeddings(self): method forward (line 420) | def forward( class VivitForVideoClassification (line 527) | class VivitForVideoClassification(VivitPreTrainedModel): method __init__ (line 528) | def __init__(self, config: VivitConfig): method forward (line 542) | def forward( FILE: src/transformers/models/vjepa2/configuration_vjepa2.py class VJEPA2Config (line 24) | class VJEPA2Config(PreTrainedConfig): FILE: src/transformers/models/vjepa2/convert_vjepa2_classifier_to_hf.py function get_video (line 31) | def get_video(): function get_id2label_mapping (line 93) | def get_id2label_mapping(dataset_name: str) -> dict[int, str]: function split_qkv (line 105) | def split_qkv(state_dict): function convert_old_keys_to_new_keys (line 124) | def convert_old_keys_to_new_keys(state_dict): function main (line 141) | def main(args: argparse.Namespace): FILE: src/transformers/models/vjepa2/convert_vjepa2_to_hf.py function get_vjepa2_config (line 51) | def get_vjepa2_config(model_name): function convert_encoder_keys (line 109) | def convert_encoder_keys(model_state_dict, og_encoder_state_dict, config): function convert_predictor_keys (line 146) | def convert_predictor_keys(model_state_dict, og_predictor_state_dict, co... function prepare_img (line 198) | def prepare_img(): function upload_original_ckpts (line 205) | def upload_original_ckpts(model_name): function convert_and_test_vjepa2_checkpoint (line 224) | def convert_and_test_vjepa2_checkpoint(model_name, pytorch_dump_folder_p... FILE: src/transformers/models/vjepa2/modeling_vjepa2.py class VJEPA2WithMaskedInputPredictorOutput (line 41) | class VJEPA2WithMaskedInputPredictorOutput(ModelOutput): class VJEPA2WithMaskedInputModelOutput (line 63) | class VJEPA2WithMaskedInputModelOutput(ModelOutput): method to_tuple (line 77) | def to_tuple(self): class VJEPA2PatchEmbeddings3D (line 84) | class VJEPA2PatchEmbeddings3D(nn.Module): method __init__ (line 89) | def __init__( method num_patches (line 107) | def num_patches(config): method forward (line 114) | def forward(self, pixel_values_videos: torch.Tensor) -> torch.Tensor: class VJEPA2Embeddings (line 119) | class VJEPA2Embeddings(nn.Module): method __init__ (line 124) | def __init__(self, config: VJEPA2Config, hidden_size: int = 1024): method forward (line 134) | def forward(self, pixel_values_videos: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 154) | def eager_attention_forward( function rotate_queries_or_keys (line 180) | def rotate_queries_or_keys(x, pos): class VJEPA2RopeAttention (line 207) | class VJEPA2RopeAttention(nn.Module): method __init__ (line 208) | def __init__( method _get_frame_pos (line 245) | def _get_frame_pos(self, ids): method _get_height_pos (line 249) | def _get_height_pos(self, ids): method get_position_ids (line 258) | def get_position_ids(self, x, masks=None): method apply_rotary_embeddings (line 279) | def apply_rotary_embeddings(self, qk, pos_ids): method forward (line 296) | def forward( function drop_path (line 344) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class VJEPA2DropPath (line 360) | class VJEPA2DropPath(nn.Module): method __init__ (line 363) | def __init__(self, drop_prob: float | None = None): method forward (line 367) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 370) | def extra_repr(self) -> str: class VJEPA2MLP (line 374) | class VJEPA2MLP(nn.Module): method __init__ (line 375) | def __init__(self, config: VJEPA2Config, hidden_size: int = 1024, mlp_... method forward (line 383) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class VJEPA2Layer (line 390) | class VJEPA2Layer(GradientCheckpointingLayer): method __init__ (line 393) | def __init__( method forward (line 413) | def forward( class VJEPA2Encoder (line 438) | class VJEPA2Encoder(nn.Module): method __init__ (line 439) | def __init__(self, config: VJEPA2Config): method forward (line 463) | def forward( function apply_masks (line 481) | def apply_masks(tensor: torch.Tensor, masks: list[torch.Tensor]) -> torc... class VJEPA2PredictorEmbeddings (line 498) | class VJEPA2PredictorEmbeddings(nn.Module): method __init__ (line 503) | def __init__(self, config: VJEPA2Config): method num_patches (line 517) | def num_patches(config): method forward (line 527) | def forward( class VJEPA2Predictor (line 568) | class VJEPA2Predictor(nn.Module): method __init__ (line 569) | def __init__(self, config: VJEPA2Config): method sort_tokens (line 597) | def sort_tokens(self, hidden_states, position_masks, argsort): method unsort_tokens (line 609) | def unsort_tokens(self, hidden_states, argsort): method forward (line 616) | def forward( class VJEPA2PoolerSelfAttention (line 649) | class VJEPA2PoolerSelfAttention(nn.Module): method __init__ (line 652) | def __init__(self, config: VJEPA2Config): method forward (line 672) | def forward( class VJEPA2PoolerCrossAttention (line 710) | class VJEPA2PoolerCrossAttention(nn.Module): method __init__ (line 715) | def __init__(self, config: VJEPA2Config): method forward (line 734) | def forward( class VJEPA2PoolerSelfAttentionLayer (line 775) | class VJEPA2PoolerSelfAttentionLayer(GradientCheckpointingLayer): method __init__ (line 776) | def __init__(self, config: VJEPA2Config): method forward (line 783) | def forward( class VJEPA2PoolerCrossAttentionLayer (line 811) | class VJEPA2PoolerCrossAttentionLayer(GradientCheckpointingLayer): method __init__ (line 812) | def __init__(self, config: VJEPA2Config): method forward (line 819) | def forward( class VJEPA2AttentivePooler (line 845) | class VJEPA2AttentivePooler(nn.Module): method __init__ (line 848) | def __init__(self, config: VJEPA2Config): method forward (line 856) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class VJEPA2PreTrainedModel (line 865) | class VJEPA2PreTrainedModel(PreTrainedModel): method _init_weights (line 885) | def _init_weights(self, module): class VJEPA2Model (line 912) | class VJEPA2Model(VJEPA2PreTrainedModel): method __init__ (line 913) | def __init__(self, config: VJEPA2Config): method get_input_embeddings (line 923) | def get_input_embeddings(self) -> VJEPA2PatchEmbeddings3D: method forward (line 929) | def forward( method get_vision_features (line 990) | def get_vision_features(self, pixel_values_videos) -> torch.Tensor: class VJEPA2ForVideoClassification (line 1000) | class VJEPA2ForVideoClassification(VJEPA2PreTrainedModel): method __init__ (line 1001) | def __init__(self, config: VJEPA2Config): method forward (line 1016) | def forward( FILE: src/transformers/models/vjepa2/video_processing_vjepa2.py class VJEPA2VideoProcessor (line 21) | class VJEPA2VideoProcessor(BaseVideoProcessor): method __init__ (line 32) | def __init__(self, **kwargs: Unpack[VideosKwargs]): FILE: src/transformers/models/voxtral/configuration_voxtral.py class VoxtralEncoderConfig (line 25) | class VoxtralEncoderConfig(PreTrainedConfig): class VoxtralConfig (line 76) | class VoxtralConfig(PreTrainedConfig): method __post_init__ (line 114) | def __post_init__(self, **kwargs): FILE: src/transformers/models/voxtral/convert_voxtral_weights_to_hf.py function convert_config (line 71) | def convert_config(original_config: dict, max_position_embeddings: int =... function map_old_key_to_new (line 126) | def map_old_key_to_new(old_key): function permute_for_rope (line 137) | def permute_for_rope(tensor, n_heads, dim1, dim2): function convert_state_dict (line 145) | def convert_state_dict(original_state_dict, config): function write_model (line 173) | def write_model( function write_processor (line 235) | def write_processor(input_path_or_repo: str, feature_extractor_path_or_r... function main (line 249) | def main(): FILE: src/transformers/models/voxtral/modeling_voxtral.py function eager_attention_forward (line 45) | def eager_attention_forward( class VoxtralAttention (line 71) | class VoxtralAttention(nn.Module): method __init__ (line 74) | def __init__( method _shape (line 114) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 117) | def forward( class VoxtralEncoderLayer (line 159) | class VoxtralEncoderLayer(GradientCheckpointingLayer): method __init__ (line 160) | def __init__(self, config: VoxtralConfig): method forward (line 178) | def forward( class VoxtralPreTrainedModel (line 216) | class VoxtralPreTrainedModel(PreTrainedModel): class VoxtralEncoder (line 236) | class VoxtralEncoder(VoxtralPreTrainedModel): method __init__ (line 255) | def __init__(self, config: VoxtralEncoderConfig): method _freeze_parameters (line 280) | def _freeze_parameters(self): method get_input_embeddings (line 285) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 288) | def set_input_embeddings(self, value: nn.Module): method forward (line 293) | def forward( method _get_feat_extract_output_lengths (line 339) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class VoxtralMultiModalProjector (line 348) | class VoxtralMultiModalProjector(nn.Module): method __init__ (line 349) | def __init__(self, config: VoxtralConfig): method forward (line 355) | def forward(self, audio_features): class VoxtralForConditionalGeneration (line 367) | class VoxtralForConditionalGeneration(VoxtralPreTrainedModel, Generation... method __init__ (line 370) | def __init__(self, config): method get_input_embeddings (line 380) | def get_input_embeddings(self): method set_input_embeddings (line 383) | def set_input_embeddings(self, value): method get_output_embeddings (line 386) | def get_output_embeddings(self): method set_output_embeddings (line 389) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 392) | def set_decoder(self, decoder): method get_decoder (line 395) | def get_decoder(self): method get_audio_features (line 402) | def get_audio_features( method forward (line 423) | def forward( method prepare_inputs_for_generation (line 493) | def prepare_inputs_for_generation(self, *args, **kwargs): FILE: src/transformers/models/voxtral/modular_voxtral.py class VoxtralAttention (line 41) | class VoxtralAttention(Qwen2AudioAttention): class VoxtralEncoderLayer (line 45) | class VoxtralEncoderLayer(Qwen2AudioEncoderLayer): class VoxtralPreTrainedModel (line 49) | class VoxtralPreTrainedModel(Qwen2AudioPreTrainedModel): class VoxtralEncoder (line 63) | class VoxtralEncoder(Qwen2AudioEncoder): method forward (line 71) | def forward( class VoxtralMultiModalProjector (line 117) | class VoxtralMultiModalProjector(nn.Module): method __init__ (line 118) | def __init__(self, config: VoxtralConfig): method forward (line 124) | def forward(self, audio_features): class VoxtralForConditionalGeneration (line 136) | class VoxtralForConditionalGeneration(VoxtralPreTrainedModel, Generation... method __init__ (line 139) | def __init__(self, config): method get_input_embeddings (line 149) | def get_input_embeddings(self): method set_input_embeddings (line 152) | def set_input_embeddings(self, value): method get_output_embeddings (line 155) | def get_output_embeddings(self): method set_output_embeddings (line 158) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 161) | def set_decoder(self, decoder): method get_decoder (line 164) | def get_decoder(self): method get_audio_features (line 171) | def get_audio_features( method forward (line 192) | def forward( method prepare_inputs_for_generation (line 262) | def prepare_inputs_for_generation(self, *args, **kwargs): FILE: src/transformers/models/voxtral/processing_voxtral.py class VoxtralAudioKwargs (line 39) | class VoxtralAudioKwargs(AudioKwargs, total=False): class VoxtralProcessorKwargs (line 48) | class VoxtralProcessorKwargs(ProcessingKwargs, total=False): class VoxtralProcessor (line 70) | class VoxtralProcessor(ProcessorMixin): method __init__ (line 71) | def __init__( method _retrieve_input_features (line 81) | def _retrieve_input_features(self, audio, max_source_positions, **kwar... method apply_chat_template (line 98) | def apply_chat_template( method __call__ (line 225) | def __call__( method apply_transcription_request (line 244) | def apply_transcription_request( FILE: src/transformers/models/voxtral_realtime/configuration_voxtral_realtime.py class VoxtralRealtimeTextConfig (line 27) | class VoxtralRealtimeTextConfig(MistralConfig): class VoxtralRealtimeEncoderConfig (line 33) | class VoxtralRealtimeEncoderConfig(PreTrainedConfig): method __post_init__ (line 77) | def __post_init__(self, **kwargs): class VoxtralRealtimeConfig (line 84) | class VoxtralRealtimeConfig(PreTrainedConfig): method __post_init__ (line 133) | def __post_init__(self, **kwargs): FILE: src/transformers/models/voxtral_realtime/convert_voxtral_realtime_weights_to_hf.py function convert_config (line 71) | def convert_config(original_config: dict, max_position_embeddings: int =... function map_old_key_to_new (line 126) | def map_old_key_to_new(old_key): function permute_for_rope (line 137) | def permute_for_rope(tensor, n_heads, dim1, dim2=None): function convert_state_dict (line 152) | def convert_state_dict(original_state_dict, config): function _permute_projection_weights (line 201) | def _permute_projection_weights( function write_model (line 228) | def write_model( function write_processor (line 287) | def write_processor(input_path_or_repo: str, output_dir: str): function main (line 301) | def main(): FILE: src/transformers/models/voxtral_realtime/feature_extraction_voxtral_realtime.py class VoxtralRealtimeFeatureExtractor (line 29) | class VoxtralRealtimeFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 56) | def __init__( method _torch_extract_fbank_features (line 83) | def _torch_extract_fbank_features(self, waveform, device: str = "cpu",... method __call__ (line 107) | def __call__( FILE: src/transformers/models/voxtral_realtime/modeling_voxtral_realtime.py class VoxtralRealtimeConv1dCacheLayer (line 56) | class VoxtralRealtimeConv1dCacheLayer: method __init__ (line 57) | def __init__(self): method lazy_initialization (line 61) | def lazy_initialization(self, hidden_states, conv_module): method update (line 77) | def update(self, hidden_states, conv_module=None): class VoxtralRealtimeConv1dPaddingCache (line 103) | class VoxtralRealtimeConv1dPaddingCache: method __init__ (line 104) | def __init__(self): method update (line 107) | def update(self, hidden_states, cache_key, conv_module): class VoxtralRealtimeEncoderOutput (line 117) | class VoxtralRealtimeEncoderOutput(BaseModelOutputWithPast): class VoxtralRealtimeCausalLMOutputWithPast (line 122) | class VoxtralRealtimeCausalLMOutputWithPast(CausalLMOutputWithPast): class VoxtralRealtimeRotaryEmbedding (line 136) | class VoxtralRealtimeRotaryEmbedding(nn.Module): method __init__ (line 139) | def __init__(self, config: VoxtralRealtimeConfig, device=None): method compute_default_rope_parameters (line 156) | def compute_default_rope_parameters( method forward (line 187) | def forward(self, x, position_ids): class VoxtralRealtimeCausalConv1d (line 201) | class VoxtralRealtimeCausalConv1d(nn.Conv1d): method __init__ (line 202) | def __init__( method left_pad (line 216) | def left_pad(self): method forward (line 220) | def forward( class VoxtralRealtimeRMSNorm (line 234) | class VoxtralRealtimeRMSNorm(nn.Module): method __init__ (line 235) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 243) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 250) | def extra_repr(self): function rotate_half (line 254) | def rotate_half(x): function apply_rotary_pos_emb (line 262) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 287) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 299) | def eager_attention_forward( class VoxtralRealtimeAttention (line 325) | class VoxtralRealtimeAttention(nn.Module): method __init__ (line 328) | def __init__(self, config, layer_idx: int): method forward (line 343) | def forward( class VoxtralRealtimeMLP (line 385) | class VoxtralRealtimeMLP(nn.Module): method __init__ (line 386) | def __init__(self, config): method forward (line 396) | def forward(self, x): class VoxtralRealtimeEmbedder (line 401) | class VoxtralRealtimeEmbedder(nn.Module): method __init__ (line 402) | def __init__(self, config): method forward (line 412) | def forward(self, input_features, padding_cache=None): class VoxtralRealtimeEncoderLayer (line 419) | class VoxtralRealtimeEncoderLayer(GradientCheckpointingLayer): method __init__ (line 420) | def __init__(self, config, layer_idx: int): method forward (line 428) | def forward( class VoxtralRealtimePreTrainedModel (line 469) | class VoxtralRealtimePreTrainedModel(PreTrainedModel): method _init_weights (line 485) | def _init_weights(self, module): class VoxtralRealtimeEncoder (line 497) | class VoxtralRealtimeEncoder(VoxtralRealtimePreTrainedModel): method __init__ (line 515) | def __init__(self, config): method forward (line 531) | def forward( class VoxtralRealtimeTextAdaRmsNorm (line 596) | class VoxtralRealtimeTextAdaRmsNorm(nn.Module): method __init__ (line 597) | def __init__(self, config): method forward (line 602) | def forward(self, hidden_states): class VoxtralRealtimeTextAttention (line 610) | class VoxtralRealtimeTextAttention(nn.Module): method __init__ (line 613) | def __init__(self, config: VoxtralRealtimeTextConfig, layer_idx: int): method forward (line 627) | def forward( class VoxtralRealtimeTextMLP (line 669) | class VoxtralRealtimeTextMLP(nn.Module): method __init__ (line 670) | def __init__(self, config): method forward (line 680) | def forward(self, x): class VoxtralRealtimeTextDecoderLayer (line 685) | class VoxtralRealtimeTextDecoderLayer(GradientCheckpointingLayer): method __init__ (line 686) | def __init__(self, config, layer_idx): method forward (line 695) | def forward( class VoxtralRealtimeTextPreTrainedModel (line 731) | class VoxtralRealtimeTextPreTrainedModel(PreTrainedModel): class VoxtralRealtimeTextModel (line 750) | class VoxtralRealtimeTextModel(VoxtralRealtimeTextPreTrainedModel): method __init__ (line 751) | def __init__(self, config): method forward (line 770) | def forward( class VoxtralRealtimeTextForCausalLM (line 824) | class VoxtralRealtimeTextForCausalLM(VoxtralRealtimeTextPreTrainedModel,... method __init__ (line 829) | def __init__(self, config): method forward (line 840) | def forward( class VoxtralRealtimeTimeEmbedding (line 897) | class VoxtralRealtimeTimeEmbedding(nn.Module): method __init__ (line 900) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 907) | def forward(self, time_tensor: torch.Tensor) -> torch.Tensor: class VoxtralRealtimeMultiModalProjector (line 913) | class VoxtralRealtimeMultiModalProjector(nn.Module): method __init__ (line 914) | def __init__(self, config): method forward (line 922) | def forward(self, audio_features): class VoxtralRealtimeForConditionalGeneration (line 934) | class VoxtralRealtimeForConditionalGeneration(VoxtralRealtimePreTrainedM... method __init__ (line 937) | def __init__(self, config): method get_input_embeddings (line 948) | def get_input_embeddings(self): method set_input_embeddings (line 951) | def set_input_embeddings(self, value): method get_output_embeddings (line 954) | def get_output_embeddings(self): method set_output_embeddings (line 957) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 960) | def set_decoder(self, decoder): method get_decoder (line 963) | def get_decoder(self): method get_audio_features (line 970) | def get_audio_features( method forward (line 1012) | def forward( method prepare_inputs_for_generation (line 1118) | def prepare_inputs_for_generation( method _prepare_model_inputs (line 1137) | def _prepare_model_inputs( method _has_unfinished_sequences (line 1159) | def _has_unfinished_sequences(self, this_peer_finished: bool, synced_g... method _update_model_kwargs_for_generation (line 1165) | def _update_model_kwargs_for_generation( method _prepare_cache_for_generation (line 1191) | def _prepare_cache_for_generation( method _get_encoder_cache (line 1215) | def _get_encoder_cache(self, cache_implementation: str, batch_size: in... method _prepare_generation_config (line 1239) | def _prepare_generation_config( method _prepare_generated_length (line 1278) | def _prepare_generated_length( FILE: src/transformers/models/voxtral_realtime/modular_voxtral_realtime.py class VoxtralRealtimeConv1dCacheLayer (line 54) | class VoxtralRealtimeConv1dCacheLayer: method __init__ (line 55) | def __init__(self): method lazy_initialization (line 59) | def lazy_initialization(self, hidden_states, conv_module): method update (line 75) | def update(self, hidden_states, conv_module=None): class VoxtralRealtimeConv1dPaddingCache (line 101) | class VoxtralRealtimeConv1dPaddingCache: method __init__ (line 102) | def __init__(self): method update (line 105) | def update(self, hidden_states, cache_key, conv_module): class VoxtralRealtimeEncoderOutput (line 115) | class VoxtralRealtimeEncoderOutput(BaseModelOutputWithPast): class VoxtralRealtimeCausalLMOutputWithPast (line 120) | class VoxtralRealtimeCausalLMOutputWithPast(CausalLMOutputWithPast): class VoxtralRealtimeRotaryEmbedding (line 134) | class VoxtralRealtimeRotaryEmbedding(LlamaRotaryEmbedding): ... class VoxtralRealtimeCausalConv1d (line 137) | class VoxtralRealtimeCausalConv1d(nn.Conv1d): method __init__ (line 138) | def __init__( method left_pad (line 152) | def left_pad(self): method forward (line 156) | def forward( class VoxtralRealtimeRMSNorm (line 169) | class VoxtralRealtimeRMSNorm(MistralRMSNorm): ... class VoxtralRealtimeAttention (line 172) | class VoxtralRealtimeAttention(MistralAttention): method __init__ (line 173) | def __init__(self, config, layer_idx: int): class VoxtralRealtimeMLP (line 182) | class VoxtralRealtimeMLP(MistralMLP): method __init__ (line 183) | def __init__(self, config): class VoxtralRealtimeEmbedder (line 188) | class VoxtralRealtimeEmbedder(nn.Module): method __init__ (line 189) | def __init__(self, config): method forward (line 199) | def forward(self, input_features, padding_cache=None): class VoxtralRealtimeEncoderLayer (line 206) | class VoxtralRealtimeEncoderLayer(GradientCheckpointingLayer): method __init__ (line 207) | def __init__(self, config, layer_idx: int): method forward (line 215) | def forward( class VoxtralRealtimePreTrainedModel (line 255) | class VoxtralRealtimePreTrainedModel(VoxtralPreTrainedModel, PreTrainedM... method _init_weights (line 260) | def _init_weights(self, module): class VoxtralRealtimeEncoder (line 272) | class VoxtralRealtimeEncoder(VoxtralRealtimePreTrainedModel): method __init__ (line 290) | def __init__(self, config): method forward (line 306) | def forward( class VoxtralRealtimeTextAdaRmsNorm (line 371) | class VoxtralRealtimeTextAdaRmsNorm(nn.Module): method __init__ (line 372) | def __init__(self, config): method forward (line 377) | def forward(self, hidden_states): class VoxtralRealtimeTextAttention (line 384) | class VoxtralRealtimeTextAttention(MistralAttention): ... class VoxtralRealtimeTextMLP (line 387) | class VoxtralRealtimeTextMLP(MistralMLP): ... class VoxtralRealtimeTextDecoderLayer (line 390) | class VoxtralRealtimeTextDecoderLayer(MistralDecoderLayer): method __init__ (line 391) | def __init__(self, config, layer_idx): method forward (line 397) | def forward( class VoxtralRealtimeTextModel (line 432) | class VoxtralRealtimeTextModel(MistralModel): method __init__ (line 433) | def __init__(self, config): class VoxtralRealtimeTextForCausalLM (line 439) | class VoxtralRealtimeTextForCausalLM(MistralForCausalLM): method forward (line 442) | def forward( class VoxtralRealtimeTimeEmbedding (line 499) | class VoxtralRealtimeTimeEmbedding(nn.Module): method __init__ (line 502) | def __init__(self, dim: int, theta: float = 10000.0) -> None: method forward (line 509) | def forward(self, time_tensor: torch.Tensor) -> torch.Tensor: class VoxtralRealtimeMultiModalProjector (line 515) | class VoxtralRealtimeMultiModalProjector(VoxtralMultiModalProjector): method __init__ (line 516) | def __init__(self, config): class VoxtralRealtimeForConditionalGeneration (line 523) | class VoxtralRealtimeForConditionalGeneration(VoxtralForConditionalGener... method __init__ (line 526) | def __init__(self, config): method get_audio_features (line 535) | def get_audio_features( method forward (line 577) | def forward( method prepare_inputs_for_generation (line 683) | def prepare_inputs_for_generation( method _prepare_model_inputs (line 702) | def _prepare_model_inputs( method _has_unfinished_sequences (line 724) | def _has_unfinished_sequences(self, this_peer_finished: bool, synced_g... method _update_model_kwargs_for_generation (line 730) | def _update_model_kwargs_for_generation( method _prepare_cache_for_generation (line 756) | def _prepare_cache_for_generation( method _get_encoder_cache (line 780) | def _get_encoder_cache(self, cache_implementation: str, batch_size: in... method _prepare_generation_config (line 804) | def _prepare_generation_config( method _prepare_generated_length (line 843) | def _prepare_generated_length( FILE: src/transformers/models/voxtral_realtime/processing_voxtral_realtime.py class VoxtralRealtimeProcessorKwargs (line 39) | class VoxtralRealtimeProcessorKwargs(ProcessingKwargs, total=False): class VoxtralRealtimeProcessor (line 55) | class VoxtralRealtimeProcessor(ProcessorMixin): method __init__ (line 56) | def __init__(self, feature_extractor, tokenizer): method mistral_common_audio_config (line 91) | def mistral_common_audio_config(self): method num_delay_tokens (line 95) | def num_delay_tokens(self): method num_right_pad_tokens (line 99) | def num_right_pad_tokens(self): method audio_length_per_tok (line 103) | def audio_length_per_tok(self): method raw_audio_length_per_tok (line 107) | def raw_audio_length_per_tok(self): method num_mel_frames_first_audio_chunk (line 111) | def num_mel_frames_first_audio_chunk(self): method num_samples_first_audio_chunk (line 119) | def num_samples_first_audio_chunk(self) -> int: method num_samples_per_audio_chunk (line 128) | def num_samples_per_audio_chunk(self) -> int: method __call__ (line 131) | def __call__( FILE: src/transformers/models/wav2vec2/configuration_wav2vec2.py class Wav2Vec2Config (line 27) | class Wav2Vec2Config(PreTrainedConfig): method __post_init__ (line 221) | def __post_init__(self, **kwargs): method validate_architecture (line 226) | def validate_architecture(self): method inputs_to_logits_ratio (line 241) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/wav2vec2/convert_wav2vec2_original_pytorch_checkpoint_to_pytorch.py function read_txt_into_dict (line 73) | def read_txt_into_dict(filename): function set_recursively (line 86) | def set_recursively(key, value, full_name, weight_type, hf_pointer): function rename_dict (line 148) | def rename_dict(key, value, full_name, weight_type, hf_dict): function load_wav2vec2_layer (line 175) | def load_wav2vec2_layer(name, value, hf_model=None, hf_dict=None): function recursively_load_weights (line 203) | def recursively_load_weights(fairseq_model, hf_model, is_headless): function load_conv_layer (line 228) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_wav2vec2_checkpoint (line 273) | def convert_wav2vec2_checkpoint( FILE: src/transformers/models/wav2vec2/convert_wav2vec2_original_s3prl_checkpoint_to_pytorch.py function convert_classification (line 34) | def convert_classification(base_model_name, hf_config, downstream_dict): function convert_diarization (line 43) | def convert_diarization(base_model_name, hf_config, downstream_dict): function convert_xvector (line 50) | def convert_xvector(base_model_name, hf_config, downstream_dict): function convert_s3prl_checkpoint (line 69) | def convert_s3prl_checkpoint(base_model_name, config_path, checkpoint_pa... FILE: src/transformers/models/wav2vec2/feature_extraction_wav2vec2.py class Wav2Vec2FeatureExtractor (line 28) | class Wav2Vec2FeatureExtractor(SequenceFeatureExtractor): method __init__ (line 64) | def __init__( method zero_mean_unit_var_norm (line 78) | def zero_mean_unit_var_norm( method __call__ (line 99) | def __call__( FILE: src/transformers/models/wav2vec2/modeling_wav2vec2.py class Wav2Vec2ForPreTrainingOutput (line 72) | class Wav2Vec2ForPreTrainingOutput(ModelOutput): function _compute_mask_indices (line 101) | def _compute_mask_indices( function _sample_negative_indices (line 220) | def _sample_negative_indices(features_shape: tuple, num_negatives: int, ... class Wav2Vec2NoLayerNormConvLayer (line 254) | class Wav2Vec2NoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 255) | def __init__(self, config, layer_id=0): method forward (line 269) | def forward(self, hidden_states): class Wav2Vec2LayerNormConvLayer (line 275) | class Wav2Vec2LayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 276) | def __init__(self, config, layer_id=0): method forward (line 291) | def forward(self, hidden_states): class Wav2Vec2GroupNormConvLayer (line 302) | class Wav2Vec2GroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 303) | def __init__(self, config, layer_id=0): method forward (line 319) | def forward(self, hidden_states): class Wav2Vec2PositionalConvEmbedding (line 326) | class Wav2Vec2PositionalConvEmbedding(nn.Module): method __init__ (line 327) | def __init__(self, config): method forward (line 360) | def forward(self, hidden_states): class Wav2Vec2SamePadLayer (line 371) | class Wav2Vec2SamePadLayer(nn.Module): method __init__ (line 372) | def __init__(self, num_conv_pos_embeddings): method forward (line 376) | def forward(self, hidden_states): class Wav2Vec2FeatureEncoder (line 382) | class Wav2Vec2FeatureEncoder(nn.Module): method __init__ (line 385) | def __init__(self, config): method _freeze_parameters (line 404) | def _freeze_parameters(self): method forward (line 409) | def forward(self, input_values): class Wav2Vec2FeatureProjection (line 422) | class Wav2Vec2FeatureProjection(nn.Module): method __init__ (line 423) | def __init__(self, config): method forward (line 429) | def forward(self, hidden_states): function eager_attention_forward (line 438) | def eager_attention_forward( class Wav2Vec2Attention (line 466) | class Wav2Vec2Attention(nn.Module): method __init__ (line 469) | def __init__( method forward (line 500) | def forward( class Wav2Vec2FeedForward (line 552) | class Wav2Vec2FeedForward(nn.Module): method __init__ (line 553) | def __init__(self, config): method forward (line 566) | def forward(self, hidden_states): class Wav2Vec2EncoderLayer (line 576) | class Wav2Vec2EncoderLayer(GradientCheckpointingLayer): method __init__ (line 577) | def __init__(self, config): method forward (line 592) | def forward(self, hidden_states, attention_mask=None, output_attention... class Wav2Vec2EncoderLayerStableLayerNorm (line 612) | class Wav2Vec2EncoderLayerStableLayerNorm(GradientCheckpointingLayer): method __init__ (line 613) | def __init__(self, config): method forward (line 632) | def forward( class Wav2Vec2Encoder (line 658) | class Wav2Vec2Encoder(nn.Module): method __init__ (line 659) | def __init__(self, config): method forward (line 668) | def forward( class Wav2Vec2EncoderStableLayerNorm (line 730) | class Wav2Vec2EncoderStableLayerNorm(nn.Module): method __init__ (line 731) | def __init__(self, config): method forward (line 742) | def forward( class Wav2Vec2GumbelVectorQuantizer (line 806) | class Wav2Vec2GumbelVectorQuantizer(nn.Module): method __init__ (line 812) | def __init__(self, config): method _compute_perplexity (line 833) | def _compute_perplexity(probs, mask=None): method forward (line 844) | def forward(self, hidden_states, mask_time_indices=None): class Wav2Vec2Adapter (line 882) | class Wav2Vec2Adapter(nn.Module): method __init__ (line 883) | def __init__(self, config): method forward (line 896) | def forward(self, hidden_states): class Wav2Vec2AdapterLayer (line 913) | class Wav2Vec2AdapterLayer(nn.Module): method __init__ (line 914) | def __init__(self, config): method forward (line 924) | def forward(self, hidden_states): class Wav2Vec2AttnAdapterLayer (line 931) | class Wav2Vec2AttnAdapterLayer(nn.Module): method __init__ (line 932) | def __init__(self, config): method forward (line 946) | def forward(self, hidden_states: torch.FloatTensor): class Wav2Vec2PreTrainedModel (line 957) | class Wav2Vec2PreTrainedModel(PreTrainedModel): method _init_weights (line 968) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 1005) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 1026) | def _get_feature_vector_attention_mask( method _get_adapters (line 1046) | def _get_adapters(self): method init_adapter_layers (line 1062) | def init_adapter_layers(self): method load_adapter (line 1075) | def load_adapter(self, target_lang: str, force_load=True, **kwargs): class Wav2Vec2Model (line 1252) | class Wav2Vec2Model(Wav2Vec2PreTrainedModel): method __init__ (line 1253) | def __init__(self, config: Wav2Vec2Config): method freeze_feature_encoder (line 1273) | def freeze_feature_encoder(self): method _mask_hidden_states (line 1280) | def _mask_hidden_states( method forward (line 1327) | def forward( class Wav2Vec2ForPreTraining (line 1391) | class Wav2Vec2ForPreTraining(Wav2Vec2PreTrainedModel): method __init__ (line 1392) | def __init__(self, config: Wav2Vec2Config): method set_gumbel_temperature (line 1405) | def set_gumbel_temperature(self, temperature: int): method freeze_feature_encoder (line 1411) | def freeze_feature_encoder(self): method compute_contrastive_logits (line 1419) | def compute_contrastive_logits( method forward (line 1440) | def forward( class Wav2Vec2ForCTC (line 1605) | class Wav2Vec2ForCTC(Wav2Vec2PreTrainedModel): method __init__ (line 1606) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 1635) | def tie_weights(self, **kwargs): method freeze_feature_encoder (line 1659) | def freeze_feature_encoder(self): method freeze_base_model (line 1666) | def freeze_base_model(self): method forward (line 1675) | def forward( class Wav2Vec2ForSequenceClassification (line 1753) | class Wav2Vec2ForSequenceClassification(Wav2Vec2PreTrainedModel): method __init__ (line 1754) | def __init__(self, config): method freeze_feature_encoder (line 1771) | def freeze_feature_encoder(self): method freeze_base_model (line 1778) | def freeze_base_model(self): method forward (line 1787) | def forward( class Wav2Vec2ForAudioFrameClassification (line 1858) | class Wav2Vec2ForAudioFrameClassification(Wav2Vec2PreTrainedModel): method __init__ (line 1859) | def __init__(self, config): method freeze_feature_encoder (line 1875) | def freeze_feature_encoder(self): method freeze_base_model (line 1882) | def freeze_base_model(self): method forward (line 1891) | def forward( class AMSoftmaxLoss (line 1952) | class AMSoftmaxLoss(nn.Module): method __init__ (line 1953) | def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4): method forward (line 1961) | def forward(self, hidden_states, labels): class TDNNLayer (line 1975) | class TDNNLayer(nn.Module): method __init__ (line 1976) | def __init__(self, config, layer_id=0): method forward (line 1986) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Wav2Vec2ForXVector (line 2012) | class Wav2Vec2ForXVector(Wav2Vec2PreTrainedModel): method __init__ (line 2013) | def __init__(self, config): method freeze_feature_encoder (line 2032) | def freeze_feature_encoder(self): method freeze_base_model (line 2039) | def freeze_base_model(self): method _get_tdnn_output_lengths (line 2047) | def _get_tdnn_output_lengths(self, input_lengths: torch.LongTensor | i... method forward (line 2063) | def forward( FILE: src/transformers/models/wav2vec2/processing_wav2vec2.py class Wav2Vec2ProcessorKwargs (line 23) | class Wav2Vec2ProcessorKwargs(ProcessingKwargs, total=False): class Wav2Vec2Processor (line 28) | class Wav2Vec2Processor(ProcessorMixin): method __init__ (line 29) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 33) | def __call__( method pad (line 65) | def pad(self, *args, **kwargs): method model_input_names (line 99) | def model_input_names(self): FILE: src/transformers/models/wav2vec2/tokenization_wav2vec2.py class Wav2Vec2CTCTokenizerOutput (line 80) | class Wav2Vec2CTCTokenizerOutput(ModelOutput): class Wav2Vec2CTCTokenizer (line 101) | class Wav2Vec2CTCTokenizer(PreTrainedTokenizer): method __init__ (line 135) | def __init__( method set_target_lang (line 184) | def set_target_lang(self, target_lang: str): method word_delimiter_token (line 211) | def word_delimiter_token(self) -> str: method word_delimiter_token_id (line 221) | def word_delimiter_token_id(self) -> int | None: method word_delimiter_token (line 231) | def word_delimiter_token(self, value): method word_delimiter_token_id (line 235) | def word_delimiter_token_id(self, value): method vocab_size (line 239) | def vocab_size(self) -> int: method get_vocab (line 242) | def get_vocab(self) -> dict: method _add_tokens (line 247) | def _add_tokens(self, new_tokens: list[str] | list[AddedToken], specia... method _tokenize (line 258) | def _tokenize(self, text, **kwargs): method _convert_token_to_id (line 267) | def _convert_token_to_id(self, token: str) -> int: method _convert_id_to_token (line 271) | def _convert_id_to_token(self, index: int) -> str: method convert_ids_to_tokens (line 276) | def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tok... method convert_tokens_to_string (line 296) | def convert_tokens_to_string( method _compute_offsets (line 360) | def _compute_offsets(char_repetitions: list[int], chars: list[str], ct... method _get_word_offsets (line 373) | def _get_word_offsets(offsets: dict[str, str | float], word_delimiter_... method prepare_for_tokenization (line 405) | def prepare_for_tokenization(self, text, is_split_into_words=False, **... method _decode (line 410) | def _decode( method batch_decode (line 464) | def batch_decode( method decode (line 534) | def decode( method save_vocabulary (line 639) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/wav2vec2_bert/configuration_wav2vec2_bert.py class Wav2Vec2BertConfig (line 26) | class Wav2Vec2BertConfig(PreTrainedConfig): method __post_init__ (line 187) | def __post_init__(self, **kwargs): method validate_architecture (line 191) | def validate_architecture(self): method inputs_to_logits_ratio (line 197) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/wav2vec2_bert/convert_wav2vec2_seamless_checkpoint.py function param_count (line 74) | def param_count(model): function _convert_model (line 78) | def _convert_model( function convert_wav2vec2_bert_checkpoint (line 124) | def convert_wav2vec2_bert_checkpoint( FILE: src/transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py class Wav2Vec2BertRotaryPositionalEmbedding (line 34) | class Wav2Vec2BertRotaryPositionalEmbedding(nn.Module): method __init__ (line 39) | def __init__(self, config): method forward (line 50) | def forward(self, hidden_states): class Wav2Vec2BertRelPositionalEmbedding (line 69) | class Wav2Vec2BertRelPositionalEmbedding(nn.Module): method __init__ (line 72) | def __init__(self, config): method extend_pe (line 78) | def extend_pe(self, x, pe=None): method forward (line 109) | def forward(self, hidden_states: torch.Tensor): class Wav2Vec2BertFeatureProjection (line 118) | class Wav2Vec2BertFeatureProjection(nn.Module): method __init__ (line 119) | def __init__(self, config): method forward (line 125) | def forward(self, hidden_states): class Wav2Vec2BertFeedForward (line 133) | class Wav2Vec2BertFeedForward(nn.Module): method __init__ (line 134) | def __init__(self, config, act_fn=None, hidden_size=None): method forward (line 146) | def forward(self, hidden_states): class Wav2Vec2BertConvolutionModule (line 156) | class Wav2Vec2BertConvolutionModule(nn.Module): method __init__ (line 159) | def __init__(self, config): method forward (line 195) | def forward(self, hidden_states, attention_mask=None): class Wav2Vec2BertSelfAttention (line 228) | class Wav2Vec2BertSelfAttention(nn.Module): method __init__ (line 233) | def __init__(self, config, is_adapter_attention=False): method forward (line 262) | def forward( method _apply_rotary_embedding (line 338) | def _apply_rotary_embedding(self, hidden_states, relative_position_emb... method _apply_relative_embeddings (line 357) | def _apply_relative_embeddings(self, query, key, relative_position_emb... class Wav2Vec2BertEncoderLayer (line 397) | class Wav2Vec2BertEncoderLayer(GradientCheckpointingLayer): method __init__ (line 400) | def __init__(self, config): method forward (line 422) | def forward( class Wav2Vec2BertEncoder (line 463) | class Wav2Vec2BertEncoder(nn.Module): method __init__ (line 464) | def __init__(self, config): method forward (line 479) | def forward( class Wav2Vec2BertAdapter (line 548) | class Wav2Vec2BertAdapter(nn.Module): method __init__ (line 549) | def __init__(self, config): method _compute_sub_sample_lengths_from_attention_mask (line 563) | def _compute_sub_sample_lengths_from_attention_mask(self, seq_lens): method forward (line 570) | def forward(self, hidden_states, attention_mask=None): function _compute_new_attention_mask (line 592) | def _compute_new_attention_mask(hidden_states: torch.Tensor, seq_lens: t... class Wav2Vec2BertAdapterLayer (line 617) | class Wav2Vec2BertAdapterLayer(nn.Module): method __init__ (line 618) | def __init__(self, config): method forward (line 655) | def forward( class Wav2Vec2BertPreTrainedModel (line 709) | class Wav2Vec2BertPreTrainedModel(PreTrainedModel): method _init_weights (line 717) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 762) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 783) | def _get_feature_vector_attention_mask( function _compute_mask_indices (line 804) | def _compute_mask_indices( class Wav2Vec2BertModel (line 927) | class Wav2Vec2BertModel(Wav2Vec2BertPreTrainedModel): method __init__ (line 928) | def __init__(self, config: Wav2Vec2BertConfig): method _mask_hidden_states (line 948) | def _mask_hidden_states( method forward (line 995) | def forward( class Wav2Vec2BertForCTC (line 1057) | class Wav2Vec2BertForCTC(Wav2Vec2BertPreTrainedModel): method __init__ (line 1058) | def __init__(self, config, target_lang: str | None = None): method forward (line 1088) | def forward( class Wav2Vec2BertForSequenceClassification (line 1168) | class Wav2Vec2BertForSequenceClassification(Wav2Vec2BertPreTrainedModel): method __init__ (line 1169) | def __init__(self, config): method freeze_base_model (line 1186) | def freeze_base_model(self): method forward (line 1195) | def forward( class Wav2Vec2BertForAudioFrameClassification (line 1260) | class Wav2Vec2BertForAudioFrameClassification(Wav2Vec2BertPreTrainedModel): method __init__ (line 1261) | def __init__(self, config): method freeze_base_model (line 1277) | def freeze_base_model(self): method forward (line 1286) | def forward( class AMSoftmaxLoss (line 1341) | class AMSoftmaxLoss(nn.Module): method __init__ (line 1342) | def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4): method forward (line 1350) | def forward(self, hidden_states, labels): class TDNNLayer (line 1364) | class TDNNLayer(nn.Module): method __init__ (line 1365) | def __init__(self, config, layer_id=0): method forward (line 1375) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Wav2Vec2BertForXVector (line 1401) | class Wav2Vec2BertForXVector(Wav2Vec2BertPreTrainedModel): method __init__ (line 1402) | def __init__(self, config): method freeze_base_model (line 1421) | def freeze_base_model(self): method _get_tdnn_output_lengths (line 1429) | def _get_tdnn_output_lengths(self, input_lengths: torch.LongTensor | i... method forward (line 1445) | def forward( FILE: src/transformers/models/wav2vec2_bert/modular_wav2vec2_bert.py function _compute_new_attention_mask (line 42) | def _compute_new_attention_mask(hidden_states: torch.Tensor, seq_lens: t... class Wav2Vec2BertRotaryPositionalEmbedding (line 67) | class Wav2Vec2BertRotaryPositionalEmbedding(Wav2Vec2ConformerRotaryPosit... method __init__ (line 68) | def __init__(self, config): class Wav2Vec2BertRelPositionalEmbedding (line 80) | class Wav2Vec2BertRelPositionalEmbedding(Wav2Vec2ConformerRelPositionalE... class Wav2Vec2BertFeatureProjection (line 84) | class Wav2Vec2BertFeatureProjection(nn.Module): method __init__ (line 85) | def __init__(self, config): method forward (line 91) | def forward(self, hidden_states): class Wav2Vec2BertFeedForward (line 99) | class Wav2Vec2BertFeedForward(Wav2Vec2FeedForward): method __init__ (line 100) | def __init__(self, config, act_fn=None, hidden_size=None): class Wav2Vec2BertConvolutionModule (line 113) | class Wav2Vec2BertConvolutionModule(nn.Module): method __init__ (line 116) | def __init__(self, config): method forward (line 152) | def forward(self, hidden_states, attention_mask=None): class Wav2Vec2BertSelfAttention (line 185) | class Wav2Vec2BertSelfAttention(Wav2Vec2ConformerSelfAttention, nn.Module): method __init__ (line 190) | def __init__(self, config, is_adapter_attention=False): method forward (line 219) | def forward( class Wav2Vec2BertEncoderLayer (line 296) | class Wav2Vec2BertEncoderLayer(GradientCheckpointingLayer): method __init__ (line 299) | def __init__(self, config): method forward (line 321) | def forward( class Wav2Vec2BertEncoder (line 362) | class Wav2Vec2BertEncoder(nn.Module): method __init__ (line 363) | def __init__(self, config): method forward (line 378) | def forward( class Wav2Vec2BertAdapter (line 447) | class Wav2Vec2BertAdapter(nn.Module): method __init__ (line 448) | def __init__(self, config): method _compute_sub_sample_lengths_from_attention_mask (line 462) | def _compute_sub_sample_lengths_from_attention_mask(self, seq_lens): method forward (line 469) | def forward(self, hidden_states, attention_mask=None): class Wav2Vec2BertAdapterLayer (line 490) | class Wav2Vec2BertAdapterLayer(nn.Module): method __init__ (line 491) | def __init__(self, config): method forward (line 528) | def forward( class Wav2Vec2BertPreTrainedModel (line 582) | class Wav2Vec2BertPreTrainedModel(PreTrainedModel): method _init_weights (line 590) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 635) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 656) | def _get_feature_vector_attention_mask( class Wav2Vec2BertModel (line 680) | class Wav2Vec2BertModel(Wav2Vec2Model, Wav2Vec2BertPreTrainedModel): method __init__ (line 681) | def __init__(self, config: Wav2Vec2BertConfig): method freeze_feature_encoder (line 701) | def freeze_feature_encoder(self): method forward (line 704) | def forward( class Wav2Vec2BertForCTC (line 758) | class Wav2Vec2BertForCTC(Wav2Vec2ConformerForCTC): method __init__ (line 759) | def __init__(self, config, target_lang: str | None = None): method freeze_feature_encoder (line 768) | def freeze_feature_encoder(self): method forward (line 771) | def forward( class Wav2Vec2BertForSequenceClassification (line 845) | class Wav2Vec2BertForSequenceClassification(Wav2Vec2ForSequenceClassific... method __init__ (line 846) | def __init__(self, config): method freeze_feature_encoder (line 849) | def freeze_feature_encoder(self): method freeze_base_model (line 852) | def freeze_base_model(self): method forward (line 860) | def forward( class Wav2Vec2BertForAudioFrameClassification (line 924) | class Wav2Vec2BertForAudioFrameClassification(Wav2Vec2ConformerForAudioF... method __init__ (line 925) | def __init__(self, config): method freeze_feature_encoder (line 928) | def freeze_feature_encoder(self): method forward (line 931) | def forward( class Wav2Vec2BertForXVector (line 986) | class Wav2Vec2BertForXVector(Wav2Vec2ConformerForXVector): method __init__ (line 987) | def __init__(self, config): method freeze_feature_encoder (line 990) | def freeze_feature_encoder(self): method forward (line 993) | def forward( FILE: src/transformers/models/wav2vec2_bert/processing_wav2vec2_bert.py class Wav2Vec2BertProcessorKwargs (line 23) | class Wav2Vec2BertProcessorKwargs(ProcessingKwargs, total=False): class Wav2Vec2BertProcessor (line 28) | class Wav2Vec2BertProcessor(ProcessorMixin): method __init__ (line 29) | def __init__(self, feature_extractor, tokenizer): method __call__ (line 33) | def __call__( method pad (line 70) | def pad(self, input_features=None, labels=None, **kwargs): method model_input_names (line 93) | def model_input_names(self): FILE: src/transformers/models/wav2vec2_conformer/configuration_wav2vec2_conformer.py class Wav2Vec2ConformerConfig (line 27) | class Wav2Vec2ConformerConfig(PreTrainedConfig): method __post_init__ (line 225) | def __post_init__(self, **kwargs): method validate_architecture (line 230) | def validate_architecture(self): method inputs_to_logits_ratio (line 245) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/wav2vec2_conformer/convert_wav2vec2_conformer_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 80) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 117) | def recursively_load_weights(fairseq_model, hf_model, is_headless): function load_conv_layer (line 174) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_wav2vec2_conformer_checkpoint (line 219) | def convert_wav2vec2_conformer_checkpoint( FILE: src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py class Wav2Vec2ConformerForPreTrainingOutput (line 40) | class Wav2Vec2ConformerForPreTrainingOutput(ModelOutput): class Wav2Vec2ConformerSamePadLayer (line 69) | class Wav2Vec2ConformerSamePadLayer(nn.Module): method __init__ (line 70) | def __init__(self, num_conv_pos_embeddings): method forward (line 74) | def forward(self, hidden_states): class Wav2Vec2ConformerPositionalConvEmbedding (line 80) | class Wav2Vec2ConformerPositionalConvEmbedding(nn.Module): method __init__ (line 81) | def __init__(self, config): method forward (line 114) | def forward(self, hidden_states): class Wav2Vec2ConformerRotaryPositionalEmbedding (line 125) | class Wav2Vec2ConformerRotaryPositionalEmbedding(nn.Module): method __init__ (line 130) | def __init__(self, config): method forward (line 140) | def forward(self, hidden_states): class Wav2Vec2ConformerRelPositionalEmbedding (line 159) | class Wav2Vec2ConformerRelPositionalEmbedding(nn.Module): method __init__ (line 162) | def __init__(self, config): method extend_pe (line 168) | def extend_pe(self, x, pe=None): method forward (line 199) | def forward(self, hidden_states: torch.Tensor): class Wav2Vec2ConformerNoLayerNormConvLayer (line 208) | class Wav2Vec2ConformerNoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 209) | def __init__(self, config, layer_id=0): method forward (line 223) | def forward(self, hidden_states): class Wav2Vec2ConformerLayerNormConvLayer (line 229) | class Wav2Vec2ConformerLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 230) | def __init__(self, config, layer_id=0): method forward (line 245) | def forward(self, hidden_states): class Wav2Vec2ConformerGroupNormConvLayer (line 256) | class Wav2Vec2ConformerGroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 257) | def __init__(self, config, layer_id=0): method forward (line 273) | def forward(self, hidden_states): class Wav2Vec2ConformerFeatureEncoder (line 280) | class Wav2Vec2ConformerFeatureEncoder(nn.Module): method __init__ (line 283) | def __init__(self, config): method _freeze_parameters (line 303) | def _freeze_parameters(self): method forward (line 308) | def forward(self, input_values): class Wav2Vec2ConformerFeatureProjection (line 321) | class Wav2Vec2ConformerFeatureProjection(nn.Module): method __init__ (line 322) | def __init__(self, config): method forward (line 328) | def forward(self, hidden_states): class Wav2Vec2ConformerFeedForward (line 336) | class Wav2Vec2ConformerFeedForward(nn.Module): method __init__ (line 337) | def __init__(self, config): method forward (line 350) | def forward(self, hidden_states): class Wav2Vec2ConformerConvolutionModule (line 360) | class Wav2Vec2ConformerConvolutionModule(nn.Module): method __init__ (line 363) | def __init__(self, config): method forward (line 398) | def forward(self, hidden_states): class Wav2Vec2ConformerSelfAttention (line 420) | class Wav2Vec2ConformerSelfAttention(nn.Module): method __init__ (line 425) | def __init__(self, config): method forward (line 447) | def forward( method _apply_rotary_embedding (line 509) | def _apply_rotary_embedding(self, hidden_states, relative_position_emb... method _apply_relative_embeddings (line 528) | def _apply_relative_embeddings(self, query, key, relative_position_emb... class Wav2Vec2ConformerEncoderLayer (line 568) | class Wav2Vec2ConformerEncoderLayer(GradientCheckpointingLayer): method __init__ (line 571) | def __init__(self, config): method forward (line 593) | def forward( class Wav2Vec2ConformerEncoder (line 633) | class Wav2Vec2ConformerEncoder(nn.Module): method __init__ (line 634) | def __init__(self, config): method forward (line 651) | def forward( class Wav2Vec2ConformerGumbelVectorQuantizer (line 720) | class Wav2Vec2ConformerGumbelVectorQuantizer(nn.Module): method __init__ (line 726) | def __init__(self, config): method _compute_perplexity (line 747) | def _compute_perplexity(probs, mask=None): method forward (line 758) | def forward(self, hidden_states, mask_time_indices=None): class Wav2Vec2ConformerAdapter (line 796) | class Wav2Vec2ConformerAdapter(nn.Module): method __init__ (line 797) | def __init__(self, config): method forward (line 810) | def forward(self, hidden_states): class Wav2Vec2ConformerAdapterLayer (line 827) | class Wav2Vec2ConformerAdapterLayer(nn.Module): method __init__ (line 828) | def __init__(self, config): method forward (line 838) | def forward(self, hidden_states): class Wav2Vec2ConformerPreTrainedModel (line 846) | class Wav2Vec2ConformerPreTrainedModel(PreTrainedModel): method _init_weights (line 854) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 907) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 928) | def _get_feature_vector_attention_mask( function _compute_mask_indices (line 949) | def _compute_mask_indices( class Wav2Vec2ConformerModel (line 1072) | class Wav2Vec2ConformerModel(Wav2Vec2ConformerPreTrainedModel): method __init__ (line 1073) | def __init__(self, config: Wav2Vec2ConformerConfig): method freeze_feature_encoder (line 1090) | def freeze_feature_encoder(self): method _mask_hidden_states (line 1097) | def _mask_hidden_states( method forward (line 1144) | def forward( class Wav2Vec2ConformerForPreTraining (line 1208) | class Wav2Vec2ConformerForPreTraining(Wav2Vec2ConformerPreTrainedModel): method __init__ (line 1209) | def __init__(self, config: Wav2Vec2ConformerConfig): method set_gumbel_temperature (line 1222) | def set_gumbel_temperature(self, temperature: int): method freeze_feature_encoder (line 1228) | def freeze_feature_encoder(self): method compute_contrastive_logits (line 1236) | def compute_contrastive_logits( method forward (line 1257) | def forward( class Wav2Vec2ConformerForCTC (line 1425) | class Wav2Vec2ConformerForCTC(Wav2Vec2ConformerPreTrainedModel): method __init__ (line 1426) | def __init__(self, config, target_lang: str | None = None): method freeze_feature_encoder (line 1455) | def freeze_feature_encoder(self): method forward (line 1463) | def forward( class Wav2Vec2ConformerForSequenceClassification (line 1541) | class Wav2Vec2ConformerForSequenceClassification(Wav2Vec2ConformerPreTra... method __init__ (line 1542) | def __init__(self, config): method freeze_feature_encoder (line 1559) | def freeze_feature_encoder(self): method freeze_base_model (line 1566) | def freeze_base_model(self): method forward (line 1575) | def forward( class Wav2Vec2ConformerForAudioFrameClassification (line 1646) | class Wav2Vec2ConformerForAudioFrameClassification(Wav2Vec2ConformerPreT... method __init__ (line 1647) | def __init__(self, config): method freeze_feature_encoder (line 1663) | def freeze_feature_encoder(self): method freeze_base_model (line 1670) | def freeze_base_model(self): method forward (line 1679) | def forward( class AMSoftmaxLoss (line 1740) | class AMSoftmaxLoss(nn.Module): method __init__ (line 1741) | def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4): method forward (line 1749) | def forward(self, hidden_states, labels): class TDNNLayer (line 1763) | class TDNNLayer(nn.Module): method __init__ (line 1764) | def __init__(self, config, layer_id=0): method forward (line 1774) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class Wav2Vec2ConformerForXVector (line 1800) | class Wav2Vec2ConformerForXVector(Wav2Vec2ConformerPreTrainedModel): method __init__ (line 1801) | def __init__(self, config): method freeze_feature_encoder (line 1820) | def freeze_feature_encoder(self): method freeze_base_model (line 1827) | def freeze_base_model(self): method _get_tdnn_output_lengths (line 1835) | def _get_tdnn_output_lengths(self, input_lengths: torch.LongTensor | i... method forward (line 1851) | def forward( FILE: src/transformers/models/wav2vec2_conformer/modular_wav2vec2_conformer.py class Wav2Vec2ConformerForPreTrainingOutput (line 44) | class Wav2Vec2ConformerForPreTrainingOutput(ModelOutput): class Wav2Vec2ConformerPositionalConvEmbedding (line 73) | class Wav2Vec2ConformerPositionalConvEmbedding(Wav2Vec2PositionalConvEmb... class Wav2Vec2ConformerRotaryPositionalEmbedding (line 77) | class Wav2Vec2ConformerRotaryPositionalEmbedding(nn.Module): method __init__ (line 82) | def __init__(self, config): method forward (line 92) | def forward(self, hidden_states): class Wav2Vec2ConformerRelPositionalEmbedding (line 111) | class Wav2Vec2ConformerRelPositionalEmbedding(nn.Module): method __init__ (line 114) | def __init__(self, config): method extend_pe (line 120) | def extend_pe(self, x, pe=None): method forward (line 151) | def forward(self, hidden_states: torch.Tensor): class Wav2Vec2ConformerFeatureEncoder (line 160) | class Wav2Vec2ConformerFeatureEncoder(Wav2Vec2FeatureEncoder): class Wav2Vec2ConformerFeatureProjection (line 164) | class Wav2Vec2ConformerFeatureProjection(Wav2Vec2FeatureProjection): class Wav2Vec2ConformerFeedForward (line 168) | class Wav2Vec2ConformerFeedForward(Wav2Vec2FeedForward): class Wav2Vec2ConformerConvolutionModule (line 172) | class Wav2Vec2ConformerConvolutionModule(nn.Module): method __init__ (line 175) | def __init__(self, config): method forward (line 210) | def forward(self, hidden_states): class Wav2Vec2ConformerSelfAttention (line 232) | class Wav2Vec2ConformerSelfAttention(nn.Module): method __init__ (line 237) | def __init__(self, config): method forward (line 259) | def forward( method _apply_rotary_embedding (line 321) | def _apply_rotary_embedding(self, hidden_states, relative_position_emb... method _apply_relative_embeddings (line 340) | def _apply_relative_embeddings(self, query, key, relative_position_emb... class Wav2Vec2ConformerEncoderLayer (line 380) | class Wav2Vec2ConformerEncoderLayer(GradientCheckpointingLayer): method __init__ (line 383) | def __init__(self, config): method forward (line 405) | def forward( class Wav2Vec2ConformerEncoder (line 445) | class Wav2Vec2ConformerEncoder(nn.Module): method __init__ (line 446) | def __init__(self, config): method forward (line 463) | def forward( class Wav2Vec2ConformerGumbelVectorQuantizer (line 532) | class Wav2Vec2ConformerGumbelVectorQuantizer(Wav2Vec2GumbelVectorQuantiz... class Wav2Vec2ConformerAdapter (line 536) | class Wav2Vec2ConformerAdapter(Wav2Vec2Adapter): class Wav2Vec2ConformerAdapterLayer (line 540) | class Wav2Vec2ConformerAdapterLayer(Wav2Vec2AdapterLayer): class Wav2Vec2ConformerPreTrainedModel (line 545) | class Wav2Vec2ConformerPreTrainedModel(PreTrainedModel): method _init_weights (line 553) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 606) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 627) | def _get_feature_vector_attention_mask( class Wav2Vec2ConformerModel (line 654) | class Wav2Vec2ConformerModel(Wav2Vec2ConformerPreTrainedModel, Wav2Vec2M... method __init__ (line 655) | def __init__(self, config: Wav2Vec2ConformerConfig): class Wav2Vec2ConformerForPreTraining (line 673) | class Wav2Vec2ConformerForPreTraining(Wav2Vec2ForPreTraining): method __init__ (line 674) | def __init__(self, config: Wav2Vec2ConformerConfig): class Wav2Vec2ConformerForCTC (line 678) | class Wav2Vec2ConformerForCTC(Wav2Vec2ForCTC): method __init__ (line 679) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 688) | def tie_weights(self): method freeze_base_model (line 691) | def freeze_base_model(self): class Wav2Vec2ConformerForSequenceClassification (line 695) | class Wav2Vec2ConformerForSequenceClassification(Wav2Vec2ForSequenceClas... method __init__ (line 696) | def __init__(self, config): class Wav2Vec2ConformerForAudioFrameClassification (line 700) | class Wav2Vec2ConformerForAudioFrameClassification(Wav2Vec2ForAudioFrame... method __init__ (line 701) | def __init__(self, config): class Wav2Vec2ConformerForXVector (line 705) | class Wav2Vec2ConformerForXVector(Wav2Vec2ForXVector): method __init__ (line 706) | def __init__(self, config): FILE: src/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py class Wav2Vec2PhonemeCTCTokenizerOutput (line 54) | class Wav2Vec2PhonemeCTCTokenizerOutput(ModelOutput): class Wav2Vec2PhonemeCTCTokenizer (line 71) | class Wav2Vec2PhonemeCTCTokenizer(PreTrainedTokenizer): method __init__ (line 106) | def __init__( method vocab_size (line 147) | def vocab_size(self) -> int: method get_vocab (line 150) | def get_vocab(self) -> dict: method _add_tokens (line 155) | def _add_tokens(self, new_tokens: list[str] | list[AddedToken], specia... method init_backend (line 166) | def init_backend(self, phonemizer_lang: str): method prepare_for_tokenization (line 178) | def prepare_for_tokenization( method _tokenize (line 222) | def _tokenize(self, text, **kwargs): method phonemize (line 243) | def phonemize(self, text: str, phonemizer_lang: str | None = None) -> ... method word_delimiter_token (line 262) | def word_delimiter_token(self) -> str: method word_delimiter_token_id (line 273) | def word_delimiter_token_id(self) -> int | None: method word_delimiter_token (line 283) | def word_delimiter_token(self, value): method word_delimiter_token_id (line 287) | def word_delimiter_token_id(self, value): method phone_delimiter_token (line 291) | def phone_delimiter_token(self) -> str: method phone_delimiter_token_id (line 302) | def phone_delimiter_token_id(self) -> int | None: method phone_delimiter_token (line 312) | def phone_delimiter_token(self, value): method phone_delimiter_token_id (line 316) | def phone_delimiter_token_id(self, value): method _convert_token_to_id (line 319) | def _convert_token_to_id(self, token: str) -> int: method _convert_id_to_token (line 323) | def _convert_id_to_token(self, index: int) -> str: method convert_tokens_to_string (line 328) | def convert_tokens_to_string( method _compute_offsets (line 379) | def _compute_offsets( method _decode (line 398) | def _decode( method decode (line 445) | def decode( method batch_decode (line 501) | def batch_decode( method save_vocabulary (line 557) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py class Wav2Vec2DecoderWithLMOutput (line 46) | class Wav2Vec2DecoderWithLMOutput(ModelOutput): class Wav2Vec2ProcessorWithLM (line 69) | class Wav2Vec2ProcessorWithLM(ProcessorMixin): method __init__ (line 70) | def __init__( method save_pretrained (line 102) | def save_pretrained(self, save_directory): method from_pretrained (line 107) | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): method _set_language_model_attribute (line 178) | def _set_language_model_attribute(decoder: "BeamSearchDecoderCTC", att... method language_model (line 182) | def language_model(self): method get_missing_alphabet_tokens (line 186) | def get_missing_alphabet_tokens(decoder, tokenizer): method __call__ (line 209) | def __call__(self, *args, **kwargs): method pad (line 233) | def pad(self, *args, **kwargs): method batch_decode (line 260) | def batch_decode( method decode (line 445) | def decode( FILE: src/transformers/models/wavlm/configuration_wavlm.py class WavLMConfig (line 27) | class WavLMConfig(PreTrainedConfig): method __post_init__ (line 215) | def __post_init__(self, **kwargs): method validate_architecture (line 220) | def validate_architecture(self): method inputs_to_logits_ratio (line 235) | def inputs_to_logits_ratio(self): FILE: src/transformers/models/wavlm/convert_wavlm_original_pytorch_checkpoint_to_pytorch.py function set_recursively (line 66) | def set_recursively(hf_pointer, key, value, full_name, weight_type): function recursively_load_weights (line 94) | def recursively_load_weights(fairseq_model, hf_model): function load_conv_layer (line 138) | def load_conv_layer(full_name, value, feature_extractor, unused_weights,... function convert_wavlm_checkpoint (line 179) | def convert_wavlm_checkpoint(checkpoint_path, pytorch_dump_folder_path, ... FILE: src/transformers/models/wavlm/convert_wavlm_original_s3prl_checkpoint_to_pytorch.py function convert_classification (line 34) | def convert_classification(base_model_name, hf_config, downstream_dict): function convert_diarization (line 43) | def convert_diarization(base_model_name, hf_config, downstream_dict): function convert_xvector (line 50) | def convert_xvector(base_model_name, hf_config, downstream_dict): function convert_s3prl_checkpoint (line 69) | def convert_s3prl_checkpoint(base_model_name, config_path, checkpoint_pa... FILE: src/transformers/models/wavlm/modeling_wavlm.py class WavLMSamePadLayer (line 37) | class WavLMSamePadLayer(nn.Module): method __init__ (line 38) | def __init__(self, num_conv_pos_embeddings): method forward (line 42) | def forward(self, hidden_states): class WavLMPositionalConvEmbedding (line 48) | class WavLMPositionalConvEmbedding(nn.Module): method __init__ (line 49) | def __init__(self, config): method forward (line 82) | def forward(self, hidden_states): class WavLMFeatureProjection (line 93) | class WavLMFeatureProjection(nn.Module): method __init__ (line 94) | def __init__(self, config): method forward (line 100) | def forward(self, hidden_states): class WavLMAttention (line 108) | class WavLMAttention(nn.Module): method __init__ (line 111) | def __init__( method forward (line 147) | def forward( method torch_multi_head_self_attention (line 188) | def torch_multi_head_self_attention( method compute_bias (line 243) | def compute_bias(self, query_length: int, key_length: int) -> torch.Fl... method _relative_positions_bucket (line 253) | def _relative_positions_bucket(self, relative_positions: torch.FloatTe... class WavLMFeedForward (line 274) | class WavLMFeedForward(nn.Module): method __init__ (line 275) | def __init__(self, config): method forward (line 288) | def forward(self, hidden_states): class WavLMEncoderLayer (line 298) | class WavLMEncoderLayer(GradientCheckpointingLayer): method __init__ (line 299) | def __init__(self, config: WavLMConfig, has_relative_position_bias: bo... method forward (line 314) | def forward(self, hidden_states, attention_mask=None, position_bias=No... class WavLMEncoderLayerStableLayerNorm (line 339) | class WavLMEncoderLayerStableLayerNorm(GradientCheckpointingLayer): method __init__ (line 340) | def __init__(self, config: WavLMConfig, has_relative_position_bias: bo... method forward (line 355) | def forward(self, hidden_states, attention_mask=None, position_bias=No... class WavLMEncoder (line 376) | class WavLMEncoder(nn.Module): method __init__ (line 377) | def __init__(self, config): method forward (line 388) | def forward( class WavLMEncoderStableLayerNorm (line 450) | class WavLMEncoderStableLayerNorm(nn.Module): method __init__ (line 451) | def __init__(self, config): method forward (line 465) | def forward( class WavLMGumbelVectorQuantizer (line 525) | class WavLMGumbelVectorQuantizer(nn.Module): method __init__ (line 531) | def __init__(self, config): method _compute_perplexity (line 553) | def _compute_perplexity(probs): method forward (line 558) | def forward(self, hidden_states): class WavLMPreTrainedModel (line 596) | class WavLMPreTrainedModel(PreTrainedModel): method _init_weights (line 607) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 640) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method _get_feature_vector_attention_mask (line 661) | def _get_feature_vector_attention_mask( class WavLMNoLayerNormConvLayer (line 682) | class WavLMNoLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 683) | def __init__(self, config, layer_id=0): method forward (line 697) | def forward(self, hidden_states): class WavLMLayerNormConvLayer (line 703) | class WavLMLayerNormConvLayer(GradientCheckpointingLayer): method __init__ (line 704) | def __init__(self, config, layer_id=0): method forward (line 719) | def forward(self, hidden_states): class WavLMGroupNormConvLayer (line 730) | class WavLMGroupNormConvLayer(GradientCheckpointingLayer): method __init__ (line 731) | def __init__(self, config, layer_id=0): method forward (line 747) | def forward(self, hidden_states): class WavLMFeatureEncoder (line 754) | class WavLMFeatureEncoder(nn.Module): method __init__ (line 757) | def __init__(self, config): method _freeze_parameters (line 774) | def _freeze_parameters(self): method forward (line 779) | def forward(self, input_values): class WavLMAdapterLayer (line 792) | class WavLMAdapterLayer(nn.Module): method __init__ (line 793) | def __init__(self, config): method forward (line 803) | def forward(self, hidden_states): class WavLMAdapter (line 810) | class WavLMAdapter(nn.Module): method __init__ (line 811) | def __init__(self, config): method forward (line 824) | def forward(self, hidden_states): function _compute_mask_indices (line 841) | def _compute_mask_indices( class WavLMModel (line 964) | class WavLMModel(WavLMPreTrainedModel): method __init__ (line 965) | def __init__(self, config: WavLMConfig): method freeze_feature_encoder (line 985) | def freeze_feature_encoder(self): method _mask_hidden_states (line 992) | def _mask_hidden_states( method forward (line 1039) | def forward( class WavLMForCTC (line 1106) | class WavLMForCTC(WavLMPreTrainedModel): method __init__ (line 1107) | def __init__(self, config, target_lang: str | None = None): method tie_weights (line 1136) | def tie_weights(self, **kwargs): method freeze_feature_encoder (line 1160) | def freeze_feature_encoder(self): method freeze_base_model (line 1167) | def freeze_base_model(self): method forward (line 1176) | def forward( class WavLMForSequenceClassification (line 1254) | class WavLMForSequenceClassification(WavLMPreTrainedModel): method __init__ (line 1255) | def __init__(self, config): method freeze_feature_encoder (line 1272) | def freeze_feature_encoder(self): method freeze_base_model (line 1279) | def freeze_base_model(self): method forward (line 1288) | def forward( class WavLMForAudioFrameClassification (line 1359) | class WavLMForAudioFrameClassification(WavLMPreTrainedModel): method __init__ (line 1360) | def __init__(self, config): method freeze_feature_encoder (line 1376) | def freeze_feature_encoder(self): method freeze_base_model (line 1383) | def freeze_base_model(self): method forward (line 1392) | def forward( class AMSoftmaxLoss (line 1453) | class AMSoftmaxLoss(nn.Module): method __init__ (line 1454) | def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4): method forward (line 1462) | def forward(self, hidden_states, labels): class TDNNLayer (line 1476) | class TDNNLayer(nn.Module): method __init__ (line 1477) | def __init__(self, config, layer_id=0): method forward (line 1487) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class WavLMForXVector (line 1513) | class WavLMForXVector(WavLMPreTrainedModel): method __init__ (line 1514) | def __init__(self, config): method freeze_feature_encoder (line 1533) | def freeze_feature_encoder(self): method freeze_base_model (line 1540) | def freeze_base_model(self): method _get_tdnn_output_lengths (line 1548) | def _get_tdnn_output_lengths(self, input_lengths: torch.LongTensor | i... method forward (line 1564) | def forward( FILE: src/transformers/models/wavlm/modular_wavlm.py class WavLMPositionalConvEmbedding (line 31) | class WavLMPositionalConvEmbedding(Wav2Vec2PositionalConvEmbedding): class WavLMFeatureProjection (line 35) | class WavLMFeatureProjection(Wav2Vec2FeatureProjection): class WavLMAttention (line 39) | class WavLMAttention(nn.Module): method __init__ (line 42) | def __init__( method forward (line 78) | def forward( method torch_multi_head_self_attention (line 119) | def torch_multi_head_self_attention( method compute_bias (line 174) | def compute_bias(self, query_length: int, key_length: int) -> torch.Fl... method _relative_positions_bucket (line 184) | def _relative_positions_bucket(self, relative_positions: torch.FloatTe... class WavLMFeedForward (line 205) | class WavLMFeedForward(Wav2Vec2FeedForward): class WavLMEncoderLayer (line 209) | class WavLMEncoderLayer(GradientCheckpointingLayer): method __init__ (line 210) | def __init__(self, config: WavLMConfig, has_relative_position_bias: bo... method forward (line 225) | def forward(self, hidden_states, attention_mask=None, position_bias=No... class WavLMEncoderLayerStableLayerNorm (line 250) | class WavLMEncoderLayerStableLayerNorm(GradientCheckpointingLayer): method __init__ (line 251) | def __init__(self, config: WavLMConfig, has_relative_position_bias: bo... method forward (line 266) | def forward(self, hidden_states, attention_mask=None, position_bias=No... class WavLMEncoder (line 287) | class WavLMEncoder(nn.Module): method __init__ (line 288) | def __init__(self, config): method forward (line 299) | def forward( class WavLMEncoderStableLayerNorm (line 361) | class WavLMEncoderStableLayerNorm(nn.Module): method __init__ (line 362) | def __init__(self, config): method forward (line 376) | def forward( class WavLMGumbelVectorQuantizer (line 436) | class WavLMGumbelVectorQuantizer(nn.Module): method __init__ (line 442) | def __init__(self, config): method _compute_perplexity (line 464) | def _compute_perplexity(probs): method forward (line 469) | def forward(self, hidden_states): class WavLMPreTrainedModel (line 506) | class WavLMPreTrainedModel(PreTrainedModel, Wav2Vec2PreTrainedModel): method _init_weights (line 517) | def _init_weights(self, module): method _get_adapters (line 550) | def _get_adapters(self): method init_adapter_layers (line 553) | def init_adapter_layers(self): method load_adapter (line 556) | def load_adapter(self): class WavLMModel (line 563) | class WavLMModel(Wav2Vec2Model): class WavLMForCTC (line 567) | class WavLMForCTC(Wav2Vec2ForCTC): class WavLMForSequenceClassification (line 571) | class WavLMForSequenceClassification(Wav2Vec2ForSequenceClassification): class WavLMForAudioFrameClassification (line 575) | class WavLMForAudioFrameClassification(Wav2Vec2ForAudioFrameClassificati... class WavLMForXVector (line 579) | class WavLMForXVector(Wav2Vec2ForXVector): FILE: src/transformers/models/whisper/configuration_whisper.py class WhisperConfig (line 50) | class WhisperConfig(PreTrainedConfig): FILE: src/transformers/models/whisper/convert_openai_to_hf.py function _get_generation_config (line 65) | def _get_generation_config( function remove_ignore_keys_ (line 96) | def remove_ignore_keys_(state_dict): function rename_keys (line 126) | def rename_keys(s_dict): function make_linear_from_emb (line 140) | def make_linear_from_emb(emb): function _download (line 147) | def _download(url: str, root: str) -> Any: function convert_openai_whisper_to_tfms (line 185) | def convert_openai_whisper_to_tfms( function _bpe (line 255) | def _bpe(mergeable_ranks, token: bytes, max_rank=None) -> list[bytes]: function convert_tiktoken_bpe_to_hf (line 272) | def convert_tiktoken_bpe_to_hf(tiktoken_url: str): function convert_tiktoken_to_hf (line 291) | def convert_tiktoken_to_hf( FILE: src/transformers/models/whisper/english_normalizer.py function remove_symbols_and_diacritics (line 46) | def remove_symbols_and_diacritics(s: str, keep=""): function remove_symbols (line 69) | def remove_symbols(s: str): class BasicTextNormalizer (line 76) | class BasicTextNormalizer: method __init__ (line 77) | def __init__(self, remove_diacritics: bool = False, split_letters: boo... method __call__ (line 81) | def __call__(self, s: str): class EnglishNumberNormalizer (line 95) | class EnglishNumberNormalizer: method __init__ (line 106) | def __init__(self): method process_words (line 212) | def process_words(self, words: list[str]) -> Iterator[str]: method preprocess (line 435) | def preprocess(self, s: str): method postprocess (line 464) | def postprocess(self, s: str): method __call__ (line 489) | def __call__(self, s: str): class EnglishSpellingNormalizer (line 497) | class EnglishSpellingNormalizer: method __init__ (line 504) | def __init__(self, english_spelling_mapping): method __call__ (line 507) | def __call__(self, s: str): class EnglishTextNormalizer (line 511) | class EnglishTextNormalizer: method __init__ (line 512) | def __init__(self, english_spelling_mapping): method __call__ (line 572) | def __call__(self, s: str): FILE: src/transformers/models/whisper/feature_extraction_whisper.py class WhisperFeatureExtractor (line 33) | class WhisperFeatureExtractor(SequenceFeatureExtractor): method __init__ (line 69) | def __init__( method _np_extract_fbank_features (line 105) | def _np_extract_fbank_features(self, waveform_batch: np.ndarray, devic... method _torch_extract_fbank_features (line 135) | def _torch_extract_fbank_features(self, waveform: np.ndarray, device: ... method zero_mean_unit_var_norm (line 168) | def zero_mean_unit_var_norm( method __call__ (line 189) | def __call__( FILE: src/transformers/models/whisper/generation_whisper.py function _median_filter (line 43) | def _median_filter(inputs: torch.Tensor, filter_width: int) -> torch.Ten... function _dynamic_time_warping (line 64) | def _dynamic_time_warping(matrix: np.ndarray): function _get_attr_from_logit_processors (line 118) | def _get_attr_from_logit_processors(logits_processor, logit_processor_cl... function _pad_to_max_length (line 126) | def _pad_to_max_length( class WhisperGenerationMixin (line 240) | class WhisperGenerationMixin(GenerationMixin): method _extract_token_timestamps (line 241) | def _extract_token_timestamps( method generate (line 383) | def generate( method generate_with_fallback (line 970) | def generate_with_fallback( method _prepare_segments (line 1119) | def _prepare_segments(prompt_ids, batch_size, generation_config): method _postprocess_outputs (line 1129) | def _postprocess_outputs( method _stack_split_outputs (line 1194) | def _stack_split_outputs(self, seek_outputs, model_output_type, device... method _need_fallback (line 1243) | def _need_fallback( method _expand_variables_for_generation (line 1289) | def _expand_variables_for_generation( method _setup_no_speech_detection (line 1317) | def _setup_no_speech_detection(logits_processor, segment_input, decode... method _retrieve_total_input_frames (line 1323) | def _retrieve_total_input_frames(input_features, input_stride, kwargs): method _maybe_warn_unused_inputs (line 1338) | def _maybe_warn_unused_inputs( method _set_return_outputs (line 1366) | def _set_return_outputs(return_dict_in_generate, return_token_timestam... method _set_return_timestamps (line 1384) | def _set_return_timestamps(self, return_timestamps, is_shortform, gene... method _set_language_and_task (line 1420) | def _set_language_and_task(language, task, is_multilingual, generation... method _retrieve_init_tokens (line 1455) | def _retrieve_init_tokens(self, input_features, batch_size, generation... method detect_language (line 1610) | def detect_language( method _check_decoder_input_ids (line 1676) | def _check_decoder_input_ids(kwargs): method _set_num_frames (line 1685) | def _set_num_frames(return_token_timestamps, generation_config, attent... method _set_thresholds_and_condition (line 1703) | def _set_thresholds_and_condition( method _set_prompt_condition_type (line 1732) | def _set_prompt_condition_type(generation_config, prompt_condition_type): method _set_condition_on_prev_tokens (line 1751) | def _set_condition_on_prev_tokens(condition_on_prev_tokens, generation... method _retrieve_max_frames_and_seek (line 1760) | def _retrieve_max_frames_and_seek(batch_size, attention_mask, total_in... method _retrieve_logit_processors (line 1774) | def _retrieve_logit_processors(self, generation_config, logits_process... method _maybe_reduce_batch (line 1815) | def _maybe_reduce_batch(input_features, seek, max_frames, cur_bsz, bat... method _get_input_segment (line 1831) | def _get_input_segment(input_features, seek, seek_num_frames, num_segm... method _prepare_decoder_input_ids (line 1853) | def _prepare_decoder_input_ids( method _set_max_new_tokens_and_length (line 1920) | def _set_max_new_tokens_and_length(self, config, decoder_input_ids, ge... method _retrieve_compression_ratio (line 1948) | def _retrieve_compression_ratio(tokens, vocab_size): method _retrieve_avg_logprobs (line 1957) | def _retrieve_avg_logprobs(scores, tokens, temperature): method _retrieve_segment (line 1976) | def _retrieve_segment( FILE: src/transformers/models/whisper/modeling_whisper.py function sinusoids (line 55) | def sinusoids(length: int, channels: int, max_timescale: float = 10000) ... function shift_tokens_right (line 68) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... function _compute_mask_indices (line 85) | def _compute_mask_indices( class WhisperPositionalEmbedding (line 204) | class WhisperPositionalEmbedding(nn.Embedding): method __init__ (line 205) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method forward (line 208) | def forward(self, input_ids, past_key_values_length=0, position_ids=No... function eager_attention_forward (line 215) | def eager_attention_forward( class WhisperAttention (line 241) | class WhisperAttention(nn.Module): method __init__ (line 244) | def __init__( method forward (line 284) | def forward( class WhisperEncoderLayer (line 361) | class WhisperEncoderLayer(GradientCheckpointingLayer): method __init__ (line 362) | def __init__(self, config: WhisperConfig): method forward (line 380) | def forward( class WhisperDecoderLayer (line 417) | class WhisperDecoderLayer(GradientCheckpointingLayer): method __init__ (line 418) | def __init__(self, config: WhisperConfig, layer_idx: int | None = None): method forward (line 449) | def forward( class WhisperPreTrainedModel (line 510) | class WhisperPreTrainedModel(PreTrainedModel): method _init_weights (line 524) | def _init_weights(self, module): method _get_feat_extract_output_lengths (line 532) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class WhisperEncoder (line 541) | class WhisperEncoder(WhisperPreTrainedModel): method __init__ (line 556) | def __init__(self, config: WhisperConfig): method _freeze_parameters (line 580) | def _freeze_parameters(self): method get_input_embeddings (line 585) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 588) | def set_input_embeddings(self, value: nn.Module): method forward (line 593) | def forward( class WhisperDecoder (line 650) | class WhisperDecoder(WhisperPreTrainedModel): method __init__ (line 667) | def __init__(self, config: WhisperConfig): method forward (line 691) | def forward( class WhisperModel (line 800) | class WhisperModel(WhisperPreTrainedModel): method __init__ (line 801) | def __init__(self, config: WhisperConfig): method get_input_embeddings (line 809) | def get_input_embeddings(self): method set_input_embeddings (line 812) | def set_input_embeddings(self, value): method freeze_encoder (line 815) | def freeze_encoder(self): method _mask_input_features (line 822) | def _mask_input_features( method forward (line 867) | def forward( class WhisperForConditionalGeneration (line 964) | class WhisperForConditionalGeneration(WhisperGenerationMixin, WhisperPre... method __init__ (line 968) | def __init__(self, config: WhisperConfig): method get_output_embeddings (line 977) | def get_output_embeddings(self): method set_output_embeddings (line 980) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 983) | def get_input_embeddings(self) -> nn.Module: method freeze_encoder (line 986) | def freeze_encoder(self): method forward (line 995) | def forward( class WhisperDecoderWrapper (line 1103) | class WhisperDecoderWrapper(WhisperPreTrainedModel): method __init__ (line 1109) | def __init__(self, config): method get_input_embeddings (line 1115) | def get_input_embeddings(self): method set_input_embeddings (line 1118) | def set_input_embeddings(self, value): method forward (line 1121) | def forward(self, *args, **kwargs): class WhisperForCausalLM (line 1130) | class WhisperForCausalLM(WhisperPreTrainedModel, GenerationMixin): method __init__ (line 1134) | def __init__(self, config): method get_output_embeddings (line 1144) | def get_output_embeddings(self): method set_output_embeddings (line 1147) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 1150) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1153) | def set_input_embeddings(self, value): method forward (line 1158) | def forward( class WhisperForAudioClassification (line 1242) | class WhisperForAudioClassification(WhisperPreTrainedModel): method __init__ (line 1243) | def __init__(self, config): method freeze_encoder (line 1256) | def freeze_encoder(self): method get_input_embeddings (line 1263) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1266) | def set_input_embeddings(self, value: nn.Module): method forward (line 1271) | def forward( FILE: src/transformers/models/whisper/processing_whisper.py class WhisperProcessor (line 23) | class WhisperProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, feature_extractor, tokenizer): method get_decoder_prompt_ids (line 27) | def get_decoder_prompt_ids(self, task=None, language=None, no_timestam... method __call__ (line 31) | def __call__(self, *args, **kwargs): method get_prompt_ids (line 56) | def get_prompt_ids(self, text: str, return_tensors="np"): FILE: src/transformers/models/whisper/tokenization_whisper.py class WhisperTokenizer (line 163) | class WhisperTokenizer(TokenizersBackend): method __init__ (line 206) | def __init__( method _decode_with_timestamps (line 279) | def _decode_with_timestamps( method _compute_offsets (line 328) | def _compute_offsets(self, token_ids, time_precision=0.02, segment_siz... method timestamp_ids (line 398) | def timestamp_ids(self, time_precision=0.02): method _preprocess_token_ids (line 409) | def _preprocess_token_ids(self, token_ids, skip_special_tokens: bool =... method _filter_timestamp_ids (line 428) | def _filter_timestamp_ids(self, text): method decode (line 432) | def decode( method _decode (line 514) | def _decode( method normalize (line 528) | def normalize(self, text): method basic_normalize (line 537) | def basic_normalize(text, remove_diacritics=False): method save_vocabulary (line 545) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method set_prefix_tokens (line 575) | def set_prefix_tokens( method prefix_tokens (line 617) | def prefix_tokens(self) -> list[int]: method build_inputs_with_special_tokens (line 651) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method get_special_tokens_mask (line 659) | def get_special_tokens_mask( method get_decoder_prompt_ids (line 690) | def get_decoder_prompt_ids(self, task=None, language=None, no_timestam... method _decode_asr (line 700) | def _decode_asr(self, model_outputs, *, return_timestamps, return_lang... method get_prompt_ids (line 710) | def get_prompt_ids(self, text: str, return_tensors="np"): method _strip_prompt (line 725) | def _strip_prompt(self, token_ids: list[int], prompt_token_id: int, de... method _convert_to_list (line 745) | def _convert_to_list(token_ids): function _combine_tokens_into_words (line 755) | def _combine_tokens_into_words( function _find_longest_common_sequence (line 781) | def _find_longest_common_sequence(sequences, token_timestamp_sequences=N... function _decode_asr (line 901) | def _decode_asr(tokenizer, model_outputs, *, return_timestamps, return_l... function _find_longest_common_sequence (line 1153) | def _find_longest_common_sequence(sequences, token_timestamp_sequences=N... function _collate_word_timestamps (line 1273) | def _collate_word_timestamps(tokenizer, tokens, token_timestamps, langua... function _combine_tokens_into_words (line 1289) | def _combine_tokens_into_words( function _split_tokens_on_unicode (line 1315) | def _split_tokens_on_unicode(tokenizer, tokens: list[int]): function _split_tokens_on_spaces (line 1346) | def _split_tokens_on_spaces(tokenizer, tokens: list[int]): function _merge_punctuations (line 1370) | def _merge_punctuations(words, tokens, indices, prepended, appended): FILE: src/transformers/models/x_clip/configuration_x_clip.py class XCLIPTextConfig (line 27) | class XCLIPTextConfig(PreTrainedConfig): class XCLIPVisionConfig (line 65) | class XCLIPVisionConfig(PreTrainedConfig): class XCLIPConfig (line 119) | class XCLIPConfig(PreTrainedConfig): method __post_init__ (line 151) | def __post_init__(self, **kwargs): FILE: src/transformers/models/x_clip/convert_x_clip_original_pytorch_to_hf.py function get_xclip_config (line 34) | def get_xclip_config(model_name, num_frames): function rename_key (line 65) | def rename_key(name): function convert_state_dict (line 119) | def convert_state_dict(orig_state_dict, config): function prepare_video (line 201) | def prepare_video(num_frames): function convert_xclip_checkpoint (line 217) | def convert_xclip_checkpoint(model_name, pytorch_dump_folder_path=None, ... FILE: src/transformers/models/x_clip/modeling_x_clip.py function contrastive_loss (line 48) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function x_clip_loss (line 53) | def x_clip_loss(similarity: torch.Tensor) -> torch.Tensor: class XCLIPOutput (line 61) | class XCLIPOutput(ModelOutput): method to_tuple (line 93) | def to_tuple(self) -> tuple[Any]: class XCLIPVisionEmbeddings (line 103) | class XCLIPVisionEmbeddings(nn.Module): method __init__ (line 104) | def __init__(self, config: XCLIPVisionConfig): method interpolate_pos_encoding (line 126) | def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: i... method forward (line 167) | def forward(self, pixel_values: torch.FloatTensor, interpolate_pos_enc... class XCLIPTextEmbeddings (line 187) | class XCLIPTextEmbeddings(nn.Module): method __init__ (line 188) | def __init__(self, config: XCLIPTextConfig): method forward (line 200) | def forward( function eager_attention_forward (line 228) | def eager_attention_forward( class XCLIPAttention (line 251) | class XCLIPAttention(nn.Module): method __init__ (line 254) | def __init__(self, config): method forward (line 274) | def forward( class XCLIPMLP (line 313) | class XCLIPMLP(nn.Module): method __init__ (line 314) | def __init__(self, config): method forward (line 321) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XCLIPEncoderLayer (line 329) | class XCLIPEncoderLayer(GradientCheckpointingLayer): method __init__ (line 330) | def __init__(self, config: XCLIPConfig): method forward (line 338) | def forward( function drop_path (line 363) | def drop_path(input: torch.Tensor, drop_prob: float = 0.0, training: boo... class XCLIPDropPath (line 379) | class XCLIPDropPath(nn.Module): method __init__ (line 382) | def __init__(self, drop_prob: float | None = None) -> None: method forward (line 386) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 389) | def extra_repr(self) -> str: class XCLIPVisionEncoderLayer (line 393) | class XCLIPVisionEncoderLayer(GradientCheckpointingLayer): method __init__ (line 398) | def __init__(self, config: XCLIPConfig): method forward (line 414) | def forward( class XCLIPPreTrainedModel (line 452) | class XCLIPPreTrainedModel(PreTrainedModel): method _init_weights (line 463) | def _init_weights(self, module): class XCLIPEncoder (line 514) | class XCLIPEncoder(nn.Module): method __init__ (line 523) | def __init__(self, config: XCLIPConfig): method forward (line 529) | def forward( class XCLIPTextTransformer (line 562) | class XCLIPTextTransformer(XCLIPPreTrainedModel): method __init__ (line 563) | def __init__(self, config: XCLIPTextConfig): method forward (line 576) | def forward( class XCLIPTextModel (line 618) | class XCLIPTextModel(XCLIPPreTrainedModel): method __init__ (line 622) | def __init__(self, config: XCLIPTextConfig): method get_input_embeddings (line 628) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 631) | def set_input_embeddings(self, value): method forward (line 636) | def forward( class XCLIPVisionEncoder (line 666) | class XCLIPVisionEncoder(nn.Module): method __init__ (line 675) | def __init__(self, config: XCLIPConfig): method forward (line 681) | def forward( class XCLIPVisionTransformer (line 712) | class XCLIPVisionTransformer(XCLIPPreTrainedModel): method __init__ (line 717) | def __init__(self, config: XCLIPVisionConfig): method forward (line 731) | def forward( class XCLIPVisionModel (line 755) | class XCLIPVisionModel(XCLIPPreTrainedModel): method __init__ (line 760) | def __init__(self, config: XCLIPVisionConfig): method get_input_embeddings (line 766) | def get_input_embeddings(self) -> nn.Module: method forward (line 771) | def forward( class XCLIPMultiframeIntegrationTransformer (line 856) | class XCLIPMultiframeIntegrationTransformer(nn.Module): method __init__ (line 861) | def __init__(self, config: XCLIPVisionConfig): method forward (line 867) | def forward( class XCLIPCrossAttention (line 893) | class XCLIPCrossAttention(nn.Module): method __init__ (line 896) | def __init__(self, config): method _shape (line 912) | def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int): method forward (line 915) | def forward(self, queries, keys, values): class PromptGeneratorLayer (line 945) | class PromptGeneratorLayer(nn.Module): method __init__ (line 946) | def __init__(self, config): method forward (line 960) | def forward(self, x, visual): class XCLIPPromptGenerator (line 966) | class XCLIPPromptGenerator(nn.Module): method __init__ (line 969) | def __init__(self, config): method forward (line 976) | def forward(self, text, visual): class XCLIPModel (line 985) | class XCLIPModel(XCLIPPreTrainedModel): method __init__ (line 988) | def __init__(self, config: XCLIPConfig): method get_text_features (line 1037) | def get_text_features( method get_video_features (line 1071) | def get_video_features( method forward (line 1161) | def forward( FILE: src/transformers/models/x_clip/processing_x_clip.py class XCLIPProcessor (line 23) | class XCLIPProcessor(ProcessorMixin): method __init__ (line 24) | def __init__(self, image_processor=None, tokenizer=None, **kwargs): FILE: src/transformers/models/xcodec/configuration_xcodec.py class XcodecConfig (line 28) | class XcodecConfig(PreTrainedConfig): method __post_init__ (line 92) | def __post_init__(self, **kwargs): method frame_rate (line 123) | def frame_rate(self) -> int: method semantic_hidden_size (line 127) | def semantic_hidden_size(self) -> int: method hop_length (line 131) | def hop_length(self) -> int: method codebook_nbits (line 135) | def codebook_nbits(self) -> int: method hidden_size (line 139) | def hidden_size(self) -> int: method num_quantizers (line 143) | def num_quantizers(self) -> int: FILE: src/transformers/models/xcodec/convert_xcodec_weights_to_hf.py function safe_load (line 78) | def safe_load(path: str) -> dict[str, torch.Tensor]: function _rewrite_weight_norm (line 86) | def _rewrite_weight_norm(key: str) -> str: function convert_old_keys_to_new_keys (line 94) | def convert_old_keys_to_new_keys(original_state_dict: dict[str, torch.Te... function convert_checkpoint (line 184) | def convert_checkpoint(checkpoint_path, config_path, pytorch_dump_folder... FILE: src/transformers/models/xcodec/modeling_xcodec.py class XcodecOutput (line 33) | class XcodecOutput(ModelOutput): class XcodecEncoderOutput (line 47) | class XcodecEncoderOutput(ModelOutput): class XcodecDecoderOutput (line 58) | class XcodecDecoderOutput(ModelOutput): class XcodecResidualUnit (line 68) | class XcodecResidualUnit(nn.Module): method __init__ (line 71) | def __init__(self, config: XcodecConfig, in_channels: int, out_channel... method forward (line 87) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class XcodecSemanticEncoderBlock (line 95) | class XcodecSemanticEncoderBlock(nn.Module): method __init__ (line 96) | def __init__(self, config: XcodecConfig, in_channels: int, out_channel... method forward (line 107) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class SemanticEncoder (line 114) | class SemanticEncoder(nn.Module): method __init__ (line 115) | def __init__(self, config): method forward (line 137) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class SemanticDecoderBlock (line 144) | class SemanticDecoderBlock(nn.Module): method __init__ (line 145) | def __init__(self, config: XcodecConfig, in_channels: int, out_channel... method forward (line 168) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class SemanticDecoder (line 175) | class SemanticDecoder(nn.Module): method __init__ (line 176) | def __init__(self, config): method forward (line 207) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class XcodecEuclideanCodebook (line 215) | class XcodecEuclideanCodebook(nn.Module): method __init__ (line 218) | def __init__(self, config): method quantize (line 228) | def quantize(self, hidden_states): method encode (line 235) | def encode(self, hidden_states): method decode (line 242) | def decode(self, embed_ind): class XcodecVectorQuantization (line 247) | class XcodecVectorQuantization(nn.Module): method __init__ (line 252) | def __init__(self, config: XcodecConfig): method encode (line 257) | def encode(self, hidden_states): method decode (line 263) | def decode(self, embed_ind): class XcodecResidualVectorQuantization (line 269) | class XcodecResidualVectorQuantization(nn.Module): method __init__ (line 274) | def __init__(self, config: XcodecConfig): method get_bandwidth_per_quantizer (line 281) | def get_bandwidth_per_quantizer(self): method get_num_quantizers_for_bandwidth (line 285) | def get_num_quantizers_for_bandwidth(self, bandwidth=None) -> int: method encode (line 293) | def encode(self, embeddings: torch.Tensor, bandwidth=None) -> torch.Te... method decode (line 309) | def decode(self, codes: torch.Tensor) -> torch.Tensor: class XcodecPreTrainedModel (line 320) | class XcodecPreTrainedModel(PreTrainedAudioTokenizerBase): method _init_weights (line 333) | def _init_weights(self, module): method apply_weight_norm (line 370) | def apply_weight_norm(self): method remove_weight_norm (line 392) | def remove_weight_norm(self): method _get_conv1d_layers (line 404) | def _get_conv1d_layers(self, module): method _get_conv1d_output_lengths (line 423) | def _get_conv1d_output_lengths(self, input_length, module=None): class XcodecModel (line 439) | class XcodecModel(XcodecPreTrainedModel): method __init__ (line 440) | def __init__(self, config): method _adjust_dac_decoder (line 460) | def _adjust_dac_decoder(decoder: nn.Module): method _extract_semantic_features (line 473) | def _extract_semantic_features(self, input_values: torch.FloatTensor) ... method encode (line 484) | def encode( method decode (line 536) | def decode( method forward (line 564) | def forward( FILE: src/transformers/models/xglm/configuration_xglm.py class XGLMConfig (line 24) | class XGLMConfig(PreTrainedConfig): FILE: src/transformers/models/xglm/convert_xglm_original_ckpt_to_trfms.py function remove_ignore_keys_ (line 10) | def remove_ignore_keys_(state_dict): function make_linear_from_emb (line 21) | def make_linear_from_emb(emb): function convert_fairseq_xglm_checkpoint_from_disk (line 28) | def convert_fairseq_xglm_checkpoint_from_disk(checkpoint_path): FILE: src/transformers/models/xglm/modeling_xglm.py class XGLMScaledWordEmbedding (line 40) | class XGLMScaledWordEmbedding(nn.Embedding): method __init__ (line 45) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 49) | def forward(self, input_ids: torch.Tensor): class XGLMSinusoidalPositionalEmbedding (line 53) | class XGLMSinusoidalPositionalEmbedding(nn.Module): method __init__ (line 56) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method make_weights (line 64) | def make_weights(self, num_embeddings: int, embedding_dim: int, paddin... method get_embedding (line 73) | def get_embedding(num_embeddings: int, embedding_dim: int, padding_idx... method forward (line 94) | def forward(self, position_ids: torch.Tensor | None = None, past_key_v... class XGLMAttention (line 105) | class XGLMAttention(nn.Module): method __init__ (line 108) | def __init__( method forward (line 137) | def forward( class XGLMDecoderLayer (line 248) | class XGLMDecoderLayer(GradientCheckpointingLayer): method __init__ (line 249) | def __init__(self, config: XGLMConfig, layer_idx=None): method forward (line 280) | def forward( class XGLMPreTrainedModel (line 342) | class XGLMPreTrainedModel(PreTrainedModel): method _init_weights (line 348) | def _init_weights(self, module): class XGLMModel (line 358) | class XGLMModel(XGLMPreTrainedModel): method __init__ (line 365) | def __init__(self, config: XGLMConfig): method forward (line 392) | def forward( class XGLMForCausalLM (line 494) | class XGLMForCausalLM(XGLMPreTrainedModel, GenerationMixin): method __init__ (line 498) | def __init__(self, config): method forward (line 509) | def forward( FILE: src/transformers/models/xglm/tokenization_xglm.py class XGLMTokenizer (line 28) | class XGLMTokenizer(TokenizersBackend): method __init__ (line 62) | def __init__( FILE: src/transformers/models/xlm/configuration_xlm.py class XLMConfig (line 24) | class XLMConfig(PreTrainedConfig): FILE: src/transformers/models/xlm/convert_xlm_original_pytorch_checkpoint_to_pytorch.py function convert_xlm_checkpoint_to_pytorch (line 29) | def convert_xlm_checkpoint_to_pytorch(xlm_checkpoint_path, pytorch_dump_... FILE: src/transformers/models/xlm/modeling_xlm.py function create_sinusoidal_embeddings (line 48) | def create_sinusoidal_embeddings(n_pos, dim, out): function get_masks (line 57) | def get_masks(slen, lengths, causal, padding_mask=None): class XLMSquadHeadOutput (line 88) | class XLMSquadHeadOutput(ModelOutput): class XLMPoolerStartLogits (line 114) | class XLMPoolerStartLogits(nn.Module): method __init__ (line 123) | def __init__(self, config: XLMConfig): method forward (line 127) | def forward(self, hidden_states: torch.FloatTensor, p_mask: torch.Floa... class XLMPoolerEndLogits (line 150) | class XLMPoolerEndLogits(nn.Module): method __init__ (line 160) | def __init__(self, config: XLMConfig): method forward (line 167) | def forward( class XLMPoolerAnswerClass (line 219) | class XLMPoolerAnswerClass(nn.Module): method __init__ (line 228) | def __init__(self, config: XLMConfig): method forward (line 234) | def forward( class XLMSQuADHead (line 284) | class XLMSQuADHead(nn.Module): method __init__ (line 294) | def __init__(self, config: XLMConfig): method forward (line 304) | def forward( class XLMSequenceSummary (line 396) | class XLMSequenceSummary(nn.Module): method __init__ (line 422) | def __init__(self, config: XLMConfig): method forward (line 451) | def forward( class MultiHeadAttention (line 495) | class MultiHeadAttention(nn.Module): method __init__ (line 496) | def __init__(self, n_heads, dim, config, layer_idx: int = 0): method forward (line 510) | def forward( class TransformerFFN (line 575) | class TransformerFFN(nn.Module): method __init__ (line 576) | def __init__(self, in_dim, dim_hidden, out_dim, config): method forward (line 585) | def forward(self, input): method ff_chunk (line 588) | def ff_chunk(self, input): class XLMPreTrainedModel (line 597) | class XLMPreTrainedModel(PreTrainedModel): method dummy_inputs (line 602) | def dummy_inputs(self): method _init_weights (line 612) | def _init_weights(self, module): class XLMForQuestionAnsweringOutput (line 647) | class XLMForQuestionAnsweringOutput(ModelOutput): class XLMModel (line 676) | class XLMModel(XLMPreTrainedModel): method __init__ (line 677) | def __init__(self, config): method get_input_embeddings (line 740) | def get_input_embeddings(self): method set_input_embeddings (line 743) | def set_input_embeddings(self, new_embeddings): method forward (line 747) | def forward( class XLMPredLayer (line 876) | class XLMPredLayer(nn.Module): method __init__ (line 881) | def __init__(self, config): method forward (line 899) | def forward(self, x, y=None): class XLMWithLMHeadModel (line 924) | class XLMWithLMHeadModel(XLMPreTrainedModel, GenerationMixin): method __init__ (line 927) | def __init__(self, config): method get_output_embeddings (line 935) | def get_output_embeddings(self): method set_output_embeddings (line 938) | def set_output_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 941) | def prepare_inputs_for_generation(self, input_ids, is_first_iteration=... method forward (line 969) | def forward( class XLMForSequenceClassification (line 1049) | class XLMForSequenceClassification(XLMPreTrainedModel): method __init__ (line 1050) | def __init__(self, config): method forward (line 1062) | def forward( class XLMForQuestionAnsweringSimple (line 1159) | class XLMForQuestionAnsweringSimple(XLMPreTrainedModel): method __init__ (line 1160) | def __init__(self, config): method forward (line 1170) | def forward( class XLMForQuestionAnswering (line 1258) | class XLMForQuestionAnswering(XLMPreTrainedModel): method __init__ (line 1259) | def __init__(self, config): method forward (line 1269) | def forward( class XLMForTokenClassification (line 1376) | class XLMForTokenClassification(XLMPreTrainedModel): method __init__ (line 1377) | def __init__(self, config): method forward (line 1389) | def forward( class XLMForMultipleChoice (line 1463) | class XLMForMultipleChoice(XLMPreTrainedModel): method __init__ (line 1464) | def __init__(self, config, *inputs, **kwargs): method forward (line 1475) | def forward( FILE: src/transformers/models/xlm/tokenization_xlm.py function get_pairs (line 34) | def get_pairs(word): function lowercase_and_remove_accent (line 47) | def lowercase_and_remove_accent(text): function replace_unicode_punct (line 64) | def replace_unicode_punct(text): function remove_non_printing_char (line 107) | def remove_non_printing_char(text): function romanian_preprocessing (line 120) | def romanian_preprocessing(text): class XLMTokenizer (line 134) | class XLMTokenizer(PreTrainedTokenizer): method __init__ (line 192) | def __init__( method do_lower_case (line 267) | def do_lower_case(self): method moses_punct_norm (line 270) | def moses_punct_norm(self, text, lang): method moses_tokenize (line 278) | def moses_tokenize(self, text, lang): method moses_pipeline (line 286) | def moses_pipeline(self, text, lang): method ja_tokenize (line 292) | def ja_tokenize(self, text): method vocab_size (line 314) | def vocab_size(self): method get_vocab (line 317) | def get_vocab(self): method bpe (line 320) | def bpe(self, token): method _tokenize (line 364) | def _tokenize(self, text, lang="en", bypass_tokenizer=False): method _convert_token_to_id (line 462) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 466) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 470) | def convert_tokens_to_string(self, tokens): method build_inputs_with_special_tokens (line 475) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 502) | def get_special_tokens_mask( method save_vocabulary (line 530) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method __getstate__ (line 558) | def __getstate__(self): method __setstate__ (line 563) | def __setstate__(self, d): FILE: src/transformers/models/xlm_roberta/configuration_xlm_roberta.py class XLMRobertaConfig (line 25) | class XLMRobertaConfig(PreTrainedConfig): FILE: src/transformers/models/xlm_roberta/modeling_xlm_roberta.py class XLMRobertaEmbeddings (line 56) | class XLMRobertaEmbeddings(nn.Module): method __init__ (line 59) | def __init__(self, config): method forward (line 79) | def forward( method create_position_ids_from_inputs_embeds (line 128) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 146) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 162) | def eager_attention_forward( class XLMRobertaSelfAttention (line 190) | class XLMRobertaSelfAttention(nn.Module): method __init__ (line 191) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 215) | def forward( class XLMRobertaCrossAttention (line 257) | class XLMRobertaCrossAttention(nn.Module): method __init__ (line 258) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 281) | def forward( class XLMRobertaSelfOutput (line 334) | class XLMRobertaSelfOutput(nn.Module): method __init__ (line 335) | def __init__(self, config): method forward (line 341) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class XLMRobertaAttention (line 348) | class XLMRobertaAttention(nn.Module): method __init__ (line 349) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 356) | def forward( class XLMRobertaIntermediate (line 377) | class XLMRobertaIntermediate(nn.Module): method __init__ (line 378) | def __init__(self, config): method forward (line 386) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XLMRobertaOutput (line 392) | class XLMRobertaOutput(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 399) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class XLMRobertaLayer (line 406) | class XLMRobertaLayer(GradientCheckpointingLayer): method __init__ (line 407) | def __init__(self, config, layer_idx=None): method forward (line 426) | def forward( method feed_forward_chunk (line 465) | def feed_forward_chunk(self, attention_output): class XLMRobertaLMHead (line 471) | class XLMRobertaLMHead(nn.Module): method __init__ (line 474) | def __init__(self, config): method forward (line 482) | def forward(self, features, **kwargs): class XLMRobertaPreTrainedModel (line 494) | class XLMRobertaPreTrainedModel(PreTrainedModel): method _init_weights (line 509) | def _init_weights(self, module): class XLMRobertaEncoder (line 519) | class XLMRobertaEncoder(nn.Module): method __init__ (line 520) | def __init__(self, config): method forward (line 525) | def forward( class XLMRobertaPooler (line 551) | class XLMRobertaPooler(nn.Module): method __init__ (line 552) | def __init__(self, config): method forward (line 557) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XLMRobertaModel (line 567) | class XLMRobertaModel(XLMRobertaPreTrainedModel): method __init__ (line 570) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 587) | def get_input_embeddings(self): method set_input_embeddings (line 590) | def set_input_embeddings(self, value): method forward (line 596) | def forward( method _create_attention_masks (line 661) | def _create_attention_masks( class XLMRobertaForCausalLM (line 699) | class XLMRobertaForCausalLM(XLMRobertaPreTrainedModel, GenerationMixin): method __init__ (line 705) | def __init__(self, config): method get_output_embeddings (line 716) | def get_output_embeddings(self): method set_output_embeddings (line 719) | def set_output_embeddings(self, new_embeddings): method forward (line 724) | def forward( class XLMRobertaForMaskedLM (line 807) | class XLMRobertaForMaskedLM(XLMRobertaPreTrainedModel): method __init__ (line 813) | def __init__(self, config): method get_output_embeddings (line 828) | def get_output_embeddings(self): method set_output_embeddings (line 831) | def set_output_embeddings(self, new_embeddings): method forward (line 836) | def forward( class XLMRobertaClassificationHead (line 892) | class XLMRobertaClassificationHead(nn.Module): method __init__ (line 895) | def __init__(self, config): method forward (line 904) | def forward(self, features, **kwargs): class XLMRobertaForSequenceClassification (line 920) | class XLMRobertaForSequenceClassification(XLMRobertaPreTrainedModel): method __init__ (line 921) | def __init__(self, config): method forward (line 934) | def forward( class XLMRobertaForMultipleChoice (line 1005) | class XLMRobertaForMultipleChoice(XLMRobertaPreTrainedModel): method __init__ (line 1006) | def __init__(self, config): method forward (line 1018) | def forward( class XLMRobertaForTokenClassification (line 1102) | class XLMRobertaForTokenClassification(XLMRobertaPreTrainedModel): method __init__ (line 1103) | def __init__(self, config): method forward (line 1119) | def forward( class XLMRobertaForQuestionAnswering (line 1173) | class XLMRobertaForQuestionAnswering(XLMRobertaPreTrainedModel): method __init__ (line 1174) | def __init__(self, config): method forward (line 1186) | def forward( FILE: src/transformers/models/xlm_roberta/modular_xlm_roberta.py class XLMRobertaPreTrainedModel (line 45) | class XLMRobertaPreTrainedModel(RobertaPreTrainedModel): class XLMRobertaModel (line 50) | class XLMRobertaModel(RobertaModel): class XLMRobertaForCausalLM (line 59) | class XLMRobertaForCausalLM(RobertaForCausalLM): method __init__ (line 65) | def __init__(self, config): method forward (line 72) | def forward( class XLMRobertaForMaskedLM (line 155) | class XLMRobertaForMaskedLM(RobertaForMaskedLM): method __init__ (line 161) | def __init__(self, config): method forward (line 169) | def forward( class XLMRobertaForSequenceClassification (line 231) | class XLMRobertaForSequenceClassification(RobertaForSequenceClassificati... method __init__ (line 232) | def __init__(self, config): method forward (line 240) | def forward( class XLMRobertaForMultipleChoice (line 311) | class XLMRobertaForMultipleChoice(RobertaForMultipleChoice): method __init__ (line 312) | def __init__(self, config): method forward (line 320) | def forward( class XLMRobertaForTokenClassification (line 404) | class XLMRobertaForTokenClassification(RobertaForTokenClassification): method __init__ (line 405) | def __init__(self, config): method forward (line 413) | def forward( class XLMRobertaForQuestionAnswering (line 467) | class XLMRobertaForQuestionAnswering(RobertaForQuestionAnswering): method __init__ (line 468) | def __init__(self, config): method forward (line 476) | def forward( FILE: src/transformers/models/xlm_roberta/tokenization_xlm_roberta.py class XLMRobertaTokenizer (line 28) | class XLMRobertaTokenizer(TokenizersBackend): method __init__ (line 54) | def __init__( FILE: src/transformers/models/xlm_roberta_xl/configuration_xlm_roberta_xl.py class XLMRobertaXLConfig (line 24) | class XLMRobertaXLConfig(PreTrainedConfig): FILE: src/transformers/models/xlm_roberta_xl/convert_xlm_roberta_xl_original_pytorch_checkpoint_to_pytorch.py function convert_xlm_roberta_xl_checkpoint_to_pytorch (line 46) | def convert_xlm_roberta_xl_checkpoint_to_pytorch( FILE: src/transformers/models/xlm_roberta_xl/modeling_xlm_roberta_xl.py class XLMRobertaXLEmbeddings (line 61) | class XLMRobertaXLEmbeddings(nn.Module): method __init__ (line 64) | def __init__(self, config): method forward (line 82) | def forward( method create_position_ids_from_inputs_embeds (line 130) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 148) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 164) | def eager_attention_forward( class XLMRobertaXLSelfAttention (line 192) | class XLMRobertaXLSelfAttention(nn.Module): method __init__ (line 193) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 217) | def forward( class XLMRobertaXLCrossAttention (line 259) | class XLMRobertaXLCrossAttention(nn.Module): method __init__ (line 260) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 283) | def forward( class XLMRobertaXLSelfOutput (line 336) | class XLMRobertaXLSelfOutput(nn.Module): method __init__ (line 337) | def __init__(self, config): method forward (line 342) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class XLMRobertaXLAttention (line 349) | class XLMRobertaXLAttention(nn.Module): method __init__ (line 350) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 359) | def forward( class XLMRobertaXLOutput (line 381) | class XLMRobertaXLOutput(nn.Module): method __init__ (line 382) | def __init__(self, config): method forward (line 386) | def forward(self, hidden_states, input_tensor): class XLMRobertaXLIntermediate (line 392) | class XLMRobertaXLIntermediate(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 401) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XLMRobertaXLLayer (line 407) | class XLMRobertaXLLayer(GradientCheckpointingLayer): method __init__ (line 408) | def __init__(self, config, layer_idx=None): method forward (line 428) | def forward( method feed_forward_chunk (line 467) | def feed_forward_chunk(self, attention_output): class XLMRobertaXLEncoder (line 474) | class XLMRobertaXLEncoder(nn.Module): method __init__ (line 475) | def __init__(self, config): method forward (line 481) | def forward( class XLMRobertaXLPreTrainedModel (line 511) | class XLMRobertaXLPreTrainedModel(PreTrainedModel): method _init_weights (line 526) | def _init_weights(self, module): class XLMRobertaXLPooler (line 536) | class XLMRobertaXLPooler(nn.Module): method __init__ (line 537) | def __init__(self, config): method forward (line 542) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XLMRobertaXLModel (line 563) | class XLMRobertaXLModel(XLMRobertaXLPreTrainedModel): method __init__ (line 566) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 583) | def get_input_embeddings(self): method set_input_embeddings (line 586) | def set_input_embeddings(self, value): method forward (line 592) | def forward( method _create_attention_masks (line 657) | def _create_attention_masks( class XLMRobertaXLLMHead (line 690) | class XLMRobertaXLLMHead(nn.Module): method __init__ (line 693) | def __init__(self, config): method forward (line 701) | def forward(self, features, **kwargs): class XLMRobertaXLClassificationHead (line 712) | class XLMRobertaXLClassificationHead(nn.Module): method __init__ (line 715) | def __init__(self, config): method forward (line 724) | def forward(self, features, **kwargs): class XLMRobertaXLForCausalLM (line 739) | class XLMRobertaXLForCausalLM(XLMRobertaXLPreTrainedModel, GenerationMix... method __init__ (line 745) | def __init__(self, config): method get_output_embeddings (line 756) | def get_output_embeddings(self): method set_output_embeddings (line 759) | def set_output_embeddings(self, new_embeddings): method forward (line 765) | def forward( class XLMRobertaXLForMaskedLM (line 837) | class XLMRobertaXLForMaskedLM(XLMRobertaXLPreTrainedModel): method __init__ (line 843) | def __init__(self, config): method get_output_embeddings (line 857) | def get_output_embeddings(self): method set_output_embeddings (line 860) | def set_output_embeddings(self, new_embeddings): method forward (line 866) | def forward( class XLMRobertaXLForSequenceClassification (line 917) | class XLMRobertaXLForSequenceClassification(XLMRobertaXLPreTrainedModel): method __init__ (line 918) | def __init__(self, config): method forward (line 930) | def forward( class XLMRobertaXLForMultipleChoice (line 990) | class XLMRobertaXLForMultipleChoice(XLMRobertaXLPreTrainedModel): method __init__ (line 991) | def __init__(self, config): method forward (line 1002) | def forward( class XLMRobertaXLForTokenClassification (line 1077) | class XLMRobertaXLForTokenClassification(XLMRobertaXLPreTrainedModel): method __init__ (line 1078) | def __init__(self, config): method forward (line 1093) | def forward( class XLMRobertaXLForQuestionAnswering (line 1145) | class XLMRobertaXLForQuestionAnswering(XLMRobertaXLPreTrainedModel): method __init__ (line 1146) | def __init__(self, config): method forward (line 1157) | def forward( FILE: src/transformers/models/xlm_roberta_xl/modular_xlm_roberta_xl.py class XLMRobertaXLEmbeddings (line 59) | class XLMRobertaXLEmbeddings(RobertaEmbeddings): method __init__ (line 60) | def __init__(self, config): method forward (line 64) | def forward( class XLMRobertaXLSelfAttention (line 112) | class XLMRobertaXLSelfAttention(BertSelfAttention): class XLMRobertaXLCrossAttention (line 116) | class XLMRobertaXLCrossAttention(BertCrossAttention): class XLMRobertaXLSelfOutput (line 120) | class XLMRobertaXLSelfOutput(nn.Module): method __init__ (line 121) | def __init__(self, config): method forward (line 126) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class XLMRobertaXLAttention (line 133) | class XLMRobertaXLAttention(BertAttention): method __init__ (line 134) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 140) | def forward( class XLMRobertaXLOutput (line 162) | class XLMRobertaXLOutput(nn.Module): method __init__ (line 163) | def __init__(self, config): method forward (line 167) | def forward(self, hidden_states, input_tensor): class XLMRobertaXLLayer (line 173) | class XLMRobertaXLLayer(BertLayer): method __init__ (line 174) | def __init__(self, config, layer_idx=None): method feed_forward_chunk (line 178) | def feed_forward_chunk(self, attention_output): class XLMRobertaXLEncoder (line 185) | class XLMRobertaXLEncoder(nn.Module): method __init__ (line 186) | def __init__(self, config): method forward (line 192) | def forward( class XLMRobertaXLPreTrainedModel (line 222) | class XLMRobertaXLPreTrainedModel(RobertaPreTrainedModel): class XLMRobertaXLModel (line 226) | class XLMRobertaXLModel(BertModel): class XLMRobertaXLLMHead (line 230) | class XLMRobertaXLLMHead(nn.Module): method __init__ (line 233) | def __init__(self, config): method forward (line 241) | def forward(self, features, **kwargs): class XLMRobertaXLClassificationHead (line 252) | class XLMRobertaXLClassificationHead(RobertaClassificationHead): class XLMRobertaXLForCausalLM (line 261) | class XLMRobertaXLForCausalLM(XLMRobertaXLPreTrainedModel, GenerationMix... method __init__ (line 267) | def __init__(self, config): method get_output_embeddings (line 278) | def get_output_embeddings(self): method set_output_embeddings (line 281) | def set_output_embeddings(self, new_embeddings): method forward (line 287) | def forward( class XLMRobertaXLForMaskedLM (line 359) | class XLMRobertaXLForMaskedLM(XLMRobertaXLPreTrainedModel): method __init__ (line 365) | def __init__(self, config): method get_output_embeddings (line 379) | def get_output_embeddings(self): method set_output_embeddings (line 382) | def set_output_embeddings(self, new_embeddings): method forward (line 388) | def forward( class XLMRobertaXLForSequenceClassification (line 439) | class XLMRobertaXLForSequenceClassification(XLMRobertaXLPreTrainedModel): method __init__ (line 440) | def __init__(self, config): method forward (line 452) | def forward( class XLMRobertaXLForMultipleChoice (line 512) | class XLMRobertaXLForMultipleChoice(XLMRobertaXLPreTrainedModel): method __init__ (line 513) | def __init__(self, config): method forward (line 524) | def forward( class XLMRobertaXLForTokenClassification (line 599) | class XLMRobertaXLForTokenClassification(XLMRobertaXLPreTrainedModel): method __init__ (line 600) | def __init__(self, config): method forward (line 615) | def forward( class XLMRobertaXLForQuestionAnswering (line 667) | class XLMRobertaXLForQuestionAnswering(XLMRobertaXLPreTrainedModel): method __init__ (line 668) | def __init__(self, config): method forward (line 679) | def forward( FILE: src/transformers/models/xlnet/configuration_xlnet.py class XLNetConfig (line 28) | class XLNetConfig(PreTrainedConfig): method __post_init__ (line 135) | def __post_init__(self, **kwargs): method validate_architecture (line 139) | def validate_architecture(self): method max_position_embeddings (line 149) | def max_position_embeddings(self): method max_position_embeddings (line 154) | def max_position_embeddings(self, value): FILE: src/transformers/models/xlnet/convert_xlnet_original_tf_checkpoint_to_pytorch.py function build_tf_xlnet_to_pytorch_map (line 47) | def build_tf_xlnet_to_pytorch_map(model, config, tf_weights=None): function load_tf_weights_in_xlnet (line 130) | def load_tf_weights_in_xlnet(model, config, tf_path): function convert_xlnet_checkpoint_to_pytorch (line 197) | def convert_xlnet_checkpoint_to_pytorch( FILE: src/transformers/models/xlnet/modeling_xlnet.py class XLNetRelativeAttention (line 38) | class XLNetRelativeAttention(nn.Module): method __init__ (line 39) | def __init__(self, config): method rel_shift (line 68) | def rel_shift(x, klen=-1): method rel_shift_bnij (line 81) | def rel_shift_bnij(x, klen=-1): method rel_attn_core (line 95) | def rel_attn_core( method post_attention (line 142) | def post_attention(self, h, attn_vec, residual=True): method forward (line 154) | def forward( class XLNetFeedForward (line 285) | class XLNetFeedForward(nn.Module): method __init__ (line 286) | def __init__(self, config): method forward (line 297) | def forward(self, inp): class XLNetLayer (line 308) | class XLNetLayer(nn.Module): method __init__ (line 309) | def __init__(self, config): method forward (line 317) | def forward( method ff_chunk (line 351) | def ff_chunk(self, output_x): class XLNetPoolerStartLogits (line 357) | class XLNetPoolerStartLogits(nn.Module): method __init__ (line 366) | def __init__(self, config: XLNetConfig): method forward (line 370) | def forward(self, hidden_states: torch.FloatTensor, p_mask: torch.Floa... class XLNetPoolerEndLogits (line 394) | class XLNetPoolerEndLogits(nn.Module): method __init__ (line 404) | def __init__(self, config: XLNetConfig): method forward (line 411) | def forward( class XLNetPoolerAnswerClass (line 464) | class XLNetPoolerAnswerClass(nn.Module): method __init__ (line 473) | def __init__(self, config: XLNetConfig): method forward (line 479) | def forward( class XLNetSequenceSummary (line 530) | class XLNetSequenceSummary(nn.Module): method __init__ (line 556) | def __init__(self, config: XLNetConfig): method forward (line 585) | def forward( class XLNetPreTrainedModel (line 630) | class XLNetPreTrainedModel(PreTrainedModel): method _init_weights (line 635) | def _init_weights(self, module): class XLNetModelOutput (line 661) | class XLNetModelOutput(ModelOutput): class XLNetLMHeadModelOutput (line 686) | class XLNetLMHeadModelOutput(ModelOutput): class XLNetForSequenceClassificationOutput (line 714) | class XLNetForSequenceClassificationOutput(ModelOutput): class XLNetForTokenClassificationOutput (line 739) | class XLNetForTokenClassificationOutput(ModelOutput): class XLNetForMultipleChoiceOutput (line 764) | class XLNetForMultipleChoiceOutput(ModelOutput): class XLNetForQuestionAnsweringSimpleOutput (line 791) | class XLNetForQuestionAnsweringSimpleOutput(ModelOutput): class XLNetForQuestionAnsweringOutput (line 819) | class XLNetForQuestionAnsweringOutput(ModelOutput): class XLNetModel (line 853) | class XLNetModel(XLNetPreTrainedModel): method __init__ (line 854) | def __init__(self, config): method get_input_embeddings (line 874) | def get_input_embeddings(self): method set_input_embeddings (line 877) | def set_input_embeddings(self, new_embeddings): method create_mask (line 880) | def create_mask(self, qlen, mlen): method cache_mem (line 908) | def cache_mem(self, curr_out, prev_mem): method positional_embedding (line 930) | def positional_embedding(pos_seq, inv_freq, bsz=None): method relative_positional_encoding (line 940) | def relative_positional_encoding(self, qlen, klen, bsz=None, device=No... method forward (line 979) | def forward( class XLNetLMHeadModel (line 1213) | class XLNetLMHeadModel(XLNetPreTrainedModel, GenerationMixin): method __init__ (line 1216) | def __init__(self, config): method get_output_embeddings (line 1227) | def get_output_embeddings(self): method set_output_embeddings (line 1230) | def set_output_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 1233) | def prepare_inputs_for_generation( method forward (line 1289) | def forward( method _reorder_cache (line 1447) | def _reorder_cache(mems: list[torch.Tensor], beam_idx: torch.Tensor) -... class XLNetForSequenceClassification (line 1462) | class XLNetForSequenceClassification(XLNetPreTrainedModel): method __init__ (line 1463) | def __init__(self, config): method forward (line 1476) | def forward( class XLNetForTokenClassification (line 1590) | class XLNetForTokenClassification(XLNetPreTrainedModel): method __init__ (line 1591) | def __init__(self, config): method forward (line 1602) | def forward( class XLNetForMultipleChoice (line 1698) | class XLNetForMultipleChoice(XLNetPreTrainedModel): method __init__ (line 1699) | def __init__(self, config): method forward (line 1710) | def forward( class XLNetForQuestionAnsweringSimple (line 1842) | class XLNetForQuestionAnsweringSimple(XLNetPreTrainedModel): method __init__ (line 1843) | def __init__(self, config): method forward (line 1854) | def forward( class XLNetForQuestionAnswering (line 1963) | class XLNetForQuestionAnswering(XLNetPreTrainedModel): method __init__ (line 1964) | def __init__(self, config): method forward (line 1978) | def forward( FILE: src/transformers/models/xlnet/tokenization_xlnet.py class XLNetTokenizer (line 38) | class XLNetTokenizer(TokenizersBackend): method __init__ (line 100) | def __init__( FILE: src/transformers/models/xlstm/configuration_xlstm.py function round_up_to_next_multiple_of (line 49) | def round_up_to_next_multiple_of(x: int, multiple_of: int) -> int: class xLSTMConfig (line 58) | class xLSTMConfig(PreTrainedConfig): method __post_init__ (line 153) | def __post_init__(self, **kwargs): method qk_dim (line 161) | def qk_dim(self): method v_dim (line 168) | def v_dim(self): method qk_head_dim (line 175) | def qk_head_dim(self): method v_head_dim (line 179) | def v_head_dim(self): method to_xlstm_block_config (line 182) | def to_xlstm_block_config(self): FILE: src/transformers/models/xlstm/modeling_xlstm.py class xLSTMBlock (line 40) | class xLSTMBlock(GradientCheckpointingLayer, mLSTMBlock): method __init__ (line 1176) | def __init__(self, config: xLSTMConfig): method forward (line 1196) | def forward(self, x: torch.Tensor, state: mLSTMStateType | None = None... function soft_cap (line 55) | def soft_cap(values: torch.Tensor, cap_value: float | torch.Tensor | Non... function mlstm_chunkwise_recurrent_fw_C (line 74) | def mlstm_chunkwise_recurrent_fw_C( function mlstm_chunkwise_parallel_fw_H (line 164) | def mlstm_chunkwise_parallel_fw_H( function mlstm_chunkwise_fw (line 242) | def mlstm_chunkwise_fw( function mlstm_chunkwise_native_autograd (line 323) | def mlstm_chunkwise_native_autograd( function mlstm_recurrent_step_native (line 388) | def mlstm_recurrent_step_native( function mlstm_recurrent_sequence_native (line 451) | def mlstm_recurrent_sequence_native( function wrap_chunkwise_pad_zeros (line 524) | def wrap_chunkwise_pad_zeros( function wrap_chunkwise_arbitrary_sequence_length (line 586) | def wrap_chunkwise_arbitrary_sequence_length( class xLSTMBackend (line 735) | class xLSTMBackend(nn.Module): method __init__ (line 743) | def __init__(self, config: xLSTMConfig): method forward (line 777) | def forward( method extra_repr (line 850) | def extra_repr(self) -> str: class xLSTMRMSNorm (line 853) | class xLSTMRMSNorm(nn.Module): method __init__ (line 867) | def __init__( method _apply_weight_bias (line 890) | def _apply_weight_bias(self, x: torch.Tensor) -> torch.Tensor: method _rms_normalize (line 897) | def _rms_normalize(self, x: torch.Tensor) -> torch.Tensor: method forward (line 905) | def forward(self, x: torch.Tensor) -> torch.Tensor: class xLSTMMultiHeadLayerNorm (line 910) | class xLSTMMultiHeadLayerNorm(nn.Module): method __init__ (line 935) | def __init__( method _apply_weight_bias (line 961) | def _apply_weight_bias(self, x: torch.Tensor) -> torch.Tensor: method _layer_normalize (line 968) | def _layer_normalize(self, x: torch.Tensor) -> torch.Tensor: method forward (line 977) | def forward( class xLSTMFeedForward (line 992) | class xLSTMFeedForward(nn.Module): method __init__ (line 993) | def __init__(self, config: xLSTMConfig): method forward (line 1028) | def forward(self, x: torch.Tensor) -> torch.Tensor: class xLSTMLayer (line 1039) | class xLSTMLayer(nn.Module): method __init__ (line 1040) | def __init__(self, config: xLSTMConfig): method forward (line 1108) | def forward( class xLSTMBlock (line 1175) | class xLSTMBlock(GradientCheckpointingLayer): method __init__ (line 1176) | def __init__(self, config: xLSTMConfig): method forward (line 1196) | def forward(self, x: torch.Tensor, state: mLSTMStateType | None = None... function small_init_method (line 1208) | def small_init_method(dim): function wang_init_method (line 1221) | def wang_init_method(n_layers, dim): class xLSTMPreTrainedModel (line 1233) | class xLSTMPreTrainedModel(PreTrainedModel): method _module_name_map (line 1247) | def _module_name_map(self, module): method _init_weights (line 1254) | def _init_weights(self, module): class xLSTMCache (line 1311) | class xLSTMCache: method __init__ (line 1346) | def __init__( method reset (line 1370) | def reset(self): class xLSTMOutput (line 1383) | class xLSTMOutput(ModelOutput): class xLSTMModel (line 1396) | class xLSTMModel(xLSTMPreTrainedModel): method __init__ (line 1397) | def __init__(self, config): method get_input_embeddings (line 1407) | def get_input_embeddings(self): method set_input_embeddings (line 1410) | def set_input_embeddings(self, new_embedding): method forward (line 1416) | def forward( class xLSTMCausalLMOutput (line 1501) | class xLSTMCausalLMOutput(ModelOutput): class xLSTMForCausalLM (line 1519) | class xLSTMForCausalLM(xLSTMPreTrainedModel, GenerationMixin): method __init__ (line 1520) | def __init__(self, config): method get_output_embeddings (line 1527) | def get_output_embeddings(self): method set_output_embeddings (line 1530) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 1533) | def get_input_embeddings(self): method set_input_embeddings (line 1536) | def set_input_embeddings(self, new_embeddings): method forward (line 1541) | def forward( FILE: src/transformers/models/xmod/configuration_xmod.py class XmodConfig (line 25) | class XmodConfig(PreTrainedConfig): FILE: src/transformers/models/xmod/convert_xmod_original_pytorch_checkpoint_to_pytorch.py function convert_xmod_checkpoint_to_pytorch (line 40) | def convert_xmod_checkpoint_to_pytorch( FILE: src/transformers/models/xmod/modeling_xmod.py class XmodEmbeddings (line 51) | class XmodEmbeddings(nn.Module): method __init__ (line 54) | def __init__(self, config): method forward (line 74) | def forward( method create_position_ids_from_inputs_embeds (line 123) | def create_position_ids_from_inputs_embeds(inputs_embeds, padding_idx): method create_position_ids_from_input_ids (line 141) | def create_position_ids_from_input_ids(input_ids, padding_idx, past_ke... function eager_attention_forward (line 158) | def eager_attention_forward( class XmodSelfAttention (line 187) | class XmodSelfAttention(nn.Module): method __init__ (line 188) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 212) | def forward( class XmodCrossAttention (line 255) | class XmodCrossAttention(nn.Module): method __init__ (line 256) | def __init__(self, config, is_causal=False, layer_idx=None): method forward (line 279) | def forward( class XmodSelfOutput (line 332) | class XmodSelfOutput(nn.Module): method __init__ (line 334) | def __init__(self, config): method forward (line 340) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class XmodAttention (line 347) | class XmodAttention(nn.Module): method __init__ (line 348) | def __init__(self, config, is_causal=False, layer_idx=None, is_cross_a... method forward (line 357) | def forward( class XmodIntermediate (line 387) | class XmodIntermediate(nn.Module): method __init__ (line 388) | def __init__(self, config): method forward (line 396) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XmodAdapter (line 402) | class XmodAdapter(nn.Module): method __init__ (line 403) | def __init__(self, config): method forward (line 413) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XmodOutput (line 420) | class XmodOutput(nn.Module): method __init__ (line 421) | def __init__(self, config): method forward (line 436) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... method lang_adapter (line 443) | def lang_adapter(self, lang_ids: torch.Tensor, hidden_states: torch.Te... class XmodLayer (line 467) | class XmodLayer(GradientCheckpointingLayer): method __init__ (line 468) | def __init__(self, config, layer_idx=None): method forward (line 488) | def forward( method feed_forward_chunk (line 538) | def feed_forward_chunk(self, attention_output): class XmodEncoder (line 542) | class XmodEncoder(nn.Module): method __init__ (line 543) | def __init__(self, config): method forward (line 551) | def forward( class XmodPooler (line 583) | class XmodPooler(nn.Module): method __init__ (line 584) | def __init__(self, config): method forward (line 589) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class XmodPreTrainedModel (line 599) | class XmodPreTrainedModel(PreTrainedModel): method _init_weights (line 615) | def _init_weights(self, module): method set_default_language (line 624) | def set_default_language(self, language: str): method freeze_embeddings_and_language_adapters (line 637) | def freeze_embeddings_and_language_adapters(self): class XmodModel (line 668) | class XmodModel(XmodPreTrainedModel): method __init__ (line 669) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 687) | def get_input_embeddings(self): method set_input_embeddings (line 691) | def set_input_embeddings(self, value): method forward (line 697) | def forward( method _create_attention_masks (line 779) | def _create_attention_masks( class XmodForCausalLM (line 817) | class XmodForCausalLM(XmodPreTrainedModel, GenerationMixin): method __init__ (line 824) | def __init__(self, config): method get_output_embeddings (line 837) | def get_output_embeddings(self): method set_output_embeddings (line 841) | def set_output_embeddings(self, new_embeddings): method forward (line 846) | def forward( class XmodForMaskedLM (line 926) | class XmodForMaskedLM(XmodPreTrainedModel): method __init__ (line 933) | def __init__(self, config): method get_output_embeddings (line 949) | def get_output_embeddings(self): method set_output_embeddings (line 953) | def set_output_embeddings(self, new_embeddings): method forward (line 958) | def forward( class XmodLMHead (line 1009) | class XmodLMHead(nn.Module): method __init__ (line 1012) | def __init__(self, config): method forward (line 1020) | def forward(self, features, **kwargs): class XmodForSequenceClassification (line 1037) | class XmodForSequenceClassification(XmodPreTrainedModel): method __init__ (line 1039) | def __init__(self, config): method forward (line 1052) | def forward( class XmodForMultipleChoice (line 1117) | class XmodForMultipleChoice(XmodPreTrainedModel): method __init__ (line 1119) | def __init__(self, config): method forward (line 1131) | def forward( class XmodForTokenClassification (line 1218) | class XmodForTokenClassification(XmodPreTrainedModel): method __init__ (line 1220) | def __init__(self, config): method forward (line 1236) | def forward( class XmodClassificationHead (line 1284) | class XmodClassificationHead(nn.Module): method __init__ (line 1287) | def __init__(self, config): method forward (line 1296) | def forward(self, features, **kwargs): class XmodForQuestionAnswering (line 1307) | class XmodForQuestionAnswering(XmodPreTrainedModel): method __init__ (line 1309) | def __init__(self, config): method forward (line 1321) | def forward( FILE: src/transformers/models/yolos/configuration_yolos.py class YolosConfig (line 24) | class YolosConfig(PreTrainedConfig): FILE: src/transformers/models/yolos/convert_yolos_to_pytorch.py function get_yolos_config (line 34) | def get_yolos_config(yolos_name: str) -> YolosConfig: function read_in_q_k_v (line 70) | def read_in_q_k_v(state_dict: dict, config: YolosConfig, base_model: boo... function rename_key (line 88) | def rename_key(name: str) -> str: function convert_state_dict (line 125) | def convert_state_dict(orig_state_dict: dict, model: YolosForObjectDetec... function prepare_img (line 150) | def prepare_img() -> torch.Tensor: function convert_yolos_checkpoint (line 158) | def convert_yolos_checkpoint( FILE: src/transformers/models/yolos/image_processing_pil_yolos.py class YolosImageProcessorKwargs (line 49) | class YolosImageProcessorKwargs(ImagesKwargs, total=False): function convert_coco_poly_to_mask (line 67) | def convert_coco_poly_to_mask(segmentations, height: int, width: int) ->... function prepare_coco_detection_annotation (line 102) | def prepare_coco_detection_annotation( function masks_to_boxes (line 162) | def masks_to_boxes(masks: np.ndarray) -> np.ndarray: function rgb_to_id (line 199) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 210) | def prepare_coco_panoptic_annotation( function get_size_with_aspect_ratio_yolos (line 251) | def get_size_with_aspect_ratio_yolos( class YolosImageProcessorPil (line 293) | class YolosImageProcessorPil(PilBackend): method __init__ (line 307) | def __init__(self, **kwargs: Unpack[YolosImageProcessorKwargs]) -> None: method prepare_annotation (line 327) | def prepare_annotation( method resize (line 359) | def resize( method resize_annotation (line 413) | def resize_annotation( method normalize_annotation (line 466) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 479) | def _update_annotation_for_padded_image( method pad (line 523) | def pad( method preprocess (line 562) | def preprocess( method _preprocess (line 580) | def _preprocess( method post_process_object_detection (line 707) | def post_process_object_detection( FILE: src/transformers/models/yolos/image_processing_yolos.py class YolosImageProcessorKwargs (line 36) | class YolosImageProcessorKwargs(ImagesKwargs, total=False): function convert_coco_poly_to_mask (line 54) | def convert_coco_poly_to_mask(segmentations, height: int, width: int, de... function prepare_coco_detection_annotation (line 89) | def prepare_coco_detection_annotation( function masks_to_boxes (line 153) | def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor: function rgb_to_id (line 190) | def rgb_to_id(color): function prepare_coco_panoptic_annotation (line 201) | def prepare_coco_panoptic_annotation( function get_size_with_aspect_ratio_yolos (line 250) | def get_size_with_aspect_ratio_yolos( class YolosImageProcessor (line 292) | class YolosImageProcessor(TorchvisionBackend): method __init__ (line 306) | def __init__(self, **kwargs: Unpack[YolosImageProcessorKwargs]) -> None: method prepare_annotation (line 323) | def prepare_annotation( method resize (line 355) | def resize( method resize_annotation (line 400) | def resize_annotation( method normalize_annotation (line 457) | def normalize_annotation(self, annotation: dict, image_size: tuple[int... method _update_annotation_for_padded_image (line 472) | def _update_annotation_for_padded_image( method pad (line 507) | def pad( method preprocess (line 538) | def preprocess( method _preprocess (line 556) | def _preprocess( method post_process_object_detection (line 672) | def post_process_object_detection( FILE: src/transformers/models/yolos/modeling_yolos.py class YolosObjectDetectionOutput (line 43) | class YolosObjectDetectionOutput(ModelOutput): class YolosEmbeddings (line 76) | class YolosEmbeddings(nn.Module): method __init__ (line 82) | def __init__(self, config: YolosConfig) -> None: method forward (line 97) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: class InterpolateInitialPositionEmbeddings (line 118) | class InterpolateInitialPositionEmbeddings(nn.Module): method __init__ (line 119) | def __init__(self, config) -> None: method forward (line 123) | def forward(self, pos_embed, img_size=(800, 1344)) -> torch.Tensor: class InterpolateMidPositionEmbeddings (line 147) | class InterpolateMidPositionEmbeddings(nn.Module): method __init__ (line 148) | def __init__(self, config) -> None: method forward (line 152) | def forward(self, pos_embed, img_size=(800, 1344)) -> torch.Tensor: class YolosPatchEmbeddings (line 180) | class YolosPatchEmbeddings(nn.Module): method __init__ (line 187) | def __init__(self, config): method forward (line 202) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: function eager_attention_forward (line 214) | def eager_attention_forward( class YolosSelfAttention (line 243) | class YolosSelfAttention(nn.Module): method __init__ (line 244) | def __init__(self, config: YolosConfig): method forward (line 264) | def forward( class YolosSelfOutput (line 299) | class YolosSelfOutput(nn.Module): method __init__ (line 305) | def __init__(self, config: YolosConfig): method forward (line 310) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class YolosAttention (line 317) | class YolosAttention(nn.Module): method __init__ (line 318) | def __init__(self, config: YolosConfig): method forward (line 323) | def forward( class YolosIntermediate (line 334) | class YolosIntermediate(nn.Module): method __init__ (line 335) | def __init__(self, config: YolosConfig): method forward (line 343) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class YolosOutput (line 350) | class YolosOutput(nn.Module): method __init__ (line 351) | def __init__(self, config: YolosConfig): method forward (line 356) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class YolosLayer (line 364) | class YolosLayer(GradientCheckpointingLayer): method __init__ (line 367) | def __init__(self, config: YolosConfig): method forward (line 377) | def forward( class YolosEncoder (line 398) | class YolosEncoder(nn.Module): method __init__ (line 399) | def __init__(self, config: YolosConfig) -> None: method forward (line 423) | def forward( class YolosPreTrainedModel (line 443) | class YolosPreTrainedModel(PreTrainedModel): class YolosModel (line 461) | class YolosModel(YolosPreTrainedModel): method __init__ (line 462) | def __init__(self, config: YolosConfig, add_pooling_layer: bool = True): method get_input_embeddings (line 479) | def get_input_embeddings(self) -> YolosPatchEmbeddings: method forward (line 485) | def forward( class YolosPooler (line 504) | class YolosPooler(nn.Module): method __init__ (line 505) | def __init__(self, config: YolosConfig): method forward (line 510) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class YolosMLPPredictionHead (line 520) | class YolosMLPPredictionHead(nn.Module): method __init__ (line 527) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): method forward (line 533) | def forward(self, x): class YolosForObjectDetection (line 544) | class YolosForObjectDetection(YolosPreTrainedModel): method __init__ (line 545) | def __init__(self, config: YolosConfig): method _set_aux_loss (line 564) | def _set_aux_loss(self, outputs_class, outputs_coord): method forward (line 569) | def forward( FILE: src/transformers/models/yolos/modular_yolos.py function get_size_with_aspect_ratio_yolos (line 19) | def get_size_with_aspect_ratio_yolos( class YolosImageProcessor (line 60) | class YolosImageProcessor(DetrImageProcessor): method resize (line 61) | def resize( method post_process_object_detection (line 106) | def post_process_object_detection( method post_process_instance_segmentation (line 159) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 162) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 165) | def post_process_panoptic_segmentation(self): class YolosImageProcessorPil (line 169) | class YolosImageProcessorPil(DetrImageProcessorPil): method resize (line 170) | def resize( method post_process_object_detection (line 224) | def post_process_object_detection( method post_process_instance_segmentation (line 278) | def post_process_instance_segmentation(self): method post_process_semantic_segmentation (line 281) | def post_process_semantic_segmentation(self): method post_process_panoptic_segmentation (line 284) | def post_process_panoptic_segmentation(self): FILE: src/transformers/models/yoso/configuration_yoso.py class YosoConfig (line 24) | class YosoConfig(PreTrainedConfig): FILE: src/transformers/models/yoso/convert_yoso_pytorch_to_pytorch.py function rename_key (line 23) | def rename_key(orig_key): function convert_checkpoint_helper (line 61) | def convert_checkpoint_helper(max_position_embeddings, orig_state_dict): function convert_yoso_checkpoint (line 76) | def convert_yoso_checkpoint(checkpoint_path, yoso_config_file, pytorch_d... FILE: src/transformers/models/yoso/modeling_yoso.py function load_cuda_kernels (line 51) | def load_cuda_kernels(): function to_contiguous (line 61) | def to_contiguous(input_tensors): function normalize (line 75) | def normalize(input_tensors): function hashing (line 85) | def hashing(query, key, num_hash, hash_len): class YosoCumulation (line 104) | class YosoCumulation(torch.autograd.Function): method forward (line 106) | def forward(ctx, query_mask, key_mask, query, key, value, config): method backward (line 119) | def backward(ctx, grad): class YosoLSHCumulation (line 135) | class YosoLSHCumulation(torch.autograd.Function): method forward (line 137) | def forward(ctx, query_mask, key_mask, query, key, value, config): method backward (line 175) | def backward(ctx, grad): class YosoEmbeddings (line 225) | class YosoEmbeddings(nn.Module): method __init__ (line 228) | def __init__(self, config): method forward (line 247) | def forward(self, input_ids=None, token_type_ids=None, position_ids=No... class YosoSelfAttention (line 282) | class YosoSelfAttention(nn.Module): method __init__ (line 283) | def __init__(self, config): method forward (line 331) | def forward(self, hidden_states, attention_mask=None, output_attention... class YosoSelfOutput (line 427) | class YosoSelfOutput(nn.Module): method __init__ (line 428) | def __init__(self, config): method forward (line 434) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class YosoAttention (line 441) | class YosoAttention(nn.Module): method __init__ (line 442) | def __init__(self, config): method forward (line 447) | def forward(self, hidden_states, attention_mask=None, output_attention... class YosoIntermediate (line 455) | class YosoIntermediate(nn.Module): method __init__ (line 456) | def __init__(self, config): method forward (line 464) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class YosoOutput (line 471) | class YosoOutput(nn.Module): method __init__ (line 472) | def __init__(self, config): method forward (line 478) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class YosoLayer (line 485) | class YosoLayer(GradientCheckpointingLayer): method __init__ (line 486) | def __init__(self, config): method forward (line 495) | def forward(self, hidden_states, attention_mask=None, output_attention... method feed_forward_chunk (line 508) | def feed_forward_chunk(self, attention_output): class YosoEncoder (line 514) | class YosoEncoder(nn.Module): method __init__ (line 515) | def __init__(self, config): method forward (line 521) | def forward( class YosoPredictionHeadTransform (line 555) | class YosoPredictionHeadTransform(nn.Module): method __init__ (line 556) | def __init__(self, config): method forward (line 565) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class YosoLMPredictionHead (line 573) | class YosoLMPredictionHead(nn.Module): method __init__ (line 574) | def __init__(self, config): method forward (line 583) | def forward(self, hidden_states): class YosoOnlyMLMHead (line 590) | class YosoOnlyMLMHead(nn.Module): method __init__ (line 591) | def __init__(self, config): method forward (line 595) | def forward(self, sequence_output: torch.Tensor) -> torch.Tensor: class YosoPreTrainedModel (line 601) | class YosoPreTrainedModel(PreTrainedModel): method _init_weights (line 607) | def _init_weights(self, module: nn.Module): class YosoModel (line 618) | class YosoModel(YosoPreTrainedModel): method __init__ (line 619) | def __init__(self, config): method get_input_embeddings (line 629) | def get_input_embeddings(self): method set_input_embeddings (line 632) | def set_input_embeddings(self, value): method forward (line 636) | def forward( class YosoForMaskedLM (line 705) | class YosoForMaskedLM(YosoPreTrainedModel): method __init__ (line 711) | def __init__(self, config): method get_output_embeddings (line 720) | def get_output_embeddings(self): method set_output_embeddings (line 723) | def set_output_embeddings(self, new_embeddings): method forward (line 728) | def forward( class YosoClassificationHead (line 780) | class YosoClassificationHead(nn.Module): method __init__ (line 783) | def __init__(self, config): method forward (line 791) | def forward(self, features, **kwargs): class YosoForSequenceClassification (line 807) | class YosoForSequenceClassification(YosoPreTrainedModel): method __init__ (line 808) | def __init__(self, config): method forward (line 818) | def forward( class YosoForMultipleChoice (line 888) | class YosoForMultipleChoice(YosoPreTrainedModel): method __init__ (line 889) | def __init__(self, config): method forward (line 900) | def forward( class YosoForTokenClassification (line 993) | class YosoForTokenClassification(YosoPreTrainedModel): method __init__ (line 994) | def __init__(self, config): method forward (line 1006) | def forward( class YosoForQuestionAnswering (line 1068) | class YosoForQuestionAnswering(YosoPreTrainedModel): method __init__ (line 1069) | def __init__(self, config): method forward (line 1082) | def forward( FILE: src/transformers/models/youtu/configuration_youtu.py class YoutuConfig (line 36) | class YoutuConfig(PreTrainedConfig): method __post_init__ (line 91) | def __post_init__(self, **kwargs): FILE: src/transformers/models/youtu/modeling_youtu.py class YoutuRMSNorm (line 54) | class YoutuRMSNorm(nn.Module): method __init__ (line 55) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 63) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 70) | def extra_repr(self): class YoutuRotaryEmbedding (line 74) | class YoutuRotaryEmbedding(nn.Module): method __init__ (line 77) | def __init__(self, config: YoutuConfig, device=None): method compute_default_rope_parameters (line 94) | def compute_default_rope_parameters( method forward (line 125) | def forward(self, x, position_ids): class YoutuMLP (line 139) | class YoutuMLP(nn.Module): method __init__ (line 140) | def __init__(self, config): method forward (line 150) | def forward(self, x): function rotate_half (line 155) | def rotate_half(x): function apply_rotary_pos_emb (line 163) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): function repeat_kv (line 188) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 200) | def eager_attention_forward( function apply_rotary_pos_emb_interleave (line 225) | def apply_rotary_pos_emb_interleave(q, k, cos, sin, position_ids=None, u... function yarn_get_mscale (line 263) | def yarn_get_mscale(scale=1, mscale=1): class YoutuAttention (line 269) | class YoutuAttention(nn.Module): method __init__ (line 272) | def __init__(self, config: YoutuConfig, layer_idx: int): method forward (line 321) | def forward( class YoutuDecoderLayer (line 387) | class YoutuDecoderLayer(GradientCheckpointingLayer): method __init__ (line 388) | def __init__(self, config: YoutuConfig, layer_idx: int): method forward (line 398) | def forward( class YoutuPreTrainedModel (line 431) | class YoutuPreTrainedModel(PreTrainedModel): method _init_weights (line 449) | def _init_weights(self, module): class YoutuModel (line 460) | class YoutuModel(YoutuPreTrainedModel): method __init__ (line 461) | def __init__(self, config: YoutuConfig): method forward (line 480) | def forward( class YoutuForCausalLM (line 534) | class YoutuForCausalLM(YoutuPreTrainedModel, GenerationMixin): method __init__ (line 539) | def __init__(self, config): method forward (line 550) | def forward( FILE: src/transformers/models/youtu/modular_youtu.py class YoutuConfig (line 46) | class YoutuConfig(DeepseekV3Config): method __post_init__ (line 95) | def __post_init__(self, **kwargs): method convert_rope_params_to_dict (line 105) | def convert_rope_params_to_dict(self, **kwargs): class YoutuRMSNorm (line 109) | class YoutuRMSNorm(LlamaRMSNorm): class YoutuRotaryEmbedding (line 113) | class YoutuRotaryEmbedding(LlamaRotaryEmbedding): class YoutuMLP (line 117) | class YoutuMLP(Qwen3MLP): class YoutuAttention (line 121) | class YoutuAttention(DeepseekV3Attention): class YoutuDecoderLayer (line 125) | class YoutuDecoderLayer(LlamaDecoderLayer): class YoutuPreTrainedModel (line 129) | class YoutuPreTrainedModel(LlamaPreTrainedModel, PreTrainedModel): method _init_weights (line 131) | def _init_weights(self, module): class YoutuModel (line 141) | class YoutuModel(LlamaModel): class YoutuForCausalLM (line 145) | class YoutuForCausalLM(LlamaForCausalLM): FILE: src/transformers/models/zamba/configuration_zamba.py class ZambaConfig (line 26) | class ZambaConfig(PreTrainedConfig): method __post_init__ (line 92) | def __post_init__(self, **kwargs): method validate_architecture (line 101) | def validate_architecture(self): method _layers_block_type (line 106) | def _layers_block_type(self, num_hidden_layers, attn_layer_period, att... FILE: src/transformers/models/zamba/modeling_zamba.py class ZambaRMSNorm (line 49) | class ZambaRMSNorm(nn.Module): method __init__ (line 50) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 58) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 65) | def extra_repr(self): function repeat_kv (line 70) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 82) | def eager_attention_forward( class ZambaAttention (line 107) | class ZambaAttention(nn.Module): method __init__ (line 121) | def __init__(self, config: ZambaConfig, layer_idx: int): method forward (line 139) | def forward( class ZambaMambaMixer (line 177) | class ZambaMambaMixer(nn.Module): method __init__ (line 190) | def __init__(self, config: ZambaConfig, layer_idx): method cuda_kernels_forward (line 269) | def cuda_kernels_forward( method slow_forward (line 366) | def slow_forward(self, input_states, cache_params: Cache | None = None... method forward (line 448) | def forward(self, hidden_states, cache_params: Cache | None = None, at... class ZambaMLP (line 465) | class ZambaMLP(nn.Module): method __init__ (line 466) | def __init__(self, config): method forward (line 476) | def forward(self, x): class ZambaAttentionDecoderLayer (line 481) | class ZambaAttentionDecoderLayer(nn.Module): method __init__ (line 482) | def __init__(self, config: ZambaConfig, layer_idx: int | None = None): method forward (line 490) | def forward( class ZambaMambaDecoderLayer (line 532) | class ZambaMambaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 533) | def __init__(self, config: ZambaConfig, layer_idx: int): method forward (line 539) | def forward( class ZambaHybridLayer (line 584) | class ZambaHybridLayer(GradientCheckpointingLayer): method __init__ (line 585) | def __init__(self, shared_transf: ZambaAttentionDecoderLayer, linear: ... method forward (line 591) | def forward( class ZambaPreTrainedModel (line 640) | class ZambaPreTrainedModel(PreTrainedModel): method _init_weights (line 655) | def _init_weights(self, module): class ZambaModel (line 680) | class ZambaModel(ZambaPreTrainedModel): method __init__ (line 688) | def __init__(self, config: ZambaConfig): method forward (line 719) | def forward( class ZambaForCausalLM (line 779) | class ZambaForCausalLM(ZambaPreTrainedModel, GenerationMixin): method __init__ (line 782) | def __init__(self, config: ZambaConfig): method forward (line 793) | def forward( method prepare_inputs_for_generation (line 859) | def prepare_inputs_for_generation( class ZambaForSequenceClassification (line 899) | class ZambaForSequenceClassification(ZambaPreTrainedModel): method __init__ (line 900) | def __init__(self, config): method forward (line 911) | def forward( FILE: src/transformers/models/zamba2/configuration_zamba2.py class Zamba2Config (line 26) | class Zamba2Config(PreTrainedConfig): method __post_init__ (line 110) | def __post_init__(self, **kwargs): FILE: src/transformers/models/zamba2/modeling_zamba2.py class Zamba2RMSNormGated (line 51) | class Zamba2RMSNormGated(torch.nn.Module): method __init__ (line 52) | def __init__(self, hidden_size, group_size, eps=1e-6): method forward (line 58) | def forward(self, hidden_states, gate=None): class Zamba2RMSNorm (line 72) | class Zamba2RMSNorm(nn.Module): method __init__ (line 73) | def __init__(self, hidden_size, eps: float = 1e-6) -> None: method forward (line 81) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: method extra_repr (line 88) | def extra_repr(self): class Zamba2RotaryEmbedding (line 92) | class Zamba2RotaryEmbedding(nn.Module): method __init__ (line 95) | def __init__(self, config: Zamba2Config, device=None): method compute_default_rope_parameters (line 112) | def compute_default_rope_parameters( method forward (line 143) | def forward(self, x, position_ids): function repeat_kv (line 157) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: function eager_attention_forward (line 169) | def eager_attention_forward( function rotate_half (line 194) | def rotate_half(x): function apply_rotary_pos_emb (line 202) | def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1): class Zamba2Attention (line 227) | class Zamba2Attention(nn.Module): method __init__ (line 243) | def __init__( method forward (line 299) | def forward( function pad_tensor_by_size (line 354) | def pad_tensor_by_size(input_tensor: torch.Tensor, pad_size: int): function reshape_into_chunks (line 365) | def reshape_into_chunks(input_tensor, pad_size, chunk_size): function segment_sum (line 385) | def segment_sum(input_tensor): class Zamba2MambaMixer (line 405) | class Zamba2MambaMixer(nn.Module): method __init__ (line 413) | def __init__(self, config: Zamba2Config, layer_idx: int | None = None): method cuda_kernels_forward (line 504) | def cuda_kernels_forward( method torch_forward (line 655) | def torch_forward(self, input_states, cache_params: Cache | None=None,... method forward (line 837) | def forward( class Zamba2MLP (line 850) | class Zamba2MLP(nn.Module): method __init__ (line 851) | def __init__(self, config: Zamba2Config, num_fwd_mem_blocks=None, bloc... method forward (line 881) | def forward(self, hidden_state, layer_idx=None): class Zamba2AttentionDecoderLayer (line 892) | class Zamba2AttentionDecoderLayer(nn.Module): method __init__ (line 893) | def __init__(self, config: Zamba2Config, block_id: int | None = None, ... method forward (line 902) | def forward( class Zamba2MambaDecoderLayer (line 946) | class Zamba2MambaDecoderLayer(GradientCheckpointingLayer): method __init__ (line 947) | def __init__(self, config: Zamba2Config, layer_idx: int): method forward (line 953) | def forward( class Zamba2HybridLayer (line 998) | class Zamba2HybridLayer(GradientCheckpointingLayer): method __init__ (line 999) | def __init__( method forward (line 1007) | def forward( class Zamba2PreTrainedModel (line 1063) | class Zamba2PreTrainedModel(PreTrainedModel): method _init_weights (line 1079) | def _init_weights(self, module): class Zamba2Model (line 1097) | class Zamba2Model(Zamba2PreTrainedModel): method __init__ (line 1105) | def __init__(self, config: Zamba2Config): method forward (line 1131) | def forward( method get_layers (line 1197) | def get_layers(self): class Zamba2ForCausalLM (line 1233) | class Zamba2ForCausalLM(Zamba2PreTrainedModel, GenerationMixin): method __init__ (line 1236) | def __init__(self, config: Zamba2Config): method forward (line 1247) | def forward( method prepare_inputs_for_generation (line 1313) | def prepare_inputs_for_generation( class Zamba2ForSequenceClassification (line 1353) | class Zamba2ForSequenceClassification(Zamba2PreTrainedModel): method __init__ (line 1354) | def __init__(self, config: Zamba2Config): method forward (line 1365) | def forward( FILE: src/transformers/models/zamba2/modular_zamba2.py class Zamba2RMSNormGated (line 55) | class Zamba2RMSNormGated(torch.nn.Module): method __init__ (line 56) | def __init__(self, hidden_size, group_size, eps=1e-6): method forward (line 62) | def forward(self, hidden_states, gate=None): class Zamba2RMSNorm (line 76) | class Zamba2RMSNorm(ZambaRMSNorm): class Zamba2RotaryEmbedding (line 80) | class Zamba2RotaryEmbedding(LlamaRotaryEmbedding): class Zamba2Attention (line 84) | class Zamba2Attention(ZambaAttention): method __init__ (line 100) | def __init__( method forward (line 141) | def forward( class Zamba2MambaMixer (line 193) | class Zamba2MambaMixer(nn.Module): method __init__ (line 201) | def __init__(self, config: Zamba2Config, layer_idx: int | None = None): method cuda_kernels_forward (line 292) | def cuda_kernels_forward( method torch_forward (line 443) | def torch_forward(self, input_states, cache_params: Cache | None=None,... method forward (line 625) | def forward( class Zamba2MLP (line 638) | class Zamba2MLP(nn.Module): method __init__ (line 639) | def __init__(self, config: Zamba2Config, num_fwd_mem_blocks=None, bloc... method forward (line 669) | def forward(self, hidden_state, layer_idx=None): class Zamba2AttentionDecoderLayer (line 680) | class Zamba2AttentionDecoderLayer(ZambaAttentionDecoderLayer): method __init__ (line 681) | def __init__(self, config: Zamba2Config, block_id: int | None = None, ... method forward (line 688) | def forward( class Zamba2MambaDecoderLayer (line 732) | class Zamba2MambaDecoderLayer(ZambaMambaDecoderLayer): method __init__ (line 733) | def __init__(self, config: Zamba2Config, layer_idx: int): class Zamba2HybridLayer (line 739) | class Zamba2HybridLayer(ZambaHybridLayer): method __init__ (line 740) | def __init__( method forward (line 747) | def forward( class Zamba2PreTrainedModel (line 803) | class Zamba2PreTrainedModel(PreTrainedModel): method _init_weights (line 819) | def _init_weights(self, module): class Zamba2Model (line 836) | class Zamba2Model(ZambaModel, Zamba2PreTrainedModel): method __init__ (line 844) | def __init__(self, config: Zamba2Config): method get_layers (line 867) | def get_layers(self): method forward (line 904) | def forward( class Zamba2ForCausalLM (line 971) | class Zamba2ForCausalLM(ZambaForCausalLM): method __init__ (line 972) | def __init__(self, config: Zamba2Config): class Zamba2ForSequenceClassification (line 978) | class Zamba2ForSequenceClassification(ZambaForSequenceClassification): method __init__ (line 979) | def __init__(self, config: Zamba2Config): method forward (line 986) | def forward( FILE: src/transformers/models/zoedepth/configuration_zoedepth.py class ZoeDepthConfig (line 33) | class ZoeDepthConfig(PreTrainedConfig): method __post_init__ (line 142) | def __post_init__(self, **kwargs): FILE: src/transformers/models/zoedepth/convert_zoedepth_to_hf.py function get_zoedepth_config (line 36) | def get_zoedepth_config(model_name): function rename_key (line 74) | def rename_key(name): function read_in_q_k_v_metric_head (line 231) | def read_in_q_k_v_metric_head(state_dict): function convert_state_dict (line 256) | def convert_state_dict(orig_state_dict): function remove_ignore_keys (line 267) | def remove_ignore_keys(state_dict): function read_in_q_k_v (line 280) | def read_in_q_k_v(state_dict, config): function prepare_img (line 298) | def prepare_img(): function convert_zoedepth_checkpoint (line 305) | def convert_zoedepth_checkpoint(model_name, pytorch_dump_folder_path, pu... FILE: src/transformers/models/zoedepth/image_processing_pil_zoedepth.py class ZoeDepthImageProcessorKwargs (line 52) | class ZoeDepthImageProcessorKwargs(ImagesKwargs, total=False): function get_resize_output_image_size (line 72) | def get_resize_output_image_size( class ZoeDepthImageProcessorPil (line 113) | class ZoeDepthImageProcessorPil(PilBackend): method __init__ (line 126) | def __init__(self, **kwargs: Unpack[ZoeDepthImageProcessorKwargs]) -> ... method preprocess (line 130) | def preprocess(self, images: ImageInput, **kwargs: Unpack[ZoeDepthImag... method resize (line 133) | def resize( method pad_image (line 181) | def pad_image( method _preprocess (line 203) | def _preprocess( method post_process_depth_estimation (line 234) | def post_process_depth_estimation( FILE: src/transformers/models/zoedepth/image_processing_zoedepth.py class ZoeDepthImageProcessorKwargs (line 46) | class ZoeDepthImageProcessorKwargs(ImagesKwargs, total=False): function get_resize_output_image_size (line 65) | def get_resize_output_image_size( class ZoeDepthImageProcessor (line 105) | class ZoeDepthImageProcessor(TorchvisionBackend): method __init__ (line 118) | def __init__(self, **kwargs: Unpack[ZoeDepthImageProcessorKwargs]) -> ... method preprocess (line 122) | def preprocess(self, images: ImageInput, **kwargs: Unpack[ZoeDepthImag... method resize (line 125) | def resize( method _pad_images (line 172) | def _pad_images( method _preprocess (line 188) | def _preprocess( method post_process_depth_estimation (line 223) | def post_process_depth_estimation( FILE: src/transformers/models/zoedepth/modeling_zoedepth.py class ZoeDepthDepthEstimatorOutput (line 40) | class ZoeDepthDepthEstimatorOutput(ModelOutput): class ZoeDepthReassembleStage (line 55) | class ZoeDepthReassembleStage(nn.Module): method __init__ (line 71) | def __init__(self, config): method forward (line 88) | def forward(self, hidden_states: list[torch.Tensor], patch_height, pat... class ZoeDepthReassembleLayer (line 129) | class ZoeDepthReassembleLayer(nn.Module): method __init__ (line 130) | def __init__(self, config, channels, factor): method forward (line 146) | def forward(self, hidden_state): class ZoeDepthFeatureFusionStage (line 153) | class ZoeDepthFeatureFusionStage(nn.Module): method __init__ (line 154) | def __init__(self, config: ZoeDepthConfig): method forward (line 160) | def forward(self, hidden_states): class ZoeDepthPreActResidualLayer (line 178) | class ZoeDepthPreActResidualLayer(nn.Module): method __init__ (line 188) | def __init__(self, config): method forward (line 222) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class ZoeDepthFeatureFusionLayer (line 241) | class ZoeDepthFeatureFusionLayer(nn.Module): method __init__ (line 251) | def __init__(self, config: ZoeDepthConfig, align_corners: bool = True): method forward (line 261) | def forward(self, hidden_state: torch.Tensor, residual: torch.Tensor |... class ZoeDepthNeck (line 278) | class ZoeDepthNeck(nn.Module): method __init__ (line 291) | def __init__(self, config: ZoeDepthConfig): method forward (line 308) | def forward(self, hidden_states: list[torch.Tensor], patch_height, pat... class ZoeDepthRelativeDepthEstimationHead (line 332) | class ZoeDepthRelativeDepthEstimationHead(nn.Module): method __init__ (line 339) | def __init__(self, config): method forward (line 354) | def forward(self, hidden_states: list[torch.Tensor]) -> torch.Tensor: function log_binom (line 376) | def log_binom(n, k, eps=1e-7): class LogBinomialSoftmax (line 383) | class LogBinomialSoftmax(nn.Module): method __init__ (line 384) | def __init__(self, n_classes=256, act=torch.softmax): method forward (line 399) | def forward(self, probabilities, temperature=1.0, eps=1e-4): class ZoeDepthConditionalLogBinomialSoftmax (line 427) | class ZoeDepthConditionalLogBinomialSoftmax(nn.Module): method __init__ (line 428) | def __init__( method forward (line 465) | def forward(self, main_feature, condition_feature): class ZoeDepthSeedBinRegressor (line 494) | class ZoeDepthSeedBinRegressor(nn.Module): method __init__ (line 495) | def __init__(self, config, n_bins=16, mlp_dim=256, min_depth=1e-3, max... method forward (line 524) | def forward(self, x): function inv_attractor (line 551) | def inv_attractor(dx, alpha: float = 300, gamma: int = 2): class ZoeDepthAttractorLayer (line 570) | class ZoeDepthAttractorLayer(nn.Module): method __init__ (line 571) | def __init__( method forward (line 602) | def forward(self, x, prev_bin, prev_bin_embedding=None, interpolate=Tr... class ZoeDepthAttractorLayerUnnormed (line 665) | class ZoeDepthAttractorLayerUnnormed(nn.Module): method __init__ (line 666) | def __init__( method forward (line 695) | def forward(self, x, prev_bin, prev_bin_embedding=None, interpolate=Tr... class ZoeDepthProjector (line 749) | class ZoeDepthProjector(nn.Module): method __init__ (line 750) | def __init__(self, in_features, out_features, mlp_dim=128): method forward (line 767) | def forward(self, hidden_state: torch.Tensor) -> torch.Tensor: class ZoeDepthMultiheadAttention (line 776) | class ZoeDepthMultiheadAttention(nn.Module): method __init__ (line 780) | def __init__(self, hidden_size, num_attention_heads, dropout): method forward (line 800) | def forward( class ZoeDepthTransformerEncoderLayer (line 849) | class ZoeDepthTransformerEncoderLayer(nn.Module): method __init__ (line 850) | def __init__(self, config, dropout=0.1, activation="relu"): method forward (line 870) | def forward( class ZoeDepthPatchTransformerEncoder (line 885) | class ZoeDepthPatchTransformerEncoder(nn.Module): method __init__ (line 886) | def __init__(self, config): method positional_encoding_1d (line 905) | def positional_encoding_1d(self, batch_size, sequence_length, embeddin... method forward (line 923) | def forward(self, x): class ZoeDepthMLPClassifier (line 948) | class ZoeDepthMLPClassifier(nn.Module): method __init__ (line 949) | def __init__(self, in_features, out_features) -> None: method forward (line 957) | def forward(self, hidden_state): class ZoeDepthMultipleMetricDepthEstimationHeads (line 965) | class ZoeDepthMultipleMetricDepthEstimationHeads(nn.Module): method __init__ (line 970) | def __init__(self, config): method forward (line 1054) | def forward(self, outconv_activation, bottleneck, feature_blocks, rela... class ZoeDepthMetricDepthEstimationHead (line 1106) | class ZoeDepthMetricDepthEstimationHead(nn.Module): method __init__ (line 1107) | def __init__(self, config): method forward (line 1166) | def forward(self, outconv_activation, bottleneck, feature_blocks, rela... class ZoeDepthPreTrainedModel (line 1206) | class ZoeDepthPreTrainedModel(PreTrainedModel): method _init_weights (line 1213) | def _init_weights(self, module): class ZoeDepthForDepthEstimation (line 1225) | class ZoeDepthForDepthEstimation(ZoeDepthPreTrainedModel): method __init__ (line 1226) | def __init__(self, config): method forward (line 1252) | def forward( FILE: src/transformers/monkey_patching.py function _compile_pattern (line 34) | def _compile_pattern(pattern: str) -> re.Pattern | None: function _find_replacement_class (line 56) | def _find_replacement_class(class_name: str, mapping: dict[str, type[nn.... function register_patch_mapping (line 85) | def register_patch_mapping(mapping: dict[str, type[nn.Module]], overwrit... function unregister_patch_mapping (line 158) | def unregister_patch_mapping(keys: list[str]) -> None: function get_patch_mapping (line 198) | def get_patch_mapping() -> dict[str, type[nn.Module]]: function clear_patch_mapping (line 209) | def clear_patch_mapping() -> None: function apply_patches (line 234) | def apply_patches(): function patch_output_recorders (line 302) | def patch_output_recorders(model: nn.Module) -> None: FILE: src/transformers/optimization.py function _get_constant_lambda (line 35) | def _get_constant_lambda(_=None): function get_constant_schedule (line 39) | def get_constant_schedule(optimizer: Optimizer, last_epoch: int = -1): function get_reduce_on_plateau_schedule (line 56) | def get_reduce_on_plateau_schedule(optimizer: Optimizer, **kwargs): function _get_constant_schedule_with_warmup_lr_lambda (line 74) | def _get_constant_schedule_with_warmup_lr_lambda(current_step: int, *, n... function get_constant_schedule_with_warmup (line 80) | def get_constant_schedule_with_warmup(optimizer: Optimizer, num_warmup_s... function _get_linear_schedule_with_warmup_lr_lambda (line 101) | def _get_linear_schedule_with_warmup_lr_lambda(current_step: int, *, num... function get_linear_schedule_with_warmup (line 107) | def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_tra... function _get_cosine_schedule_with_warmup_lr_lambda (line 134) | def _get_cosine_schedule_with_warmup_lr_lambda( function get_cosine_schedule_with_warmup (line 143) | def get_cosine_schedule_with_warmup( function _get_cosine_with_hard_restarts_schedule_with_warmup_lr_lambda (line 177) | def _get_cosine_with_hard_restarts_schedule_with_warmup_lr_lambda( function get_cosine_with_hard_restarts_schedule_with_warmup (line 188) | def get_cosine_with_hard_restarts_schedule_with_warmup( function _get_polynomial_decay_schedule_with_warmup_lr_lambda (line 221) | def _get_polynomial_decay_schedule_with_warmup_lr_lambda( function get_polynomial_decay_schedule_with_warmup (line 242) | def get_polynomial_decay_schedule_with_warmup( function _get_inverse_sqrt_schedule_lr_lambda (line 288) | def _get_inverse_sqrt_schedule_lr_lambda(current_step: int, *, num_warmu... function get_inverse_sqrt_schedule (line 296) | def get_inverse_sqrt_schedule( function _get_cosine_schedule_with_warmup_lr_lambda (line 326) | def _get_cosine_schedule_with_warmup_lr_lambda( function get_cosine_with_min_lr_schedule_with_warmup (line 337) | def get_cosine_with_min_lr_schedule_with_warmup( function _get_cosine_with_min_lr_schedule_with_warmup_lr_rate_lambda (line 389) | def _get_cosine_with_min_lr_schedule_with_warmup_lr_rate_lambda( function get_cosine_with_min_lr_schedule_with_warmup_lr_rate (line 414) | def get_cosine_with_min_lr_schedule_with_warmup_lr_rate( function _get_wsd_scheduler_lambda (line 470) | def _get_wsd_scheduler_lambda( function get_wsd_schedule (line 508) | def get_wsd_schedule( class StreamingAverage (line 581) | class StreamingAverage: method __init__ (line 592) | def __init__(self, window_size: int) -> None: method streamavg (line 597) | def streamavg(self, value: float) -> float: method state_dict (line 608) | def state_dict(self) -> dict[str, Any]: method load_state_dict (line 615) | def load_state_dict(self, state_dict: dict[str, Any]) -> None: class GreedyLR (line 621) | class GreedyLR: method __init__ (line 678) | def __init__( method step (line 749) | def step(self, metrics: float, epoch: int | None = None) -> None: method is_better (line 795) | def is_better(self, current: float, best: float) -> bool: method _reduce_lr (line 807) | def _reduce_lr(self, epoch: int) -> None: method _increase_lr (line 826) | def _increase_lr(self, epoch: int) -> None: method _reset (line 838) | def _reset(self) -> None: method get_last_lr (line 855) | def get_last_lr(self) -> list[float]: method state_dict (line 859) | def state_dict(self) -> dict[str, Any]: method load_state_dict (line 892) | def load_state_dict(self, state_dict: dict[str, Any]) -> None: function get_greedy_schedule (line 928) | def get_greedy_schedule(optimizer: Optimizer, **kwargs): function get_scheduler (line 960) | def get_scheduler( class Adafactor (line 1057) | class Adafactor(Optimizer): method __init__ (line 1142) | def __init__( method _get_lr (line 1174) | def _get_lr(param_group, param_state): method _get_options (line 1185) | def _get_options(param_group, param_shape): method _rms (line 1191) | def _rms(tensor): method _approx_sq_grad (line 1195) | def _approx_sq_grad(exp_avg_sq_row, exp_avg_sq_col): method step (line 1203) | def step(self, closure=None): class AdafactorSchedule (line 1297) | class AdafactorSchedule(LambdaLR): method __init__ (line 1305) | def __init__(self, optimizer, initial_lr=0.0): method get_lr (line 1315) | def get_lr(self): function get_adafactor_schedule (line 1327) | def get_adafactor_schedule(optimizer, initial_lr=0.0): FILE: src/transformers/pipelines/__init__.py function get_supported_tasks (line 295) | def get_supported_tasks() -> list[str]: function get_task (line 302) | def get_task(model: str, token: str | None = None, **deprecated_kwargs) ... function check_task (line 319) | def check_task(task: str) -> tuple[str, dict, Any]: function clean_custom_task (line 358) | def clean_custom_task(task_info): function pipeline (line 383) | def pipeline(task: Literal[None], model: str | PreTrainedModel | None = ... function pipeline (line 385) | def pipeline(task: Literal["any-to-any"], model: str | PreTrainedModel |... function pipeline (line 387) | def pipeline(task: Literal["audio-classification"], model: str | PreTrai... function pipeline (line 389) | def pipeline(task: Literal["automatic-speech-recognition"], model: str |... function pipeline (line 391) | def pipeline(task: Literal["depth-estimation"], model: str | PreTrainedM... function pipeline (line 393) | def pipeline(task: Literal["document-question-answering"], model: str | ... function pipeline (line 395) | def pipeline(task: Literal["feature-extraction"], model: str | PreTraine... function pipeline (line 397) | def pipeline(task: Literal["fill-mask"], model: str | PreTrainedModel | ... function pipeline (line 399) | def pipeline(task: Literal["image-classification"], model: str | PreTrai... function pipeline (line 401) | def pipeline(task: Literal["image-feature-extraction"], model: str | Pre... function pipeline (line 403) | def pipeline(task: Literal["image-segmentation"], model: str | PreTraine... function pipeline (line 405) | def pipeline(task: Literal["image-text-to-text"], model: str | PreTraine... function pipeline (line 407) | def pipeline(task: Literal["keypoint-matching"], model: str | PreTrained... function pipeline (line 409) | def pipeline(task: Literal["mask-generation"], model: str | PreTrainedMo... function pipeline (line 411) | def pipeline(task: Literal["object-detection"], model: str | PreTrainedM... function pipeline (line 413) | def pipeline(task: Literal["table-question-answering"], model: str | Pre... function pipeline (line 415) | def pipeline(task: Literal["text-classification"], model: str | PreTrain... function pipeline (line 417) | def pipeline(task: Literal["text-generation"], model: str | PreTrainedMo... function pipeline (line 419) | def pipeline(task: Literal["text-to-audio"], model: str | PreTrainedMode... function pipeline (line 421) | def pipeline(task: Literal["token-classification"], model: str | PreTrai... function pipeline (line 423) | def pipeline(task: Literal["video-classification"], model: str | PreTrai... function pipeline (line 425) | def pipeline(task: Literal["zero-shot-audio-classification"], model: str... function pipeline (line 427) | def pipeline(task: Literal["zero-shot-classification"], model: str | Pre... function pipeline (line 429) | def pipeline(task: Literal["zero-shot-image-classification"], model: str... function pipeline (line 431) | def pipeline(task: Literal["zero-shot-object-detection"], model: str | P... function pipeline (line 440) | def pipeline( FILE: src/transformers/pipelines/any_to_any.py class ReturnType (line 47) | class ReturnType(enum.Enum): class Chat (line 53) | class Chat: method __init__ (line 58) | def __init__(self, messages: list[dict]): class AnyToAnyPipeline (line 66) | class AnyToAnyPipeline(Pipeline): method __init__ (line 140) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 149) | def _sanitize_parameters( method __call__ (line 234) | def __call__( method __call__ (line 244) | def __call__( method __call__ (line 253) | def __call__( method preprocess (line 355) | def preprocess(self, inputs=None, timeout=None, continue_final_message... method _forward (line 403) | def _forward(self, model_inputs, generate_kwargs=None): method postprocess (line 415) | def postprocess( FILE: src/transformers/pipelines/audio_classification.py function ffmpeg_read (line 30) | def ffmpeg_read(bpayload: bytes, sampling_rate: int) -> np.ndarray: class AudioClassificationPipeline (line 67) | class AudioClassificationPipeline(Pipeline): method __init__ (line 99) | def __init__(self, *args, **kwargs): method __call__ (line 109) | def __call__(self, inputs: np.ndarray | bytes | str | dict, **kwargs: ... method _sanitize_parameters (line 145) | def _sanitize_parameters(self, top_k=None, function_to_apply=None, **k... method preprocess (line 167) | def preprocess(self, inputs): method _forward (line 242) | def _forward(self, model_inputs): method postprocess (line 246) | def postprocess(self, model_outputs, top_k=5, function_to_apply="softm... FILE: src/transformers/pipelines/audio_utils.py function ffmpeg_read (line 9) | def ffmpeg_read(bpayload: bytes, sampling_rate: int) -> np.ndarray: function ffmpeg_microphone (line 48) | def ffmpeg_microphone( function ffmpeg_microphone_live (line 132) | def ffmpeg_microphone_live( function chunk_bytes_iter (line 227) | def chunk_bytes_iter(iterator, chunk_len: int, stride: tuple[int, int], ... function _ffmpeg_stream (line 262) | def _ffmpeg_stream(ffmpeg_command, buflen: int): function _get_microphone_name (line 278) | def _get_microphone_name(): FILE: src/transformers/pipelines/automatic_speech_recognition.py function rescale_stride (line 41) | def rescale_stride(stride, ratio): function chunk_iter (line 61) | def chunk_iter(inputs, feature_extractor, chunk_len, stride_left, stride... function _find_longest_common_sequence (line 87) | def _find_longest_common_sequence(sequences, tokenizer): class AutomaticSpeechRecognitionPipeline (line 112) | class AutomaticSpeechRecognitionPipeline(ChunkPipeline): method __init__ (line 165) | def __init__( method __call__ (line 187) | def __call__(self, inputs: np.ndarray | bytes | str | dict, **kwargs: ... method _sanitize_parameters (line 246) | def _sanitize_parameters( method _align_to (line 328) | def _align_to(self): method preprocess (line 341) | def preprocess(self, inputs, chunk_length_s=0, stride_length_s=None): method _forward (line 479) | def _forward(self, model_inputs, return_timestamps=False, **generate_k... method postprocess (line 562) | def postprocess( FILE: src/transformers/pipelines/base.py function no_collate_fn (line 72) | def no_collate_fn(items): function _pad (line 78) | def _pad(items, key, padding_value, padding_side): function pad_collate_fn (line 116) | def pad_collate_fn(tokenizer, feature_extractor): function load_model (line 179) | def load_model( function get_default_model_and_revision (line 275) | def get_default_model_and_revision(targeted_task: dict, task_options: An... function load_assistant_model (line 305) | def load_assistant_model( class PipelineException (line 355) | class PipelineException(Exception): method __init__ (line 365) | def __init__(self, task: str, model: str, reason: str): class ArgumentHandler (line 372) | class ArgumentHandler(ABC): method __call__ (line 378) | def __call__(self, *args, **kwargs): class PipelineDataFormat (line 382) | class PipelineDataFormat: method __init__ (line 404) | def __init__( method __iter__ (line 428) | def __iter__(self): method save (line 432) | def save(self, data: dict | list[dict]): method save_binary (line 441) | def save_binary(self, data: dict | list[dict]) -> str: method from_str (line 460) | def from_str( class CsvPipelineDataFormat (line 495) | class CsvPipelineDataFormat(PipelineDataFormat): method __init__ (line 507) | def __init__( method __iter__ (line 516) | def __iter__(self): method save (line 525) | def save(self, data: list[dict]): class JsonPipelineDataFormat (line 539) | class JsonPipelineDataFormat(PipelineDataFormat): method __init__ (line 551) | def __init__( method __iter__ (line 563) | def __iter__(self): method save (line 570) | def save(self, data: dict): class PipedPipelineDataFormat (line 581) | class PipedPipelineDataFormat(PipelineDataFormat): method __iter__ (line 595) | def __iter__(self): method save (line 610) | def save(self, data: dict): method save_binary (line 619) | def save_binary(self, data: dict | list[dict]) -> str: class _ScikitCompat (line 629) | class _ScikitCompat(ABC): method transform (line 635) | def transform(self, X): method predict (line 639) | def predict(self, X): function build_pipeline_init_args (line 643) | def build_pipeline_init_args( class Pipeline (line 737) | class Pipeline(_ScikitCompat, PushToHubMixin): method __init__ (line 769) | def __init__( method __repr__ (line 931) | def __repr__(self): method save_pretrained (line 942) | def save_pretrained(self, save_directory: str | os.PathLike, **kwargs:... method transform (line 988) | def transform(self, X): method predict (line 994) | def predict(self, X): method dtype (line 1001) | def dtype(self) -> torch.dtype | None: method torch_dtype (line 1008) | def torch_dtype(self) -> torch.dtype | None: method device_placement (line 1016) | def device_placement(self): method ensure_tensor_on_device (line 1047) | def ensure_tensor_on_device(self, **inputs): method _ensure_tensor_on_device (line 1061) | def _ensure_tensor_on_device(self, inputs, device): method check_model_type (line 1079) | def check_model_type(self, supported_models: list[str] | dict): method _sanitize_parameters (line 1113) | def _sanitize_parameters(self, **pipeline_parameters): method preprocess (line 1126) | def preprocess(self, input_: Any, **preprocess_parameters: dict) -> di... method _forward (line 1134) | def _forward(self, input_tensors: dict[str, GenericTensor], **forward_... method postprocess (line 1147) | def postprocess(self, model_outputs: ModelOutput, **postprocess_parame... method get_inference_context (line 1155) | def get_inference_context(self): method forward (line 1158) | def forward(self, model_inputs, **forward_params): method get_iterator (line 1167) | def get_iterator( method __call__ (line 1192) | def __call__(self, inputs, *args, num_workers=None, batch_size=None, *... method run_multi (line 1266) | def run_multi(self, inputs, preprocess_params, forward_params, postpro... method run_single (line 1269) | def run_single(self, inputs, preprocess_params, forward_params, postpr... method iterate (line 1275) | def iterate(self, inputs, preprocess_params, forward_params, postproce... class ChunkPipeline (line 1289) | class ChunkPipeline(Pipeline): method run_single (line 1290) | def run_single(self, inputs, preprocess_params, forward_params, postpr... method get_iterator (line 1298) | def get_iterator( class PipelineRegistry (line 1321) | class PipelineRegistry: method __init__ (line 1322) | def __init__(self, supported_tasks: dict[str, Any], task_aliases: dict... method get_supported_tasks (line 1326) | def get_supported_tasks(self) -> list[str]: method check_task (line 1331) | def check_task(self, task: str) -> tuple[str, dict, Any]: method register_pipeline (line 1340) | def register_pipeline( method to_dict (line 1369) | def to_dict(self): FILE: src/transformers/pipelines/depth_estimation.py class DepthEstimationPipeline (line 25) | class DepthEstimationPipeline(Pipeline): method __init__ (line 55) | def __init__(self, *args, **kwargs): method __call__ (line 61) | def __call__(self, inputs: Union[str, "Image.Image"], **kwargs: Any) -... method __call__ (line 64) | def __call__(self, inputs: list[Union[str, "Image.Image"]], **kwargs: ... method __call__ (line 66) | def __call__( method _sanitize_parameters (line 108) | def _sanitize_parameters(self, timeout=None, parameters=None, **kwargs): method preprocess (line 116) | def preprocess(self, image, timeout=None): method _forward (line 123) | def _forward(self, model_inputs): method postprocess (line 129) | def postprocess(self, model_outputs): FILE: src/transformers/pipelines/document_question_answering.py function normalize_box (line 53) | def normalize_box(box, width, height): function decode_spans (line 62) | def decode_spans( function select_starts_ends (line 112) | def select_starts_ends( function apply_tesseract (line 166) | def apply_tesseract(image: "Image.Image", lang: str | None, tesseract_co... class ModelType (line 199) | class ModelType(ExplicitEnum): class DocumentQuestionAnsweringPipeline (line 206) | class DocumentQuestionAnsweringPipeline(ChunkPipeline): method __init__ (line 250) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 271) | def _sanitize_parameters( method __call__ (line 322) | def __call__( method __call__ (line 331) | def __call__(self, image: dict[str, Any], **kwargs: Any) -> list[dict[... method __call__ (line 334) | def __call__(self, image: list[dict[str, Any]], **kwargs: Any) -> list... method __call__ (line 336) | def __call__( method preprocess (line 415) | def preprocess( method _forward (line 560) | def _forward(self, model_inputs, **generate_kwargs): method postprocess (line 583) | def postprocess(self, model_outputs, top_k=1, **kwargs): method postprocess_encoder_decoder_single (line 592) | def postprocess_encoder_decoder_single(self, model_outputs, **kwargs): method postprocess_extractive_qa (line 608) | def postprocess_extractive_qa( FILE: src/transformers/pipelines/feature_extraction.py class FeatureExtractionPipeline (line 15) | class FeatureExtractionPipeline(Pipeline): method _sanitize_parameters (line 45) | def _sanitize_parameters(self, truncation=None, tokenize_kwargs=None, ... method preprocess (line 64) | def preprocess(self, inputs, **tokenize_kwargs) -> dict[str, GenericTe... method _forward (line 68) | def _forward(self, model_inputs): method postprocess (line 72) | def postprocess(self, model_outputs, return_tensors=False): method __call__ (line 78) | def __call__(self, *args: str | list[str], **kwargs: Any) -> Any | lis... FILE: src/transformers/pipelines/fill_mask.py class FillMaskPipeline (line 28) | class FillMaskPipeline(Pipeline): method get_masked_index (line 86) | def get_masked_index(self, input_ids: GenericTensor) -> np.ndarray: method _ensure_exactly_one_mask_token (line 90) | def _ensure_exactly_one_mask_token(self, input_ids: GenericTensor) -> ... method ensure_exactly_one_mask_token (line 100) | def ensure_exactly_one_mask_token(self, model_inputs: GenericTensor): method preprocess (line 108) | def preprocess( method _forward (line 120) | def _forward(self, model_inputs): method postprocess (line 125) | def postprocess(self, model_outputs, top_k=5, target_ids=None): method get_target_ids (line 166) | def get_target_ids(self, targets): method _sanitize_parameters (line 207) | def _sanitize_parameters(self, top_k=None, targets=None, tokenizer_kwa... method __call__ (line 229) | def __call__(self, inputs: str, **kwargs: Any) -> list[dict[str, Any]]... method __call__ (line 232) | def __call__(self, inputs: list[str], **kwargs: Any) -> list[list[dict... method __call__ (line 234) | def __call__(self, inputs: str | list[str], **kwargs: Any) -> list[dic... FILE: src/transformers/pipelines/image_classification.py function sigmoid (line 43) | def sigmoid(_outputs): function softmax (line 48) | def softmax(_outputs): class ClassificationFunction (line 55) | class ClassificationFunction(ExplicitEnum): class ImageClassificationPipeline (line 73) | class ImageClassificationPipeline(Pipeline): method __init__ (line 103) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 108) | def _sanitize_parameters(self, top_k=None, function_to_apply=None, tim... method __call__ (line 122) | def __call__(self, inputs: Union[str, "Image.Image"], **kwargs: Any) -... method __call__ (line 125) | def __call__(self, inputs: list[str] | list["Image.Image"], **kwargs: ... method __call__ (line 127) | def __call__( method preprocess (line 183) | def preprocess(self, image, timeout=None): method _forward (line 189) | def _forward(self, model_inputs): method postprocess (line 193) | def postprocess(self, model_outputs, function_to_apply=None, top_k=5): FILE: src/transformers/pipelines/image_feature_extraction.py class ImageFeatureExtractionPipeline (line 23) | class ImageFeatureExtractionPipeline(Pipeline): method _sanitize_parameters (line 53) | def _sanitize_parameters(self, image_processor_kwargs=None, return_ten... method preprocess (line 67) | def preprocess(self, image, timeout=None, **image_processor_kwargs) ->... method _forward (line 73) | def _forward(self, model_inputs): method postprocess (line 77) | def postprocess(self, model_outputs, pool=None, return_tensors=False): method __call__ (line 94) | def __call__(self, *args: Union[str, "Image.Image", list["Image.Image"... FILE: src/transformers/pipelines/image_segmentation.py class ImageSegmentationPipeline (line 27) | class ImageSegmentationPipeline(Pipeline): method __init__ (line 68) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 78) | def _sanitize_parameters(self, **kwargs): method __call__ (line 96) | def __call__(self, inputs: Union[str, "Image.Image"], **kwargs: Any) -... method __call__ (line 99) | def __call__(self, inputs: list[str] | list["Image.Image"], **kwargs: ... method __call__ (line 101) | def __call__( method preprocess (line 151) | def preprocess(self, image, subtask=None, timeout=None): method _forward (line 173) | def _forward(self, model_inputs): method postprocess (line 179) | def postprocess( FILE: src/transformers/pipelines/image_text_to_text.py class ReturnType (line 46) | class ReturnType(enum.Enum): class ImageTextToTextPipeline (line 53) | class ImageTextToTextPipeline(Pipeline): method __init__ (line 126) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 131) | def _sanitize_parameters( method __call__ (line 198) | def __call__( method __call__ (line 206) | def __call__( method __call__ (line 213) | def __call__( method preprocess (line 324) | def preprocess(self, inputs=None, timeout=None, continue_final_message... method _forward (line 361) | def _forward(self, model_inputs, generate_kwargs=None): method postprocess (line 376) | def postprocess( FILE: src/transformers/pipelines/keypoint_matching.py class Keypoint (line 34) | class Keypoint(TypedDict): class Match (line 39) | class Match(TypedDict): function validate_image_pairs (line 45) | def validate_image_pairs(images: Any) -> Sequence[Sequence[ImagePair]]: class KeypointMatchingPipeline (line 69) | class KeypointMatchingPipeline(Pipeline): method __init__ (line 79) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 83) | def _sanitize_parameters(self, threshold=None, timeout=None): method __call__ (line 93) | def __call__(self, inputs: ImagePair, threshold: float = 0.0, **kwargs... method __call__ (line 96) | def __call__(self, inputs: list[ImagePair], threshold: float = 0.0, **... method __call__ (line 98) | def __call__( method preprocess (line 145) | def preprocess(self, images, timeout=None): method _forward (line 153) | def _forward(self, preprocess_outputs): method postprocess (line 159) | def postprocess(self, forward_outputs, threshold=0.0) -> list[Match]: FILE: src/transformers/pipelines/mask_generation.py class MaskGenerationPipeline (line 36) | class MaskGenerationPipeline(ChunkPipeline): method __init__ (line 92) | def __init__(self, **kwargs): method _sanitize_parameters (line 99) | def _sanitize_parameters(self, **kwargs): method __call__ (line 138) | def __call__(self, image: Union[str, "Image.Image"], *args: Any, **kwa... method __call__ (line 141) | def __call__(self, image: list[str] | list["Image.Image"], *args: Any,... method __call__ (line 143) | def __call__( method preprocess (line 187) | def preprocess( method _forward (line 243) | def _forward( method postprocess (line 302) | def postprocess( FILE: src/transformers/pipelines/object_detection.py class ObjectDetectionPipeline (line 26) | class ObjectDetectionPipeline(Pipeline): method __init__ (line 56) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 64) | def _sanitize_parameters(self, **kwargs): method __call__ (line 74) | def __call__(self, image: Union[str, "Image.Image"], *args: Any, **kwa... method __call__ (line 77) | def __call__( method __call__ (line 81) | def __call__(self, *args, **kwargs) -> list[dict[str, Any]] | list[lis... method preprocess (line 117) | def preprocess(self, image, timeout=None): method _forward (line 127) | def _forward(self, model_inputs): method postprocess (line 135) | def postprocess(self, model_outputs, threshold=0.5): method _get_bounding_box (line 180) | def _get_bounding_box(self, box: "torch.Tensor") -> dict[str, int]: FILE: src/transformers/pipelines/pt_utils.py class PipelineDataset (line 8) | class PipelineDataset(Dataset): method __init__ (line 9) | def __init__(self, dataset, process, params): method __len__ (line 14) | def __len__(self): method __getitem__ (line 17) | def __getitem__(self, i): class PipelineIterator (line 23) | class PipelineIterator(IterableDataset): method __init__ (line 24) | def __init__(self, loader, infer, params, loader_batch_size=None): method __len__ (line 63) | def __len__(self): method __iter__ (line 66) | def __iter__(self): method loader_batch_item (line 70) | def loader_batch_item(self): method __next__ (line 119) | def __next__(self): class PipelineChunkIterator (line 156) | class PipelineChunkIterator(PipelineIterator): method __init__ (line 157) | def __init__(self, loader, infer, params, loader_batch_size=None): method __iter__ (line 177) | def __iter__(self): method __next__ (line 182) | def __next__(self): class PipelinePackIterator (line 201) | class PipelinePackIterator(PipelineIterator): method __iter__ (line 247) | def __iter__(self): method __next__ (line 251) | def __next__(self): class KeyDataset (line 301) | class KeyDataset(Dataset): method __init__ (line 302) | def __init__(self, dataset: Dataset, key: str): method __len__ (line 306) | def __len__(self): method __getitem__ (line 309) | def __getitem__(self, i): class KeyPairDataset (line 313) | class KeyPairDataset(Dataset): method __init__ (line 314) | def __init__(self, dataset: Dataset, key1: str, key2: str): method __len__ (line 319) | def __len__(self): method __getitem__ (line 322) | def __getitem__(self, i): FILE: src/transformers/pipelines/table_question_answering.py class TableQuestionAnsweringArgumentHandler (line 24) | class TableQuestionAnsweringArgumentHandler(ArgumentHandler): method __call__ (line 29) | def __call__(self, table=None, query=None, **kwargs): class TableQuestionAnsweringPipeline (line 78) | class TableQuestionAnsweringPipeline(Pipeline): method __init__ (line 125) | def __init__(self, args_parser=TableQuestionAnsweringArgumentHandler()... method batch_inference (line 138) | def batch_inference(self, **inputs): method sequential_inference (line 141) | def sequential_inference(self, **inputs): method __call__ (line 208) | def __call__(self, *args, **kwargs): method _sanitize_parameters (line 290) | def _sanitize_parameters(self, sequential=None, padding=None, truncati... method preprocess (line 309) | def preprocess(self, pipeline_input, padding=True, truncation=None): method _forward (line 325) | def _forward(self, model_inputs, sequential=False, **generate_kwargs): method postprocess (line 342) | def postprocess(self, model_outputs): FILE: src/transformers/pipelines/text_classification.py function sigmoid (line 14) | def sigmoid(_outputs): function softmax (line 18) | def softmax(_outputs): class ClassificationFunction (line 24) | class ClassificationFunction(ExplicitEnum): class TextClassificationPipeline (line 43) | class TextClassificationPipeline(Pipeline): method __init__ (line 82) | def __init__(self, **kwargs): method _sanitize_parameters (line 87) | def _sanitize_parameters(self, function_to_apply=None, top_k="", **tok... method __call__ (line 105) | def __call__( method preprocess (line 154) | def preprocess(self, inputs, **tokenizer_kwargs) -> dict[str, GenericT... method _forward (line 171) | def _forward(self, model_inputs): method postprocess (line 178) | def postprocess(self, model_outputs, function_to_apply=None, top_k=1, ... FILE: src/transformers/pipelines/text_generation.py class ReturnType (line 16) | class ReturnType(enum.Enum): class TextGenerationPipeline (line 23) | class TextGenerationPipeline(Pipeline): method __init__ (line 99) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 128) | def _sanitize_parameters( method _parse_and_tokenize (line 227) | def _parse_and_tokenize(self, *args, **kwargs): method __call__ (line 238) | def __call__(self, text_inputs: str, **kwargs: Any) -> list[dict[str, ... method __call__ (line 241) | def __call__(self, text_inputs: list[str], **kwargs: Any) -> list[list... method __call__ (line 244) | def __call__(self, text_inputs: ChatType, **kwargs: Any) -> list[dict[... method __call__ (line 247) | def __call__(self, text_inputs: list[ChatType], **kwargs: Any) -> list... method __call__ (line 249) | def __call__(self, text_inputs, **kwargs): method preprocess (line 301) | def preprocess( method _forward (line 369) | def _forward(self, model_inputs, **generate_kwargs): method postprocess (line 432) | def postprocess( FILE: src/transformers/pipelines/text_to_audio.py class AudioOutput (line 33) | class AudioOutput(TypedDict, total=False): class TextToAudioPipeline (line 45) | class TextToAudioPipeline(Pipeline): method __init__ (line 109) | def __init__(self, *args, vocoder=None, sampling_rate=None, **kwargs): method preprocess (line 149) | def preprocess(self, text, **kwargs): method _forward (line 188) | def _forward(self, model_inputs, **kwargs): method __call__ (line 231) | def __call__(self, text_inputs: str, **forward_params: Any) -> AudioOu... method __call__ (line 234) | def __call__(self, text_inputs: list[str], **forward_params: Any) -> l... method __call__ (line 237) | def __call__(self, text_inputs: ChatType, **forward_params: Any) -> Au... method __call__ (line 240) | def __call__(self, text_inputs: list[ChatType], **forward_params: Any)... method __call__ (line 242) | def __call__(self, text_inputs, **forward_params): method _sanitize_parameters (line 269) | def _sanitize_parameters( method postprocess (line 292) | def postprocess(self, audio): FILE: src/transformers/pipelines/token_classification.py class TokenClassificationArgumentHandler (line 22) | class TokenClassificationArgumentHandler(ArgumentHandler): method __call__ (line 27) | def __call__(self, inputs: str | list[str], **kwargs): class AggregationStrategy (line 51) | class AggregationStrategy(ExplicitEnum): class TokenClassificationPipeline (line 92) | class TokenClassificationPipeline(ChunkPipeline): method __init__ (line 136) | def __init__(self, args_parser=TokenClassificationArgumentHandler(), *... method _sanitize_parameters (line 144) | def _sanitize_parameters( method __call__ (line 204) | def __call__(self, inputs: str, **kwargs: Any) -> list[dict[str, str]]... method __call__ (line 207) | def __call__(self, inputs: list[str], **kwargs: Any) -> list[list[dict... method __call__ (line 209) | def __call__(self, inputs: str | list[str], **kwargs: Any) -> list[dic... method preprocess (line 246) | def preprocess(self, sentence, offset_mapping=None, **preprocess_params): method _forward (line 302) | def _forward(self, model_inputs): method postprocess (line 325) | def postprocess(self, all_outputs, aggregation_strategy=AggregationStr... method aggregate_overlapping_entities (line 375) | def aggregate_overlapping_entities(self, entities): method gather_pre_entities (line 397) | def gather_pre_entities( method aggregate (line 469) | def aggregate(self, pre_entities: list[dict], aggregation_strategy: Ag... method aggregate_word (line 491) | def aggregate_word(self, entities: list[dict], aggregation_strategy: A... method aggregate_words (line 521) | def aggregate_words(self, entities: list[dict], aggregation_strategy: ... method group_sub_entities (line 549) | def group_sub_entities(self, entities: list[dict]) -> dict: method get_tag (line 570) | def get_tag(self, entity_name: str) -> tuple[str, str]: method group_entities (line 584) | def group_entities(self, entities: list[dict]) -> list[dict]: FILE: src/transformers/pipelines/video_classification.py class VideoClassificationPipeline (line 41) | class VideoClassificationPipeline(Pipeline): method __init__ (line 58) | def __init__(self, *args, **kwargs): method _sanitize_parameters (line 63) | def _sanitize_parameters(self, top_k=None, num_frames=None, frame_samp... method __call__ (line 85) | def __call__(self, inputs: str, **kwargs: Any) -> list[dict[str, Any]]... method __call__ (line 88) | def __call__(self, inputs: list[str], **kwargs: Any) -> list[list[dict... method __call__ (line 90) | def __call__(self, inputs: str | list[str] | None, **kwargs): method preprocess (line 132) | def preprocess(self, video, num_frames=None, frame_sampling_rate=1): method _forward (line 152) | def _forward(self, model_inputs): method postprocess (line 156) | def postprocess(self, model_outputs, top_k=5, function_to_apply="softm... function read_video_pyav (line 173) | def read_video_pyav(container, indices): FILE: src/transformers/pipelines/zero_shot_audio_classification.py class ZeroShotAudioClassificationPipeline (line 32) | class ZeroShotAudioClassificationPipeline(Pipeline): method __init__ (line 67) | def __init__(self, **kwargs): method __call__ (line 70) | def __call__(self, audios: np.ndarray | bytes | str | dict, **kwargs: ... method _sanitize_parameters (line 95) | def _sanitize_parameters(self, **kwargs): method preprocess (line 104) | def preprocess(self, audio, candidate_labels=None, hypothesis_template... method _forward (line 132) | def _forward(self, model_inputs): method postprocess (line 149) | def postprocess(self, model_outputs): FILE: src/transformers/pipelines/zero_shot_classification.py class ZeroShotClassificationArgumentHandler (line 13) | class ZeroShotClassificationArgumentHandler(ArgumentHandler): method _parse_labels (line 19) | def _parse_labels(self, labels): method __call__ (line 24) | def __call__(self, sequences, labels, hypothesis_template): class ZeroShotClassificationPipeline (line 44) | class ZeroShotClassificationPipeline(ChunkPipeline): method __init__ (line 89) | def __init__(self, args_parser=ZeroShotClassificationArgumentHandler()... method entailment_id (line 99) | def entailment_id(self): method _parse_and_tokenize (line 105) | def _parse_and_tokenize( method _sanitize_parameters (line 147) | def _sanitize_parameters(self, **kwargs): method __call__ (line 159) | def __call__( method preprocess (line 204) | def preprocess(self, inputs, candidate_labels=None, hypothesis_templat... method _forward (line 217) | def _forward(self, inputs): method postprocess (line 235) | def postprocess(self, model_outputs, multi_label=False): FILE: src/transformers/pipelines/zero_shot_image_classification.py class ZeroShotImageClassificationPipeline (line 29) | class ZeroShotImageClassificationPipeline(Pipeline): method __init__ (line 67) | def __init__(self, **kwargs): method __call__ (line 74) | def __call__( method __call__ (line 79) | def __call__( method __call__ (line 83) | def __call__( method _sanitize_parameters (line 126) | def _sanitize_parameters(self, tokenizer_kwargs=None, **kwargs): method preprocess (line 137) | def preprocess( method _forward (line 160) | def _forward(self, model_inputs): method postprocess (line 177) | def postprocess(self, model_outputs): FILE: src/transformers/pipelines/zero_shot_object_detection.py class ZeroShotObjectDetectionPipeline (line 23) | class ZeroShotObjectDetectionPipeline(ChunkPipeline): method __init__ (line 61) | def __init__(self, **kwargs): method __call__ (line 68) | def __call__( method __call__ (line 73) | def __call__(self, image: list[dict[str, Any]], **kwargs: Any) -> list... method __call__ (line 75) | def __call__( method _sanitize_parameters (line 163) | def _sanitize_parameters(self, **kwargs): method preprocess (line 174) | def preprocess(self, inputs, timeout=None): method _forward (line 193) | def _forward(self, model_inputs): method postprocess (line 203) | def postprocess(self, model_outputs, threshold=0.1, top_k=None): method _get_bounding_box (line 225) | def _get_bounding_box(self, box: "torch.Tensor") -> dict[str, int]: FILE: src/transformers/processing_utils.py class _LazyAutoProcessorMapping (line 93) | class _LazyAutoProcessorMapping(dict): method __getitem__ (line 107) | def __getitem__(self, key): method __contains__ (line 114) | def __contains__(self, key): method keys (line 117) | def keys(self): function _get_modality_for_attribute (line 136) | def _get_modality_for_attribute(attribute_name: str) -> str: class TextKwargs (line 161) | class TextKwargs(TypedDict, total=False): class ImagesKwargs (line 227) | class ImagesKwargs(TypedDict, total=False): class VideosKwargs (line 300) | class VideosKwargs(TypedDict, total=False): class AudioKwargs (line 377) | class AudioKwargs(TypedDict, total=False): class ProcessingKwargs (line 421) | class ProcessingKwargs(TypedDict, total=False): class TokenizerChatTemplateKwargs (line 476) | class TokenizerChatTemplateKwargs(TypedDict, total=False): class ProcessorChatTemplateKwargs (line 521) | class ProcessorChatTemplateKwargs(TokenizerChatTemplateKwargs, total=Fal... class AllKwargsForChatTemplate (line 541) | class AllKwargsForChatTemplate(TypedDict, total=False): class MultiModalData (line 549) | class MultiModalData: method __contains__ (line 565) | def __contains__(self, key): method __getitem__ (line 568) | def __getitem__(self, key): class ProcessorMixin (line 574) | class ProcessorMixin(PushToHubMixin): method __init__ (line 584) | def __init__(self, *args, **kwargs): method __call__ (line 623) | def __call__( method check_argument_for_proper_class (line 686) | def check_argument_for_proper_class(self, argument_name, argument): method to_dict (line 709) | def to_dict(self) -> dict[str, Any]: method to_json_string (line 772) | def to_json_string(self) -> str: method to_json_file (line 783) | def to_json_file(self, json_file_path: str | os.PathLike): method __repr__ (line 794) | def __repr__(self): method save_pretrained (line 799) | def save_pretrained(self, save_directory, push_to_hub: bool = False, *... method get_processor_dict (line 906) | def get_processor_dict( method from_args_and_dict (line 1145) | def from_args_and_dict(cls, args, processor_dict: dict[str, Any], **kw... method _merge_kwargs (line 1197) | def _merge_kwargs( method from_pretrained (line 1373) | def from_pretrained( method get_attributes (line 1425) | def get_attributes(cls): method register_for_auto_class (line 1452) | def register_for_auto_class(cls, auto_class="AutoProcessor"): method _load_tokenizer_from_pretrained (line 1474) | def _load_tokenizer_from_pretrained( method _get_arguments_from_pretrained (line 1494) | def _get_arguments_from_pretrained(cls, pretrained_model_name_or_path,... method get_possibly_dynamic_module (line 1585) | def get_possibly_dynamic_module(module_name): method batch_decode (line 1609) | def batch_decode(self, *args, **kwargs): method decode (line 1618) | def decode(self, *args, **kwargs): method model_input_names (line 1628) | def model_input_names(self): method validate_init_kwargs (line 1637) | def validate_init_kwargs(processor_config, valid_kwargs): method create_mm_token_type_ids (line 1649) | def create_mm_token_type_ids(self, input_ids: list) -> list[list[int]]: method apply_chat_template (line 1663) | def apply_chat_template( method parse_response (line 1925) | def parse_response( method post_process_multimodal_output (line 1947) | def post_process_multimodal_output( method post_process_image_text_to_text (line 1976) | def post_process_image_text_to_text(self, generated_outputs, skip_spec... method _check_special_mm_tokens (line 1994) | def _check_special_mm_tokens(self, text: list[str], text_inputs: "Batc... FILE: src/transformers/pytorch_utils.py function softmax_backward_data (line 52) | def softmax_backward_data(parent, grad_output, output): function prune_linear_layer (line 63) | def prune_linear_layer(layer: nn.Linear, index: torch.LongTensor, dim: i... class Conv1D (line 97) | class Conv1D(nn.Module): method __init__ (line 108) | def __init__(self, nf, nx): method __repr__ (line 116) | def __repr__(self) -> str: method forward (line 119) | def forward(self, x): function apply_chunking_to_forward (line 126) | def apply_chunking_to_forward( function meshgrid (line 204) | def meshgrid(*tensors: torch.Tensor | list[torch.Tensor], indexing: str ... function id_tensor_storage (line 213) | def id_tensor_storage(tensor: torch.Tensor) -> tuple[torch.device, int, ... function compile_compatible_method_lru_cache (line 242) | def compile_compatible_method_lru_cache(*lru_args, **lru_kwargs): FILE: src/transformers/quantizers/auto.py class AutoQuantizationConfig (line 137) | class AutoQuantizationConfig: method from_dict (line 144) | def from_dict(cls, quantization_config_dict: dict): method from_pretrained (line 165) | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): class AutoHfQuantizer (line 178) | class AutoHfQuantizer: method from_config (line 185) | def from_config(cls, quantization_config: QuantizationConfigMixin | di... method from_pretrained (line 214) | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): method merge_quantization_configs (line 219) | def merge_quantization_configs( method supports_quant_method (line 269) | def supports_quant_method(quantization_config_dict): function register_quantization_config (line 289) | def register_quantization_config(method: str): function register_quantizer (line 305) | def register_quantizer(name: str): function get_hf_quantizer (line 321) | def get_hf_quantizer(config, quantization_config, device_map, weights_on... FILE: src/transformers/quantizers/base.py function get_keys_to_not_convert (line 38) | def get_keys_to_not_convert(model) -> list: function _assign_is_quantized (line 65) | def _assign_is_quantized(model): class HfQuantizer (line 73) | class HfQuantizer(ABC): method __init__ (line 88) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method update_dtype (line 99) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method update_device_map (line 111) | def update_device_map(self, device_map: dict[str, Any] | None) -> dict... method param_element_size (line 123) | def param_element_size(self, model: "PreTrainedModel", param_name: str... method adjust_max_memory (line 126) | def adjust_max_memory(self, max_memory: dict[str, int | str]) -> dict[... method param_needs_quantization (line 130) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method validate_environment (line 136) | def validate_environment(self, *args, **kwargs): method update_tp_plan (line 144) | def update_tp_plan(self, config): method update_ep_plan (line 148) | def update_ep_plan(self, config): method _process_model_before_weight_loading (line 152) | def _process_model_before_weight_loading(self, model, **kwargs): method preprocess_model (line 155) | def preprocess_model(self, model: "PreTrainedModel", dtype=None, **kwa... method _process_model_after_weight_loading (line 173) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method postprocess_model (line 176) | def postprocess_model(self, model: "PreTrainedModel", **kwargs): method remove_quantization_config (line 196) | def remove_quantization_config(self, model): method dequantize (line 208) | def dequantize(self, model, dtype=None): method _dequantize (line 222) | def _dequantize(self, model, dtype=None): method get_param_name (line 227) | def get_param_name(self, param_name: str) -> str: method get_modules_to_not_convert (line 234) | def get_modules_to_not_convert( method is_qat_trainable (line 256) | def is_qat_trainable(self) -> bool: method is_compileable (line 261) | def is_compileable(self) -> bool: method get_state_dict_and_metadata (line 265) | def get_state_dict_and_metadata(self, model): method is_serializable (line 270) | def is_serializable(self): ... method is_trainable (line 274) | def is_trainable(self): ... method _convert_model_for_quantization (line 276) | def _convert_model_for_quantization(self, model): method get_quantize_ops (line 289) | def get_quantize_ops(self): method get_weight_conversions (line 294) | def get_weight_conversions(self): class SequentialLlama4TextExperts (line 298) | class SequentialLlama4TextExperts(ModuleList): method __init__ (line 304) | def __init__(self, config): method forward (line 310) | def forward( FILE: src/transformers/quantizers/quantizer_aqlm.py class AqlmHfQuantizer (line 34) | class AqlmHfQuantizer(HfQuantizer): method __init__ (line 42) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method validate_environment (line 45) | def validate_environment(self, *args, **kwargs): method _process_model_before_weight_loading (line 52) | def _process_model_before_weight_loading( method is_trainable (line 64) | def is_trainable(self) -> bool: method is_serializable (line 74) | def is_serializable(self): FILE: src/transformers/quantizers/quantizer_auto_round.py class AutoRoundQuantizer (line 29) | class AutoRoundQuantizer(HfQuantizer): method __init__ (line 37) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method validate_environment (line 40) | def validate_environment(self, *args, **kwargs): method _process_model_before_weight_loading (line 47) | def _process_model_before_weight_loading(self, model: "PreTrainedModel... method _process_model_after_weight_loading (line 57) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method is_trainable (line 66) | def is_trainable(self) -> bool: method is_serializable (line 69) | def is_serializable(self): FILE: src/transformers/quantizers/quantizer_awq.py class AwqQuantizer (line 36) | class AwqQuantizer(HfQuantizer): method __init__ (line 45) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 48) | def validate_environment(self, **kwargs): method update_dtype (line 57) | def update_dtype(self, dtype): method _process_model_before_weight_loading (line 67) | def _process_model_before_weight_loading(self, model: "PreTrainedModel... method _process_model_after_weight_loading (line 83) | def _process_model_after_weight_loading(self, model, **kwargs): method is_serializable (line 88) | def is_serializable(self): method is_trainable (line 96) | def is_trainable(self): FILE: src/transformers/quantizers/quantizer_bitnet.py class BitNetHfQuantizer (line 33) | class BitNetHfQuantizer(HfQuantizer): method __init__ (line 44) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 47) | def validate_environment(self, *args, **kwargs): method _process_model_before_weight_loading (line 70) | def _process_model_before_weight_loading( method adjust_max_memory (line 87) | def adjust_max_memory(self, max_memory: dict[str, int | str]) -> dict[... method is_serializable (line 91) | def is_serializable(self): method is_trainable (line 95) | def is_trainable(self) -> bool: method is_qat_trainable (line 102) | def is_qat_trainable(self) -> bool: method get_weight_conversions (line 109) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_bnb_4bit.py class Bnb4BitHfQuantizer (line 45) | class Bnb4BitHfQuantizer(HfQuantizer): method __init__ (line 53) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 56) | def validate_environment(self, *args, **kwargs): method param_element_size (line 83) | def param_element_size(self, model: "PreTrainedModel", param_name: str... method param_needs_quantization (line 91) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method adjust_max_memory (line 97) | def adjust_max_memory(self, max_memory: dict[str, int | str]) -> dict[... method update_device_map (line 102) | def update_device_map(self, device_map): method _process_model_before_weight_loading (line 121) | def _process_model_before_weight_loading( method _process_model_after_weight_loading (line 145) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method is_serializable (line 150) | def is_serializable(self): method is_trainable (line 154) | def is_trainable(self) -> bool: method _dequantize (line 157) | def _dequantize(self, model, dtype=None): method get_quantize_ops (line 163) | def get_quantize_ops(self): method get_weight_conversions (line 168) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_bnb_8bit.py class Bnb8BitHfQuantizer (line 45) | class Bnb8BitHfQuantizer(HfQuantizer): method __init__ (line 53) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 56) | def validate_environment(self, *args, **kwargs): method adjust_max_memory (line 83) | def adjust_max_memory(self, max_memory: dict[str, int | str]) -> dict[... method update_device_map (line 88) | def update_device_map(self, device_map): method param_element_size (line 107) | def param_element_size(self, model: "PreTrainedModel", param_name: str... method param_needs_quantization (line 114) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method _process_model_after_weight_loading (line 120) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method _process_model_before_weight_loading (line 125) | def _process_model_before_weight_loading( method is_serializable (line 149) | def is_serializable(self): method is_trainable (line 153) | def is_trainable(self) -> bool: method _dequantize (line 156) | def _dequantize(self, model, dtype=None): method get_quantize_ops (line 162) | def get_quantize_ops(self): method get_weight_conversions (line 167) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_compressed_tensors.py class CompressedTensorsHfQuantizer (line 27) | class CompressedTensorsHfQuantizer(HfQuantizer): method __init__ (line 36) | def __init__(self, quantization_config: CompressedTensorsConfig, **kwa... method validate_environment (line 55) | def validate_environment(self, *args, **kwargs): method update_dtype (line 62) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method _process_model_before_weight_loading (line 67) | def _process_model_before_weight_loading(self, model, **kwargs): method _process_model_after_weight_loading (line 80) | def _process_model_after_weight_loading(self, model, **kwargs): method update_tp_plan (line 90) | def update_tp_plan(self, config): method is_trainable (line 104) | def is_trainable(self): method is_qat_trainable (line 107) | def is_qat_trainable(self) -> bool: method is_serializable (line 112) | def is_serializable(self) -> bool: FILE: src/transformers/quantizers/quantizer_eetq.py class EetqHfQuantizer (line 34) | class EetqHfQuantizer(HfQuantizer): method __init__ (line 42) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 45) | def validate_environment(self, *args, **kwargs): method update_dtype (line 68) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method param_needs_quantization (line 73) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method _process_model_before_weight_loading (line 85) | def _process_model_before_weight_loading( method is_serializable (line 100) | def is_serializable(self): method is_trainable (line 104) | def is_trainable(self) -> bool: method get_quantize_ops (line 107) | def get_quantize_ops(self): FILE: src/transformers/quantizers/quantizer_fbgemm_fp8.py class FbgemmFp8HfQuantizer (line 41) | class FbgemmFp8HfQuantizer(HfQuantizer): method __init__ (line 49) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 52) | def validate_environment(self, *args, **kwargs): method update_dtype (line 88) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method param_needs_quantization (line 96) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method param_element_size (line 113) | def param_element_size(self, model: "PreTrainedModel", param_name: str... method _process_model_before_weight_loading (line 120) | def _process_model_before_weight_loading( method _process_model_after_weight_loading (line 139) | def _process_model_after_weight_loading(self, model, **kwargs): method update_tp_plan (line 153) | def update_tp_plan(self, config): method is_serializable (line 197) | def is_serializable(self): method is_trainable (line 201) | def is_trainable(self) -> bool: method get_quantize_ops (line 204) | def get_quantize_ops(self): FILE: src/transformers/quantizers/quantizer_finegrained_fp8.py class FineGrainedFP8HfQuantizer (line 18) | class FineGrainedFP8HfQuantizer(HfQuantizer): method __init__ (line 27) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 30) | def validate_environment(self, *args, **kwargs): method param_needs_quantization (line 79) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method param_element_size (line 90) | def param_element_size(self, model: "PreTrainedModel", param_name: str... method _process_model_before_weight_loading (line 97) | def _process_model_before_weight_loading( method update_tp_plan (line 115) | def update_tp_plan(self, config): method is_serializable (line 138) | def is_serializable(self): method is_trainable (line 142) | def is_trainable(self) -> bool: method is_compileable (line 146) | def is_compileable(self) -> bool: method get_quantize_ops (line 149) | def get_quantize_ops(self): method get_weight_conversions (line 154) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_fouroversix.py class FourOverSixHfQuantizer (line 21) | class FourOverSixHfQuantizer(HfQuantizer): method __init__ (line 29) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 32) | def validate_environment(self, *args, **kwargs): method param_element_size (line 38) | def param_element_size( method param_needs_quantization (line 53) | def param_needs_quantization( method _process_model_before_weight_loading (line 65) | def _process_model_before_weight_loading( method _process_model_after_weight_loading (line 88) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method is_serializable (line 91) | def is_serializable(self): method is_trainable (line 95) | def is_trainable(self) -> bool: method get_quantize_ops (line 98) | def get_quantize_ops(self): method get_weight_conversions (line 103) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_fp_quant.py class FPQuantHfQuantizer (line 34) | class FPQuantHfQuantizer(HfQuantizer): method __init__ (line 43) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method validate_environment (line 46) | def validate_environment(self, device_map, **kwargs): method update_dtype (line 94) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method param_needs_quantization (line 102) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method _process_model_before_weight_loading (line 112) | def _process_model_before_weight_loading( method is_trainable (line 127) | def is_trainable(self, model: Optional["PreTrainedModel"] = None): method is_serializable (line 135) | def is_serializable(self): method get_quantize_ops (line 138) | def get_quantize_ops(self): method get_weight_conversions (line 143) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_gptq.py class GptqHfQuantizer (line 39) | class GptqHfQuantizer(HfQuantizer): method __init__ (line 49) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method validate_environment (line 58) | def validate_environment(self, *args, **kwargs): method update_dtype (line 75) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method update_device_map (line 80) | def update_device_map(self, device_map): method _process_model_before_weight_loading (line 85) | def _process_model_before_weight_loading(self, model: "PreTrainedModel... method _process_model_after_weight_loading (line 96) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method is_trainable (line 107) | def is_trainable(self) -> bool: method is_serializable (line 110) | def is_serializable(self): FILE: src/transformers/quantizers/quantizer_higgs.py class HiggsHfQuantizer (line 35) | class HiggsHfQuantizer(HfQuantizer): method __init__ (line 43) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method validate_environment (line 46) | def validate_environment(self, device_map, **kwargs): method update_dtype (line 73) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method _process_model_before_weight_loading (line 115) | def _process_model_before_weight_loading( method _process_model_after_weight_loading (line 132) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method is_trainable (line 158) | def is_trainable(self) -> bool: method is_serializable (line 161) | def is_serializable(self): method param_needs_quantization (line 164) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method _dequantize (line 174) | def _dequantize(self, model): FILE: src/transformers/quantizers/quantizer_hqq.py function weight (line 38) | def weight(self): class HqqHfQuantizer (line 46) | class HqqHfQuantizer(HfQuantizer): method __init__ (line 55) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 66) | def validate_environment(self, *args, **kwargs): method param_needs_quantization (line 146) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method _patch_layer_for_multigpu (line 235) | def _patch_layer_for_multigpu(self, hqq_layer): method _process_model_before_weight_loading (line 245) | def _process_model_before_weight_loading( method _process_model_after_weight_loading (line 254) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method is_serializable (line 259) | def is_serializable(self): method is_trainable (line 263) | def is_trainable(self) -> bool: FILE: src/transformers/quantizers/quantizer_metal.py class MetalHfQuantizer (line 31) | class MetalHfQuantizer(HfQuantizer): method __init__ (line 43) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 46) | def validate_environment(self, *args, **kwargs): method update_device_map (line 77) | def update_device_map(self, device_map: dict[str, Any] | None) -> dict... method param_needs_quantization (line 82) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method _process_model_before_weight_loading (line 92) | def _process_model_before_weight_loading(self, model: "PreTrainedModel... method is_serializable (line 106) | def is_serializable(self): method is_trainable (line 110) | def is_trainable(self) -> bool: method get_quantize_ops (line 113) | def get_quantize_ops(self): method get_weight_conversions (line 118) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_mxfp4.py class Mxfp4HfQuantizer (line 42) | class Mxfp4HfQuantizer(HfQuantizer): method __init__ (line 50) | def __init__(self, quantization_config, **kwargs): method _lazy_import_kernels (line 54) | def _lazy_import_kernels(self): method validate_environment (line 65) | def validate_environment(self, *args, **kwargs): method param_needs_quantization (line 161) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method _process_model_after_weight_loading (line 171) | def _process_model_after_weight_loading(self, model: "PreTrainedModel"... method _process_model_before_weight_loading (line 178) | def _process_model_before_weight_loading( method update_tp_plan (line 211) | def update_tp_plan(self, config): method update_ep_plan (line 224) | def update_ep_plan(self, config): method get_state_dict_and_metadata (line 237) | def get_state_dict_and_metadata(self, model): method is_serializable (line 272) | def is_serializable(self): method is_trainable (line 276) | def is_trainable(self) -> bool: method get_quantize_ops (line 282) | def get_quantize_ops(self): method get_weight_conversions (line 287) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_quanto.py class QuantoHfQuantizer (line 38) | class QuantoHfQuantizer(HfQuantizer): method __init__ (line 46) | def __init__(self, quantization_config: QuantoConfig, **kwargs): method validate_environment (line 56) | def validate_environment(self, *args, **kwargs): method param_needs_quantization (line 79) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method adjust_max_memory (line 90) | def adjust_max_memory(self, max_memory: dict[str, int | str]) -> dict[... method param_element_size (line 94) | def param_element_size(self, model: "PreTrainedModel", param_name: str... method _process_model_before_weight_loading (line 101) | def _process_model_before_weight_loading(self, model: "PreTrainedModel... method is_trainable (line 113) | def is_trainable(self) -> bool: method is_serializable (line 116) | def is_serializable(self): method get_quantize_ops (line 119) | def get_quantize_ops(self): FILE: src/transformers/quantizers/quantizer_quark.py class QuarkHfQuantizer (line 42) | class QuarkHfQuantizer(HfQuantizer): method __init__ (line 50) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 55) | def validate_environment(self, *args, **kwargs): method _process_model_before_weight_loading (line 61) | def _process_model_before_weight_loading(self, model: "PreTrainedModel... method param_needs_quantization (line 73) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method is_serializable (line 76) | def is_serializable(self): method is_trainable (line 80) | def is_trainable(self): method get_weight_conversions (line 83) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_sinq.py class SinqHfQuantizer (line 33) | class SinqHfQuantizer(HfQuantizer): method __init__ (line 50) | def __init__(self, quantization_config: SinqConfig, **kwargs): method is_serializable (line 56) | def is_serializable(self) -> bool: method is_trainable (line 60) | def is_trainable(self) -> bool: method update_device_map (line 63) | def update_device_map(self, device_map): method update_dtype (line 76) | def update_dtype(self, dtype: torch.dtype) -> torch.dtype: method validate_environment (line 82) | def validate_environment(self, *args, **kwargs) -> None: method _build_sinq_quant_dict (line 110) | def _build_sinq_quant_dict(self, cfg: SinqConfig) -> dict: method param_needs_quantization (line 128) | def param_needs_quantization(self, model: PreTrainedModel, param_name:... method get_quantize_ops (line 162) | def get_quantize_ops(self): method get_weight_conversions (line 171) | def get_weight_conversions(self): method _process_model_before_weight_loading (line 200) | def _process_model_before_weight_loading( method _process_model_after_weight_loading (line 243) | def _process_model_after_weight_loading( FILE: src/transformers/quantizers/quantizer_spqr.py class SpQRHfQuantizer (line 34) | class SpQRHfQuantizer(HfQuantizer): method __init__ (line 42) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method validate_environment (line 45) | def validate_environment(self, *args, **kwargs): method update_dtype (line 55) | def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype": method _process_model_before_weight_loading (line 62) | def _process_model_before_weight_loading( method is_trainable (line 77) | def is_trainable(self): method is_serializable (line 80) | def is_serializable(self): FILE: src/transformers/quantizers/quantizer_torchao.py function _fuzzy_match_size (line 49) | def _fuzzy_match_size(config_name: str) -> str | None: class TorchAoHfQuantizer (line 58) | class TorchAoHfQuantizer(HfQuantizer): method __init__ (line 66) | def __init__(self, quantization_config, **kwargs): method validate_environment (line 72) | def validate_environment(self, *args, **kwargs): method get_state_dict_and_metadata (line 87) | def get_state_dict_and_metadata(self, model): method param_element_size (line 93) | def param_element_size(self, model: "PreTrainedModel", param_name: str... method adjust_max_memory (line 100) | def adjust_max_memory(self, max_memory: dict[str, int | str]) -> dict[... method _process_model_before_weight_loading (line 105) | def _process_model_before_weight_loading(self, model: "PreTrainedModel... method param_needs_quantization (line 121) | def param_needs_quantization(self, model: "PreTrainedModel", param_nam... method is_serializable (line 148) | def is_serializable(self) -> bool: method is_trainable (line 152) | def is_trainable(self) -> bool: method is_compileable (line 157) | def is_compileable(self) -> bool: method set_metadata (line 160) | def set_metadata(self, checkpoint_files: list[str]): method get_quantize_ops (line 170) | def get_quantize_ops(self): method get_weight_conversions (line 175) | def get_weight_conversions(self): FILE: src/transformers/quantizers/quantizer_vptq.py class VptqHfQuantizer (line 33) | class VptqHfQuantizer(HfQuantizer): method __init__ (line 41) | def __init__(self, quantization_config: QuantizationConfigMixin, **kwa... method validate_environment (line 44) | def validate_environment(self, *args, **kwargs): method _process_model_before_weight_loading (line 54) | def _process_model_before_weight_loading( method is_trainable (line 71) | def is_trainable(self) -> bool: method is_serializable (line 74) | def is_serializable(self): FILE: src/transformers/quantizers/quantizers_utils.py function get_module_from_name (line 18) | def get_module_from_name(module, tensor_name: str) -> tuple[Any, str]: function should_convert_module (line 25) | def should_convert_module(full_name, patterns: list[str] | None = None): FILE: src/transformers/safetensors_conversion.py function previous_pr (line 12) | def previous_pr(api: HfApi, model_id: str, pr_title: str, token: str) ->... function spawn_conversion (line 23) | def spawn_conversion(token: str, private: bool, model_id: str): function get_conversion_pr_reference (line 59) | def get_conversion_pr_reference(api: HfApi, model_id: str, **kwargs): function auto_conversion (line 87) | def auto_conversion( FILE: src/transformers/testing_utils.py function parse_flag_from_env (line 250) | def parse_flag_from_env(key, default=False): function parse_int_from_env (line 266) | def parse_int_from_env(key, default=None): function is_staging_test (line 289) | def is_staging_test(test_case): function is_pipeline_test (line 306) | def is_pipeline_test(test_case): function is_agent_test (line 322) | def is_agent_test(test_case): function is_training_test (line 337) | def is_training_test(test_case): function is_tensor_parallel_test (line 353) | def is_tensor_parallel_test(test_case): function slow (line 369) | def slow(test_case): function tooslow (line 379) | def tooslow(test_case): function skip_if_not_implemented (line 390) | def skip_if_not_implemented(test_func): function apply_skip_if_not_implemented (line 401) | def apply_skip_if_not_implemented(cls): function custom_tokenizers (line 413) | def custom_tokenizers(test_case): function require_bs4 (line 423) | def require_bs4(test_case): function require_galore_torch (line 430) | def require_galore_torch(test_case): function require_apollo_torch (line 438) | def require_apollo_torch(test_case): function require_torch_optimi (line 446) | def require_torch_optimi(test_case): function require_lomo (line 454) | def require_lomo(test_case): function require_grokadamw (line 462) | def require_grokadamw(test_case): function require_schedulefree (line 469) | def require_schedulefree(test_case): function require_cv2 (line 477) | def require_cv2(test_case): function require_levenshtein (line 487) | def require_levenshtein(test_case): function require_nltk (line 497) | def require_nltk(test_case): function require_accelerate (line 507) | def require_accelerate(test_case, min_version: str = ACCELERATE_MIN_VERS... function require_triton (line 516) | def require_triton(min_version: str = TRITON_MIN_VERSION): function require_gguf (line 529) | def require_gguf(test_case, min_version: str = GGUF_MIN_VERSION): function require_fsdp (line 538) | def require_fsdp(test_case, min_version: str = "1.12.0"): function require_g2p_en (line 547) | def require_g2p_en(test_case): function require_rjieba (line 554) | def require_rjieba(test_case): function require_jinja (line 561) | def require_jinja(test_case): function require_jmespath (line 568) | def require_jmespath(test_case): function require_onnx (line 575) | def require_onnx(test_case): function require_timm (line 579) | def require_timm(test_case): function require_natten (line 589) | def require_natten(test_case): function require_torch (line 599) | def require_torch(test_case): function require_torch_greater_or_equal (line 609) | def require_torch_greater_or_equal(version: str): function require_huggingface_hub_greater_or_equal (line 624) | def require_huggingface_hub_greater_or_equal(version: str): function require_flash_attn (line 639) | def require_flash_attn(test_case): function require_kernels (line 658) | def require_kernels(test_case): function require_flash_attn_3 (line 668) | def require_flash_attn_3(test_case): function require_flash_attn_4 (line 677) | def require_flash_attn_4(test_case): function require_all_flash_attn (line 686) | def require_all_flash_attn(test_case): function require_peft (line 708) | def require_peft(test_case): function require_torchvision (line 718) | def require_torchvision(test_case): function require_torchcodec (line 728) | def require_torchcodec(test_case): function require_torchaudio (line 738) | def require_torchaudio(test_case): function require_sentencepiece (line 745) | def require_sentencepiece(test_case): function require_sacremoses (line 752) | def require_sacremoses(test_case): function require_seqio (line 759) | def require_seqio(test_case): function require_scipy (line 766) | def require_scipy(test_case): function require_tokenizers (line 773) | def require_tokenizers(test_case): function require_pandas (line 780) | def require_pandas(test_case): function require_pytesseract (line 787) | def require_pytesseract(test_case): function require_pytorch_quantization (line 794) | def require_pytorch_quantization(test_case): function require_vision (line 804) | def require_vision(test_case): function require_spacy (line 812) | def require_spacy(test_case): function require_torch_multi_gpu (line 819) | def require_torch_multi_gpu(test_case): function require_torch_multi_accelerator (line 834) | def require_torch_multi_accelerator(test_case): function require_torch_non_multi_gpu (line 848) | def require_torch_non_multi_gpu(test_case): function require_torch_non_multi_accelerator (line 860) | def require_torch_non_multi_accelerator(test_case): function require_torch_up_to_2_gpus (line 870) | def require_torch_up_to_2_gpus(test_case): function require_torch_up_to_2_accelerators (line 882) | def require_torch_up_to_2_accelerators(test_case): function require_torch_xla (line 894) | def require_torch_xla(test_case): function require_torch_neuroncore (line 901) | def require_torch_neuroncore(test_case): function require_torch_npu (line 910) | def require_torch_npu(test_case): function require_torch_multi_npu (line 917) | def require_torch_multi_npu(test_case): function require_non_hpu (line 930) | def require_non_hpu(test_case): function require_torch_xpu (line 937) | def require_torch_xpu(test_case): function require_non_xpu (line 946) | def require_non_xpu(test_case): function require_torch_multi_xpu (line 953) | def require_torch_multi_xpu(test_case): function require_torch_multi_hpu (line 966) | def require_torch_multi_hpu(test_case): function require_torchao (line 1039) | def require_torchao(test_case): function require_torchao_version_greater_or_equal (line 1044) | def require_torchao_version_greater_or_equal(torchao_version): function require_torch_tensorrt_fx (line 1056) | def require_torch_tensorrt_fx(test_case): function require_torch_gpu (line 1061) | def require_torch_gpu(test_case): function require_torch_mps (line 1066) | def require_torch_mps(test_case): function require_large_cpu_ram (line 1071) | def require_large_cpu_ram(test_case, memory: float = 80): function require_torch_large_gpu (line 1084) | def require_torch_large_gpu(test_case, memory: float = 20): function require_torch_large_accelerator (line 1095) | def require_torch_large_accelerator(test_case=None, *, memory: float = 20): function require_torch_accelerator (line 1111) | def require_torch_accelerator(test_case): function require_torch_fp16 (line 1118) | def require_torch_fp16(test_case): function require_fp8 (line 1125) | def require_fp8(test_case): function require_cuda_capability_at_least (line 1132) | def require_cuda_capability_at_least(major, minor): function require_torch_bf16 (line 1142) | def require_torch_bf16(test_case): function require_deterministic_for_xpu (line 1149) | def require_deterministic_for_xpu(test_case): function require_torch_tf32 (line 1165) | def require_torch_tf32(test_case): function require_detectron2 (line 1172) | def require_detectron2(test_case): function require_faiss (line 1177) | def require_faiss(test_case): function require_optuna (line 1182) | def require_optuna(test_case): function require_ray (line 1192) | def require_ray(test_case): function require_swanlab (line 1202) | def require_swanlab(test_case): function require_trackio (line 1212) | def require_trackio(test_case): function require_wandb (line 1222) | def require_wandb(test_case): function require_clearml (line 1232) | def require_clearml(test_case): function require_deepspeed (line 1242) | def require_deepspeed(test_case): function require_apex (line 1249) | def require_apex(test_case): function require_aqlm (line 1256) | def require_aqlm(test_case): function require_vptq (line 1263) | def require_vptq(test_case): function require_spqr (line 1270) | def require_spqr(test_case): function require_av (line 1277) | def require_av(test_case): function require_decord (line 1284) | def require_decord(test_case): function require_bitsandbytes (line 1291) | def require_bitsandbytes(test_case): function require_optimum (line 1298) | def require_optimum(test_case): function require_tensorboard (line 1305) | def require_tensorboard(test_case): function require_gptqmodel (line 1312) | def require_gptqmodel(test_case): function require_hqq (line 1319) | def require_hqq(test_case): function require_auto_round (line 1326) | def require_auto_round(test_case): function require_optimum_quanto (line 1333) | def require_optimum_quanto(test_case): function require_compressed_tensors (line 1340) | def require_compressed_tensors(test_case): function require_fbgemm_gpu (line 1347) | def require_fbgemm_gpu(test_case): function require_quark (line 1354) | def require_quark(test_case): function require_flute_hadamard (line 1361) | def require_flute_hadamard(test_case): function require_fouroversix (line 1370) | def require_fouroversix(test_case): function require_fp_quant (line 1377) | def require_fp_quant(test_case): function require_qutlass (line 1384) | def require_qutlass(test_case): function require_phonemizer (line 1391) | def require_phonemizer(test_case): function require_pyctcdecode (line 1398) | def require_pyctcdecode(test_case): function require_numba (line 1405) | def require_numba(test_case): function require_librosa (line 1412) | def require_librosa(test_case): function require_multipart (line 1419) | def require_multipart(test_case): function require_liger_kernel (line 1426) | def require_liger_kernel(test_case): function require_essentia (line 1433) | def require_essentia(test_case): function require_pretty_midi (line 1440) | def require_pretty_midi(test_case): function cmd_exists (line 1447) | def cmd_exists(cmd): function require_usr_bin_time (line 1451) | def require_usr_bin_time(test_case): function require_sudachi (line 1458) | def require_sudachi(test_case): function require_sudachi_projection (line 1465) | def require_sudachi_projection(test_case): function require_jumanpp (line 1474) | def require_jumanpp(test_case): function require_cython (line 1481) | def require_cython(test_case): function require_tiktoken (line 1488) | def require_tiktoken(test_case): function require_speech (line 1495) | def require_speech(test_case): function require_openai (line 1502) | def require_openai(test_case): function require_serve (line 1509) | def require_serve(test_case): function require_mistral_common (line 1516) | def require_mistral_common(test_case): function get_gpu_count (line 1523) | def get_gpu_count(): function get_tests_dir (line 1535) | def get_tests_dir(append_path=None): function get_steps_per_epoch (line 1558) | def get_steps_per_epoch(trainer: Trainer) -> int: function evaluate_side_effect_factory (line 1568) | def evaluate_side_effect_factory( function apply_print_resets (line 1596) | def apply_print_resets(buf): function assert_screenout (line 1600) | def assert_screenout(out, what): function set_config_for_less_flaky_test (line 1606) | def set_config_for_less_flaky_test(config): function set_model_for_less_flaky_test (line 1627) | def set_model_for_less_flaky_test(model): class CaptureStd (line 1648) | class CaptureStd: method __init__ (line 1697) | def __init__(self, out=True, err=True, replay=True): method __enter__ (line 1714) | def __enter__(self): method __exit__ (line 1725) | def __exit__(self, *exc): method __repr__ (line 1740) | def __repr__(self): class CaptureStdout (line 1755) | class CaptureStdout(CaptureStd): method __init__ (line 1758) | def __init__(self, replay=True): class CaptureStderr (line 1762) | class CaptureStderr(CaptureStd): method __init__ (line 1765) | def __init__(self, replay=True): class CaptureLogger (line 1769) | class CaptureLogger: method __init__ (line 1794) | def __init__(self, logger): method __enter__ (line 1800) | def __enter__(self): method __exit__ (line 1804) | def __exit__(self, *exc): method __repr__ (line 1808) | def __repr__(self): function LoggingLevel (line 1813) | def LoggingLevel(level): class TemporaryHubRepo (line 1833) | class TemporaryHubRepo: method __init__ (line 1850) | def __init__(self, namespace: str | None = None, token: str | None = N... method __enter__ (line 1858) | def __enter__(self): method __exit__ (line 1861) | def __exit__(self, exc, value, tb): function ExtendSysPath (line 1867) | def ExtendSysPath(path: str | os.PathLike) -> Iterator[None]: class TestCasePlus (line 1887) | class TestCasePlus(unittest.TestCase): method setUp (line 1966) | def setUp(self): method test_file_path (line 1987) | def test_file_path(self): method test_file_path_str (line 1991) | def test_file_path_str(self): method test_file_dir (line 1995) | def test_file_dir(self): method test_file_dir_str (line 1999) | def test_file_dir_str(self): method tests_dir (line 2003) | def tests_dir(self): method tests_dir_str (line 2007) | def tests_dir_str(self): method examples_dir (line 2011) | def examples_dir(self): method examples_dir_str (line 2015) | def examples_dir_str(self): method repo_root_dir (line 2019) | def repo_root_dir(self): method repo_root_dir_str (line 2023) | def repo_root_dir_str(self): method src_dir (line 2027) | def src_dir(self): method src_dir_str (line 2031) | def src_dir_str(self): method get_env (line 2034) | def get_env(self): method get_auto_remove_tmp_dir (line 2052) | def get_auto_remove_tmp_dir(self, tmp_dir=None, before=None, after=Non... method python_one_liner_max_rss (line 2122) | def python_one_liner_max_rss(self, one_liner_str): method tearDown (line 2155) | def tearDown(self): function mockenv (line 2170) | def mockenv(**kwargs): function mockenv_context (line 2183) | def mockenv_context(*remove, **update): function pytest_addoption_shared (line 2219) | def pytest_addoption_shared(parser): function pytest_terminal_summary_main (line 2238) | def pytest_terminal_summary_main(tr, id): class _RunOutput (line 2377) | class _RunOutput: method __init__ (line 2378) | def __init__(self, returncode, stdout, stderr): function _read_stream (line 2384) | async def _read_stream(stream, callback): function _stream_subprocess (line 2393) | async def _stream_subprocess(cmd, env=None, stdin=None, timeout=None, qu... function execute_subprocess_async (line 2434) | def execute_subprocess_async(cmd, env=None, stdin=None, timeout=180, qui... function pytest_xdist_worker_id (line 2456) | def pytest_xdist_worker_id(): function get_torch_dist_unique_port (line 2466) | def get_torch_dist_unique_port(): function nested_simplify (line 2480) | def nested_simplify(obj, decimals=3): function check_json_file_has_correct_format (line 2507) | def check_json_file_has_correct_format(file_path): function to_2tuple (line 2524) | def to_2tuple(x): class SubprocessCallException (line 2531) | class SubprocessCallException(Exception): function run_command (line 2535) | def run_command(command: list[str], return_stdout=False): class RequestCounter (line 2552) | class RequestCounter: method __enter__ (line 2568) | def __enter__(self): method __exit__ (line 2588) | def __exit__(self, *args, **kwargs) -> None: method __getitem__ (line 2603) | def __getitem__(self, key: str) -> int: method total_calls (line 2607) | def total_calls(self) -> int: function is_flaky (line 2611) | def is_flaky(max_attempts: int = 5, wait_before_retry: float | None = No... function hub_retry (line 2652) | def hub_retry(max_attempts: int = 5, wait_before_retry: float | None = 2): function run_first (line 2695) | def run_first(test_case): function run_test_in_subprocess (line 2713) | def run_test_in_subprocess(test_case, target_func, inputs=None, timeout=... function run_test_using_subprocess (line 2756) | def run_test_using_subprocess(func): function preprocess_string (line 2824) | def preprocess_string(string, skip_cuda_tests): class HfDocTestParser (line 2853) | class HfDocTestParser(doctest.DocTestParser): method parse (line 2890) | def parse(self, string, name=""): class HfDoctestModule (line 2899) | class HfDoctestModule(Module): method collect (line 2905) | def collect(self) -> Iterable[DoctestItem]: function _device_agnostic_dispatch (line 2975) | def _device_agnostic_dispatch(device: str, dispatch_table: dict[str, Cal... function backend_manual_seed (line 3086) | def backend_manual_seed(device: str, seed: int): function backend_empty_cache (line 3090) | def backend_empty_cache(device: str): function backend_device_count (line 3094) | def backend_device_count(device: str): function backend_reset_max_memory_allocated (line 3098) | def backend_reset_max_memory_allocated(device: str): function backend_reset_peak_memory_stats (line 3102) | def backend_reset_peak_memory_stats(device: str): function backend_max_memory_allocated (line 3106) | def backend_max_memory_allocated(device: str): function backend_memory_allocated (line 3110) | def backend_memory_allocated(device: str): function backend_synchronize (line 3114) | def backend_synchronize(device: str): function backend_torch_accelerator_module (line 3118) | def backend_torch_accelerator_module(device: str): function update_mapping_from_spec (line 3156) | def update_mapping_from_spec(device_fn_dict: dict[str, Callable], attrib... function compare_pipeline_output_to_hub_spec (line 3174) | def compare_pipeline_output_to_hub_spec(output, hub_spec): function cleanup (line 3202) | def cleanup(device: str, gc_collect=False): function get_device_properties (line 3216) | def get_device_properties() -> DeviceProperties: function unpack_device_properties (line 3242) | def unpack_device_properties( class Expectations (line 3260) | class Expectations(UserDict[PackedDeviceProperties, Any]): method get_expectation (line 3261) | def get_expectation(self) -> Any: method unpacked (line 3269) | def unpacked(self) -> list[tuple[DeviceProperties, Any]]: method is_default (line 3273) | def is_default(expectation_key: PackedDeviceProperties) -> bool: method score (line 3284) | def score(properties: DeviceProperties, other: DeviceProperties) -> fl... method find_expectation (line 3314) | def find_expectation(self, properties: DeviceProperties = (None, None,... method __repr__ (line 3334) | def __repr__(self): function patch_torch_compile_force_graph (line 3338) | def patch_torch_compile_force_graph(): function _get_test_info (line 3364) | def _get_test_info(): function _get_call_arguments (line 3481) | def _get_call_arguments(code_context): function _prepare_debugging_info (line 3541) | def _prepare_debugging_info(test_info, info): function _patched_tearDown (line 3553) | def _patched_tearDown(self, *args, **kwargs): function _patch_with_call_info (line 3651) | def _patch_with_call_info(module_or_class, attr_name, _parse_call_info_f... function _parse_call_info (line 3731) | def _parse_call_info(func, args, kwargs, call_argument_expressions, targ... function patch_testing_methods_to_collect_info (line 3770) | def patch_testing_methods_to_collect_info(): function torchrun (line 3800) | def torchrun(script: str, nproc_per_node: int, is_torchrun: bool = True,... function _format_tensor (line 3820) | def _format_tensor(t, indent_level=0, sci_mode=None): function _quote_string (line 3890) | def _quote_string(s): function _format_py_obj (line 3912) | def _format_py_obj(obj, indent=0, mode="", cache=None, prefix=""): function write_file (line 4130) | def write_file(file, content): function read_json_file (line 4135) | def read_json_file(file): class Colors (line 4146) | class Colors: class ColoredFormatter (line 4170) | class ColoredFormatter(logging.Formatter): method __init__ (line 4184) | def __init__(self, fmt: str | None = None, datefmt: str | None = None): method format (line 4187) | def format(self, record: logging.LogRecord) -> str: function init_test_logger (line 4219) | def init_test_logger() -> logging.Logger: function warn_once (line 4249) | def warn_once(logger_instance: logging.Logger, msg: str) -> None: class CPUMemoryMonitor (line 4279) | class CPUMemoryMonitor: method __init__ (line 4282) | def __init__(self): method _to_gib (line 4297) | def _to_gib(self, memory_in_bytes: int) -> float: method _to_pct (line 4301) | def _to_pct(self, memory_in_bytes: int) -> float: method _update_peak (line 4307) | def _update_peak(self) -> None: method get_stats (line 4313) | def get_stats(self) -> MemoryStats: method reset_peak_stats (line 4335) | def reset_peak_stats(self) -> None: function build_cpu_memory_monitor (line 4341) | def build_cpu_memory_monitor(logger_instance: logging.Logger | None = No... function convert_all_safetensors_to_bins (line 4359) | def convert_all_safetensors_to_bins(folder: str): function force_serialization_as_bin_files (line 4386) | def force_serialization_as_bin_files(): FILE: src/transformers/time_series_utils.py class AffineTransformed (line 34) | class AffineTransformed(TransformedDistribution): method __init__ (line 35) | def __init__(self, base_distribution: Distribution, loc=None, scale=No... method mean (line 42) | def mean(self): method variance (line 49) | def variance(self): method stddev (line 56) | def stddev(self): class ParameterProjection (line 63) | class ParameterProjection(nn.Module): method __init__ (line 64) | def __init__( method forward (line 72) | def forward(self, x: torch.Tensor) -> tuple[torch.Tensor]: class LambdaLayer (line 78) | class LambdaLayer(nn.Module): method __init__ (line 79) | def __init__(self, function): method forward (line 83) | def forward(self, x, *args): class DistributionOutput (line 87) | class DistributionOutput: method __init__ (line 92) | def __init__(self, dim: int = 1) -> None: method _base_distribution (line 96) | def _base_distribution(self, distr_args): method distribution (line 102) | def distribution( method event_shape (line 115) | def event_shape(self) -> tuple: method event_dim (line 122) | def event_dim(self) -> int: method value_in_support (line 130) | def value_in_support(self) -> float: method get_parameter_projection (line 137) | def get_parameter_projection(self, in_features: int) -> nn.Module: method domain_map (line 147) | def domain_map(self, *args: torch.Tensor): method squareplus (line 156) | def squareplus(x: torch.Tensor) -> torch.Tensor: class StudentTOutput (line 164) | class StudentTOutput(DistributionOutput): method domain_map (line 173) | def domain_map(cls, df: torch.Tensor, loc: torch.Tensor, scale: torch.... class NormalOutput (line 179) | class NormalOutput(DistributionOutput): method domain_map (line 188) | def domain_map(cls, loc: torch.Tensor, scale: torch.Tensor): class NegativeBinomialOutput (line 193) | class NegativeBinomialOutput(DistributionOutput): method domain_map (line 202) | def domain_map(cls, total_count: torch.Tensor, logits: torch.Tensor): method _base_distribution (line 206) | def _base_distribution(self, distr_args) -> Distribution: method distribution (line 216) | def distribution( FILE: src/transformers/tokenization_mistral_common.py class MistralTokenizerType (line 152) | class MistralTokenizerType(str, Enum): function _maybe_remove_lang (line 160) | def _maybe_remove_lang(text: str, skip_special_tokens: bool) -> str: ... function _maybe_remove_lang (line 162) | def _maybe_remove_lang(text: list[str], skip_special_tokens: bool) -> li... function _maybe_remove_lang (line 163) | def _maybe_remove_lang(text: str | list[str], skip_special_tokens: bool)... class MistralCommonBackend (line 187) | class MistralCommonBackend(PreTrainedTokenizerBase): method __init__ (line 223) | def __init__( method mode (line 308) | def mode(self) -> ValidationMode: method all_special_ids (line 318) | def all_special_ids(self) -> list[int]: method all_special_tokens (line 325) | def all_special_tokens(self) -> list[str]: method vocab_size (line 332) | def vocab_size(self) -> int: method get_vocab (line 340) | def get_vocab(self) -> dict[str, int]: method __len__ (line 360) | def __len__(self): method encode (line 377) | def encode( method _decode (line 433) | def _decode( method decode (line 463) | def decode( method batch_decode (line 500) | def batch_decode( method convert_ids_to_tokens (line 538) | def convert_ids_to_tokens(self, ids: int, skip_special_tokens: bool = ... method convert_ids_to_tokens (line 540) | def convert_ids_to_tokens(self, ids: list[int], skip_special_tokens: b... method convert_ids_to_tokens (line 541) | def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tok... method _tekken_piece_to_id (line 575) | def _tekken_piece_to_id(self, piece: str, warn: bool) -> int: method _piece_to_id (line 591) | def _piece_to_id(self, piece: str, warn: bool) -> int: method convert_tokens_to_ids (line 599) | def convert_tokens_to_ids(self, tokens: str | list[str]) -> int | list... method _text_to_ids (line 625) | def _text_to_ids(self, text: TextInput, add_special_tokens: bool) -> l... method tokenize (line 633) | def tokenize( method _get_all_special_ids (line 667) | def _get_all_special_ids(self) -> set[int]: method get_special_tokens_mask (line 679) | def get_special_tokens_mask( method _encode_plus (line 710) | def _encode_plus( # type: ignore[override] method prepare_for_model (line 833) | def prepare_for_model( method truncate_sequences (line 962) | def truncate_sequences( # type: ignore[override] method apply_chat_template (line 1026) | def apply_chat_template( # type: ignore[override] method _get_image_sizes_for_tensor (line 1247) | def _get_image_sizes_for_tensor( method build_inputs_with_special_tokens (line 1272) | def build_inputs_with_special_tokens(self, token_ids_0: list[int], tok... method create_token_type_ids_from_sequences (line 1301) | def create_token_type_ids_from_sequences(self, token_ids_0: list[int],... method num_special_tokens_to_add (line 1325) | def num_special_tokens_to_add(self, pair: Literal[False] = False) -> int: method __call__ (line 1350) | def __call__( method from_pretrained (line 1426) | def from_pretrained( method save_pretrained (line 1533) | def save_pretrained( # type: ignore[override] method _get_validation_mode (line 1595) | def _get_validation_mode(mode: str | ValidationMode) -> ValidationMode: method __repr__ (line 1612) | def __repr__(self) -> str: method added_tokens_decoder (line 1621) | def added_tokens_decoder(self): method add_special_tokens (line 1624) | def add_special_tokens( method add_tokens (line 1636) | def add_tokens( # type: ignore[override] method convert_added_tokens (line 1649) | def convert_added_tokens(cls, obj: AddedToken | Any, save: bool = Fals... method get_chat_template (line 1658) | def get_chat_template(self, chat_template: str | None = None, tools: l... method save_chat_templates (line 1663) | def save_chat_templates( method save_vocabulary (line 1674) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/tokenization_python.py class Trie (line 45) | class Trie: method __init__ (line 51) | def __init__(self, *args): method update (line 57) | def update(self, *args): method add (line 67) | def add(self, word: str): method split (line 98) | def split(self, text: str) -> list[str]: method cut_text (line 251) | def cut_text(self, text, offsets): class ExtensionsTrie (line 276) | class ExtensionsTrie(Trie): method __init__ (line 277) | def __init__(self, *args): method extensions (line 280) | def extensions(self, prefix: str): method _get_node (line 299) | def _get_node(self, token: str) -> dict: method _collect_tokens (line 317) | def _collect_tokens(self, node: dict) -> list: function _is_whitespace (line 335) | def _is_whitespace(char): function _is_control (line 347) | def _is_control(char): function _is_punctuation (line 359) | def _is_punctuation(char): function _is_end_of_word (line 374) | def _is_end_of_word(text): function _is_start_of_word (line 380) | def _is_start_of_word(text): function _insert_one_token_to_ordered_list (line 386) | def _insert_one_token_to_ordered_list(token_list: list[str], new_token: ... class PythonBackend (line 400) | class PythonBackend(PreTrainedTokenizerBase): method __init__ (line 413) | def __init__(self, **kwargs): method is_fast (line 454) | def is_fast(self) -> bool: method added_tokens_encoder (line 458) | def added_tokens_encoder(self) -> dict[str, int]: method added_tokens_decoder (line 466) | def added_tokens_decoder(self) -> dict[int, AddedToken]: method added_tokens_decoder (line 476) | def added_tokens_decoder(self, value: dict[int, AddedToken | str]) -> ... method get_added_vocab (line 488) | def get_added_vocab(self) -> dict[str, int]: method __len__ (line 499) | def __len__(self): method _update_total_vocab_size (line 508) | def _update_total_vocab_size(self): method _add_tokens (line 516) | def _add_tokens(self, new_tokens: list[str] | list[AddedToken], specia... method _update_trie (line 594) | def _update_trie(self, unique_no_split_tokens: list[str] | None = None): method num_special_tokens_to_add (line 602) | def num_special_tokens_to_add(self, pair: bool = False) -> int: method tokenize (line 625) | def tokenize(self, text: TextInput, **kwargs) -> list[str]: method _tokenize (line 680) | def _tokenize(self, text, **kwargs): method _convert_token_to_id_with_added_voc (line 689) | def _convert_token_to_id_with_added_voc(self, token): method _convert_token_to_id (line 694) | def _convert_token_to_id(self, token): method _encode_plus (line 697) | def _encode_plus( method prepare_for_tokenization (line 836) | def prepare_for_tokenization( method build_inputs_with_special_tokens (line 860) | def build_inputs_with_special_tokens( method get_special_tokens_mask (line 965) | def get_special_tokens_mask( method convert_ids_to_tokens (line 1046) | def convert_ids_to_tokens(self, ids: int, skip_special_tokens: bool = ... method convert_ids_to_tokens (line 1049) | def convert_ids_to_tokens(self, ids: list[int], skip_special_tokens: b... method convert_ids_to_tokens (line 1051) | def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tok... method _convert_id_to_token (line 1084) | def _convert_id_to_token(self, index: int) -> str: method convert_tokens_to_string (line 1087) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method _decode (line 1090) | def _decode( method prepare_for_model (line 1115) | def prepare_for_model( method truncate_sequences (line 1225) | def truncate_sequences( method create_token_type_ids_from_sequences (line 1292) | def create_token_type_ids_from_sequences( method save_vocabulary (line 1356) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... FILE: src/transformers/tokenization_utils_base.py function import_protobuf_decode_error (line 73) | def import_protobuf_decode_error(error_message=""): function flatten (line 82) | def flatten(arr: list): class AddedToken (line 101) | class AddedToken: method __init__ (line 110) | def __init__( method __getstate__ (line 120) | def __getstate__(self): method __str__ (line 123) | def __str__(self): class TruncationStrategy (line 153) | class TruncationStrategy(ExplicitEnum): class CharSpan (line 165) | class CharSpan(NamedTuple): class TokenSpan (line 178) | class TokenSpan(NamedTuple): class BatchEncoding (line 191) | class BatchEncoding(UserDict): method __init__ (line 219) | def __init__( method n_sequences (line 243) | def n_sequences(self) -> int | None: method __getitem__ (line 251) | def __getitem__(self, item: int | str) -> Any | EncodingFast: method __getattr__ (line 273) | def __getattr__(self, item: str): method __getstate__ (line 279) | def __getstate__(self): method __setstate__ (line 282) | def __setstate__(self, state): method is_fast (line 294) | def is_fast(self) -> bool: method encodings (line 301) | def encodings(self) -> list[EncodingFast] | None: method tokens (line 308) | def tokens(self, batch_index: int = 0) -> list[str]: method sequence_ids (line 326) | def sequence_ids(self, batch_index: int = 0) -> list[int | None]: method word_ids (line 350) | def word_ids(self, batch_index: int = 0) -> list[int | None]: method token_to_sequence (line 369) | def token_to_sequence(self, batch_or_token_index: int, token_index: in... method token_to_word (line 408) | def token_to_word(self, batch_or_token_index: int, token_index: int | ... method word_to_tokens (line 446) | def word_to_tokens( method token_to_chars (line 499) | def token_to_chars(self, batch_or_token_index: int, token_index: int |... method char_to_token (line 538) | def char_to_token(self, batch_or_char_index: int, char_index: int | No... method word_to_chars (line 578) | def word_to_chars( method char_to_word (line 623) | def char_to_word(self, batch_or_char_index: int, char_index: int | Non... method convert_to_tensors (line 662) | def convert_to_tensors(self, tensor_type: str | TensorType | None = No... method to (line 756) | def to(self, device: str | torch.device, *, non_blocking: bool = False... class PreTrainedTokenizerBase (line 959) | class PreTrainedTokenizerBase(PushToHubMixin): method __init__ (line 987) | def __init__(self, **kwargs): method _set_processor_class (line 1090) | def _set_processor_class(self, processor_class: str): method add_special_tokens (line 1095) | def add_special_tokens( method add_tokens (line 1202) | def add_tokens( method _add_tokens (line 1243) | def _add_tokens(self, new_tokens: list[str] | list[AddedToken], specia... method pad_token_type_id (line 1247) | def pad_token_type_id(self) -> int: method __setattr__ (line 1250) | def __setattr__(self, key, value): method __getattr__ (line 1274) | def __getattr__(self, key): method get_special_tokens_mask (line 1296) | def get_special_tokens_mask( method special_tokens_map (line 1329) | def special_tokens_map(self) -> dict[str, str]: method all_special_tokens (line 1351) | def all_special_tokens(self) -> list[str]: method all_special_ids (line 1380) | def all_special_ids(self) -> list[int]: method _set_model_specific_special_tokens (line 1386) | def _set_model_specific_special_tokens(self, special_tokens: dict[str,... method added_tokens_decoder (line 1404) | def added_tokens_decoder(self) -> dict[int, AddedToken]: method __repr__ (line 1407) | def __repr__(self) -> str: method __len__ (line 1419) | def __len__(self) -> int: method vocab_size (line 1423) | def vocab_size(self) -> int: method get_vocab (line 1429) | def get_vocab(self) -> dict[str, int]: method convert_tokens_to_ids (line 1441) | def convert_tokens_to_ids(self, tokens: str | list[str]) -> int | list... method convert_ids_to_tokens (line 1457) | def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tok... method from_pretrained (line 1474) | def from_pretrained( method _from_pretrained (line 1736) | def _from_pretrained( method convert_to_native_format (line 1932) | def convert_to_native_format(cls, **kwargs): method convert_added_tokens (line 1936) | def convert_added_tokens(cls, obj: AddedToken | Any, save=False, add_t... method save_pretrained (line 1954) | def save_pretrained( method _save_pretrained (line 2115) | def _save_pretrained( method clean_up_tokenization (line 2150) | def clean_up_tokenization(self, text: str) -> str: method save_vocabulary (line 2171) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method tokenize (line 2189) | def tokenize(self, text: str, pair: str | None = None, add_special_tok... method encode (line 2219) | def encode( method num_special_tokens_to_add (line 2271) | def num_special_tokens_to_add(self, pair: bool = False) -> int: method max_len_single_sentence (line 2275) | def max_len_single_sentence(self) -> int: method max_len_single_sentence (line 2282) | def max_len_single_sentence(self, value) -> None: method max_len_sentences_pair (line 2296) | def max_len_sentences_pair(self) -> int: method max_len_sentences_pair (line 2303) | def max_len_sentences_pair(self, value) -> None: method _get_padding_truncation_strategies (line 2314) | def _get_padding_truncation_strategies( method __call__ (line 2396) | def __call__( method _encode_plus (line 2521) | def _encode_plus( method pad (line 2546) | def pad( method _pad (line 2717) | def _pad( method convert_tokens_to_string (line 2799) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method decode (line 2812) | def decode( method batch_decode (line 2860) | def batch_decode( method _decode (line 2899) | def _decode( method _eventual_warn_about_too_long_sequence (line 2908) | def _eventual_warn_about_too_long_sequence(self, ids: list[int], max_l... method register_for_auto_class (line 2929) | def register_for_auto_class(cls, auto_class="AutoTokenizer"): method apply_chat_template (line 2948) | def apply_chat_template( method encode_message_with_chat_template (line 3120) | def encode_message_with_chat_template( method get_chat_template (line 3180) | def get_chat_template(self, chat_template: str | None = None, tools: l... method save_chat_templates (line 3234) | def save_chat_templates( method parse_response (line 3289) | def parse_response( function get_fast_tokenizer_file (line 3326) | def get_fast_tokenizer_file(tokenization_files: list[str]) -> str: function find_sentencepiece_model_file (line 3358) | def find_sentencepiece_model_file(pretrained_model_name_or_path, **kwargs): function load_vocab_and_merges (line 3420) | def load_vocab_and_merges(pretrained_model_name_or_path, **kwargs): function _get_prepend_scheme (line 3526) | def _get_prepend_scheme(add_prefix_space: bool, original_tokenizer) -> str: function generate_merges (line 3536) | def generate_merges(vocab, vocab_scores: dict[str, float] | None = None,... FILE: src/transformers/tokenization_utils_sentencepiece.py class SentencePieceBackend (line 45) | class SentencePieceBackend(PreTrainedTokenizer): method __init__ (line 60) | def __init__(self, **kwargs): method vocab_size (line 100) | def vocab_size(self) -> int: method get_vocab (line 104) | def get_vocab(self): method _add_tokens (line 110) | def _add_tokens(self, new_tokens: list[str] | list[AddedToken], specia... method _update_trie (line 190) | def _update_trie(self, unique_no_split_tokens: list[str] | None = None): method _tokenize (line 204) | def _tokenize(self, text, **kwargs): method _convert_token_to_id (line 223) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 227) | def _convert_id_to_token(self, index): method convert_tokens_to_string (line 232) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method save_vocabulary (line 237) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method _decode (line 266) | def _decode( class SentencePieceExtractor (line 289) | class SentencePieceExtractor: method __init__ (line 294) | def __init__(self, model: str): method extract (line 301) | def extract(self, vocab_scores=None) -> tuple[dict[str, int], list[tup... FILE: src/transformers/tokenization_utils_tokenizers.py class TokenizersBackend (line 84) | class TokenizersBackend(PreTrainedTokenizerBase): method convert_to_native_format (line 102) | def convert_to_native_format(cls, trust_remote_code=False, **kwargs): method __init__ (line 328) | def __init__(self, *args, **kwargs): method is_fast (line 492) | def is_fast(self) -> bool: method can_save_slow_tokenizer (line 496) | def can_save_slow_tokenizer(self) -> bool: method save_vocabulary (line 509) | def save_vocabulary(self, save_directory: str, filename_prefix: str | ... method update_post_processor (line 522) | def update_post_processor(self): method add_eos_token (line 549) | def add_eos_token(self): method add_bos_token (line 553) | def add_bos_token(self): method add_eos_token (line 557) | def add_eos_token(self, value): method add_bos_token (line 562) | def add_bos_token(self, value): method _post_init (line 566) | def _post_init(self): method vocab_size (line 599) | def vocab_size(self) -> int: method get_vocab (line 605) | def get_vocab(self) -> dict[str, int]: method vocab (line 609) | def vocab(self) -> dict[str, int]: method added_tokens_encoder (line 613) | def added_tokens_encoder(self) -> dict[str, int]: method added_tokens_decoder (line 621) | def added_tokens_decoder(self) -> dict[int, AddedToken]: method get_added_vocab (line 635) | def get_added_vocab(self) -> dict[str, int]: method __bool__ (line 644) | def __bool__(self) -> bool: method __len__ (line 650) | def __len__(self) -> int: method backend_tokenizer (line 657) | def backend_tokenizer(self) -> TokenizerFast: method decoder (line 664) | def decoder(self) -> DecoderFast: method _convert_encoding (line 670) | def _convert_encoding( method _convert_token_to_id_with_added_voc (line 717) | def _convert_token_to_id_with_added_voc(self, token: str) -> int: method _convert_id_to_token (line 723) | def _convert_id_to_token(self, index: int) -> str | None: method _add_tokens (line 726) | def _add_tokens(self, new_tokens: list[str | AddedToken], special_toke... method num_special_tokens_to_add (line 732) | def num_special_tokens_to_add(self, pair: bool = False) -> int: method convert_ids_to_tokens (line 753) | def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tok... method tokenize (line 779) | def tokenize(self, text: str, pair: str | None = None, add_special_tok... method set_truncation_and_padding (line 782) | def set_truncation_and_padding( method _encode_plus (line 857) | def _encode_plus( method convert_tokens_to_string (line 1011) | def convert_tokens_to_string(self, tokens: list[str]) -> str: method _decode (line 1018) | def _decode( method _save_pretrained (line 1044) | def _save_pretrained( method train_new_from_iterator (line 1061) | def train_new_from_iterator( method _patch_mistral_regex (line 1259) | def _patch_mistral_regex( FILE: src/transformers/trainer.py class Trainer (line 255) | class Trainer: method __init__ (line 362) | def __init__( method _validate_args (line 611) | def _validate_args(self) -> None: method _build_accelerator_args (line 693) | def _build_accelerator_args(self, **kwargs) -> dict[str, Any]: method create_accelerator_and_postprocess (line 750) | def create_accelerator_and_postprocess(self) -> None: method get_train_dataloader (line 862) | def get_train_dataloader(self) -> DataLoader: method get_eval_dataloader (line 882) | def get_eval_dataloader(self, eval_dataset: str | Dataset | None = Non... method get_test_dataloader (line 921) | def get_test_dataloader(self, test_dataset: Dataset) -> DataLoader: method num_examples (line 939) | def num_examples(self, dataloader: DataLoader) -> int: method _get_dataloader (line 953) | def _get_dataloader( method _get_train_sampler (line 1003) | def _get_train_sampler(self, train_dataset: Dataset | None = None) -> ... method _get_eval_sampler (line 1034) | def _get_eval_sampler(self, eval_dataset: Dataset) -> torch.utils.data... method _set_signature_columns_if_needed (line 1063) | def _set_signature_columns_if_needed(self) -> None: method _remove_unused_columns (line 1079) | def _remove_unused_columns( method _get_collator_with_removed_columns (line 1114) | def _get_collator_with_removed_columns(self, data_collator: Callable, ... method create_optimizer_and_scheduler (line 1132) | def create_optimizer_and_scheduler(self, num_training_steps: int) -> N... method create_optimizer (line 1143) | def create_optimizer(self, model=None) -> torch.optim.Optimizer: method create_scheduler (line 1219) | def create_scheduler( method get_optimizer_cls_and_kwargs (line 1250) | def get_optimizer_cls_and_kwargs(args: TrainingArguments, model: PreTr... method get_decay_parameter_names (line 1280) | def get_decay_parameter_names(self, model: nn.Module) -> list[str]: method _get_learning_rate (line 1292) | def _get_learning_rate(self) -> float: method train (line 1322) | def train( method _inner_training_loop (line 1431) | def _inner_training_loop( method _init_training_state (line 1524) | def _init_training_state( method _prepare_for_training (line 1555) | def _prepare_for_training(self, max_steps, train_dataloader, resume_fr... method _run_epoch (line 1653) | def _run_epoch( method _finalize_training (line 1818) | def _finalize_training(self, trial, num_train_samples, start_time): method training_step (line 1867) | def training_step( method compute_loss (line 1938) | def compute_loss( method compute_loss_context_manager (line 2022) | def compute_loss_context_manager(self) -> contextlib.ExitStack: method autocast_smart_context_manager (line 2034) | def autocast_smart_context_manager(self, cache_enabled: bool | None = ... method _maybe_log_save_evaluate (line 2041) | def _maybe_log_save_evaluate( method get_batch_samples (line 2092) | def get_batch_samples( method _get_num_items_in_batch (line 2109) | def _get_num_items_in_batch(self, batch_samples: list, device: torch.d... method _prepare_input (line 2161) | def _prepare_input(self, data: torch.Tensor | Any) -> torch.Tensor | Any: method _prepare_inputs (line 2179) | def _prepare_inputs(self, inputs: dict[str, torch.Tensor | Any]) -> di... method _prepare_context_parallel_inputs (line 2193) | def _prepare_context_parallel_inputs( method set_initial_training_values (line 2287) | def set_initial_training_values( method get_total_train_batch_size (line 2357) | def get_total_train_batch_size(self, args: TrainingArguments) -> int: method get_sp_size (line 2375) | def get_sp_size(self) -> int: method get_cp_size (line 2383) | def get_cp_size(self) -> int: method get_tp_size (line 2391) | def get_tp_size(self) -> int: method _wrap_model (line 2405) | def _wrap_model(self, model: nn.Module, training: bool = True, dataloa... method _update_auto_batch_size (line 2435) | def _update_auto_batch_size(self, batch_size): method _track_num_input_tokens (line 2456) | def _track_num_input_tokens(self, inputs): method _clip_grad_norm (line 2489) | def _clip_grad_norm(self, model): method _get_grad_norm (line 2495) | def _get_grad_norm(self, model, grad_norm=None): method evaluate (line 2508) | def evaluate( method evaluation_loop (line 2608) | def evaluation_loop( method predict (line 2815) | def predict( method prediction_step (line 2876) | def prediction_step( method _evaluate (line 2981) | def _evaluate( method _get_output_dir (line 3013) | def _get_output_dir(self, trial: "optuna.Trial | dict[str, Any] | None... method _save_checkpoint (line 3032) | def _save_checkpoint(self, model: nn.Module, trial: "optuna.Trial | di... method _determine_best_metric (line 3101) | def _determine_best_metric(self, metrics: dict[str, float], trial: "op... method _save_rng_state (line 3139) | def _save_rng_state(self, output_dir: str) -> None: method _save_optimizer_and_scheduler (line 3190) | def _save_optimizer_and_scheduler(self, output_dir: str) -> None: method _save_scaler (line 3256) | def _save_scaler(self, output_dir: str) -> None: method _load_from_checkpoint (line 3279) | def _load_from_checkpoint(self, resume_from_checkpoint: str, model: nn... method _load_best_model (line 3408) | def _load_best_model(self) -> None: method _load_rng_state (line 3514) | def _load_rng_state(self, checkpoint: str | None) -> None: method _load_optimizer_and_scheduler (line 3559) | def _load_optimizer_and_scheduler(self, checkpoint: str | None) -> None: method _load_scaler (line 3663) | def _load_scaler(self, checkpoint: str | None) -> None: method _load_callback_state (line 3690) | def _load_callback_state(self) -> None: method _issue_warnings_after_load (line 3729) | def _issue_warnings_after_load(self, load_result: Any) -> None: method save_model (line 3745) | def save_model(self, output_dir: str | None = None, _internal_call: bo... method _save (line 3803) | def _save(self, output_dir: str | None = None, state_dict: dict | None... method log (line 3844) | def log(self, logs: dict[str, float], start_time: float | None = None)... method store_flos (line 3868) | def store_flos(self) -> None: method floating_point_ops (line 3879) | def floating_point_ops(self, inputs: dict[str, torch.Tensor | Any]) ->... method init_hf_repo (line 3900) | def init_hf_repo(self, token: str | None = None) -> None: method create_model_card (line 3918) | def create_model_card( method push_to_hub (line 3992) | def push_to_hub( method _push_from_checkpoint (line 4074) | def _push_from_checkpoint(self, checkpoint_folder: str) -> None: method _finish_current_push (line 4143) | def _finish_current_push(self) -> None: method hyperparameter_search (line 4153) | def hyperparameter_search( method call_model_init (line 4234) | def call_model_init(self, trial: "optuna.Trial | dict[str, Any] | None... method _hp_search_setup (line 4249) | def _hp_search_setup(self, trial: "optuna.Trial | dict[str, Any] | Non... method _report_to_hp_search (line 4303) | def _report_to_hp_search( method _tune_save_checkpoint (line 4330) | def _tune_save_checkpoint(self, checkpoint_dir: str) -> None: method add_callback (line 4343) | def add_callback(self, callback: type[TrainerCallback] | TrainerCallba... method pop_callback (line 4354) | def pop_callback(self, callback: type[TrainerCallback] | TrainerCallba... method remove_callback (line 4370) | def remove_callback(self, callback: type[TrainerCallback] | TrainerCal... method is_local_process_zero (line 4383) | def is_local_process_zero(self) -> bool: method is_world_process_zero (line 4390) | def is_world_process_zero(self) -> bool: method _move_model_to_device (line 4401) | def _move_model_to_device(self, model: nn.Module, device: torch.device... FILE: src/transformers/trainer_callback.py class TrainerState (line 35) | class TrainerState: method __post_init__ (line 116) | def __post_init__(self): method save_to_json (line 143) | def save_to_json(self, json_path: str): method load_from_json (line 150) | def load_from_json(cls, json_path: str): method compute_steps (line 156) | def compute_steps(self, args, max_steps): method init_training_references (line 169) | def init_training_references(self, trainer, max_steps, num_train_epoch... class ExportableState (line 189) | class ExportableState: method state (line 222) | def state(self) -> dict: method from_state (line 226) | def from_state(cls, state): class TrainerControl (line 234) | class TrainerControl(ExportableState): method _new_training (line 268) | def _new_training(self): method _new_epoch (line 272) | def _new_epoch(self): method _new_step (line 276) | def _new_step(self): method state (line 282) | def state(self) -> dict: class TrainerCallback (line 295) | class TrainerCallback: method on_init_end (line 346) | def on_init_end(self, args: TrainingArguments, state: TrainerState, co... method on_train_begin (line 351) | def on_train_begin(self, args: TrainingArguments, state: TrainerState,... method on_train_end (line 356) | def on_train_end(self, args: TrainingArguments, state: TrainerState, c... method on_epoch_begin (line 361) | def on_epoch_begin(self, args: TrainingArguments, state: TrainerState,... method on_epoch_end (line 366) | def on_epoch_end(self, args: TrainingArguments, state: TrainerState, c... method on_step_begin (line 371) | def on_step_begin(self, args: TrainingArguments, state: TrainerState, ... method on_pre_optimizer_step (line 377) | def on_pre_optimizer_step(self, args: TrainingArguments, state: Traine... method on_optimizer_step (line 382) | def on_optimizer_step(self, args: TrainingArguments, state: TrainerSta... method on_substep_end (line 387) | def on_substep_end(self, args: TrainingArguments, state: TrainerState,... method on_step_end (line 392) | def on_step_end(self, args: TrainingArguments, state: TrainerState, co... method on_evaluate (line 398) | def on_evaluate(self, args: TrainingArguments, state: TrainerState, co... method on_predict (line 403) | def on_predict(self, args: TrainingArguments, state: TrainerState, con... method on_save (line 408) | def on_save(self, args: TrainingArguments, state: TrainerState, contro... method on_log (line 413) | def on_log(self, args: TrainingArguments, state: TrainerState, control... method on_prediction_step (line 418) | def on_prediction_step(self, args: TrainingArguments, state: TrainerSt... method on_push_begin (line 423) | def on_push_begin(self, args: TrainingArguments, state: TrainerState, ... class CallbackHandler (line 429) | class CallbackHandler(TrainerCallback): method __init__ (line 432) | def __init__(self, callbacks, model, processing_class, optimizer, lr_s... method add_callback (line 451) | def add_callback(self, callback): method pop_callback (line 462) | def pop_callback(self, callback): method remove_callback (line 474) | def remove_callback(self, callback): method callback_list (line 484) | def callback_list(self): method on_init_end (line 487) | def on_init_end(self, args: TrainingArguments, state: TrainerState, co... method on_train_begin (line 490) | def on_train_begin(self, args: TrainingArguments, state: TrainerState,... method on_train_end (line 494) | def on_train_end(self, args: TrainingArguments, state: TrainerState, c... method on_epoch_begin (line 497) | def on_epoch_begin(self, args: TrainingArguments, state: TrainerState,... method on_epoch_end (line 501) | def on_epoch_end(self, args: TrainingArguments, state: TrainerState, c... method on_step_begin (line 504) | def on_step_begin(self, args: TrainingArguments, state: TrainerState, ... method on_pre_optimizer_step (line 510) | def on_pre_optimizer_step(self, args: TrainingArguments, state: Traine... method on_optimizer_step (line 513) | def on_optimizer_step(self, args: TrainingArguments, state: TrainerSta... method on_substep_end (line 516) | def on_substep_end(self, args: TrainingArguments, state: TrainerState,... method on_step_end (line 519) | def on_step_end(self, args: TrainingArguments, state: TrainerState, co... method on_evaluate (line 522) | def on_evaluate(self, args: TrainingArguments, state: TrainerState, co... method on_predict (line 526) | def on_predict(self, args: TrainingArguments, state: TrainerState, con... method on_save (line 529) | def on_save(self, args: TrainingArguments, state: TrainerState, contro... method on_log (line 533) | def on_log(self, args: TrainingArguments, state: TrainerState, control... method on_prediction_step (line 537) | def on_prediction_step(self, args: TrainingArguments, state: TrainerSt... method on_push_begin (line 540) | def on_push_begin(self, args: TrainingArguments, state: TrainerState, ... method call_event (line 543) | def call_event(self, event, args, state, control, **kwargs): class DefaultFlowCallback (line 563) | class DefaultFlowCallback(TrainerCallback): method on_step_end (line 568) | def on_step_end(self, args: TrainingArguments, state: TrainerState, co... method on_epoch_end (line 608) | def on_epoch_end(self, args: TrainingArguments, state: TrainerState, c... class ProgressCallback (line 624) | class ProgressCallback(TrainerCallback): method __init__ (line 630) | def __init__(self, max_str_len: int = 100): method on_train_begin (line 643) | def on_train_begin(self, args, state, control, **kwargs): method on_step_end (line 648) | def on_step_end(self, args, state, control, **kwargs): method on_prediction_step (line 653) | def on_prediction_step(self, args, state, control, eval_dataloader=Non... method on_evaluate (line 661) | def on_evaluate(self, args, state, control, **kwargs): method on_predict (line 667) | def on_predict(self, args, state, control, **kwargs): method on_log (line 673) | def on_log(self, args, state, control, logs=None, **kwargs): method on_train_end (line 692) | def on_train_end(self, args, state, control, **kwargs): class PrinterCallback (line 698) | class PrinterCallback(TrainerCallback): method on_log (line 703) | def on_log(self, args, state, control, logs=None, **kwargs): class EarlyStoppingCallback (line 711) | class EarlyStoppingCallback(TrainerCallback, ExportableState): method __init__ (line 728) | def __init__(self, early_stopping_patience: int = 1, early_stopping_th... method check_metric_value (line 734) | def check_metric_value(self, args, state, control, metric_value): method on_train_begin (line 745) | def on_train_begin(self, args, state, control, **kwargs): method on_evaluate (line 758) | def on_evaluate(self, args, state, control, metrics, **kwargs): method state (line 775) | def state(self) -> dict: FILE: src/transformers/trainer_jit_checkpoint.py class CheckpointManager (line 13) | class CheckpointManager: method __init__ (line 14) | def __init__(self, trainer, kill_wait: int = 3): method setup_signal_handler (line 27) | def setup_signal_handler(self): method _sigterm_handler (line 31) | def _sigterm_handler(self, signum, frame): method _enable_checkpoint (line 38) | def _enable_checkpoint(self): method execute_jit_checkpoint (line 42) | def execute_jit_checkpoint(self): class JITCheckpointCallback (line 79) | class JITCheckpointCallback(TrainerCallback): method __init__ (line 88) | def __init__(self): method set_trainer (line 92) | def set_trainer(self, trainer): method on_pre_optimizer_step (line 99) | def on_pre_optimizer_step(self, args, state, control, **kwargs): method on_step_begin (line 104) | def on_step_begin(self, args, state, control, **kwargs): method on_step_end (line 109) | def on_step_end(self, args, state, control, **kwargs): method on_epoch_end (line 115) | def on_epoch_end(self, args, state, control, **kwargs): method on_train_end (line 121) | def on_train_end(self, args, state, control, **kwargs): FILE: src/transformers/trainer_optimizer.py class OptimizerContext (line 55) | class OptimizerContext: function _parse_optim_args (line 65) | def _parse_optim_args(optim_args_str: str | None) -> dict[str, str]: function is_optimizer_factory (line 80) | def is_optimizer_factory(optimizer_cls_or_factory: Any) -> bool: function _setup_low_rank_optimizer (line 101) | def _setup_low_rank_optimizer( function _get_adafactor (line 195) | def _get_adafactor(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: function _get_adamw_torch (line 201) | def _get_adamw_torch(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: function _get_adamw_torch_xla (line 211) | def _get_adamw_torch_xla(ctx: OptimizerContext) -> tuple[Any, dict[str, ... function _get_adamw_torch_npu_fused (line 222) | def _get_adamw_torch_npu_fused(ctx: OptimizerContext) -> tuple[Any, dict... function _get_adamw_apex_fused (line 233) | def _get_adamw_apex_fused(ctx: OptimizerContext) -> tuple[Any, dict[str,... function _get_bitsandbytes_optimizer (line 244) | def _get_bitsandbytes_optimizer(ctx: OptimizerContext) -> tuple[Any, dic... function _get_adamw_anyprecision (line 294) | def _get_adamw_anyprecision(ctx: OptimizerContext) -> tuple[Any, dict[st... function _get_sgd (line 315) | def _get_sgd(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: function _get_adagrad (line 327) | def _get_adagrad(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: function _get_rmsprop (line 337) | def _get_rmsprop(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: function _get_galore_optimizer (line 349) | def _get_galore_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str,... function _get_apollo_optimizer (line 382) | def _get_apollo_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str,... function _get_lomo_optimizer (line 411) | def _get_lomo_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str, A... function _get_grokadamw (line 429) | def _get_grokadamw(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: function _get_torchao_optimizer (line 448) | def _get_torchao_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str... function _get_schedule_free_optimizer (line 483) | def _get_schedule_free_optimizer(ctx: OptimizerContext) -> tuple[Any, di... function _get_stable_adamw (line 527) | def _get_stable_adamw(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: FILE: src/transformers/trainer_pt_utils.py function get_dataloader_sampler (line 67) | def get_dataloader_sampler(dataloader): function atleast_1d (line 74) | def atleast_1d(tensor_or_array: torch.Tensor | np.ndarray): function torch_pad_and_concatenate (line 82) | def torch_pad_and_concatenate(tensor1, tensor2, padding_index=-100): function numpy_pad_and_concatenate (line 100) | def numpy_pad_and_concatenate(array1, array2, padding_index=-100): function nested_concat (line 118) | def nested_concat(tensors, new_tensors, padding_index=-100): function find_batch_size (line 141) | def find_batch_size(tensors): function nested_numpify (line 159) | def nested_numpify(tensors): function nested_detach (line 175) | def nested_detach(tensors): function nested_xla_mesh_reduce (line 184) | def nested_xla_mesh_reduce(tensors, name): function distributed_concat (line 201) | def distributed_concat(tensor: Any, num_total_examples: int | None = Non... function nested_gather (line 220) | def nested_gather(tensors, parallel_mode, name=None): function is_attention_mask_causal (line 239) | def is_attention_mask_causal(attention_mask): function distributed_broadcast_scalars (line 284) | def distributed_broadcast_scalars( function reissue_pt_warnings (line 303) | def reissue_pt_warnings(caught_warnings): function torch_distributed_zero_first (line 312) | def torch_distributed_zero_first(local_rank: int): class DistributedSamplerWithLoop (line 326) | class DistributedSamplerWithLoop(DistributedSampler): method __init__ (line 340) | def __init__(self, dataset, batch_size, **kwargs): method __iter__ (line 344) | def __iter__(self): class EvalLoopContainer (line 354) | class EvalLoopContainer: method __init__ (line 367) | def __init__(self, do_nested_concat: bool = True, padding_index: int =... method add (line 373) | def add(self, tensors) -> None: method to_cpu_and_numpy (line 382) | def to_cpu_and_numpy(self) -> None: method get_arrays (line 400) | def get_arrays(self): function get_tpu_sampler (line 406) | def get_tpu_sampler(dataset: torch.utils.data.Dataset, batch_size: int): function nested_new_like (line 412) | def nested_new_like(arrays, num_samples, padding_index=-100): function expand_like (line 419) | def expand_like(arrays, new_seq_length, padding_index=-100): function nested_truncate (line 426) | def nested_truncate(tensors, limit): class LabelSmoother (line 437) | class LabelSmoother: method __call__ (line 451) | def __call__(self, model_output, labels, shift_labels=False): function get_length_grouped_indices (line 479) | def get_length_grouped_indices(lengths, batch_size, mega_batch_mult=None... class LengthGroupedSampler (line 514) | class LengthGroupedSampler(Sampler): method __init__ (line 520) | def __init__( method __len__ (line 549) | def __len__(self): method __iter__ (line 552) | def __iter__(self): class DistributedLengthGroupedSampler (line 557) | class DistributedLengthGroupedSampler(DistributedSampler): method __init__ (line 564) | def __init__( method __iter__ (line 621) | def __iter__(self) -> Iterator: class ShardSampler (line 642) | class ShardSampler(Sampler): method __init__ (line 651) | def __init__( method __iter__ (line 670) | def __iter__(self): method __len__ (line 684) | def __len__(self): class IterableDatasetShard (line 689) | class IterableDatasetShard(IterableDataset): method __init__ (line 730) | def __init__( method set_epoch (line 748) | def set_epoch(self, epoch): method __iter__ (line 753) | def __iter__(self): method __len__ (line 786) | def __len__(self): function _secs2timedelta (line 794) | def _secs2timedelta(secs): function metrics_format (line 803) | def metrics_format(metrics: dict[str, float]) -> dict[str, float]: function log_metrics (line 830) | def log_metrics(self, split, metrics): function save_metrics (line 921) | def save_metrics(self, split, metrics, combined=True): function save_state (line 960) | def save_state(self): function get_num_trainable_parameters (line 974) | def get_num_trainable_parameters(self) -> int: function get_learning_rates (line 982) | def get_learning_rates(self) -> list[float]: function get_optimizer_group (line 992) | def get_optimizer_group(self, param: str | torch.nn.parameter.Parameter ... function get_model_param_count (line 1009) | def get_model_param_count(model, trainable_only=False): function get_parameter_names (line 1026) | def get_parameter_names(model, forbidden_layer_types, forbidden_layer_na... function get_module_class_from_name (line 1050) | def get_module_class_from_name(module, name): function remove_dummy_checkpoint (line 1070) | def remove_dummy_checkpoint(is_main_process, output_dir, filenames): function smp_forward_backward (line 1082) | def smp_forward_backward(model, inputs, gradient_accumulation_steps=1): function smp_forward_only (line 1090) | def smp_forward_only(model, inputs): function smp_gather (line 1093) | def smp_gather(tensor): function smp_nested_concat (line 1106) | def smp_nested_concat(tensor): class AcceleratorConfig (line 1117) | class AcceleratorConfig: method from_json_file (line 1226) | def from_json_file(cls, json_file): method to_dict (line 1240) | def to_dict(self): method pop (line 1243) | def pop(self, key, default=None): class LayerWiseDummyOptimizer (line 1247) | class LayerWiseDummyOptimizer(torch.optim.Optimizer): method __init__ (line 1258) | def __init__(self, optimizer_dict=None, **kwargs): method zero_grad (line 1263) | def zero_grad(self, set_to_none: bool = True) -> None: method step (line 1266) | def step(self, closure=None) -> float | None: class LayerWiseDummyScheduler (line 1270) | class LayerWiseDummyScheduler(LRScheduler): method __init__ (line 1278) | def __init__(self, *args, **kwargs): method get_lr (line 1284) | def get_lr(self): method _get_closed_form_lr (line 1297) | def _get_closed_form_lr(self): function set_rng_state_for_device (line 1301) | def set_rng_state_for_device(device_name, device_module, checkpoint_rng_... function safe_globals (line 1315) | def safe_globals(): FILE: src/transformers/trainer_seq2seq.py class Seq2SeqTrainer (line 55) | class Seq2SeqTrainer(Trainer): method __init__ (line 56) | def __init__( method load_generation_config (line 96) | def load_generation_config(gen_config_arg: str | GenerationConfig) -> ... method evaluate (line 139) | def evaluate( method predict (line 195) | def predict( method prediction_step (line 259) | def prediction_step( method _pad_tensors_to_max_len (line 374) | def _pad_tensors_to_max_len(self, tensor, max_length): FILE: src/transformers/trainer_utils.py function _is_peft_model (line 69) | def _is_peft_model(model): function unwrap_peft_model (line 75) | def unwrap_peft_model(model): function validate_quantization_for_training (line 102) | def validate_quantization_for_training(model): function seed_worker (line 145) | def seed_worker(worker_id: int, num_workers: int, rank: int): function enable_full_determinism (line 154) | def enable_full_determinism(seed: int, warn_only: bool = False): function set_seed (line 180) | def set_seed(seed: int, deterministic: bool = False): class EvalPrediction (line 210) | class EvalPrediction: method __init__ (line 221) | def __init__( method __iter__ (line 238) | def __iter__(self): method __getitem__ (line 241) | def __getitem__(self, idx): class EvalLoopOutput (line 247) | class EvalLoopOutput(NamedTuple): class PredictionOutput (line 254) | class PredictionOutput(NamedTuple): class TrainOutput (line 260) | class TrainOutput(NamedTuple): function get_last_checkpoint (line 270) | def get_last_checkpoint(folder): function sort_checkpoints (line 282) | def sort_checkpoints( function rotate_checkpoints (line 342) | def rotate_checkpoints( class IntervalStrategy (line 389) | class IntervalStrategy(ExplicitEnum): class SaveStrategy (line 395) | class SaveStrategy(ExplicitEnum): class HubStrategy (line 402) | class HubStrategy(ExplicitEnum): class BestRun (line 409) | class BestRun(NamedTuple): function default_compute_objective (line 431) | def default_compute_objective(metrics: dict[str, float]) -> float: function default_hp_space_optuna (line 452) | def default_hp_space_optuna(trial) -> dict[str, float]: function default_hp_space_ray (line 464) | def default_hp_space_ray(trial) -> dict[str, Any]: function default_hp_space_wandb (line 478) | def default_hp_space_wandb(trial) -> dict[str, Any]: class HPSearchBackend (line 496) | class HPSearchBackend(ExplicitEnum): function is_main_process (line 502) | def is_main_process(local_rank): function total_processes_number (line 514) | def total_processes_number(local_rank): function speed_metrics (line 529) | def speed_metrics(split, start_time, num_samples=None, num_steps=None, n... class SchedulerType (line 559) | class SchedulerType(ExplicitEnum): class TrainerMemoryTracker (line 592) | class TrainerMemoryTracker: method __init__ (line 623) | def __init__(self, skip_memory_metrics=False): method derive_stage (line 669) | def derive_stage(self): method cpu_mem_used (line 679) | def cpu_mem_used(self): method peak_monitor_func (line 683) | def peak_monitor_func(self): method start (line 695) | def start(self): method stop (line 757) | def stop(self, stage): method update_metrics (line 843) | def update_metrics(self, stage, metrics): method stop_and_update_metrics (line 884) | def stop_and_update_metrics(self, metrics=None): function has_length (line 897) | def has_length(dataset: Any) -> TypeGuard[Sized]: function denumpify_detensorize (line 911) | def denumpify_detensorize(metrics): function number_of_arguments (line 926) | def number_of_arguments(func): function find_executable_batch_size (line 936) | def find_executable_batch_size( class FSDPOption (line 967) | class FSDPOption(ExplicitEnum): class RemoveColumnsCollator (line 977) | class RemoveColumnsCollator: method __init__ (line 980) | def __init__( method _remove_columns (line 995) | def _remove_columns(self, feature: dict) -> dict: method __call__ (line 1011) | def __call__(self, features: list[dict]): function check_target_module_exists (line 1016) | def check_target_module_exists(optim_target_modules, key: str, return_is... function load_sharded_checkpoint (line 1055) | def load_sharded_checkpoint(model, folder, strict=True, prefer_safe=True): function compare_trainer_and_checkpoint_args (line 1131) | def compare_trainer_and_checkpoint_args(training_args, trainer_state): function align_special_tokens (line 1170) | def align_special_tokens(model, processing_class): function suppress_progress_bars (line 1246) | def suppress_progress_bars(): FILE: src/transformers/training_args.py class OptimizerNames (line 111) | class OptimizerNames(ExplicitEnum): function _convert_str_dict (line 160) | def _convert_str_dict(passed_value: dict): class TrainingArguments (line 179) | class TrainingArguments: method __post_init__ (line 1447) | def __post_init__(self): method _validate_args (line 1640) | def _validate_args(self): method __str__ (line 1726) | def __str__(self): method train_batch_size (line 1737) | def train_batch_size(self) -> int: method eval_batch_size (line 1745) | def eval_batch_size(self) -> int: method ddp_timeout_delta (line 1753) | def ddp_timeout_delta(self) -> timedelta: method _setup_devices (line 1760) | def _setup_devices(self) -> "torch.device": method device (line 1869) | def device(self) -> "torch.device": method n_gpu (line 1877) | def n_gpu(self): method parallel_mode (line 1892) | def parallel_mode(self): method world_size (line 1917) | def world_size(self): method process_index (line 1929) | def process_index(self): method local_process_index (line 1941) | def local_process_index(self): method should_log (line 1954) | def should_log(self): method should_save (line 1967) | def should_save(self): method get_process_log_level (line 1979) | def get_process_log_level(self): method place_model_on_device (line 2002) | def place_model_on_device(self) -> bool | None: method _no_sync_in_gradient_accumulation (line 2009) | def _no_sync_in_gradient_accumulation(self): method main_process_first (line 2018) | def main_process_first(self, local=True, desc="work"): method get_warmup_steps (line 2068) | def get_warmup_steps(self, num_training_steps: int): method _dict_dtype_to_str (line 2077) | def _dict_dtype_to_str(self, d: dict[str, Any]) -> None: method to_dict (line 2089) | def to_dict(self): method to_json_string (line 2119) | def to_json_string(self): method to_sanitized_dict (line 2125) | def to_sanitized_dict(self) -> dict[str, Any]: method set_training (line 2139) | def set_training( method set_evaluate (line 2214) | def set_evaluate( method set_testing (line 2271) | def set_testing( method set_save (line 2307) | def set_save( method set_logging (line 2356) | def set_logging( method set_push_to_hub (line 2431) | def set_push_to_hub( method set_optimizer (line 2505) | def set_optimizer( method set_lr_scheduler (line 2556) | def set_lr_scheduler( method set_dataloader (line 2602) | def set_dataloader( method _process_fsdp_args (line 2670) | def _process_fsdp_args(self): class ParallelMode (line 2808) | class ParallelMode(Enum): function str_to_bool (line 2817) | def str_to_bool(value, to_bool: bool = True) -> int | bool: FILE: src/transformers/training_args_seq2seq.py class Seq2SeqTrainingArguments (line 29) | class Seq2SeqTrainingArguments(TrainingArguments): method to_dict (line 84) | def to_dict(self): FILE: src/transformers/utils/__init__.py function check_min_version (line 290) | def check_min_version(min_version): function get_available_devices (line 308) | def get_available_devices() -> frozenset[str]: FILE: src/transformers/utils/attention_visualizer.py function generate_attention_matrix_from_mask (line 40) | def generate_attention_matrix_from_mask( class AttentionMaskVisualizer (line 148) | class AttentionMaskVisualizer: method __init__ (line 149) | def __init__(self, model_name: str): method __call__ (line 174) | def __call__(self, input_sentence: str, suffix=""): method visualize_attention_mask (line 177) | def visualize_attention_mask(self, input_sentence: str, suffix=""): FILE: src/transformers/utils/auto_docstring.py class ImageProcessorArgs (line 104) | class ImageProcessorArgs: class ProcessorArgs (line 290) | class ProcessorArgs: class ConfigArgs (line 563) | class ConfigArgs: class ModelArgs (line 1837) | class ModelArgs: class ModelOutputArgs (line 2170) | class ModelOutputArgs: class ClassDocstring (line 2437) | class ClassDocstring: class ClassAttrs (line 2532) | class ClassAttrs: function get_indent_level (line 2572) | def get_indent_level(func): function equalize_indent (line 2577) | def equalize_indent(docstring: str, indent_level: int) -> str: function set_min_indent (line 2587) | def set_min_indent(docstring: str, indent_level: int) -> str: function parse_shape (line 2602) | def parse_shape(docstring): function parse_default (line 2609) | def parse_default(docstring): function parse_docstring (line 2616) | def parse_docstring(docstring, max_indent_level=0, return_intro=False): function contains_type (line 2696) | def contains_type(type_hint, target_type) -> tuple[bool, object | None]: function get_model_name (line 2714) | def get_model_name(obj): function generate_processor_intro (line 2745) | def generate_processor_intro(cls) -> str: function get_placeholders_dict (line 2802) | def get_placeholders_dict(placeholders: set[str], model_name: str) -> Ma... function format_args_docstring (line 2833) | def format_args_docstring(docstring: str, model_name: str) -> str: function get_args_doc_from_source (line 2854) | def get_args_doc_from_source(args_classes: object | list[object]) -> dict: function _merge_args_dicts (line 2861) | def _merge_args_dicts(args_classes_tuple: tuple) -> dict: function get_checkpoint_from_config_class (line 2869) | def get_checkpoint_from_config_class(config_class): function add_intro_docstring (line 2894) | def add_intro_docstring(func, class_name, indent_level=0): function _get_model_info (line 2913) | def _get_model_info(func, parent_class): function _format_type_annotation_recursive (line 2960) | def _format_type_annotation_recursive(type_hint): function process_type_annotation (line 3073) | def process_type_annotation(type_input, param_name: str | None = None) -... function _process_parameter_type (line 3175) | def _process_parameter_type(param): function _get_parameter_info (line 3198) | def _get_parameter_info(param_name, documented_params, source_args_dict,... function _process_regular_parameters (line 3247) | def _process_regular_parameters( function find_sig_line (line 3357) | def find_sig_line(lines, line_end): function _is_image_processor_class (line 3374) | def _is_image_processor_class(func, parent_class): function _is_processor_class (line 3417) | def _is_processor_class(func, parent_class): function _get_base_kwargs_class_from_name (line 3466) | def _get_base_kwargs_class_from_name(cls_name: str) -> str | None: function _get_base_kwargs_class (line 3483) | def _get_base_kwargs_class(cls): function _process_kwargs_parameters (line 3529) | def _process_kwargs_parameters(sig, func, parent_class, documented_kwarg... function _add_return_tensors_to_docstring (line 3739) | def _add_return_tensors_to_docstring(func, parent_class, docstring, inde... function _process_parameters_section (line 3784) | def _process_parameters_section( function _prepare_return_docstring (line 3850) | def _prepare_return_docstring(output_type, config_class, add_intro=True): function _process_returns_section (line 3963) | def _process_returns_section(func_documentation, sig, config_class, inde... function _process_example_section (line 3997) | def _process_example_section( function auto_method_docstring (line 4094) | def auto_method_docstring( function auto_class_docstring (line 4168) | def auto_class_docstring(cls, custom_intro=None, custom_args=None, check... function auto_docstring (line 4351) | def auto_docstring(obj=None, *, custom_intro=None, custom_args=None, che... FILE: src/transformers/utils/backbone_utils.py class BackboneConfigMixin (line 6) | class BackboneConfigMixin(BackboneConfigMixin): class BackboneMixin (line 14) | class BackboneMixin(BackboneMixin): FILE: src/transformers/utils/chat_parsing_utils.py function _parse_re_match (line 29) | def _parse_re_match(node_match: re.Match) -> dict | str: function recursive_parse (line 43) | def recursive_parse( FILE: src/transformers/utils/chat_template_utils.py class TypeHintParsingException (line 72) | class TypeHintParsingException(Exception): class DocstringParsingException (line 76) | class DocstringParsingException(Exception): function _get_json_schema_type (line 80) | def _get_json_schema_type(param_type: type) -> dict[str, str]: function _parse_type_hint (line 98) | def _parse_type_hint(hint: str) -> dict: function _convert_type_hints_to_json_schema (line 177) | def _convert_type_hints_to_json_schema(func: Callable) -> dict: function parse_google_format_docstring (line 213) | def parse_google_format_docstring(docstring: str) -> tuple[str | None, d... function get_json_schema (line 246) | def get_json_schema(func: Callable) -> dict: function _get_template_variables (line 386) | def _get_template_variables(chat_template: str) -> frozenset[str]: function _render_with_assistant_indices (line 399) | def _render_with_assistant_indices( function _compile_jinja_template (line 418) | def _compile_jinja_template(chat_template): function _cached_compile_jinja_template (line 423) | def _cached_compile_jinja_template(chat_template): function render_jinja_template (line 496) | def render_jinja_template( function is_valid_message (line 598) | def is_valid_message(message): class Chat (line 609) | class Chat: method __init__ (line 614) | def __init__(self, messages: dict): FILE: src/transformers/utils/deprecation.py class Action (line 29) | class Action(ExplicitEnum): function deprecate_kwarg (line 36) | def deprecate_kwarg( FILE: src/transformers/utils/doc.py function get_docstring_indentation_level (line 27) | def get_docstring_indentation_level(func): function add_start_docstrings (line 38) | def add_start_docstrings(*docstr): function add_start_docstrings_to_model_forward (line 46) | def add_start_docstrings_to_model_forward(*docstr): function add_end_docstrings (line 82) | def add_end_docstrings(*docstr): function _get_indent (line 99) | def _get_indent(t): function _convert_output_args_doc (line 105) | def _convert_output_args_doc(output_args_doc): function _prepare_output_docstrings (line 131) | def _prepare_output_docstrings(output_type, config_class, min_indent=Non... function filter_outputs_from_example (line 955) | def filter_outputs_from_example(docstring, **kwargs): function add_code_sample_docstrings (line 969) | def add_code_sample_docstrings( function replace_return_docstrings (line 1063) | def replace_return_docstrings(output_type=None, config_class=None): function copy_func (line 1085) | def copy_func(f): FILE: src/transformers/utils/dummy_detectron2_objects.py class LayoutLMv2Model (line 5) | class LayoutLMv2Model: method __init__ (line 6) | def __init__(self, *args, **kwargs): method from_pretrained (line 10) | def from_pretrained(cls, *args, **kwargs): FILE: src/transformers/utils/dummy_essentia_and_librosa_and_pretty_midi_and_scipy_and_torch_objects.py class Pop2PianoFeatureExtractor (line 5) | class Pop2PianoFeatureExtractor(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): class Pop2PianoTokenizer (line 12) | class Pop2PianoTokenizer(metaclass=DummyObject): method __init__ (line 15) | def __init__(self, *args, **kwargs): class Pop2PianoProcessor (line 19) | class Pop2PianoProcessor(metaclass=DummyObject): method __init__ (line 22) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_mistral_common_objects.py class MistralCommonBackend (line 5) | class MistralCommonBackend(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_music_objects.py class Pop2PianoFeatureExtractor (line 5) | class Pop2PianoFeatureExtractor(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): class Pop2PianoTokenizer (line 12) | class Pop2PianoTokenizer(metaclass=DummyObject): method __init__ (line 15) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_pt_objects.py class Cache (line 5) | class Cache(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): class DynamicCache (line 12) | class DynamicCache(metaclass=DummyObject): method __init__ (line 15) | def __init__(self, *args, **kwargs): class EncoderDecoderCache (line 19) | class EncoderDecoderCache(metaclass=DummyObject): method __init__ (line 22) | def __init__(self, *args, **kwargs): class QuantizedCache (line 26) | class QuantizedCache(metaclass=DummyObject): method __init__ (line 29) | def __init__(self, *args, **kwargs): class StaticCache (line 33) | class StaticCache(metaclass=DummyObject): method __init__ (line 36) | def __init__(self, *args, **kwargs): class GlueDataset (line 40) | class GlueDataset(metaclass=DummyObject): method __init__ (line 43) | def __init__(self, *args, **kwargs): class GlueDataTrainingArguments (line 47) | class GlueDataTrainingArguments(metaclass=DummyObject): method __init__ (line 50) | def __init__(self, *args, **kwargs): class SquadDataset (line 54) | class SquadDataset(metaclass=DummyObject): method __init__ (line 57) | def __init__(self, *args, **kwargs): class SquadDataTrainingArguments (line 61) | class SquadDataTrainingArguments(metaclass=DummyObject): method __init__ (line 64) | def __init__(self, *args, **kwargs): class AlternatingCodebooksLogitsProcessor (line 68) | class AlternatingCodebooksLogitsProcessor(metaclass=DummyObject): method __init__ (line 71) | def __init__(self, *args, **kwargs): class BayesianDetectorConfig (line 75) | class BayesianDetectorConfig(metaclass=DummyObject): method __init__ (line 78) | def __init__(self, *args, **kwargs): class BayesianDetectorModel (line 82) | class BayesianDetectorModel(metaclass=DummyObject): method __init__ (line 85) | def __init__(self, *args, **kwargs): class BeamScorer (line 89) | class BeamScorer(metaclass=DummyObject): method __init__ (line 92) | def __init__(self, *args, **kwargs): class ClassifierFreeGuidanceLogitsProcessor (line 96) | class ClassifierFreeGuidanceLogitsProcessor(metaclass=DummyObject): method __init__ (line 99) | def __init__(self, *args, **kwargs): class ConstrainedBeamSearchScorer (line 103) | class ConstrainedBeamSearchScorer(metaclass=DummyObject): method __init__ (line 106) | def __init__(self, *args, **kwargs): class Constraint (line 110) | class Constraint(metaclass=DummyObject): method __init__ (line 113) | def __init__(self, *args, **kwargs): class ConstraintListState (line 117) | class ConstraintListState(metaclass=DummyObject): method __init__ (line 120) | def __init__(self, *args, **kwargs): class DisjunctiveConstraint (line 124) | class DisjunctiveConstraint(metaclass=DummyObject): method __init__ (line 127) | def __init__(self, *args, **kwargs): class EncoderNoRepeatNGramLogitsProcessor (line 131) | class EncoderNoRepeatNGramLogitsProcessor(metaclass=DummyObject): method __init__ (line 134) | def __init__(self, *args, **kwargs): class EncoderRepetitionPenaltyLogitsProcessor (line 138) | class EncoderRepetitionPenaltyLogitsProcessor(metaclass=DummyObject): method __init__ (line 141) | def __init__(self, *args, **kwargs): class EosTokenCriteria (line 145) | class EosTokenCriteria(metaclass=DummyObject): method __init__ (line 148) | def __init__(self, *args, **kwargs): class EpsilonLogitsWarper (line 152) | class EpsilonLogitsWarper(metaclass=DummyObject): method __init__ (line 155) | def __init__(self, *args, **kwargs): class EtaLogitsWarper (line 159) | class EtaLogitsWarper(metaclass=DummyObject): method __init__ (line 162) | def __init__(self, *args, **kwargs): class ExponentialDecayLengthPenalty (line 166) | class ExponentialDecayLengthPenalty(metaclass=DummyObject): method __init__ (line 169) | def __init__(self, *args, **kwargs): class ForcedBOSTokenLogitsProcessor (line 173) | class ForcedBOSTokenLogitsProcessor(metaclass=DummyObject): method __init__ (line 176) | def __init__(self, *args, **kwargs): class ForcedEOSTokenLogitsProcessor (line 180) | class ForcedEOSTokenLogitsProcessor(metaclass=DummyObject): method __init__ (line 183) | def __init__(self, *args, **kwargs): class GenerationMixin (line 187) | class GenerationMixin(metaclass=DummyObject): method __init__ (line 190) | def __init__(self, *args, **kwargs): class InfNanRemoveLogitsProcessor (line 194) | class InfNanRemoveLogitsProcessor(metaclass=DummyObject): method __init__ (line 197) | def __init__(self, *args, **kwargs): class LogitNormalization (line 201) | class LogitNormalization(metaclass=DummyObject): method __init__ (line 204) | def __init__(self, *args, **kwargs): class LogitsProcessor (line 208) | class LogitsProcessor(metaclass=DummyObject): method __init__ (line 211) | def __init__(self, *args, **kwargs): class LogitsProcessorList (line 215) | class LogitsProcessorList(metaclass=DummyObject): method __init__ (line 218) | def __init__(self, *args, **kwargs): class MaxLengthCriteria (line 222) | class MaxLengthCriteria(metaclass=DummyObject): method __init__ (line 225) | def __init__(self, *args, **kwargs): class MaxTimeCriteria (line 229) | class MaxTimeCriteria(metaclass=DummyObject): method __init__ (line 232) | def __init__(self, *args, **kwargs): class MinLengthLogitsProcessor (line 236) | class MinLengthLogitsProcessor(metaclass=DummyObject): method __init__ (line 239) | def __init__(self, *args, **kwargs): class MinNewTokensLengthLogitsProcessor (line 243) | class MinNewTokensLengthLogitsProcessor(metaclass=DummyObject): method __init__ (line 246) | def __init__(self, *args, **kwargs): class MinPLogitsWarper (line 250) | class MinPLogitsWarper(metaclass=DummyObject): method __init__ (line 253) | def __init__(self, *args, **kwargs): class NoBadWordsLogitsProcessor (line 257) | class NoBadWordsLogitsProcessor(metaclass=DummyObject): method __init__ (line 260) | def __init__(self, *args, **kwargs): class NoRepeatNGramLogitsProcessor (line 264) | class NoRepeatNGramLogitsProcessor(metaclass=DummyObject): method __init__ (line 267) | def __init__(self, *args, **kwargs): class PhrasalConstraint (line 271) | class PhrasalConstraint(metaclass=DummyObject): method __init__ (line 274) | def __init__(self, *args, **kwargs): class PrefixConstrainedLogitsProcessor (line 278) | class PrefixConstrainedLogitsProcessor(metaclass=DummyObject): method __init__ (line 281) | def __init__(self, *args, **kwargs): class RepetitionPenaltyLogitsProcessor (line 285) | class RepetitionPenaltyLogitsProcessor(metaclass=DummyObject): method __init__ (line 288) | def __init__(self, *args, **kwargs): class SequenceBiasLogitsProcessor (line 292) | class SequenceBiasLogitsProcessor(metaclass=DummyObject): method __init__ (line 295) | def __init__(self, *args, **kwargs): class StoppingCriteria (line 299) | class StoppingCriteria(metaclass=DummyObject): method __init__ (line 302) | def __init__(self, *args, **kwargs): class StoppingCriteriaList (line 306) | class StoppingCriteriaList(metaclass=DummyObject): method __init__ (line 309) | def __init__(self, *args, **kwargs): class StopStringCriteria (line 313) | class StopStringCriteria(metaclass=DummyObject): method __init__ (line 316) | def __init__(self, *args, **kwargs): class SuppressTokensAtBeginLogitsProcessor (line 320) | class SuppressTokensAtBeginLogitsProcessor(metaclass=DummyObject): method __init__ (line 323) | def __init__(self, *args, **kwargs): class SuppressTokensLogitsProcessor (line 327) | class SuppressTokensLogitsProcessor(metaclass=DummyObject): method __init__ (line 330) | def __init__(self, *args, **kwargs): class SynthIDTextWatermarkDetector (line 334) | class SynthIDTextWatermarkDetector(metaclass=DummyObject): method __init__ (line 337) | def __init__(self, *args, **kwargs): class SynthIDTextWatermarkingConfig (line 341) | class SynthIDTextWatermarkingConfig(metaclass=DummyObject): method __init__ (line 344) | def __init__(self, *args, **kwargs): class SynthIDTextWatermarkLogitsProcessor (line 348) | class SynthIDTextWatermarkLogitsProcessor(metaclass=DummyObject): method __init__ (line 351) | def __init__(self, *args, **kwargs): class TemperatureLogitsWarper (line 355) | class TemperatureLogitsWarper(metaclass=DummyObject): method __init__ (line 358) | def __init__(self, *args, **kwargs): class TopKLogitsWarper (line 362) | class TopKLogitsWarper(metaclass=DummyObject): method __init__ (line 365) | def __init__(self, *args, **kwargs): class TopPLogitsWarper (line 369) | class TopPLogitsWarper(metaclass=DummyObject): method __init__ (line 372) | def __init__(self, *args, **kwargs): class TypicalLogitsWarper (line 376) | class TypicalLogitsWarper(metaclass=DummyObject): method __init__ (line 379) | def __init__(self, *args, **kwargs): class UnbatchedClassifierFreeGuidanceLogitsProcessor (line 383) | class UnbatchedClassifierFreeGuidanceLogitsProcessor(metaclass=DummyObje... method __init__ (line 386) | def __init__(self, *args, **kwargs): class WatermarkDetector (line 390) | class WatermarkDetector(metaclass=DummyObject): method __init__ (line 393) | def __init__(self, *args, **kwargs): class WatermarkLogitsProcessor (line 397) | class WatermarkLogitsProcessor(metaclass=DummyObject): method __init__ (line 400) | def __init__(self, *args, **kwargs): class WhisperTimeStampLogitsProcessor (line 404) | class WhisperTimeStampLogitsProcessor(metaclass=DummyObject): method __init__ (line 407) | def __init__(self, *args, **kwargs): class TorchExportableModuleWithStaticCache (line 411) | class TorchExportableModuleWithStaticCache(metaclass=DummyObject): method __init__ (line 414) | def __init__(self, *args, **kwargs): function convert_and_export_with_cache (line 418) | def convert_and_export_with_cache(*args, **kwargs): class AttentionMaskInterface (line 422) | class AttentionMaskInterface(metaclass=DummyObject): method __init__ (line 425) | def __init__(self, *args, **kwargs): function model_addition_debugger_context (line 429) | def model_addition_debugger_context(*args, **kwargs): class GradientCheckpointingLayer (line 433) | class GradientCheckpointingLayer(metaclass=DummyObject): method __init__ (line 436) | def __init__(self, *args, **kwargs): function dynamic_rope_update (line 443) | def dynamic_rope_update(*args, **kwargs): class AttentionInterface (line 447) | class AttentionInterface(metaclass=DummyObject): method __init__ (line 450) | def __init__(self, *args, **kwargs): class PreTrainedModel (line 454) | class PreTrainedModel(metaclass=DummyObject): method __init__ (line 457) | def __init__(self, *args, **kwargs): class Adafactor (line 461) | class Adafactor(metaclass=DummyObject): method __init__ (line 464) | def __init__(self, *args, **kwargs): function get_constant_schedule (line 468) | def get_constant_schedule(*args, **kwargs): function get_constant_schedule_with_warmup (line 472) | def get_constant_schedule_with_warmup(*args, **kwargs): function get_cosine_schedule_with_warmup (line 476) | def get_cosine_schedule_with_warmup(*args, **kwargs): function get_cosine_with_hard_restarts_schedule_with_warmup (line 480) | def get_cosine_with_hard_restarts_schedule_with_warmup(*args, **kwargs): function get_inverse_sqrt_schedule (line 484) | def get_inverse_sqrt_schedule(*args, **kwargs): function get_linear_schedule_with_warmup (line 488) | def get_linear_schedule_with_warmup(*args, **kwargs): function get_polynomial_decay_schedule_with_warmup (line 492) | def get_polynomial_decay_schedule_with_warmup(*args, **kwargs): function get_scheduler (line 496) | def get_scheduler(*args, **kwargs): function get_wsd_schedule (line 500) | def get_wsd_schedule(*args, **kwargs): class Conv1D (line 504) | class Conv1D(metaclass=DummyObject): method __init__ (line 507) | def __init__(self, *args, **kwargs): function apply_chunking_to_forward (line 511) | def apply_chunking_to_forward(*args, **kwargs): class Trainer (line 515) | class Trainer(metaclass=DummyObject): method __init__ (line 518) | def __init__(self, *args, **kwargs): function torch_distributed_zero_first (line 522) | def torch_distributed_zero_first(*args, **kwargs): class Seq2SeqTrainer (line 526) | class Seq2SeqTrainer(metaclass=DummyObject): method __init__ (line 529) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_sentencepiece_and_tokenizers_objects.py function convert_slow_tokenizer (line 8) | def convert_slow_tokenizer(*args, **kwargs): FILE: src/transformers/utils/dummy_speech_objects.py class ASTFeatureExtractor (line 5) | class ASTFeatureExtractor(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): class Speech2TextFeatureExtractor (line 12) | class Speech2TextFeatureExtractor(metaclass=DummyObject): method __init__ (line 15) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_timm_and_torchvision_objects.py class TimmWrapperImageProcessor (line 5) | class TimmWrapperImageProcessor(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_tokenizers_objects.py class PreTrainedTokenizerFast (line 5) | class PreTrainedTokenizerFast(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_torchaudio_objects.py class GraniteSpeechFeatureExtractor (line 5) | class GraniteSpeechFeatureExtractor(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): class GraniteSpeechProcessor (line 12) | class GraniteSpeechProcessor(metaclass=DummyObject): method __init__ (line 15) | def __init__(self, *args, **kwargs): class MusicgenMelodyFeatureExtractor (line 19) | class MusicgenMelodyFeatureExtractor(metaclass=DummyObject): method __init__ (line 22) | def __init__(self, *args, **kwargs): class MusicgenMelodyProcessor (line 26) | class MusicgenMelodyProcessor(metaclass=DummyObject): method __init__ (line 29) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_torchvision_objects.py class TorchvisionBackend (line 5) | class TorchvisionBackend(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): class BaseVideoProcessor (line 12) | class BaseVideoProcessor(metaclass=DummyObject): method __init__ (line 15) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/dummy_vision_objects.py class ImageProcessingMixin (line 5) | class ImageProcessingMixin(metaclass=DummyObject): method __init__ (line 8) | def __init__(self, *args, **kwargs): class BaseImageProcessor (line 12) | class BaseImageProcessor(metaclass=DummyObject): method __init__ (line 15) | def __init__(self, *args, **kwargs): class ImageFeatureExtractionMixin (line 19) | class ImageFeatureExtractionMixin(metaclass=DummyObject): method __init__ (line 22) | def __init__(self, *args, **kwargs): FILE: src/transformers/utils/generic.py function _register_model_output_pytree_node (line 54) | def _register_model_output_pytree_node(output_type: type[ModelOutput]) -... function strtobool (line 76) | def strtobool(val) -> int: function infer_framework_from_repr (line 90) | def infer_framework_from_repr(x) -> str | None: function _get_frameworks_and_test_func (line 104) | def _get_frameworks_and_test_func(x): function is_tensor (line 123) | def is_tensor(x) -> bool: function is_numpy_array (line 140) | def is_numpy_array(x) -> bool: function is_torch_tensor (line 147) | def is_torch_tensor(x) -> bool: function is_torch_device (line 159) | def is_torch_device(x) -> bool: function is_torch_dtype (line 171) | def is_torch_dtype(x) -> bool: function _is_tensor_or_array_like (line 188) | def _is_tensor_or_array_like(value): function maybe_autocast (line 208) | def maybe_autocast( function _is_mlx (line 237) | def _is_mlx(x): function is_mlx_array (line 243) | def is_mlx_array(x) -> bool: function is_flash_attention_requested (line 250) | def is_flash_attention_requested( function to_py_obj (line 286) | def to_py_obj(obj): function to_numpy (line 320) | def to_numpy(obj): function safe_load_json_file (line 344) | def safe_load_json_file(json_file: str): class ModelOutput (line 355) | class ModelOutput(OrderedDict): method __init_subclass__ (line 369) | def __init_subclass__(cls) -> None: method __init__ (line 377) | def __init__(self, *args, **kwargs): method __post_init__ (line 393) | def __post_init__(self): method __delitem__ (line 449) | def __delitem__(self, *args, **kwargs): method setdefault (line 452) | def setdefault(self, *args, **kwargs): method pop (line 455) | def pop(self, *args, **kwargs): method update (line 458) | def update(self, *args, **kwargs): method __getitem__ (line 461) | def __getitem__(self, k): method __setattr__ (line 468) | def __setattr__(self, name, value): method __setitem__ (line 475) | def __setitem__(self, key, value): method __reduce__ (line 481) | def __reduce__(self): method to_tuple (line 488) | def to_tuple(self) -> tuple: function _model_output_flatten (line 495) | def _model_output_flatten(output: ModelOutput) -> tuple[list[Any], list[... function _model_output_unflatten (line 499) | def _model_output_unflatten( class ExplicitEnum (line 507) | class ExplicitEnum(str, Enum): method _missing_ (line 513) | def _missing_(cls, value): class PaddingStrategy (line 519) | class PaddingStrategy(ExplicitEnum): class TensorType (line 530) | class TensorType(ExplicitEnum): class ContextManagers (line 541) | class ContextManagers: method __init__ (line 547) | def __init__(self, context_managers: list[AbstractContextManager]): method __enter__ (line 551) | def __enter__(self): method __exit__ (line 555) | def __exit__(self, *args, **kwargs): function can_return_loss (line 559) | def can_return_loss(model_class): function find_labels (line 575) | def find_labels(model_class): function flatten_dict (line 591) | def flatten_dict(d: MutableMapping, parent_key: str = "", delimiter: str... function transpose (line 605) | def transpose(array, axes=None): function reshape (line 617) | def reshape(array, newshape): function squeeze (line 629) | def squeeze(array, axis=None): function expand_dims (line 641) | def expand_dims(array, axis): function tensor_size (line 653) | def tensor_size(array): function torch_int (line 665) | def torch_int(x): function torch_float (line 677) | def torch_float(x): function filter_out_non_signature_kwargs (line 689) | def filter_out_non_signature_kwargs(extra: list | None = None): class TransformersKwargs (line 768) | class TransformersKwargs(TypedDict, total=False): function is_timm_config_dict (line 807) | def is_timm_config_dict(config_dict: dict[str, Any]) -> bool: function is_timm_local_checkpoint (line 812) | def is_timm_local_checkpoint(pretrained_model_path: str) -> bool: function set_attribute_for_modules (line 840) | def set_attribute_for_modules(module: nn.Module, key: str, value: Any): function del_attribute_from_modules (line 849) | def del_attribute_from_modules(module: nn.Module, key: str): function can_return_tuple (line 861) | def can_return_tuple(func): function merge_with_config_defaults (line 884) | def merge_with_config_defaults(func): function check_model_inputs (line 969) | def check_model_inputs(func): class GeneralInterface (line 974) | class GeneralInterface(MutableMapping): method __init__ (line 984) | def __init__(self): method __getitem__ (line 987) | def __getitem__(self, key): method __setitem__ (line 993) | def __setitem__(self, key, value): method __delitem__ (line 997) | def __delitem__(self, key): method __iter__ (line 1000) | def __iter__(self): method __len__ (line 1004) | def __len__(self): method register (line 1008) | def register(cls, key: str, value: Callable): method valid_keys (line 1011) | def valid_keys(self) -> list[str]: FILE: src/transformers/utils/hp_naming.py class TrialShortNamer (line 19) | class TrialShortNamer: method set_defaults (line 25) | def set_defaults(cls, prefix, defaults): method shortname_for_word (line 31) | def shortname_for_word(info, word): method shortname_for_key (line 70) | def shortname_for_key(info, param_name): method add_new_param_name (line 89) | def add_new_param_name(info, param_name): method build_naming_info (line 95) | def build_naming_info(cls): method shortname (line 114) | def shortname(cls, params): method parse_repr (line 138) | def parse_repr(cls, repr): FILE: src/transformers/utils/hub.py class DownloadKwargs (line 76) | class DownloadKwargs(TypedDict, total=False): function _get_cache_file_to_return (line 100) | def _get_cache_file_to_return( function list_repo_templates (line 116) | def list_repo_templates( function define_sagemaker_information (line 161) | def define_sagemaker_information(): function http_user_agent (line 188) | def http_user_agent(user_agent: dict | str | None = None) -> str: function extract_commit_hash (line 209) | def extract_commit_hash(resolved_file: str | None, commit_hash: str | No... function cached_file (line 223) | def cached_file( function cached_files (line 283) | def cached_files( function has_file (line 541) | def has_file( class PushToHubMixin (line 626) | class PushToHubMixin: method _get_files_timestamps (line 631) | def _get_files_timestamps(self, working_dir: str | os.PathLike): method _upload_modified_files (line 637) | def _upload_modified_files( method save_pretrained (line 716) | def save_pretrained(self, *args, **kwargs): method push_to_hub (line 720) | def push_to_hub( function convert_file_size_to_int (line 803) | def convert_file_size_to_int(size: int | str): function get_checkpoint_shard_files (line 836) | def get_checkpoint_shard_files( function create_and_tag_model_card (line 897) | def create_and_tag_model_card(repo_id: str, tags: list[str] | None = Non... class PushInProgress (line 929) | class PushInProgress: method __init__ (line 934) | def __init__(self, jobs: futures.Future | None = None) -> None: method is_done (line 937) | def is_done(self): method wait_until_done (line 940) | def wait_until_done(self): method cancel (line 943) | def cancel(self) -> None: FILE: src/transformers/utils/import_utils.py function _is_package_available (line 50) | def _is_package_available(pkg_name: str, return_version: bool = False) -... function resolve_internal_import (line 83) | def resolve_internal_import(module: ModuleType | None, chained_path: str... function is_env_variable_true (line 113) | def is_env_variable_true(env_variable: str) -> bool: function is_env_variable_false (line 118) | def is_env_variable_false(env_variable: str) -> bool: function is_torch_available (line 144) | def is_torch_available() -> bool: function get_torch_version (line 156) | def get_torch_version() -> str: function is_torch_greater_or_equal (line 162) | def is_torch_greater_or_equal(library_version: str, accept_dev: bool = F... function is_torch_less_or_equal (line 178) | def is_torch_less_or_equal(library_version: str, accept_dev: bool = Fals... function is_torch_accelerator_available (line 194) | def is_torch_accelerator_available() -> bool: function is_torch_cuda_available (line 204) | def is_torch_cuda_available() -> bool: function is_cuda_platform (line 213) | def is_cuda_platform() -> bool: function get_cuda_runtime_version (line 222) | def get_cuda_runtime_version() -> tuple[int, int]: function is_rocm_platform (line 238) | def is_rocm_platform() -> bool: function is_habana_gaudi1 (line 247) | def is_habana_gaudi1() -> bool: function is_torch_mps_available (line 258) | def is_torch_mps_available(min_version: str | None = None) -> bool: function is_torch_npu_available (line 271) | def is_torch_npu_available(check_device=False) -> bool: function is_torch_xpu_available (line 292) | def is_torch_xpu_available(check_device: bool = False) -> bool: function is_torch_mlu_available (line 317) | def is_torch_mlu_available() -> bool: function is_torch_musa_available (line 342) | def is_torch_musa_available(check_device=False) -> bool: function is_torch_xla_available (line 368) | def is_torch_xla_available(check_is_tpu=False, check_is_gpu=False) -> bool: function is_torch_hpu_available (line 390) | def is_torch_hpu_available() -> bool: function is_torch_neuron_available (line 486) | def is_torch_neuron_available(check_device: bool = False) -> bool: function is_torch_bf16_gpu_available (line 508) | def is_torch_bf16_gpu_available() -> bool: function is_torch_fp16_available_on_device (line 535) | def is_torch_fp16_available_on_device(device: str) -> bool: function is_torch_bf16_available_on_device (line 562) | def is_torch_bf16_available_on_device(device: str) -> bool: function is_torch_tf32_available (line 583) | def is_torch_tf32_available() -> bool: function enable_tf32 (line 603) | def enable_tf32(enable: bool) -> None: function is_torch_flex_attn_available (line 628) | def is_torch_flex_attn_available() -> bool: function is_grouped_mm_available (line 633) | def is_grouped_mm_available() -> bool: function is_kenlm_available (line 638) | def is_kenlm_available() -> bool: function is_kernels_available (line 643) | def is_kernels_available(MIN_VERSION: str = KERNELS_MIN_VERSION) -> bool: function is_cv2_available (line 649) | def is_cv2_available() -> bool: function is_yt_dlp_available (line 654) | def is_yt_dlp_available() -> bool: function is_libcst_available (line 659) | def is_libcst_available() -> bool: function is_accelerate_available (line 664) | def is_accelerate_available(min_version: str = ACCELERATE_MIN_VERSION) -... function is_triton_available (line 672) | def is_triton_available(min_version: str = TRITON_MIN_VERSION) -> bool: function is_hadamard_available (line 678) | def is_hadamard_available() -> bool: function is_hqq_available (line 683) | def is_hqq_available(min_version: str = HQQ_MIN_VERSION) -> bool: function is_pygments_available (line 689) | def is_pygments_available() -> bool: function is_torchvision_available (line 694) | def is_torchvision_available() -> bool: function is_torchvision_v2_available (line 699) | def is_torchvision_v2_available() -> bool: function is_galore_torch_available (line 704) | def is_galore_torch_available() -> bool: function is_apollo_torch_available (line 709) | def is_apollo_torch_available() -> bool: function is_torch_optimi_available (line 714) | def is_torch_optimi_available() -> bool: function is_lomo_available (line 719) | def is_lomo_available() -> bool: function is_grokadamw_available (line 724) | def is_grokadamw_available() -> bool: function is_schedulefree_available (line 729) | def is_schedulefree_available(min_version: str = SCHEDULEFREE_MIN_VERSIO... function is_pyctcdecode_available (line 735) | def is_pyctcdecode_available() -> bool: function is_librosa_available (line 740) | def is_librosa_available() -> bool: function is_multipart_available (line 745) | def is_multipart_available() -> bool: function is_essentia_available (line 750) | def is_essentia_available() -> bool: function is_pydantic_available (line 755) | def is_pydantic_available() -> bool: function is_fastapi_available (line 760) | def is_fastapi_available() -> bool: function is_uvicorn_available (line 765) | def is_uvicorn_available() -> bool: function is_openai_available (line 770) | def is_openai_available() -> bool: function is_serve_available (line 775) | def is_serve_available() -> bool: function is_pretty_midi_available (line 780) | def is_pretty_midi_available() -> bool: function is_mamba_ssm_available (line 785) | def is_mamba_ssm_available() -> bool: function is_mamba_2_ssm_available (line 790) | def is_mamba_2_ssm_available() -> bool: function is_flash_linear_attention_available (line 796) | def is_flash_linear_attention_available(): function is_causal_conv1d_available (line 802) | def is_causal_conv1d_available() -> bool: function is_xlstm_available (line 807) | def is_xlstm_available() -> bool: function is_mambapy_available (line 812) | def is_mambapy_available() -> bool: function is_peft_available (line 817) | def is_peft_available() -> bool: function is_bs4_available (line 822) | def is_bs4_available() -> bool: function is_coloredlogs_available (line 827) | def is_coloredlogs_available() -> bool: function is_onnx_available (line 832) | def is_onnx_available() -> bool: function is_flute_available (line 837) | def is_flute_available() -> bool: function is_g2p_en_available (line 843) | def is_g2p_en_available() -> bool: function is_torch_neuroncore_available (line 848) | def is_torch_neuroncore_available(check_device=True) -> bool: function is_torch_tensorrt_fx_available (line 853) | def is_torch_tensorrt_fx_available() -> bool: function is_datasets_available (line 858) | def is_datasets_available() -> bool: function is_detectron2_available (line 863) | def is_detectron2_available() -> bool: function is_rjieba_available (line 876) | def is_rjieba_available() -> bool: function is_psutil_available (line 881) | def is_psutil_available() -> bool: function is_py3nvml_available (line 886) | def is_py3nvml_available() -> bool: function is_sacremoses_available (line 891) | def is_sacremoses_available() -> bool: function is_apex_available (line 896) | def is_apex_available() -> bool: function is_aqlm_available (line 901) | def is_aqlm_available() -> bool: function is_vptq_available (line 906) | def is_vptq_available(min_version: str = VPTQ_MIN_VERSION) -> bool: function is_av_available (line 912) | def is_av_available() -> bool: function is_decord_available (line 917) | def is_decord_available() -> bool: function is_torchcodec_available (line 922) | def is_torchcodec_available() -> bool: function is_ninja_available (line 927) | def is_ninja_available() -> bool: function is_bitsandbytes_available (line 941) | def is_bitsandbytes_available(min_version: str = BITSANDBYTES_MIN_VERSIO... function is_flash_attn_2_available (line 947) | def is_flash_attn_2_available() -> bool: function is_flash_attn_3_available (line 965) | def is_flash_attn_3_available() -> bool: function is_flash_attn_4_available (line 976) | def is_flash_attn_4_available() -> bool: function is_flash_attn_greater_or_equal (line 989) | def is_flash_attn_greater_or_equal(library_version: str) -> bool: function is_flash_attn_greater_or_equal_2_10 (line 1005) | def is_flash_attn_greater_or_equal_2_10() -> bool: function is_huggingface_hub_greater_or_equal (line 1015) | def is_huggingface_hub_greater_or_equal(library_version: str, accept_dev... function is_quanto_greater (line 1027) | def is_quanto_greater(library_version: str, accept_dev: bool = False) ->... function is_torchdistx_available (line 1044) | def is_torchdistx_available(): function is_faiss_available (line 1049) | def is_faiss_available() -> bool: function is_fouroversix_available (line 1054) | def is_fouroversix_available() -> bool: function is_scipy_available (line 1059) | def is_scipy_available() -> bool: function is_sklearn_available (line 1064) | def is_sklearn_available() -> bool: function is_sentencepiece_available (line 1069) | def is_sentencepiece_available() -> bool: function is_seqio_available (line 1074) | def is_seqio_available() -> bool: function is_gguf_available (line 1079) | def is_gguf_available(min_version: str = GGUF_MIN_VERSION) -> bool: function is_protobuf_available (line 1085) | def is_protobuf_available() -> bool: function is_fsdp_available (line 1090) | def is_fsdp_available(min_version: str = FSDP_MIN_VERSION) -> bool: function is_optimum_available (line 1095) | def is_optimum_available() -> bool: function is_llm_awq_available (line 1100) | def is_llm_awq_available() -> bool: function is_auto_round_available (line 1105) | def is_auto_round_available(min_version: str = AUTOROUND_MIN_VERSION) ->... function is_optimum_quanto_available (line 1111) | def is_optimum_quanto_available(): function is_quark_available (line 1116) | def is_quark_available() -> bool: function is_fp_quant_available (line 1121) | def is_fp_quant_available(): function is_qutlass_available (line 1127) | def is_qutlass_available(): function is_compressed_tensors_available (line 1133) | def is_compressed_tensors_available() -> bool: function is_sinq_available (line 1138) | def is_sinq_available() -> bool: function is_gptqmodel_available (line 1143) | def is_gptqmodel_available() -> bool: function is_fbgemm_gpu_available (line 1148) | def is_fbgemm_gpu_available() -> bool: function is_levenshtein_available (line 1153) | def is_levenshtein_available() -> bool: function is_optimum_neuron_available (line 1158) | def is_optimum_neuron_available() -> bool: function is_tokenizers_available (line 1163) | def is_tokenizers_available() -> bool: function is_vision_available (line 1168) | def is_vision_available() -> bool: function is_pytesseract_available (line 1178) | def is_pytesseract_available() -> bool: function is_pytest_available (line 1183) | def is_pytest_available() -> bool: function is_pytest_order_available (line 1188) | def is_pytest_order_available() -> bool: function is_spacy_available (line 1193) | def is_spacy_available() -> bool: function is_pytorch_quantization_available (line 1198) | def is_pytorch_quantization_available() -> bool: function is_pandas_available (line 1203) | def is_pandas_available() -> bool: function is_soundfile_available (line 1208) | def is_soundfile_available() -> bool: function is_timm_available (line 1213) | def is_timm_available() -> bool: function is_natten_available (line 1218) | def is_natten_available() -> bool: function is_nltk_available (line 1223) | def is_nltk_available() -> bool: function is_numba_available (line 1228) | def is_numba_available() -> bool: function is_torchaudio_available (line 1238) | def is_torchaudio_available() -> bool: function is_torchao_available (line 1243) | def is_torchao_available(min_version: str = TORCHAO_MIN_VERSION) -> bool: function is_speech_available (line 1251) | def is_speech_available() -> bool: function is_spqr_available (line 1257) | def is_spqr_available() -> bool: function is_phonemizer_available (line 1262) | def is_phonemizer_available() -> bool: function is_uroman_available (line 1267) | def is_uroman_available() -> bool: function is_sudachi_available (line 1272) | def is_sudachi_available() -> bool: function is_sudachi_projection_available (line 1277) | def is_sudachi_projection_available() -> bool: function is_jumanpp_available (line 1283) | def is_jumanpp_available() -> bool: function is_cython_available (line 1288) | def is_cython_available() -> bool: function is_jinja_available (line 1293) | def is_jinja_available() -> bool: function is_jmespath_available (line 1298) | def is_jmespath_available() -> bool: function is_mlx_available (line 1303) | def is_mlx_available() -> bool: function is_num2words_available (line 1308) | def is_num2words_available() -> bool: function is_tiktoken_available (line 1313) | def is_tiktoken_available(with_blobfile: bool = True) -> bool: function is_liger_kernel_available (line 1320) | def is_liger_kernel_available() -> bool: function is_rich_available (line 1326) | def is_rich_available() -> bool: function is_matplotlib_available (line 1331) | def is_matplotlib_available() -> bool: function is_mistral_common_available (line 1336) | def is_mistral_common_available() -> bool: function is_opentelemetry_available (line 1341) | def is_opentelemetry_available() -> bool: function is_pynvml_available (line 1351) | def is_pynvml_available() -> bool: function check_torch_load_is_safe (line 1355) | def check_torch_load_is_safe() -> None: function torch_only_method (line 1365) | def torch_only_method(fn: Callable) -> Callable: function is_torch_deterministic (line 1375) | def is_torch_deterministic() -> bool: function get_torch_major_and_minor_version (line 1391) | def get_torch_major_and_minor_version() -> str: function is_torchdynamo_compiling (line 1399) | def is_torchdynamo_compiling() -> bool: function is_torchdynamo_exporting (line 1412) | def is_torchdynamo_exporting() -> bool: function is_torch_fx_proxy (line 1423) | def is_torch_fx_proxy(x) -> bool: function is_fake_tensor (line 1432) | def is_fake_tensor(x) -> bool: function is_jax_jitting (line 1441) | def is_jax_jitting(x): function is_jit_tracing (line 1469) | def is_jit_tracing() -> bool: function is_cuda_stream_capturing (line 1478) | def is_cuda_stream_capturing() -> bool: function is_tracing (line 1487) | def is_tracing(tensor=None) -> bool: function torch_compilable_check (line 1502) | def torch_compilable_check(cond: Any, msg: str | Callable[[], str], erro... function is_in_notebook (line 1544) | def is_in_notebook() -> bool: function is_sagemaker_dp_enabled (line 1564) | def is_sagemaker_dp_enabled() -> bool: function is_sagemaker_mp_enabled (line 1578) | def is_sagemaker_mp_enabled() -> bool: function is_training_run_on_sagemaker (line 1602) | def is_training_run_on_sagemaker() -> bool: function requires_backends (line 1990) | def requires_backends(obj, backends): class DummyObject (line 2024) | class DummyObject(type): method __getattribute__ (line 2032) | def __getattribute__(cls, key): class _LazyModule (line 2042) | class _LazyModule(ModuleType): method __init__ (line 2049) | def __init__( method __dir__ (line 2149) | def __dir__(self): method __getattr__ (line 2158) | def __getattr__(self, name: str) -> Any: method _get_module (line 2437) | def _get_module(self, module_name: str): method __reduce__ (line 2443) | def __reduce__(self): class OptionalDependencyNotAvailable (line 2447) | class OptionalDependencyNotAvailable(BaseException): function direct_transformers_import (line 2451) | def direct_transformers_import(path: str, file="__init__.py") -> ModuleT... class VersionComparison (line 2472) | class VersionComparison(Enum): method from_string (line 2481) | def from_string(version_string: str) -> "VersionComparison": function split_package_version (line 2496) | def split_package_version(package_version_str) -> tuple[str, str, str]: class Backend (line 2505) | class Backend: method __init__ (line 2506) | def __init__(self, backend_requirement: str): method get_installed_version (line 2514) | def get_installed_version(self) -> str: method is_satisfied (line 2521) | def is_satisfied(self) -> bool: method __repr__ (line 2526) | def __repr__(self) -> str: method error_message (line 2530) | def error_message(self): function requires (line 2537) | def requires(*, backends=()): function fetch__all__ (line 2590) | def fetch__all__(file_content) -> list[str]: function create_import_structure_from_path (line 2633) | def create_import_structure_from_path(module_path): function spread_import_structure (line 2830) | def spread_import_structure(nested_import_structure): function define_import_structure (line 2957) | def define_import_structure(module_path: str, prefix: str | None = None)... function clear_import_cache (line 2990) | def clear_import_cache() -> None: FILE: src/transformers/utils/kernel_config.py function infer_device (line 18) | def infer_device(model): function add_to_mapping (line 58) | def add_to_mapping(layer_name, device, repo_name, mode, compatible_mappi... function add_to_mapping_local (line 75) | def add_to_mapping_local(layer_name, device, repo_name, mode, compatible... class KernelConfig (line 96) | class KernelConfig(PushToHubMixin): method __init__ (line 101) | def __init__(self, kernel_mapping=None, use_local_kernel=False): method update_kernel (line 106) | def update_kernel(self, repo_id, registered_name, layer_name, device, ... method store_registered_layer_names (line 119) | def store_registered_layer_names(self, model): method sanitize_kernel_mapping (line 124) | def sanitize_kernel_mapping(self, model): method create_compatible_mapping (line 207) | def create_compatible_mapping(self, model, compile=False): FILE: src/transformers/utils/loading_report.py function _pattern_of (line 26) | def _pattern_of(key: str) -> str: function _fmt_indices (line 31) | def _fmt_indices(values: list[int], cutoff=10) -> str: function update_key_name (line 41) | def update_key_name(mapping: dict[str, Any]) -> dict[str, Any]: function _strip_ansi (line 89) | def _strip_ansi(s: str) -> str: function _pad (line 93) | def _pad(text, width): function _make_table (line 99) | def _make_table(rows, headers): function _style (line 121) | def _style(s, color): function _get_terminal_width (line 129) | def _get_terminal_width(default=80): class LoadStateDictInfo (line 137) | class LoadStateDictInfo: method missing_and_mismatched (line 161) | def missing_and_mismatched(self): method to_dict (line 165) | def to_dict(self): method create_loading_report (line 174) | def create_loading_report(self) -> str | None: function log_state_dict_report (line 236) | def log_state_dict_report( FILE: src/transformers/utils/logging.py function _get_default_logging_level (line 59) | def _get_default_logging_level(): function _get_library_name (line 76) | def _get_library_name() -> str: function _get_library_root_logger (line 80) | def _get_library_root_logger() -> logging.Logger: function _configure_library_root_logger (line 84) | def _configure_library_root_logger() -> None: function _reset_library_root_logger (line 112) | def _reset_library_root_logger() -> None: function get_log_levels_dict (line 125) | def get_log_levels_dict(): function captureWarnings (line 129) | def captureWarnings(capture): function get_logger (line 152) | def get_logger(name: str | None = None) -> TransformersLogger: function get_verbosity (line 166) | def get_verbosity() -> int: function set_verbosity (line 189) | def set_verbosity(verbosity: int) -> None: function set_verbosity_info (line 208) | def set_verbosity_info(): function set_verbosity_warning (line 213) | def set_verbosity_warning(): function set_verbosity_debug (line 218) | def set_verbosity_debug(): function set_verbosity_error (line 223) | def set_verbosity_error(): function disable_default_handler (line 228) | def disable_default_handler() -> None: function enable_default_handler (line 237) | def enable_default_handler() -> None: function add_handler (line 246) | def add_handler(handler: logging.Handler) -> None: function remove_handler (line 255) | def remove_handler(handler: logging.Handler) -> None: function disable_propagation (line 264) | def disable_propagation() -> None: function enable_propagation (line 273) | def enable_propagation() -> None: function enable_explicit_format (line 283) | def enable_explicit_format() -> None: function reset_format (line 298) | def reset_format() -> None: function warning_advice (line 310) | def warning_advice(self, *args, **kwargs): function warning_once (line 325) | def warning_once(self, *args, **kwargs): function info_once (line 340) | def info_once(self, *args, **kwargs): class EmptyTqdm (line 354) | class EmptyTqdm: method __init__ (line 357) | def __init__(self, *args, **kwargs): # pylint: disable=unused-argument method __iter__ (line 360) | def __iter__(self): method __getattr__ (line 363) | def __getattr__(self, _): method __enter__ (line 371) | def __enter__(self): method __exit__ (line 374) | def __exit__(self, type_, value, traceback): class _tqdm_cls (line 378) | class _tqdm_cls: method __call__ (line 379) | def __call__(self, *args, **kwargs): method set_lock (line 385) | def set_lock(self, *args, **kwargs): method get_lock (line 390) | def get_lock(self): function is_progress_bar_enabled (line 398) | def is_progress_bar_enabled() -> bool: function enable_progress_bar (line 403) | def enable_progress_bar(): function disable_progress_bar (line 410) | def disable_progress_bar(): function set_tqdm_hook (line 417) | def set_tqdm_hook(hook: Callable[[Callable[..., Any], tuple[Any, ...], d... FILE: src/transformers/utils/metrics.py class RequestStatus (line 11) | class RequestStatus(Enum): function attach_tracer (line 32) | def attach_tracer(tracer_name_template=None): function traced (line 79) | def traced( class ContinuousBatchProcessorMetrics (line 171) | class ContinuousBatchProcessorMetrics: method __init__ (line 174) | def __init__(self, max_batch_tokens: int): method _setup_metrics (line 184) | def _setup_metrics(self): method record_ttft_metric (line 269) | def record_ttft_metric(self, created_time: float, request_id: str) -> ... method record_batch_metrics (line 288) | def record_batch_metrics(self, requests_in_batch: list) -> None: method record_kv_cache_memory_metrics (line 330) | def record_kv_cache_memory_metrics(self, cache) -> None: method record_queue_metrics (line 370) | def record_queue_metrics(self, active_requests: int, waiting_requests:... method record_request_completion (line 388) | def record_request_completion(self, created_time: float, request_id: s... FILE: src/transformers/utils/network_logging.py class _NetworkRequestTrace (line 32) | class _NetworkRequestTrace: method __init__ (line 33) | def __init__(self, request: httpx.Request): method trace (line 39) | def trace(self, name: str, info: dict[str, Any]) -> None: method build_record (line 53) | def build_record( class _NetworkDebugProfiler (line 107) | class _NetworkDebugProfiler: method __init__ (line 108) | def __init__(self): method enabled (line 118) | def enabled(self) -> bool: method clear (line 121) | def clear(self) -> None: method enable (line 125) | def enable(self, output_path: str | os.PathLike | None = None) -> None: method setup_shared_dir (line 152) | def setup_shared_dir(self) -> str | None: method set_shared_dir (line 160) | def set_shared_dir(self, shared_dir: str) -> None: method dump_worker_records (line 164) | def dump_worker_records(self, worker_id: str | None = None) -> None: method load_worker_records (line 174) | def load_worker_records(self) -> None: method cleanup_shared_dir (line 190) | def cleanup_shared_dir(self) -> None: method disable (line 198) | def disable(self) -> None: method _append_record (line 210) | def _append_record(self, record: dict[str, Any]) -> None: method _wrap_trace_callback (line 214) | def _wrap_trace_callback(self, request: httpx.Request, trace: _Network... method _awrap_trace_callback (line 225) | async def _awrap_trace_callback(self, request: httpx.Request, trace: _... method _send_with_trace (line 239) | def _send_with_trace(self, original_send, client, request: httpx.Reque... method _async_send_with_trace (line 253) | async def _async_send_with_trace(self, original_send, client, request:... method build_report (line 267) | def build_report(self) -> dict[str, Any]: method maybe_write_report (line 321) | def maybe_write_report(self) -> str | None: function _parse_network_debug_env (line 337) | def _parse_network_debug_env() -> tuple[bool, str]: function _enable_network_debug_report (line 348) | def _enable_network_debug_report(output_path: str | os.PathLike | None =... function _disable_network_debug_report (line 352) | def _disable_network_debug_report() -> None: function _clear_network_debug_report (line 356) | def _clear_network_debug_report() -> None: function _get_network_debug_report (line 360) | def _get_network_debug_report() -> dict[str, Any]: function _enable_network_debug_report_from_env (line 364) | def _enable_network_debug_report_from_env() -> bool: function _format_network_debug_report (line 373) | def _format_network_debug_report(max_requests: int = 20, max_routes: int... class NetworkDebugPlugin (line 421) | class NetworkDebugPlugin: method pytest_configure (line 424) | def pytest_configure(self, config): method pytest_configure_node (line 440) | def pytest_configure_node(self, node): method pytest_sessionfinish (line 446) | def pytest_sessionfinish(self, session, exitstatus): method pytest_terminal_summary (line 452) | def pytest_terminal_summary(self, terminalreporter): function register_network_debug_plugin (line 478) | def register_network_debug_plugin(config) -> None: FILE: src/transformers/utils/notebook.py function _require (line 29) | def _require(x: _T | None, msg: str) -> _T: function format_time (line 35) | def format_time(t): function html_progress_bar (line 42) | def html_progress_bar(value, total, prefix, label, width=300): function text_to_html_table (line 53) | def text_to_html_table(items): class NotebookProgressBar (line 70) | class NotebookProgressBar: method __init__ (line 110) | def __init__( method update (line 132) | def update(self, value: int, force_update: bool = False, comment: str ... method update_bar (line 183) | def update_bar(self, value, comment=None): method display (line 202) | def display(self): method close (line 213) | def close(self): class NotebookTrainingTracker (line 219) | class NotebookTrainingTracker(NotebookProgressBar): method __init__ (line 229) | def __init__(self, num_steps, column_names=None): method display (line 234) | def display(self): method write_line (line 245) | def write_line(self, values): method add_child (line 276) | def add_child(self, total, prefix=None, width=300): method remove_child (line 289) | def remove_child(self): class NotebookProgressCallback (line 297) | class NotebookProgressCallback(TrainerCallback): method __init__ (line 303) | def __init__(self): method on_train_begin (line 308) | def on_train_begin(self, args, state, control, **kwargs): method on_step_end (line 317) | def on_step_end(self, args, state, control, **kwargs): method on_prediction_step (line 327) | def on_prediction_step(self, args, state, control, eval_dataloader=Non... method on_predict (line 339) | def on_predict(self, args, state, control, **kwargs): method on_log (line 344) | def on_log(self, args, state, control, logs=None, **kwargs): method on_evaluate (line 353) | def on_evaluate(self, args, state, control, metrics=None, **kwargs): method on_train_end (line 390) | def on_train_end(self, args, state, control, **kwargs): FILE: src/transformers/utils/output_capturing.py class OutputRecorder (line 41) | class OutputRecorder: class CompileableContextVar (line 58) | class CompileableContextVar: method __init__ (line 66) | def __init__(self, name): method get (line 71) | def get(self): method set (line 78) | def set(self, value): method reset (line 86) | def reset(self, token): function install_output_capuring_hook (line 98) | def install_output_capuring_hook(module: nn.Module, key: str, index: int... function recursively_install_hooks (line 118) | def recursively_install_hooks( function install_all_output_capturing_hooks (line 150) | def install_all_output_capturing_hooks(model: PreTrainedModel, prefix: s... function maybe_install_capturing_hooks (line 182) | def maybe_install_capturing_hooks(model: PreTrainedModel) -> None: function capture_outputs (line 201) | def capture_outputs(func=None, *, tie_last_hidden_states=True): FILE: src/transformers/utils/peft_utils.py function find_adapter_config_file (line 29) | def find_adapter_config_file( function check_peft_version (line 103) | def check_peft_version(min_version: str) -> None: FILE: src/transformers/utils/pytest_helpers.py function _base_test_name (line 8) | def _base_test_name(nodeid: str) -> str: function _class_name (line 14) | def _class_name(nodeid: str) -> str | None: function _file_path (line 22) | def _file_path(nodeid: str) -> str: function _modeling_key (line 26) | def _modeling_key(file_path: str) -> str | None: function summarize (line 34) | def summarize(report_path: str): function main (line 73) | def main(): FILE: src/transformers/utils/quantization_config.py class QuantizationMethod (line 43) | class QuantizationMethod(str, Enum): class AwqFormat (line 68) | class AwqFormat(str, Enum): class AwqBackend (line 75) | class AwqBackend(str, Enum): class QuantizationConfigMixin (line 92) | class QuantizationConfigMixin: method from_dict (line 100) | def from_dict(cls, config_dict, return_unused_kwargs=False, **kwargs): method to_json_file (line 131) | def to_json_file(self, json_file_path: str | os.PathLike): method to_dict (line 148) | def to_dict(self) -> dict[str, Any]: method __iter__ (line 155) | def __iter__(self): method __repr__ (line 159) | def __repr__(self): method to_diff_dict (line 162) | def to_diff_dict(self) -> dict[str, Any]: method to_json_string (line 168) | def to_json_string(self, use_diff: bool = True) -> str: method update (line 183) | def update(self, **kwargs): class AutoRoundConfig (line 207) | class AutoRoundConfig(QuantizationConfigMixin): method __init__ (line 219) | def __init__( method post_init (line 238) | def post_init(self): method get_loading_attributes (line 245) | def get_loading_attributes(self): method to_dict (line 249) | def to_dict(self): method from_dict (line 254) | def from_dict(cls, config_dict, return_unused_kwargs=False, **kwargs): class HqqConfig (line 276) | class HqqConfig(QuantizationConfigMixin): method __init__ (line 298) | def __init__( method post_init (line 336) | def post_init(self): method from_dict (line 342) | def from_dict(cls, config: dict[str, Any]): method to_dict (line 351) | def to_dict(self) -> dict[str, Any]: method __repr__ (line 362) | def __repr__(self): method to_diff_dict (line 366) | def to_diff_dict(self) -> dict[str, Any]: class BitsAndBytesConfig (line 389) | class BitsAndBytesConfig(QuantizationConfigMixin): method __init__ (line 439) | def __init__( method load_in_4bit (line 495) | def load_in_4bit(self): method load_in_4bit (line 499) | def load_in_4bit(self, value: bool): method load_in_8bit (line 508) | def load_in_8bit(self): method load_in_8bit (line 512) | def load_in_8bit(self, value: bool): method post_init (line 520) | def post_init(self): method is_quantizable (line 550) | def is_quantizable(self): method quantization_method (line 556) | def quantization_method(self): method to_dict (line 570) | def to_dict(self) -> dict[str, Any]: method __repr__ (line 583) | def __repr__(self): method to_diff_dict (line 587) | def to_diff_dict(self) -> dict[str, Any]: class ExllamaVersion (line 610) | class ExllamaVersion(int, Enum): class GPTQConfig (line 616) | class GPTQConfig(QuantizationConfigMixin): method __init__ (line 681) | def __init__( method get_loading_attributes (line 731) | def get_loading_attributes(self): method post_init (line 737) | def post_init(self): method to_dict (line 775) | def to_dict(self) -> dict[str, Any]: method to_dict_optimum (line 781) | def to_dict_optimum(self): method from_dict_optimum (line 788) | def from_dict_optimum(cls, config_dict): class AwqConfig (line 798) | class AwqConfig(GPTQConfig): method __init__ (line 818) | def __init__( method post_init (line 840) | def post_init(self): method to_dict (line 855) | def to_dict(self) -> dict[str, Any]: class AqlmConfig (line 864) | class AqlmConfig(QuantizationConfigMixin): method __init__ (line 883) | def __init__( method post_init (line 901) | def post_init(self): class VptqLayerConfig (line 924) | class VptqLayerConfig(QuantizationConfigMixin): method __init__ (line 940) | def __init__( method post_init (line 970) | def post_init(self): class VptqConfig (line 979) | class VptqConfig(QuantizationConfigMixin): method __init__ (line 994) | def __init__( method post_init (line 1009) | def post_init(self): class QuantoConfig (line 1020) | class QuantoConfig(QuantizationConfigMixin): method __init__ (line 1035) | def __init__( method post_init (line 1048) | def post_init(self): class EetqConfig (line 1061) | class EetqConfig(QuantizationConfigMixin): method __init__ (line 1074) | def __init__( method post_init (line 1085) | def post_init(self): class CompressedTensorsConfig (line 1094) | class CompressedTensorsConfig(QuantizationConfigMixin): method __init__ (line 1120) | def __init__( method post_init (line 1167) | def post_init(self): method from_dict (line 1182) | def from_dict(cls, config_dict, return_unused_kwargs=False, **kwargs): method to_dict (line 1209) | def to_dict(self) -> dict[str, Any]: method to_diff_dict (line 1229) | def to_diff_dict(self) -> dict[str, Any]: method get_loading_attributes (line 1250) | def get_loading_attributes(self): method is_quantized (line 1254) | def is_quantized(self): method is_quantization_compressed (line 1258) | def is_quantization_compressed(self): method is_sparsification_compressed (line 1265) | def is_sparsification_compressed(self): class FbgemmFp8Config (line 1278) | class FbgemmFp8Config(QuantizationConfigMixin): method __init__ (line 1291) | def __init__( method get_loading_attributes (line 1301) | def get_loading_attributes(self): class HiggsConfig (line 1309) | class HiggsConfig(QuantizationConfigMixin): method __init__ (line 1328) | def __init__( method post_init (line 1350) | def post_init(self): class FPQuantConfig (line 1365) | class FPQuantConfig(QuantizationConfigMixin): method __init__ (line 1388) | def __init__( method post_init (line 1412) | def post_init(self): class TorchAoConfig (line 1454) | class TorchAoConfig(QuantizationConfigMixin): method __init__ (line 1490) | def __init__( method post_init (line 1505) | def post_init(self): method get_apply_tensor_subclass (line 1523) | def get_apply_tensor_subclass(self): method to_dict (line 1527) | def to_dict(self): method from_dict (line 1538) | def from_dict(cls, config_dict, return_unused_kwargs=False, **kwargs): class BitNetQuantConfig (line 1557) | class BitNetQuantConfig(QuantizationConfigMixin): method __init__ (line 1585) | def __init__( method post_init (line 1606) | def post_init(self): class SpQRConfig (line 1613) | class SpQRConfig(QuantizationConfigMixin): method __init__ (line 1635) | def __init__( method post_init (line 1654) | def post_init(self): class FineGrainedFP8Config (line 1676) | class FineGrainedFP8Config(QuantizationConfigMixin): method __init__ (line 1691) | def __init__( method post_init (line 1706) | def post_init(self): method get_loading_attributes (line 1718) | def get_loading_attributes(self): class QuarkConfig (line 1722) | class QuarkConfig(QuantizationConfigMixin): method __init__ (line 1723) | def __init__( class Mxfp4Config (line 1764) | class Mxfp4Config(QuantizationConfigMixin): method __init__ (line 1777) | def __init__( method get_loading_attributes (line 1787) | def get_loading_attributes(self): method to_dict (line 1790) | def to_dict(self) -> dict[str, Any]: class MetalConfig (line 1798) | class MetalConfig(QuantizationConfigMixin): method __init__ (line 1808) | def __init__( method post_init (line 1823) | def post_init(self): method get_loading_attributes (line 1829) | def get_loading_attributes(self): method to_dict (line 1832) | def to_dict(self) -> dict[str, Any]: class FourOverSixConfig (line 1842) | class FourOverSixConfig(QuantizationConfigMixin): method __init__ (line 1893) | def __init__( class SinqConfig (line 1925) | class SinqConfig(QuantizationConfigMixin): method __init__ (line 1950) | def __init__( method post_init (line 1972) | def post_init(self): FILE: src/transformers/utils/type_validators.py function positive_any_number (line 24) | def positive_any_number(value: int | float | None = None): function positive_int (line 29) | def positive_int(value: int | None = None): function padding_validator (line 34) | def padding_validator(value: bool | str | PaddingStrategy | None = None): function truncation_validator (line 44) | def truncation_validator(value: bool | str | TruncationStrategy | None =... function image_size_validator (line 54) | def image_size_validator(value: int | Sequence[int] | dict[str, int] | N... function device_validator (line 62) | def device_validator(value: str | int | None = None): function resampling_validator (line 85) | def resampling_validator(value: Union[int, "PILImageResampling"] | None ... function video_metadata_validator (line 96) | def video_metadata_validator(value: VideoMetadataType | None = None): function tensor_type_validator (line 127) | def tensor_type_validator(value: str | TensorType | None = None): function label_to_id_validation (line 136) | def label_to_id_validation(value: str | TensorType | None = None): function interval (line 144) | def interval( function probability (line 193) | def probability(value: float): function is_divisible_by (line 199) | def is_divisible_by(divisor: int | float): function activation_fn_key (line 209) | def activation_fn_key(value: str): function tensor_shape (line 220) | def tensor_shape(shape: tuple[int | str], length: int | None = None): FILE: src/transformers/utils/versions.py function _compare_versions (line 36) | def _compare_versions(op, got_ver, want_ver, requirement, pkg, hint): function require_version (line 48) | def require_version(requirement: str, hint: str | None = None) -> None: function require_version_core (line 113) | def require_version_core(requirement): FILE: src/transformers/video_processing_utils.py class BaseVideoProcessor (line 150) | class BaseVideoProcessor(TorchvisionBackend): method __init__ (line 174) | def __init__(self, **kwargs: Unpack[VideosKwargs]) -> None: method __call__ (line 177) | def __call__(self, videos, **kwargs) -> BatchFeature: method convert_to_rgb (line 180) | def convert_to_rgb( method sample_frames (line 205) | def sample_frames( method _decode_and_sample_videos (line 258) | def _decode_and_sample_videos( method _prepare_input_videos (line 298) | def _prepare_input_videos( method preprocess (line 330) | def preprocess( method _preprocess (line 374) | def _preprocess( method from_pretrained (line 420) | def from_pretrained( method save_pretrained (line 518) | def save_pretrained(self, save_directory: str | os.PathLike, push_to_h... method get_video_processor_dict (line 567) | def get_video_processor_dict( method from_dict (line 693) | def from_dict(cls, video_processor_dict: dict[str, Any], **kwargs): method to_dict (line 733) | def to_dict(self) -> dict[str, Any]: method to_json_string (line 746) | def to_json_string(self) -> str: method to_json_file (line 761) | def to_json_file(self, json_file_path: str | os.PathLike): method __repr__ (line 772) | def __repr__(self): method from_json_file (line 776) | def from_json_file(cls, json_file: str | os.PathLike): method register_for_auto_class (line 795) | def register_for_auto_class(cls, auto_class="AutoVideoProcessor"): method fetch_videos (line 820) | def fetch_videos(self, video_url_or_urls: str | list[str] | list[list[... FILE: src/transformers/video_utils.py class VideoMetadata (line 79) | class VideoMetadata(Mapping): method __iter__ (line 88) | def __iter__(self): method __len__ (line 91) | def __len__(self): method __getitem__ (line 94) | def __getitem__(self, item): method __setitem__ (line 97) | def __setitem__(self, key, value): method timestamps (line 101) | def timestamps(self) -> list[float]: method sampled_fps (line 108) | def sampled_fps(self) -> float: method update (line 114) | def update(self, dictionary): function is_valid_video_frame (line 123) | def is_valid_video_frame(frame): function is_valid_video (line 129) | def is_valid_video(video): function valid_videos (line 135) | def valid_videos(videos): function is_batched_video (line 147) | def is_batched_video(videos): function is_scaled_video (line 155) | def is_scaled_video(video: np.ndarray) -> bool: function convert_pil_frames_to_video (line 163) | def convert_pil_frames_to_video(videos: list[VideoInput]) -> list[Union[... function make_batched_videos (line 184) | def make_batched_videos(videos) -> list[Union[np.ndarray, "torch.Tensor"... function make_batched_metadata (line 230) | def make_batched_metadata(videos: VideoInput, video_metadata: VideoMetad... function get_video_size (line 260) | def get_video_size(video: np.ndarray, channel_dim: ChannelDimension | No... function get_uniform_frame_indices (line 284) | def get_uniform_frame_indices(total_num_frames: int, num_frames: int | N... function default_sample_indices_fn (line 305) | def default_sample_indices_fn(metadata: VideoMetadata, num_frames=None, ... function read_video_opencv (line 340) | def read_video_opencv( function read_video_decord (line 402) | def read_video_decord( function read_video_pyav (line 454) | def read_video_pyav( function read_video_torchvision (line 510) | def read_video_torchvision( function read_video_torchcodec (line 567) | def read_video_torchcodec( function load_video (line 631) | def load_video( function convert_to_rgb (line 730) | def convert_to_rgb( function pad (line 769) | def pad( function group_videos_by_shape (line 858) | def group_videos_by_shape( function reorder_videos (line 881) | def reorder_videos( FILE: tests/causal_lm_tester.py class CausalLMModelTester (line 49) | class CausalLMModelTester: method _verify_and_infer_model_attributes (line 66) | def _verify_and_infer_model_attributes(cls): method all_model_classes (line 134) | def all_model_classes(self): method pipeline_model_mapping (line 150) | def pipeline_model_mapping(self): method __init__ (line 166) | def __init__( method prepare_config_and_inputs (line 255) | def prepare_config_and_inputs(self): method config_args (line 279) | def config_args(self): method get_config (line 282) | def get_config(self): method create_and_check_model (line 292) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 302) | def prepare_config_and_inputs_for_common(self): class CausalLMModelTest (line 309) | class CausalLMModelTest( method setUp (line 316) | def setUp(self): method test_config (line 338) | def test_config(self): method test_model (line 341) | def test_model(self): method test_sequence_classification_model (line 345) | def test_sequence_classification_model(self): method test_sequence_classification_model_for_single_label (line 359) | def test_sequence_classification_model_for_single_label(self): method test_sequence_classification_model_for_multi_label (line 374) | def test_sequence_classification_model_for_multi_label(self): method test_token_classification_model (line 391) | def test_token_classification_model(self): method test_question_answering_model (line 408) | def test_question_answering_model(self): method test_model_rope_scaling_from_config (line 430) | def test_model_rope_scaling_from_config(self, scaling_type): method test_model_rope_scaling_frequencies (line 486) | def test_model_rope_scaling_frequencies(self): method test_flash_attn_2_equivalence (line 605) | def test_flash_attn_2_equivalence(self): method test_causal_lm_can_accept_training_kwargs (line 634) | def test_causal_lm_can_accept_training_kwargs(self): function _config_supports_rope_scaling (line 651) | def _config_supports_rope_scaling(config: PreTrainedConfig) -> bool: function _set_config_rope_params (line 662) | def _set_config_rope_params(config: PreTrainedConfig, rope_params: dict)... FILE: tests/cli/conftest.py function cli (line 23) | def cli(): FILE: tests/cli/test_chat.py function test_help (line 21) | def test_help(cli): function test_save_and_clear_chat (line 27) | def test_save_and_clear_chat(): function test_new_chat_history (line 38) | def test_new_chat_history(): function test_parse_generate_flags (line 43) | def test_parse_generate_flags(): FILE: tests/cli/test_download.py function test_cli_download (line 21) | def test_cli_download(cli): function test_cli_download_trust_remote (line 34) | def test_cli_download_trust_remote(cli, caplog, capsys): FILE: tests/cli/test_serve.py function _find_free_port (line 59) | def _find_free_port() -> int: function _start_serve (line 66) | def _start_serve(**kwargs) -> tuple["Serve", int]: function test_host_port_blocking (line 84) | def test_host_port_blocking(cli): class TestProcessorInputsFromMessages (line 105) | class TestProcessorInputsFromMessages(unittest.TestCase): method test_llm_string_content (line 106) | def test_llm_string_content(self): method test_llm_list_content_text_only (line 113) | def test_llm_list_content_text_only(self): method test_vlm_string_content_wrapped (line 120) | def test_vlm_string_content_wrapped(self): method test_vlm_text_and_image_url (line 127) | def test_vlm_text_and_image_url(self): method test_llm_multi_turn_conversation (line 144) | def test_llm_multi_turn_conversation(self): method test_llm_list_content_with_type (line 160) | def test_llm_list_content_with_type(self): method test_vlm_base64_image_creates_temp_file (line 172) | def test_vlm_base64_image_creates_temp_file(self): method test_vlm_multi_turn (line 196) | def test_vlm_multi_turn(self): class TestGenerativeModelList (line 213) | class TestGenerativeModelList(unittest.TestCase): method test_lists_only_generative_models (line 214) | def test_lists_only_generative_models(self): class TestBuildGenerationConfig (line 233) | class TestBuildGenerationConfig(unittest.TestCase): method _make_handler (line 234) | def _make_handler(self): method test_max_tokens (line 237) | def test_max_tokens(self): method test_temperature_zero_disables_sampling (line 243) | def test_temperature_zero_disables_sampling(self): method test_frequency_penalty (line 249) | def test_frequency_penalty(self): method test_logit_bias_tuple_keys (line 255) | def test_logit_bias_tuple_keys(self): method test_stop_strings (line 261) | def test_stop_strings(self): method test_generation_config_json_overrides (line 267) | def test_generation_config_json_overrides(self): method test_generation_config_json_no_defaults_applied (line 277) | def test_generation_config_json_no_defaults_applied(self): method test_default_bumps_short_max_new_tokens (line 288) | def test_default_bumps_short_max_new_tokens(self): method test_user_max_tokens_overrides_default (line 294) | def test_user_max_tokens_overrides_default(self): class TestValidation (line 303) | class TestValidation(unittest.TestCase): method _make_handler (line 304) | def _make_handler(self): method test_valid_request_passes (line 307) | def test_valid_request_passes(self): method test_unexpected_keys_rejected (line 312) | def test_unexpected_keys_rejected(self): method test_unsupported_fields_warns (line 319) | def test_unsupported_fields_warns(self): class TestModelManager (line 326) | class TestModelManager(unittest.TestCase): method test_process_model_name_adds_main (line 327) | def test_process_model_name_adds_main(self): method test_process_model_name_preserves_revision (line 330) | def test_process_model_name_preserves_revision(self): method test_quantization_config_4bit (line 333) | def test_quantization_config_4bit(self): method test_quantization_config_8bit (line 338) | def test_quantization_config_8bit(self): method test_quantization_config_none (line 343) | def test_quantization_config_none(self): class TestTimedModel (line 348) | class TestTimedModel(unittest.TestCase): method test_delete_model (line 349) | def test_delete_model(self): method test_timeout_zero_no_delete (line 360) | def test_timeout_zero_no_delete(self): class TestChunkSSE (line 369) | class TestChunkSSE(unittest.TestCase): method _make_handler (line 370) | def _make_handler(self): method test_build_chunk_sse_content (line 373) | def test_build_chunk_sse_content(self): method test_build_chunk_sse_role (line 381) | def test_build_chunk_sse_role(self): method test_build_chunk_sse_finish_reason (line 388) | def test_build_chunk_sse_finish_reason(self): method test_chunk_to_sse_string_passthrough (line 394) | def test_chunk_to_sse_string_passthrough(self): method test_chunk_to_sse_wraps_plain_string (line 398) | def test_chunk_to_sse_wraps_plain_string(self): class TestToolParser (line 407) | class TestToolParser(unittest.TestCase): method test_detect_tool_format_qwen (line 408) | def test_detect_tool_format_qwen(self): method test_detect_tool_format_unsupported (line 414) | def test_detect_tool_format_unsupported(self): method test_parser_start_token (line 419) | def test_parser_start_token(self): method test_parser_end_token (line 424) | def test_parser_end_token(self): method test_parser_buffers_until_end (line 430) | def test_parser_buffers_until_end(self): method test_parser_normal_text_returns_none (line 441) | def test_parser_normal_text_returns_none(self): method test_parser_full_flow (line 446) | def test_parser_full_flow(self): method test_parse_tool_calls_from_text (line 470) | def test_parse_tool_calls_from_text(self): method test_parse_tool_calls_no_tool_call (line 480) | def test_parse_tool_calls_no_tool_call(self): method test_parse_multiple_tool_calls (line 486) | def test_parse_multiple_tool_calls(self): method test_feed_multiple_tool_calls (line 501) | def test_feed_multiple_tool_calls(self): class TestAppRoutes (line 528) | class TestAppRoutes(unittest.TestCase): method setUpClass (line 530) | def setUpClass(cls): method _request (line 541) | async def _request(self, method: str, path: str, **kwargs) -> httpx.Re... method test_health (line 545) | def test_health(self): method test_models_list (line 550) | def test_models_list(self): method test_request_id_generated (line 557) | def test_request_id_generated(self): method test_request_id_passthrough (line 562) | def test_request_id_passthrough(self): class TestChatCompletion (line 571) | class TestChatCompletion(unittest.TestCase): method setUpClass (line 577) | def setUpClass(cls): method tearDownClass (line 583) | def tearDownClass(cls): method test_non_streaming (line 586) | def test_non_streaming(self): method test_streaming (line 593) | def test_streaming(self): method test_early_return_due_to_length (line 602) | def test_early_return_due_to_length(self): method test_continues_until_stop (line 615) | def test_continues_until_stop(self): method test_stop_strings (line 628) | def test_stop_strings(self): method test_multi_turn (line 634) | def test_multi_turn(self): method test_multiple_models_on_demand (line 645) | def test_multiple_models_on_demand(self): method test_non_streaming_usage (line 659) | def test_non_streaming_usage(self): method test_streaming_usage (line 668) | def test_streaming_usage(self): method test_tool_call (line 683) | def test_tool_call(self): method test_tool_call_non_streaming (line 730) | def test_tool_call_non_streaming(self): method test_tool_call_multi (line 758) | def test_tool_call_multi(self): method test_concurrent_non_streaming (line 787) | def test_concurrent_non_streaming(self): method test_concurrent_streaming (line 812) | def test_concurrent_streaming(self): method test_request_cancellation (line 840) | def test_request_cancellation(self): class TestResponseInputConversion (line 871) | class TestResponseInputConversion(unittest.TestCase): method _make_handler (line 872) | def _make_handler(self): method test_string_input (line 875) | def test_string_input(self): method test_string_input_with_instructions (line 880) | def test_string_input_with_instructions(self): method test_list_input (line 887) | def test_list_input(self): method test_list_input_with_instructions_prepends_system (line 895) | def test_list_input_with_instructions_prepends_system(self): method test_list_input_with_instructions_replaces_existing_system (line 902) | def test_list_input_with_instructions_replaces_existing_system(self): method test_dict_input (line 910) | def test_dict_input(self): class TestResponseValidation (line 917) | class TestResponseValidation(unittest.TestCase): method _make_handler (line 918) | def _make_handler(self): method test_unsupported_fields_warns (line 921) | def test_unsupported_fields_warns(self): method test_valid_request_passes (line 927) | def test_valid_request_passes(self): class TestResponseGenerationConfig (line 934) | class TestResponseGenerationConfig(unittest.TestCase): method _make_handler (line 935) | def _make_handler(self): method test_max_output_tokens (line 938) | def test_max_output_tokens(self): method test_default_bumps_short_max_new_tokens (line 944) | def test_default_bumps_short_max_new_tokens(self): class TestResponseUsage (line 952) | class TestResponseUsage(unittest.TestCase): method testcompute_usage (line 953) | def testcompute_usage(self): method test_usage_in_completed_response (line 961) | def test_usage_in_completed_response(self): class TestResponseSSEFormat (line 984) | class TestResponseSSEFormat(unittest.TestCase): method test_sse_format (line 985) | def test_sse_format(self): class TestResponsesIntegration (line 1012) | class TestResponsesIntegration(unittest.TestCase): method setUpClass (line 1018) | def setUpClass(cls): method tearDownClass (line 1024) | def tearDownClass(cls): method test_streaming (line 1027) | def test_streaming(self): method test_non_streaming (line 1055) | def test_non_streaming(self): method test_non_streaming_usage (line 1065) | def test_non_streaming_usage(self): method test_streaming_usage (line 1076) | def test_streaming_usage(self): method test_tool_call_streaming (line 1093) | def test_tool_call_streaming(self): method test_tool_call_non_streaming (line 1130) | def test_tool_call_non_streaming(self): method test_tool_call_multi (line 1160) | def test_tool_call_multi(self): method test_multi_turn (line 1183) | def test_multi_turn(self): method test_concurrent_non_streaming (line 1197) | def test_concurrent_non_streaming(self): method test_concurrent_streaming (line 1219) | def test_concurrent_streaming(self): function _parse_sse_events (line 1243) | def _parse_sse_events(response): class TestLoadModel (line 1255) | class TestLoadModel(unittest.TestCase): method setUpClass (line 1261) | def setUpClass(cls): method tearDownClass (line 1266) | def tearDownClass(cls): method setUp (line 1269) | def setUp(self): method _load_model (line 1273) | def _load_model(self, model: str): method test_load_model_fresh (line 1278) | def test_load_model_fresh(self): method test_load_model_cached (line 1296) | def test_load_model_cached(self): method test_load_model_error (line 1309) | def test_load_model_error(self): method test_load_model_missing_field (line 1317) | def test_load_model_missing_field(self): method test_load_model_event_schema (line 1323) | def test_load_model_event_schema(self): method test_load_model_stage_ordering (line 1343) | def test_load_model_stage_ordering(self): method test_concurrent_load_same_model (line 1359) | def test_concurrent_load_same_model(self): method test_concurrent_load_second_caller_gets_cached (line 1383) | def test_concurrent_load_second_caller_gets_cached(self): method test_load_model_weights_progress_complete (line 1398) | def test_load_model_weights_progress_complete(self): method test_load_model_exactly_one_ready (line 1420) | def test_load_model_exactly_one_ready(self): method test_load_model_usable_after_load (line 1428) | def test_load_model_usable_after_load(self): method test_load_model_model_field_matches (line 1441) | def test_load_model_model_field_matches(self): method test_concurrent_non_streaming (line 1451) | def test_concurrent_non_streaming(self): method test_concurrent_streaming (line 1473) | def test_concurrent_streaming(self): class TestVLM (line 1505) | class TestVLM(unittest.TestCase): method setUpClass (line 1511) | def setUpClass(cls): method tearDownClass (line 1517) | def tearDownClass(cls): method test_chat_completion_with_image (line 1520) | def test_chat_completion_with_image(self): method test_responses_with_image (line 1542) | def test_responses_with_image(self): class TestTranscription (line 1570) | class TestTranscription(unittest.TestCase): method setUpClass (line 1576) | def setUpClass(cls): method tearDownClass (line 1581) | def tearDownClass(cls): method _get_audio_bytes (line 1585) | def _get_audio_bytes(cls): method test_transcription_returns_text (line 1595) | def test_transcription_returns_text(self): method test_transcription_openai_client (line 1612) | def test_transcription_openai_client(self): method test_transcription_streaming (line 1623) | def test_transcription_streaming(self): method test_transcription_missing_file (line 1645) | def test_transcription_missing_file(self): class TestContinuousBatchingChatCompletion (line 1659) | class TestContinuousBatchingChatCompletion(unittest.TestCase): method setUpClass (line 1665) | def setUpClass(cls): method tearDownClass (line 1677) | def tearDownClass(cls): method test_streaming (line 1680) | def test_streaming(self): method test_non_streaming (line 1696) | def test_non_streaming(self): method test_non_streaming_response_json_format (line 1706) | def test_non_streaming_response_json_format(self): method test_multi_turn (line 1725) | def test_multi_turn(self): method test_request_cancellation (line 1738) | def test_request_cancellation(self): class TestContinuousBatchingResponses (line 1787) | class TestContinuousBatchingResponses(unittest.TestCase): method setUpClass (line 1793) | def setUpClass(cls): method tearDownClass (line 1805) | def tearDownClass(cls): method test_streaming (line 1808) | def test_streaming(self): method test_non_streaming (line 1822) | def test_non_streaming(self): method test_multi_turn (line 1833) | def test_multi_turn(self): method test_request_cancellation (line 1848) | def test_request_cancellation(self): FILE: tests/cli/test_system.py function test_cli_env (line 18) | def test_cli_env(cli): function test_cli_version (line 26) | def test_cli_version(cli): FILE: tests/generation/test_candidate_generator.py class TestAssistantToTargetTranslator (line 18) | class TestAssistantToTargetTranslator(unittest.TestCase): method setUp (line 19) | def setUp(self): method test_get_assistant_to_target_input_ids (line 42) | def test_get_assistant_to_target_input_ids(self): method test_get_suppress_input_ids (line 48) | def test_get_suppress_input_ids(self): method test_get_target_ids (line 54) | def test_get_target_ids(self): method test_get_target_logits (line 77) | def test_get_target_logits(self): class MockTokenizer (line 97) | class MockTokenizer: method __init__ (line 100) | def __init__(self, vocab=None): method get_vocab (line 103) | def get_vocab(self): method __call__ (line 106) | def __call__(self, text, add_special_tokens=True): class TestAssistantVocabTranslatorCache (line 114) | class TestAssistantVocabTranslatorCache(unittest.TestCase): method setUp (line 115) | def setUp(self): method test_same_instance_for_same_tokenizers (line 127) | def test_same_instance_for_same_tokenizers(self): method test_different_instances_for_different_tokenizers (line 145) | def test_different_instances_for_different_tokenizers(self): method test_cache_with_weakref_key (line 163) | def test_cache_with_weakref_key(self): method test_weakref_cache_cleanup (line 193) | def test_weakref_cache_cleanup(self): class TestUniversalSpeculativeDecoding (line 229) | class TestUniversalSpeculativeDecoding(unittest.TestCase): method setUpClass (line 231) | def setUpClass(cls): method setUp (line 235) | def setUp(self): method test_basic_generation (line 272) | def test_basic_generation(self): method test_mismatched_vocabularies (line 284) | def test_mismatched_vocabularies(self): method test_speculation_depth (line 301) | def test_speculation_depth(self): method test_device_consistency (line 311) | def test_device_consistency(self): method test_usd_vs_vanilla_sampling (line 318) | def test_usd_vs_vanilla_sampling(cls): FILE: tests/generation/test_configuration_utils.py class GenerationConfigTest (line 69) | class GenerationConfigTest(unittest.TestCase): method test_save_load_config (line 71) | def test_save_load_config(self, config_name): method test_from_model_config (line 93) | def test_from_model_config(self): method test_update (line 105) | def test_update(self): method test_kwarg_init (line 123) | def test_kwarg_init(self): method test_validate (line 148) | def test_validate(self): method test_refuse_to_save (line 233) | def test_refuse_to_save(self): method test_generation_mode (line 275) | def test_generation_mode(self): method test_static_cache_without_cache_config (line 293) | def test_static_cache_without_cache_config(self): class GenerationConfigSerializationTest (line 300) | class GenerationConfigSerializationTest(unittest.TestCase): method test_serialize_generation_sequence_bias (line 301) | def test_serialize_generation_sequence_bias(self): method test_serialize_generation_min_length_eos_token (line 315) | def test_serialize_generation_min_length_eos_token(self): method test_serialize_generation_min_new_tokens (line 333) | def test_serialize_generation_min_new_tokens(self): method test_serialize_generation_temperature (line 352) | def test_serialize_generation_temperature(self): method test_serialize_generation_repetition_penalty (line 365) | def test_serialize_generation_repetition_penalty(self): method test_serialize_generation_encoder_repetition_penalty (line 378) | def test_serialize_generation_encoder_repetition_penalty(self): method test_serialize_generation_top_p (line 395) | def test_serialize_generation_top_p(self): method test_serialize_generation_top_k (line 408) | def test_serialize_generation_top_k(self): method test_serialize_generation_min_p (line 421) | def test_serialize_generation_min_p(self): method test_serialize_generation_typical_p (line 434) | def test_serialize_generation_typical_p(self): method test_serialize_generation_epsilon_cutoff (line 447) | def test_serialize_generation_epsilon_cutoff(self): method test_serialize_generation_eta_cutoff (line 460) | def test_serialize_generation_eta_cutoff(self): method test_serialize_generation_ngram_size (line 473) | def test_serialize_generation_ngram_size(self): method test_serialize_generation_encoder_ngram_size (line 486) | def test_serialize_generation_encoder_ngram_size(self): method test_serialize_generation_bad_words_ids (line 502) | def test_serialize_generation_bad_words_ids(self): method test_serialize_generation_num_beams (line 515) | def test_serialize_generation_num_beams(self): method test_serialize_generation_bos_token_id (line 533) | def test_serialize_generation_bos_token_id(self): method test_serialize_generation_eos_token_id (line 546) | def test_serialize_generation_eos_token_id(self): method test_serialize_generation_exponential_decay_length_penalty (line 562) | def test_serialize_generation_exponential_decay_length_penalty(self): method test_serialize_generation_begin_suppress_tokens (line 586) | def test_serialize_generation_begin_suppress_tokens(self): method test_serialize_generation_suppress_tokens (line 603) | def test_serialize_generation_suppress_tokens(self): method test_serialize_generation_guidance_scale (line 616) | def test_serialize_generation_guidance_scale(self): method test_serialize_generation_guidance_scale_unbatched (line 628) | def test_serialize_generation_guidance_scale_unbatched(self): method test_serialize_generation_watermarking_config (line 643) | def test_serialize_generation_watermarking_config(self): class ConfigPushToHubTester (line 687) | class ConfigPushToHubTester(unittest.TestCase): method setUpClass (line 689) | def setUpClass(cls): method test_push_to_hub (line 692) | def test_push_to_hub(self): method test_push_to_hub_via_save_pretrained (line 706) | def test_push_to_hub_via_save_pretrained(self): method test_push_to_hub_in_organization (line 722) | def test_push_to_hub_in_organization(self): method test_push_to_hub_in_organization_via_save_pretrained (line 736) | def test_push_to_hub_in_organization_via_save_pretrained(self): method test_push_to_hub_on_pr_revision (line 752) | def test_push_to_hub_on_pr_revision(self): FILE: tests/generation/test_continuous_batching.py function flush_memory (line 71) | def flush_memory(flush_compile: bool = True) -> None: function get_tokenizer_and_model (line 101) | def get_tokenizer_and_model( function with_flush_memory (line 116) | def with_flush_memory(func): function get_generation_inputs (line 143) | def get_generation_inputs( class ContinuousBatchingNoAcceleratorTest (line 165) | class ContinuousBatchingNoAcceleratorTest(unittest.TestCase): method test_group_layers (line 179) | def test_group_layers( method test_attention_mask (line 238) | def test_attention_mask( method test_continuous_batching_will_allocation_be_successful (line 303) | def test_continuous_batching_will_allocation_be_successful( method test_full_attention_get_indices (line 361) | def test_full_attention_get_indices( method test_continuous_batching_no_accelerators (line 386) | def test_continuous_batching_no_accelerators(self) -> None: method test_output_router_deliver_to_queue (line 424) | def test_output_router_deliver_to_queue(self): method test_output_router_deliver_to_handler (line 433) | def test_output_router_deliver_to_handler(self): class ContinuousBatchingWithAcceleratorTest (line 450) | class ContinuousBatchingWithAcceleratorTest(unittest.TestCase): method _test_continuous_batching_parity (line 456) | def _test_continuous_batching_parity( method test_continuous_batching_config_combinations (line 564) | def test_continuous_batching_config_combinations( method test_continuous_batching_diverse_models (line 595) | def test_continuous_batching_diverse_models(self, model_id: str, use_c... method test_continuous_batching_fast (line 605) | def test_continuous_batching_fast(self) -> None: method test_continuous_batching_long_generate (line 619) | def test_continuous_batching_long_generate(self) -> None: method test_continuous_batching_log_probs (line 633) | def test_continuous_batching_log_probs(self, use_cuda_graph: bool, use... method test_continuous_batching_with_default_compile_configs (line 701) | def test_continuous_batching_with_default_compile_configs(self) -> None: method test_continuous_batching_few_blocks (line 763) | def test_continuous_batching_few_blocks(self) -> None: method _test_streaming_or_not_request (line 789) | def _test_streaming_or_not_request(self, with_streaming: bool, with_no... method test_streaming_request (line 825) | def test_streaming_request(self) -> None: method test_non_streaming_request (line 828) | def test_non_streaming_request(self) -> None: method test_streaming_and_non_streaming_requests_can_alternate (line 831) | def test_streaming_and_non_streaming_requests_can_alternate(self) -> N... method test_register_result_handler (line 834) | def test_register_result_handler(self) -> None: method _test_block_sharing (line 879) | def _test_block_sharing( method test_prefix_sharing (line 970) | def test_prefix_sharing(self) -> None: method test_block_sharing_with_hybrid_model (line 980) | def test_block_sharing_with_hybrid_model(self) -> None: method test_num_return_sequences (line 992) | def test_num_return_sequences(self, allow_block_sharing: bool) -> None: method test_continuous_batching_async (line 1038) | def test_continuous_batching_async( method test_flash_attn_with_kvcache_parity (line 1056) | def test_flash_attn_with_kvcache_parity(self, use_cuda_graph: bool, us... FILE: tests/generation/test_flash_attention_parity.py class FlashAttentionParityTest (line 28) | class FlashAttentionParityTest(unittest.TestCase): method _lcs (line 30) | def _lcs(self, X, Y): method _calculate_rouge_l (line 47) | def _calculate_rouge_l(self, output_strs_list1, output_strs_list2): method _benchmark_generation (line 62) | def _benchmark_generation(self, model, inputs, n_warmup=3, n_runs=5): method test_flash_attention_parity (line 82) | def test_flash_attention_parity(self): FILE: tests/generation/test_logits_process.py class LogitsProcessorTest (line 67) | class LogitsProcessorTest(unittest.TestCase): method _get_uniform_logits (line 68) | def _get_uniform_logits(self, batch_size: int, length: int): method test_min_length_dist_processor (line 72) | def test_min_length_dist_processor(self): method test_new_min_length_dist_processor (line 92) | def test_new_min_length_dist_processor(self, eos_token_id: int | list[... method test_temperature_dist_warper (line 151) | def test_temperature_dist_warper(self): method test_repetition_penalty_dist_process (line 186) | def test_repetition_penalty_dist_process(self): method test_repetition_penalty_dist_process_exclusion_no_new_input_ids (line 210) | def test_repetition_penalty_dist_process_exclusion_no_new_input_ids(se... method test_repetition_penalty_dist_process_exclusion_with_new_input_ids (line 232) | def test_repetition_penalty_dist_process_exclusion_with_new_input_ids(... method test_encoder_repetition_penalty_dist_process (line 260) | def test_encoder_repetition_penalty_dist_process(self): method test_repetition_penalty_continuous_batching (line 288) | def test_repetition_penalty_continuous_batching(self): method test_top_k_dist_warper (line 321) | def test_top_k_dist_warper(self): method test_top_p_dist_warper (line 359) | def test_top_p_dist_warper(self): method test_top_h_dist_warper (line 397) | def test_top_h_dist_warper(self): method test_min_p_dist_warper (line 486) | def test_min_p_dist_warper(self): method test_typical_dist_warper (line 532) | def test_typical_dist_warper(self): method test_epsilon_dist_warper (line 580) | def test_epsilon_dist_warper(self): method test_eta_dist_warper (line 620) | def test_eta_dist_warper(self): method test_no_repeat_ngram_dist_processor (line 660) | def test_no_repeat_ngram_dist_processor(self): method test_encoder_no_repeat_ngram_dist_processor (line 685) | def test_encoder_no_repeat_ngram_dist_processor(self): method test_no_bad_words_dist_processor (line 751) | def test_no_bad_words_dist_processor(self): method test_bias_dist_processor (line 779) | def test_bias_dist_processor(self): method test_processor_list (line 806) | def test_processor_list(self): method test_prefix_constrained_logits_processor (line 857) | def test_prefix_constrained_logits_processor(self): method test_forced_bos_token_logits_processor (line 887) | def test_forced_bos_token_logits_processor(self): method test_forced_eos_token_logits_processor (line 911) | def test_forced_eos_token_logits_processor(self): method test_remove_nan_inf_logits_processor (line 938) | def test_remove_nan_inf_logits_processor(self): method test_exponential_decay_length_penalty (line 965) | def test_exponential_decay_length_penalty(self): method test_normalization (line 1002) | def test_normalization(self): method test_classifier_free_guidance (line 1020) | def test_classifier_free_guidance(self): method test_early_stop_processor (line 1071) | def test_early_stop_processor(self): method test_early_stop_processor_multi_eos (line 1087) | def test_early_stop_processor_multi_eos(self): method test_watermarking_processor (line 1103) | def test_watermarking_processor(self): method test_synthidtext_watermarking_processor_bias_uniformity (line 1128) | def test_synthidtext_watermarking_processor_bias_uniformity(self, ngra... method test_synthidtext_watermark_processor_bias_uniformity_across_vocab (line 1154) | def test_synthidtext_watermark_processor_bias_uniformity_across_vocab(... method test_synthidtext_watermark_processor_distributional_convergence (line 1187) | def test_synthidtext_watermark_processor_distributional_convergence(se... method test_synthidtext_watermark_processor_bias_test (line 1246) | def test_synthidtext_watermark_processor_bias_test(self, vocab_size, n... method test_dia_classifier_free_guidance (line 1311) | def test_dia_classifier_free_guidance(self): method test_dia_channel_filter (line 1339) | def test_dia_channel_filter(self): method test_dia_delay_pattern (line 1368) | def test_dia_delay_pattern(self): FILE: tests/generation/test_paged_attention.py class TestBatchGeneration (line 40) | class TestBatchGeneration(unittest.TestCase): method setUpClass (line 42) | def setUpClass(cls): method test_generate_batch_consistency (line 63) | def test_generate_batch_consistency(self, attn_impl, num_blocks, block... method test_generate_batch_with_sampling (line 104) | def test_generate_batch_with_sampling(self, attn_impl, num_blocks, blo... FILE: tests/generation/test_stopping_criteria.py class StoppingCriteriaTestCase (line 39) | class StoppingCriteriaTestCase(unittest.TestCase): method _get_tensors (line 40) | def _get_tensors(self, length): method test_list_criteria (line 48) | def test_list_criteria(self): method test_max_length_criteria (line 66) | def test_max_length_criteria(self): method test_max_time_criteria (line 78) | def test_max_time_criteria(self): method test_eos_token_criteria (line 87) | def test_eos_token_criteria(self): method test_confidence_criteria (line 103) | def test_confidence_criteria(self): method test_validate_stopping_criteria (line 120) | def test_validate_stopping_criteria(self): method test_stop_string_criteria (line 130) | def test_stop_string_criteria(self): method test_stop_string_criteria_vocab_size_mismatch (line 178) | def test_stop_string_criteria_vocab_size_mismatch(self): method test_stop_string_matching_positions (line 190) | def test_stop_string_matching_positions(self): method test_stop_string_embedding_vecs (line 204) | def test_stop_string_embedding_vecs(self): method test_single_letter_stop_string (line 224) | def test_single_letter_stop_string(self): method test_criteria_per_row (line 242) | def test_criteria_per_row(self): method test_criteria_per_row_batched (line 264) | def test_criteria_per_row_batched(self): FILE: tests/generation/test_streamers.py class StreamerTester (line 42) | class StreamerTester(unittest.TestCase): method test_text_streamer_matches_non_streaming (line 43) | def test_text_streamer_matches_non_streaming(self): method test_iterator_streamer_matches_non_streaming (line 60) | def test_iterator_streamer_matches_non_streaming(self): method test_text_streamer_skip_prompt (line 79) | def test_text_streamer_skip_prompt(self): method test_text_streamer_decode_kwargs (line 97) | def test_text_streamer_decode_kwargs(self): method test_iterator_streamer_timeout (line 119) | def test_iterator_streamer_timeout(self): class AsyncStreamerTester (line 139) | class AsyncStreamerTester(unittest.IsolatedAsyncioTestCase): method test_async_iterator_streamer_matches_non_streaming (line 140) | async def test_async_iterator_streamer_matches_non_streaming(self): method test_async_iterator_streamer_timeout (line 159) | async def test_async_iterator_streamer_timeout(self): FILE: tests/generation/test_utils.py function is_moe_model (line 115) | def is_moe_model(config): class GenerationTesterMixin (line 119) | class GenerationTesterMixin: method prepare_config_and_inputs_for_generate (line 124) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method _get_logits_processor_kwargs (line 157) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method _get_beam_kwargs (line 193) | def _get_beam_kwargs(self, num_return_sequences=1): method _greedy_generate (line 202) | def _greedy_generate( method _sample_generate (line 231) | def _sample_generate( method _beam_search_generate (line 263) | def _beam_search_generate( method _beam_sample_generate (line 293) | def _beam_sample_generate( method test_greedy_generate (line 325) | def test_greedy_generate(self): method test_greedy_generate_dict_outputs (line 338) | def test_greedy_generate_dict_outputs(self): method test_greedy_generate_dict_outputs_use_cache (line 368) | def test_greedy_generate_dict_outputs_use_cache(self): method test_sample_generate (line 402) | def test_sample_generate(self): method test_sample_generate_dict_output (line 415) | def test_sample_generate_dict_output(self): method test_beam_search_generate (line 446) | def test_beam_search_generate(self): method test_beam_search_generate_dict_output (line 461) | def test_beam_search_generate_dict_output(self): method test_beam_search_generate_dict_outputs_use_cache (line 497) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_model_parallel_beam_search (line 543) | def test_model_parallel_beam_search(self): method test_beam_sample_generate (line 562) | def test_beam_sample_generate(self): method test_beam_sample_generate_dict_output (line 580) | def test_beam_sample_generate_dict_output(self): method test_generate_without_input_ids (line 618) | def test_generate_without_input_ids(self): method test_assisted_decoding_matches_greedy_search (line 640) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_prompt_lookup_decoding_matches_greedy_search (line 738) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_assisted_decoding_sample (line 821) | def test_assisted_decoding_sample(self): method test_prompt_lookup_decoding_stops_at_eos (line 889) | def test_prompt_lookup_decoding_stops_at_eos(self): method test_left_padding_compatibility (line 918) | def test_left_padding_compatibility( method test_past_key_values_format (line 1035) | def test_past_key_values_format(self): method test_generate_from_random_inputs_embeds (line 1067) | def test_generate_from_random_inputs_embeds(self): method test_generate_from_inputs_embeds (line 1120) | def test_generate_from_inputs_embeds(self, _, num_beams): method test_generate_from_inputs_embeds_with_static_cache (line 1199) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_continue_from_past_key_values (line 1247) | def test_generate_continue_from_past_key_values(self): method test_generate_continue_from_inputs_embeds (line 1363) | def test_generate_continue_from_inputs_embeds(self): method test_generate_with_static_cache (line 1428) | def test_generate_with_static_cache(self): method test_generate_with_quant_cache (line 1493) | def test_generate_with_quant_cache(self): method test_generate_compile_model_forward_fullgraph (line 1526) | def test_generate_compile_model_forward_fullgraph(self): method test_generate_compilation_all_outputs (line 1652) | def test_generate_compilation_all_outputs(self): method test_generate_methods_with_logits_to_keep (line 1721) | def test_generate_methods_with_logits_to_keep(self): method test_inherits_generation_mixin (line 1746) | def test_inherits_generation_mixin(self): method test_prepare_inputs_for_generation_kwargs_forwards (line 1755) | def test_prepare_inputs_for_generation_kwargs_forwards(self, **extra_k... method _test_attention_implementation (line 1788) | def _test_attention_implementation(self, attn_implementation): method test_eager_matches_sdpa_generate (line 1879) | def test_eager_matches_sdpa_generate(self): method test_eager_matches_fa2_generate (line 1887) | def test_eager_matches_fa2_generate(self): method test_eager_matches_fa3_generate (line 1895) | def test_eager_matches_fa3_generate(self): method test_eager_matches_fa4_generate (line 1903) | def test_eager_matches_fa4_generate(self): method test_flash_attention_2_continue_generate_with_position_ids (line 1910) | def test_flash_attention_2_continue_generate_with_position_ids(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 2002) | def attention_mask_padding_matches_padding_free_with_position_ids( method test_eager_padding_matches_padding_free_with_position_ids (line 2127) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 2130) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 2137) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 2144) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_3_padding_matches_padding_free_with_position_ids (line 2153) | def test_flash_attention_3_padding_matches_padding_free_with_position_... method test_flash_attention_3_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 2160) | def test_flash_attention_3_padding_matches_padding_free_with_position_... method test_flash_attention_4_padding_matches_padding_free_with_position_ids (line 2169) | def test_flash_attention_4_padding_matches_padding_free_with_position_... method test_flash_attention_4_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 2176) | def test_flash_attention_4_padding_matches_padding_free_with_position_... method _get_custom_4d_mask_test_data (line 2181) | def _get_custom_4d_mask_test_data(self): method test_custom_4d_attention_mask (line 2216) | def test_custom_4d_attention_mask(self): method test_forward_with_logits_to_keep (line 2258) | def test_forward_with_logits_to_keep(self): method test_generate_with_and_without_position_ids (line 2281) | def test_generate_with_and_without_position_ids(self): method _check_generate_outputs (line 2341) | def _check_generate_outputs(self, output, config, use_cache=False, num... method _check_scores (line 2442) | def _check_scores(self, batch_size, scores, generated_length, config): method _check_logits (line 2449) | def _check_logits(self, batch_size, logits, config): method _check_attentions_for_generate (line 2458) | def _check_attentions_for_generate( method _check_encoder_attention_for_generate (line 2497) | def _check_encoder_attention_for_generate(self, attentions, batch_size... method _check_hidden_states_for_generate (line 2505) | def _check_hidden_states_for_generate( method _check_encoder_hidden_states_for_generate (line 2532) | def _check_encoder_hidden_states_for_generate(self, hidden_states, bat... method _get_conv_state_shape (line 2540) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 2549) | def _get_recurrent_state_shape(self, batch_size: int, config): method _check_past_key_values_for_generate (line 2558) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method _check_sequence_inside_sequence (line 2626) | def _check_sequence_inside_sequence(self, tensor_1, tensor_2): method _check_caches_are_equal (line 2649) | def _check_caches_are_equal(self, cache1: Cache, cache2: Cache): class UtilsFunctionsTest (line 2691) | class UtilsFunctionsTest(unittest.TestCase): method test_speculative_sampling (line 2692) | def test_speculative_sampling(self): method test_speculative_sampling_target_distribution (line 2727) | def test_speculative_sampling_target_distribution(self): function ids_tensor (line 2784) | def ids_tensor(shape, vocab_size, rng=None, name=None): function floats_tensor (line 2801) | def floats_tensor(shape, scale=1.0, rng=None, name=None): class GenerationIntegrationTests (line 2819) | class GenerationIntegrationTests(unittest.TestCase): method test_generation_config_defaults (line 2820) | def test_generation_config_defaults(self): method test_generation_config_deprecation (line 2853) | def test_generation_config_deprecation(self): method test_beam_search_early_stop_heuristic (line 2894) | def test_beam_search_early_stop_heuristic(self): method test_max_length_if_input_embeds (line 2940) | def test_max_length_if_input_embeds(self): method test_min_length_if_input_embeds (line 2953) | def test_min_length_if_input_embeds(self): method test_custom_stopping_criteria_overload_error (line 2965) | def test_custom_stopping_criteria_overload_error(self): method test_custom_stopping_criteria (line 2991) | def test_custom_stopping_criteria(self): method test_stop_sequence_stopping_criteria (line 3014) | def test_stop_sequence_stopping_criteria(self): method test_generate_non_nlp_input_ids_as_kwarg (line 3026) | def test_generate_non_nlp_input_ids_as_kwarg(self): method test_generate_input_values_as_encoder_kwarg (line 3037) | def test_generate_input_values_as_encoder_kwarg(self): method test_generate_inputs_embeds_one_token (line 3048) | def test_generate_inputs_embeds_one_token(self): method test_green_red_watermark_generation (line 3061) | def test_green_red_watermark_generation(self): method test_synthid_text_watermark_generation_mean_expected_bias (line 3095) | def test_synthid_text_watermark_generation_mean_expected_bias(self): method test_TopH_example_integration (line 3148) | def test_TopH_example_integration(self): method test_beam_search_example_integration (line 3176) | def test_beam_search_example_integration(self): method test_cfg_mixin (line 3202) | def test_cfg_mixin(self): method test_per_row_stopping_criteria (line 3242) | def test_per_row_stopping_criteria(self): method test_batched_decoder_start_id (line 3278) | def test_batched_decoder_start_id(self): method test_decoder_start_id_from_config (line 3297) | def test_decoder_start_id_from_config(self): method test_logits_processor_not_inplace (line 3326) | def test_logits_processor_not_inplace(self): method test_eos_token_id_int_and_list_top_k_top_sampling (line 3346) | def test_eos_token_id_int_and_list_top_k_top_sampling(self): method test_model_kwarg_encoder_signature_filtering (line 3358) | def test_model_kwarg_encoder_signature_filtering(self): method test_default_max_length_warning (line 3397) | def test_default_max_length_warning(self): method test_length_warning_assisted_generation (line 3422) | def test_length_warning_assisted_generation(self): method test_generated_length_assisted_generation (line 3443) | def test_generated_length_assisted_generation(self): method test_model_kwarg_assisted_decoding_decoder_only (line 3477) | def test_model_kwarg_assisted_decoding_decoder_only(self): method test_assisted_decoding_num_assistant_tokens_heuristic_schedule (line 3511) | def test_assisted_decoding_num_assistant_tokens_heuristic_schedule(self): method test_assisted_decoding_num_assistant_tokens_heuristic_transient_schedule (line 3533) | def test_assisted_decoding_num_assistant_tokens_heuristic_transient_sc... method test_validate_assistant (line 3557) | def test_validate_assistant(self): method test_compare_unprocessed_logit_scores (line 3614) | def test_compare_unprocessed_logit_scores(self): method test_return_unprocessed_logit_scores (line 3642) | def test_return_unprocessed_logit_scores(self): method test_assisted_decoding_in_different_accelerator (line 3678) | def test_assisted_decoding_in_different_accelerator(self): method test_assisted_decoding_model_in_accelerator_assistant_in_cpu (line 3703) | def test_assisted_decoding_model_in_accelerator_assistant_in_cpu(self): method test_special_tokens_fall_back_to_model_default (line 3726) | def test_special_tokens_fall_back_to_model_default(self): method test_speculative_decoding_equals_regular_decoding (line 3759) | def test_speculative_decoding_equals_regular_decoding(self): method test_generate_with_static_cache_multi_accelerator (line 3792) | def test_generate_with_static_cache_multi_accelerator(self): method test_generate_multi_accelerator_causal_mask (line 3827) | def test_generate_multi_accelerator_causal_mask(self): method test_init_static_cache_multi_accelerator (line 3855) | def test_init_static_cache_multi_accelerator(self): method test_prepare_inputs_for_generation_decoder_llm (line 3894) | def test_prepare_inputs_for_generation_decoder_llm(self): method test_prepare_inputs_for_generation_encoder_decoder_llm (line 3980) | def test_prepare_inputs_for_generation_encoder_decoder_llm(self): method test_assisted_generation_early_exit (line 4013) | def test_assisted_generation_early_exit(self): method test_beam_search_advanced_stopping_criteria (line 4037) | def test_beam_search_advanced_stopping_criteria(self): method test_validate_generation_inputs (line 4073) | def test_validate_generation_inputs(self): method test_custom_logits_processor (line 4094) | def test_custom_logits_processor(self): method test_transition_scores_greedy_search (line 4116) | def test_transition_scores_greedy_search(self): method test_transition_scores_greedy_search_normalized (line 4147) | def test_transition_scores_greedy_search_normalized(self): method test_transition_scores_beam_search_encoder_decoder (line 4180) | def test_transition_scores_beam_search_encoder_decoder(self): method test_transition_scores_beam_search_encoder_decoder_with_eos (line 4211) | def test_transition_scores_beam_search_encoder_decoder_with_eos(self): method test_transition_scores_beam_search_decoder_only (line 4243) | def test_transition_scores_beam_search_decoder_only(self): method test_transition_scores_early_stopping (line 4278) | def test_transition_scores_early_stopping(self): method test_encoder_decoder_generate_attention_mask (line 4311) | def test_encoder_decoder_generate_attention_mask(self): method test_generate_input_ids_as_kwarg (line 4344) | def test_generate_input_ids_as_kwarg(self): method test_generate_input_ids_as_encoder_kwarg (line 4361) | def test_generate_input_ids_as_encoder_kwarg(self): method test_generate_inputs_and_encoder_kwargs (line 4379) | def test_generate_inputs_and_encoder_kwargs(self): method test_generate_too_many_encoder_kwargs (line 4391) | def test_generate_too_many_encoder_kwargs(self): method test_eos_token_id_int_and_list_greedy_search (line 4400) | def test_eos_token_id_int_and_list_greedy_search(self): method test_generate_vision2text_conditioning (line 4423) | def test_generate_vision2text_conditioning(self): method test_load_generation_config_from_text_subconfig (line 4448) | def test_load_generation_config_from_text_subconfig(self): method test_cache_device_map_with_vision_layer_device_map (line 4464) | def test_cache_device_map_with_vision_layer_device_map(self): method test_cpu_offload_doesnt_compile (line 4516) | def test_cpu_offload_doesnt_compile(self): method test_custom_generate_from_argument_in_generate (line 4546) | def test_custom_generate_from_argument_in_generate(self): method test_custom_generate_from_model_repo_with_custom_generate_code (line 4565) | def test_custom_generate_from_model_repo_with_custom_generate_code(self): method test_custom_generate_bad_requirements (line 4576) | def test_custom_generate_bad_requirements(self): method test_custom_generate_requires_trust_remote_code (line 4592) | def test_custom_generate_requires_trust_remote_code(self): method test_custom_generate_local_directory (line 4607) | def test_custom_generate_local_directory(self): method test_custom_generate_callable (line 4628) | def test_custom_generate_callable(self): method test_generate_can_restart_from_cache_and_new_tokens_only (line 4649) | def test_generate_can_restart_from_cache_and_new_tokens_only(self): method test_hub_gen_strategies (line 4750) | def test_hub_gen_strategies(self, custom_generate, extra_kwargs): method test_model_generation_config_can_override_defaults (line 4783) | def test_model_generation_config_can_override_defaults(self): class TokenHealingTestCase (line 4802) | class TokenHealingTestCase(unittest.TestCase): method test_prompts (line 4814) | def test_prompts(self, name, input, expected): method test_generate_from_inputs_embeds_with_bos_token_id_is_none (line 4839) | def test_generate_from_inputs_embeds_with_bos_token_id_is_none(self): class TestAssistedCandidateGeneratorDifferentTokenizers (line 4853) | class TestAssistedCandidateGeneratorDifferentTokenizers(unittest.TestCase): method test_no_intersection (line 4854) | def test_no_intersection(self): method test_complete_overlap (line 4860) | def test_complete_overlap(self): method test_partial_overlap (line 4870) | def test_partial_overlap(self): method test_no_new_tokens (line 4880) | def test_no_new_tokens(self): class TestAssistedCandidateGeneratorUpdateStrategy (line 4891) | class TestAssistedCandidateGeneratorUpdateStrategy(unittest.TestCase): method setUp (line 4892) | def setUp(self): method assert_no_sklearn (line 4908) | def assert_no_sklearn(self): method test_update_candidate_strategy_no_matches_short (line 4919) | def test_update_candidate_strategy_no_matches_short(self, sklearn_avai... method test_update_candidate_strategy_with_mix_matches_3 (line 4933) | def test_update_candidate_strategy_with_mix_matches_3(self, sklearn_av... method test_update_candidate_strategy_with_matches_4 (line 4946) | def test_update_candidate_strategy_with_matches_4(self, sklearn_availa... method test_update_candidate_strategy_with_matches_3 (line 4959) | def test_update_candidate_strategy_with_matches_3(self, sklearn_availa... method test_update_candidate_strategy_with_matches_2 (line 4972) | def test_update_candidate_strategy_with_matches_2(self, sklearn_availa... method test_update_candidate_strategy_with_matches_1 (line 4985) | def test_update_candidate_strategy_with_matches_1(self, sklearn_availa... function _get_generate_outputs_mismatch_message (line 4998) | def _get_generate_outputs_mismatch_message(output_1, output_2, atol=1e-5... function has_similar_generate_outputs (line 5034) | def has_similar_generate_outputs(output_1, output_2, atol=1e-5, rtol=1e-... function assert_similar_generate_outputs (line 5044) | def assert_similar_generate_outputs(output_1, output_2, atol=1e-5, rtol=... FILE: tests/kernels/test_kernels.py class TestHubKernels (line 54) | class TestHubKernels(TestCasePlus): method setUpClass (line 56) | def setUpClass(cls): method tearDownClass (line 68) | def tearDownClass(cls): method tearDown (line 90) | def tearDown(self): method test_forward (line 95) | def test_forward(self): method test_getter_use_kernels (line 106) | def test_getter_use_kernels(self): method assert_kernelized_forward_is_different (line 110) | def assert_kernelized_forward_is_different(self, kernelized_model, not... method assert_kernelized_forward_is_the_same (line 137) | def assert_kernelized_forward_is_the_same(self, model_1, model_2): method test_kernelize (line 162) | def test_kernelize(self): method test_setter_use_kernels (line 169) | def test_setter_use_kernels(self): method test_unkernelize (line 177) | def test_unkernelize(self): method test_kernels_mapping (line 194) | def test_kernels_mapping(self): method test_faulty_kernel_mapping_layer_name (line 210) | def test_faulty_kernel_mapping_layer_name(self): method test_faulty_kernel_mapping_type (line 217) | def test_faulty_kernel_mapping_type(self): class TestKernelsEnv (line 226) | class TestKernelsEnv(TestCasePlus): method test_disable_hub_kernels (line 227) | def test_disable_hub_kernels(self): method test_enable_hub_kernels (line 237) | def test_enable_hub_kernels(self): class TestKernelUtilities (line 249) | class TestKernelUtilities(TestCasePlus): method test_is_kernel_regex (line 250) | def test_is_kernel_regex(self): method test_lazy_load_kernel_success_and_cache (line 270) | def test_lazy_load_kernel_success_and_cache(self): method test_lazy_load_kernel_unknown (line 292) | def test_lazy_load_kernel_unknown(self): method test_lazy_load_kernel_version (line 301) | def test_lazy_load_kernel_version(self): class TestAttentionKernelRegistration (line 346) | class TestAttentionKernelRegistration(TestCasePlus): method test_trust_remote_code_for_attention_kernels (line 347) | def test_trust_remote_code_for_attention_kernels(self): method test_load_and_register_flash_attn_like_kernel (line 383) | def test_load_and_register_flash_attn_like_kernel(self): method test_load_and_register_named_function_kernel (line 403) | def test_load_and_register_named_function_kernel(self): class TestUseKernelsLifecycle (line 424) | class TestUseKernelsLifecycle(TestCasePlus): method setUpClass (line 426) | def setUpClass(cls): method tearDownClass (line 431) | def tearDownClass(cls): method tearDown (line 439) | def tearDown(self): method test_setting_use_kernels_twice_does_not_rekernelize (line 443) | def test_setting_use_kernels_twice_does_not_rekernelize(self): method test_train_eval_calls_kernelize_with_correct_mode (line 456) | def test_train_eval_calls_kernelize_with_correct_mode(self): class TestKernelMappingDeviceFiltering (line 471) | class TestKernelMappingDeviceFiltering(TestCasePlus): method test_multi_device_mapping_filters_correctly (line 474) | def test_multi_device_mapping_filters_correctly(self): method test_single_device_mapping_still_works (line 516) | def test_single_device_mapping_still_works(self): FILE: tests/models/afmoe/test_modeling_afmoe.py class AfmoeModelTester (line 32) | class AfmoeModelTester(CausalLMModelTester): method __init__ (line 36) | def __init__( class AfmoeModelTest (line 105) | class AfmoeModelTest(CausalLMModelTest, unittest.TestCase): method test_eager_padding_matches_padding_free_with_position_ids (line 113) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 117) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_model_rope_scaling_frequencies (line 121) | def test_model_rope_scaling_frequencies(self): method test_model_outputs_equivalence (line 125) | def test_model_outputs_equivalence(self, **kwargs): method test_router_logits_without_aux_loss (line 128) | def test_router_logits_without_aux_loss(self): method test_moe_legacy_conversion_mapping_registered (line 143) | def test_moe_legacy_conversion_mapping_registered(self): class AfmoeIntegrationTest (line 157) | class AfmoeIntegrationTest(unittest.TestCase): method tearDown (line 158) | def tearDown(self): method test_compile_static_cache (line 165) | def test_compile_static_cache(self): FILE: tests/models/aimv2/test_modeling_aimv2.py class Aimv2VisionModelTester (line 66) | class Aimv2VisionModelTester: method __init__ (line 67) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 106) | def get_config(self): method create_and_check_model (line 120) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 129) | def prepare_config_and_inputs_for_common(self): class Aimv2ModelTesterMixin (line 136) | class Aimv2ModelTesterMixin(ModelTesterMixin): method test_sdpa_can_dispatch_composite_models (line 143) | def test_sdpa_can_dispatch_composite_models(self): class Aimv2VisionModelTest (line 174) | class Aimv2VisionModelTest(Aimv2ModelTesterMixin, unittest.TestCase): method setUp (line 184) | def setUp(self): method test_config (line 190) | def test_config(self): method test_inputs_embeds (line 194) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 197) | def test_model_get_set_embeddings(self): method test_forward_signature (line 206) | def test_forward_signature(self): method test_model (line 218) | def test_model(self): class Aimv2TextModelTester (line 223) | class Aimv2TextModelTester: method __init__ (line 224) | def __init__( method prepare_config_and_inputs (line 258) | def prepare_config_and_inputs(self): method get_config (line 276) | def get_config(self): method create_and_check_model (line 289) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 299) | def prepare_config_and_inputs_for_common(self): class Aimv2TextModelTest (line 307) | class Aimv2TextModelTest(Aimv2ModelTesterMixin, unittest.TestCase): method setUp (line 312) | def setUp(self): method test_config (line 316) | def test_config(self): method test_model (line 319) | def test_model(self): method test_inputs_embeds (line 324) | def test_inputs_embeds(self): class Aimv2ModelTester (line 328) | class Aimv2ModelTester: method __init__ (line 329) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 341) | def prepare_config_and_inputs(self): method get_config (line 349) | def get_config(self): method create_and_check_model (line 356) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 367) | def prepare_config_and_inputs_for_common(self): class Aimv2ModelTest (line 380) | class Aimv2ModelTest(Aimv2ModelTesterMixin, PipelineTesterMixin, unittes... method setUp (line 393) | def setUp(self): method test_model (line 400) | def test_model(self): method test_config (line 405) | def test_config(self): method test_hidden_states_output (line 409) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 413) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 417) | def test_model_get_set_embeddings(self): method test_multi_gpu_data_parallel_forward (line 421) | def test_multi_gpu_data_parallel_forward(self): method test_load_vision_text_config (line 424) | def test_load_vision_text_config(self): method test_eager_matches_sdpa_inference (line 444) | def test_eager_matches_sdpa_inference( class Aimv2ModelIntegrationTest (line 475) | class Aimv2ModelIntegrationTest(unittest.TestCase): method test_inference (line 477) | def test_inference(self): class Aimv2VisionModelIntegrationTests (line 508) | class Aimv2VisionModelIntegrationTests(unittest.TestCase): method test_inference (line 510) | def test_inference(self): method test_inference_for_native_resolution (line 541) | def test_inference_for_native_resolution(self): FILE: tests/models/albert/test_modeling_albert.py class AlbertModelTester (line 42) | class AlbertModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 119) | def get_config(self): method create_and_check_model (line 137) | def create_and_check_model( method create_and_check_for_pretraining (line 149) | def create_and_check_for_pretraining( method create_and_check_for_masked_lm (line 165) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 174) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 190) | def create_and_check_for_sequence_classification( method create_and_check_for_multiple_choice (line 200) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 218) | def prepare_config_and_inputs_for_common(self): class AlbertModelTest (line 234) | class AlbertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method _prepare_for_class (line 261) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 274) | def setUp(self): method test_config (line 278) | def test_config(self): method test_model (line 281) | def test_model(self): method test_for_pretraining (line 285) | def test_for_pretraining(self): method test_for_masked_lm (line 289) | def test_for_masked_lm(self): method test_for_multiple_choice (line 293) | def test_for_multiple_choice(self): method test_for_question_answering (line 297) | def test_for_question_answering(self): method test_for_sequence_classification (line 301) | def test_for_sequence_classification(self): method test_model_from_pretrained (line 306) | def test_model_from_pretrained(self): class AlbertModelIntegrationTest (line 313) | class AlbertModelIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 315) | def test_inference_no_head_absolute_embedding(self): FILE: tests/models/albert/test_tokenization_albert.py class AlbertTokenizationTest (line 29) | class AlbertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 39) | def setUpClass(cls): FILE: tests/models/align/test_modeling_align.py class AlignVisionModelTester (line 56) | class AlignVisionModelTester: method __init__ (line 57) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 95) | def get_config(self): method create_and_check_model (line 109) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 122) | def prepare_config_and_inputs_for_common(self): class AlignVisionModelTest (line 130) | class AlignVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 141) | def setUp(self): method test_config (line 151) | def test_config(self): method test_inputs_embeds (line 155) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 159) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 163) | def test_model_get_set_embeddings(self): method test_forward_signature (line 166) | def test_forward_signature(self): method test_model (line 178) | def test_model(self): method test_hidden_states_output (line 182) | def test_hidden_states_output(self): method test_training (line 213) | def test_training(self): method test_training_gradient_checkpointing (line 217) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant (line 223) | def test_training_gradient_checkpointing_use_reentrant(self): method test_training_gradient_checkpointing_use_reentrant_false (line 229) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_model_from_pretrained (line 233) | def test_model_from_pretrained(self): class AlignTextModelTester (line 239) | class AlignTextModelTester: method __init__ (line 240) | def __init__( method prepare_config_and_inputs (line 282) | def prepare_config_and_inputs(self): method get_config (line 297) | def get_config(self): method create_and_check_model (line 313) | def create_and_check_model(self, config, input_ids, token_type_ids, in... method prepare_config_and_inputs_for_common (line 324) | def prepare_config_and_inputs_for_common(self): class AlignTextModelTest (line 337) | class AlignTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 340) | def setUp(self): method test_config (line 344) | def test_config(self): method test_model (line 347) | def test_model(self): method test_training (line 352) | def test_training(self): method test_training_gradient_checkpointing (line 356) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 360) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 364) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 368) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 372) | def test_inputs_embeds_matches_input_ids(self): method test_model_from_pretrained (line 376) | def test_model_from_pretrained(self): class AlignModelTester (line 382) | class AlignModelTester: method __init__ (line 383) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 395) | def prepare_config_and_inputs(self): method get_config (line 403) | def get_config(self): method create_and_check_model (line 410) | def create_and_check_model(self, config, input_ids, token_type_ids, at... method prepare_config_and_inputs_for_common (line 421) | def prepare_config_and_inputs_for_common(self): class AlignModelTest (line 435) | class AlignModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 444) | def setUp(self): method test_model (line 453) | def test_model(self): method test_config (line 457) | def test_config(self): method test_batching_equivalence (line 460) | def test_batching_equivalence(self, atol=3e-4, rtol=3e-4): method test_multi_gpu_data_parallel_forward (line 464) | def test_multi_gpu_data_parallel_forward(self): method test_hidden_states_output (line 468) | def test_hidden_states_output(self): method test_inputs_embeds (line 472) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 476) | def test_inputs_embeds_matches_input_ids(self): method test_retain_grad_hidden_states_attentions (line 480) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 484) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 487) | def test_load_vision_text_config(self): method _image_features_get_expected_num_attentions (line 502) | def _image_features_get_expected_num_attentions(self, model_tester=None): method test_model_from_pretrained (line 509) | def test_model_from_pretrained(self): function prepare_img (line 516) | def prepare_img(): class AlignModelIntegrationTest (line 524) | class AlignModelIntegrationTest(unittest.TestCase): method test_inference (line 526) | def test_inference(self): FILE: tests/models/align/test_processing_align.py class AlignProcessorTest (line 28) | class AlignProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 32) | def _setup_tokenizer(cls): method _setup_image_processor (line 59) | def _setup_image_processor(cls): FILE: tests/models/altclip/test_modeling_altclip.py class AltCLIPVisionModelTester (line 46) | class AltCLIPVisionModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 85) | def prepare_config_and_inputs(self): method get_config (line 91) | def get_config(self): method create_and_check_model (line 106) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 119) | def prepare_config_and_inputs_for_common(self): class AltCLIPVisionModelTest (line 127) | class AltCLIPVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 137) | def setUp(self): method test_config (line 143) | def test_config(self): method test_inputs_embeds (line 147) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 150) | def test_model_get_set_embeddings(self): method test_forward_signature (line 159) | def test_forward_signature(self): method test_model (line 171) | def test_model(self): method test_training (line 176) | def test_training(self): method test_training_gradient_checkpointing (line 180) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 184) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 188) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 192) | def test_model_from_pretrained(self): class AltCLIPTextModelTester (line 196) | class AltCLIPTextModelTester: method __init__ (line 197) | def __init__( method prepare_config_and_inputs (line 237) | def prepare_config_and_inputs(self): method get_config (line 255) | def get_config(self): method create_and_check_model (line 271) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 281) | def prepare_config_and_inputs_for_common(self): class AltCLIPTextModelTest (line 289) | class AltCLIPTextModelTest(ModelTesterMixin, unittest.TestCase): method test_resize_tokens_embeddings (line 294) | def test_resize_tokens_embeddings(self): method setUp (line 297) | def setUp(self): method test_config (line 301) | def test_config(self): method test_model (line 304) | def test_model(self): method test_training (line 309) | def test_training(self): method test_training_gradient_checkpointing (line 313) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 317) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 321) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_outputs_equivalence (line 324) | def test_model_outputs_equivalence(self): method test_hidden_states_output (line 328) | def test_hidden_states_output(self): method test_inputs_embeds (line 332) | def test_inputs_embeds(self): method test_model_from_pretrained (line 336) | def test_model_from_pretrained(self): class AltCLIPModelTester (line 342) | class AltCLIPModelTester: method __init__ (line 343) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 355) | def prepare_config_and_inputs(self): method get_config (line 362) | def get_config(self): method create_and_check_model (line 369) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 377) | def prepare_config_and_inputs_for_common(self): function prepare_img (line 390) | def prepare_img(): class AltCLIPModelTest (line 397) | class AltCLIPModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method is_pipeline_test_to_skip (line 405) | def is_pipeline_test_to_skip( method setUp (line 420) | def setUp(self): method test_model (line 429) | def test_model(self): method test_config (line 433) | def test_config(self): method test_hidden_states_output (line 437) | def test_hidden_states_output(self): method test_inputs_embeds (line 441) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 445) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 449) | def test_model_get_set_embeddings(self): method test_model_from_pretrained (line 453) | def test_model_from_pretrained(self): class AltCLIPModelIntegrationTest (line 461) | class AltCLIPModelIntegrationTest(unittest.TestCase): method test_inference (line 463) | def test_inference(self): method test_inference_interpolate_pos_encoding (line 491) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/altclip/test_processing_altclip.py class AltClipProcessorTest (line 25) | class AltClipProcessorTest(ProcessorTesterMixin, unittest.TestCase): FILE: tests/models/apertus/test_modeling_apertus.py class ApertusModelTester (line 39) | class ApertusModelTester(CausalLMModelTester): method __init__ (line 43) | def __init__(self, parent): class ApertusModelTest (line 52) | class ApertusModelTest(CausalLMModelTest, unittest.TestCase): class ApertusIntegrationTest (line 65) | class ApertusIntegrationTest(unittest.TestCase): FILE: tests/models/arcee/test_modeling_arcee.py class ArceeModelTester (line 41) | class ArceeModelTester(CausalLMModelTester): class ArceeModelTest (line 47) | class ArceeModelTest(CausalLMModelTest, unittest.TestCase): method test_arcee_mlp_uses_relu_squared (line 57) | def test_arcee_mlp_uses_relu_squared(self): class ArceeIntegrationTest (line 77) | class ArceeIntegrationTest(unittest.TestCase): method tearDown (line 78) | def tearDown(self): method test_model_from_pretrained (line 85) | def test_model_from_pretrained(self): method test_model_generation (line 94) | def test_model_generation(self): method test_model_generation_flash_attn (line 111) | def test_model_generation_flash_attn(self): FILE: tests/models/aria/test_image_processing_aria.py class AriaImageProcessingTester (line 34) | class AriaImageProcessingTester: method __init__ (line 35) | def __init__( method prepare_image_processor_dict (line 71) | def prepare_image_processor_dict(self): method get_expected_values (line 84) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 91) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 95) | def prepare_image_inputs( class AriaImageProcessingTest (line 151) | class AriaImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 152) | def setUp(self): method image_processor_dict (line 157) | def image_processor_dict(self): method test_image_processor_properties (line 160) | def test_image_processor_properties(self): method test_call_numpy (line 171) | def test_call_numpy(self): method test_call_numpy_4_channels (line 192) | def test_call_numpy_4_channels(self): method test_call_pil (line 216) | def test_call_pil(self): method test_call_pytorch (line 237) | def test_call_pytorch(self): method test_pad_for_patching (line 260) | def test_pad_for_patching(self): method test_get_num_patches_without_images (line 290) | def test_get_num_patches_without_images(self): FILE: tests/models/aria/test_modeling_aria.py class AriaVisionText2TextModelTester (line 60) | class AriaVisionText2TextModelTester: method __init__ (line 61) | def __init__( method get_config (line 146) | def get_config(self): method prepare_config_and_inputs (line 159) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 172) | def prepare_config_and_inputs_for_common(self): class AriaForConditionalGenerationModelTest (line 188) | class AriaForConditionalGenerationModelTest(ModelTesterMixin, Generation... method setUp (line 197) | def setUp(self): method test_training_gradient_checkpointing (line 204) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 210) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 216) | def test_training_gradient_checkpointing_use_reentrant_true(self): class AriaForConditionalGenerationIntegrationTest (line 231) | class AriaForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 232) | def setUp(self): method tearDown (line 236) | def tearDown(self): method test_small_model_integration_test (line 241) | def test_small_model_integration_test(self): method test_small_model_integration_test_llama_single (line 278) | def test_small_model_integration_test_llama_single(self): method test_small_model_integration_test_llama_batched (line 309) | def test_small_model_integration_test_llama_batched(self): method test_small_model_integration_test_batch (line 350) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_llama_batched_regression (line 386) | def test_small_model_integration_test_llama_batched_regression(self): method test_batched_generation (line 420) | def test_batched_generation(self): method test_tokenizer_integration (line 488) | def test_tokenizer_integration(self): method test_generation_no_images (line 511) | def test_generation_no_images(self): FILE: tests/models/aria/test_processing_aria.py class AriaProcessorTest (line 28) | class AriaProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 39) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 70) | def prepare_processor_dict(): method test_get_num_vision_tokens (line 76) | def test_get_num_vision_tokens(self): method test_process_interleaved_images_prompts_image_splitting (line 88) | def test_process_interleaved_images_prompts_image_splitting(self): method test_process_interleaved_images_prompts_no_image_splitting (line 97) | def test_process_interleaved_images_prompts_no_image_splitting(self): method test_non_nested_images_with_batched_text (line 162) | def test_non_nested_images_with_batched_text(self): method test_apply_chat_template (line 181) | def test_apply_chat_template(self): method test_image_chat_template_accepts_processing_kwargs (line 219) | def test_image_chat_template_accepts_processing_kwargs(self): method test_special_mm_token_truncation (line 273) | def test_special_mm_token_truncation(self): FILE: tests/models/audio_spectrogram_transformer/test_feature_extraction_audio_spectrogram_transformer.py function floats_list (line 38) | def floats_list(shape, scale=1.0, rng=None, name=None): class ASTFeatureExtractionTester (line 52) | class ASTFeatureExtractionTester: method __init__ (line 53) | def __init__( method prepare_feat_extract_dict (line 76) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 85) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class ASTFeatureExtractionTest (line 106) | class ASTFeatureExtractionTest(SequenceFeatureExtractionTestMixin, unitt... method setUp (line 109) | def setUp(self): method test_call (line 112) | def test_call(self): method test_double_precision_pad (line 139) | def test_double_precision_pad(self): method _load_datasamples (line 152) | def _load_datasamples(self, num_samples): method test_integration (line 162) | def test_integration(self): method test_feat_extract_from_and_save_pretrained (line 178) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 190) | def test_feat_extract_to_json_file(self): class ASTFeatureExtractionWithoutTorchaudioTest (line 209) | class ASTFeatureExtractionWithoutTorchaudioTest(ASTFeatureExtractionTest): method test_using_audio_utils (line 210) | def test_using_audio_utils(self): FILE: tests/models/audio_spectrogram_transformer/test_modeling_audio_spectrogram_transformer.py class ASTModelTester (line 44) | class ASTModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 95) | def prepare_config_and_inputs(self): method get_config (line 106) | def get_config(self): method create_and_check_model (line 125) | def create_and_check_model(self, config, input_values, labels): method prepare_config_and_inputs_for_common (line 132) | def prepare_config_and_inputs_for_common(self): class ASTModelTest (line 144) | class ASTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method is_pipeline_test_to_skip (line 167) | def is_pipeline_test_to_skip( method setUp (line 182) | def setUp(self): method test_config (line 186) | def test_config(self): method test_inputs_embeds (line 190) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 193) | def test_model_get_set_embeddings(self): method test_forward_signature (line 202) | def test_forward_signature(self): method test_model (line 214) | def test_model(self): method test_model_from_pretrained (line 219) | def test_model_from_pretrained(self): function prepare_audio (line 226) | def prepare_audio(): class ASTModelIntegrationTest (line 238) | class ASTModelIntegrationTest(unittest.TestCase): method default_feature_extractor (line 240) | def default_feature_extractor(self): method test_inference_audio_classification (line 248) | def test_inference_audio_classification(self): FILE: tests/models/audioflamingo3/test_modeling_audioflamingo3.py class AudioFlamingo3ModelTester (line 46) | class AudioFlamingo3ModelTester: method __init__ (line 52) | def __init__( method get_config (line 107) | def get_config(self): method prepare_config_and_inputs (line 114) | def prepare_config_and_inputs(self): method _post_pool_tokens_per_window (line 124) | def _post_pool_tokens_per_window(self, T_mel): method prepare_config_and_inputs_for_common (line 130) | def prepare_config_and_inputs_for_common(self): class AudioFlamingo3ForConditionalGenerationModelTest (line 153) | class AudioFlamingo3ForConditionalGenerationModelTest(ModelTesterMixin, ... method setUp (line 170) | def setUp(self): method test_inputs_embeds_matches_input_ids (line 177) | def test_inputs_embeds_matches_input_ids(self): method test_sdpa_can_compile_dynamic (line 182) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 186) | def test_sdpa_can_dispatch_on_flash(self): method test_flash_attn_2_inference_equivalence_right_padding (line 190) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_model_base_model_prefix (line 194) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 197) | def test_sdpa_can_dispatch_composite_models(self): class AudioFlamingo3ForConditionalGenerationIntegrationTest (line 237) | class AudioFlamingo3ForConditionalGenerationIntegrationTest(unittest.Tes... method setUp (line 243) | def setUp(cls): method tearDown (line 248) | def tearDown(self): method test_fixture_single_matches (line 252) | def test_fixture_single_matches(self): method test_fixture_batched_matches (line 294) | def test_fixture_batched_matches(self): FILE: tests/models/audioflamingo3/test_processing_audioflamingo3.py class AudioFlamingo3ProcessorTest (line 33) | class AudioFlamingo3ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method setUpClass (line 39) | def setUpClass(cls): method get_tokenizer (line 48) | def get_tokenizer(self, **kwargs): method get_audio_processor (line 53) | def get_audio_processor(self, **kwargs): method get_processor (line 58) | def get_processor(self, **kwargs): method tearDownClass (line 62) | def tearDownClass(cls): method test_can_load_various_tokenizers (line 67) | def test_can_load_various_tokenizers(self): method test_save_load_pretrained_default (line 74) | def test_save_load_pretrained_default(self): method test_tokenizer_integration (line 91) | def test_tokenizer_integration(self): method test_chat_template (line 128) | def test_chat_template(self): method test_apply_transcription_request_single (line 157) | def test_apply_transcription_request_single(self): method test_apply_chat_template_audio (line 186) | def test_apply_chat_template_audio(self, batch_size: int, return_tenso... FILE: tests/models/auto/test_configuration_auto.py class AutoConfigTest (line 39) | class AutoConfigTest(unittest.TestCase): method setUp (line 40) | def setUp(self): method test_module_spec (line 43) | def test_module_spec(self): method test_config_from_model_shortcut (line 47) | def test_config_from_model_shortcut(self): method test_config_model_type_from_local_file (line 51) | def test_config_model_type_from_local_file(self): method test_config_model_type_from_model_identifier (line 55) | def test_config_model_type_from_model_identifier(self): method test_config_for_model_str (line 59) | def test_config_for_model_str(self): method test_new_config_registration (line 63) | def test_new_config_registration(self): method test_repo_not_found (line 84) | def test_repo_not_found(self): method test_revision_not_found (line 90) | def test_revision_not_found(self): method test_from_pretrained_dynamic_config (line 96) | def test_from_pretrained_dynamic_config(self): method test_from_pretrained_dynamic_config_conflict (line 120) | def test_from_pretrained_dynamic_config_conflict(self): method test_config_missing_model_type (line 150) | def test_config_missing_model_type(self): FILE: tests/models/auto/test_feature_extraction_auto.py class AutoFeatureExtractorTest (line 45) | class AutoFeatureExtractorTest(unittest.TestCase): method setUp (line 46) | def setUp(self): method test_feature_extractor_from_model_shortcut (line 49) | def test_feature_extractor_from_model_shortcut(self): method test_feature_extractor_from_local_directory_from_key (line 53) | def test_feature_extractor_from_local_directory_from_key(self): method test_feature_extractor_from_local_directory_from_config (line 57) | def test_feature_extractor_from_local_directory_from_config(self): method test_feature_extractor_from_local_file (line 79) | def test_feature_extractor_from_local_file(self): method test_repo_not_found (line 83) | def test_repo_not_found(self): method test_revision_not_found (line 89) | def test_revision_not_found(self): method test_feature_extractor_not_found (line 95) | def test_feature_extractor_not_found(self): method test_from_pretrained_dynamic_feature_extractor (line 102) | def test_from_pretrained_dynamic_feature_extractor(self): method test_new_feature_extractor_registration (line 135) | def test_new_feature_extractor_registration(self): method test_from_pretrained_dynamic_feature_extractor_conflict (line 156) | def test_from_pretrained_dynamic_feature_extractor_conflict(self): FILE: tests/models/auto/test_image_processing_auto.py class AutoImageProcessorTest (line 42) | class AutoImageProcessorTest(unittest.TestCase): method setUp (line 43) | def setUp(self): method test_image_processor_from_model_shortcut (line 47) | def test_image_processor_from_model_shortcut(self): method test_image_processor_from_local_directory_from_key (line 52) | def test_image_processor_from_local_directory_from_key(self): method test_image_processor_from_local_directory_from_feature_extractor_key (line 66) | def test_image_processor_from_local_directory_from_feature_extractor_k... method test_image_processor_from_new_filename (line 83) | def test_image_processor_from_new_filename(self): method test_image_processor_from_local_directory_from_config (line 98) | def test_image_processor_from_local_directory_from_config(self): method test_image_processor_from_local_file (line 130) | def test_image_processor_from_local_file(self): method test_repo_not_found (line 141) | def test_repo_not_found(self): method test_revision_not_found (line 147) | def test_revision_not_found(self): method test_image_processor_not_found (line 153) | def test_image_processor_not_found(self): method test_use_fast_selection (line 162) | def test_use_fast_selection(self): method test_from_pretrained_dynamic_image_processor (line 177) | def test_from_pretrained_dynamic_image_processor(self): method test_new_image_processor_registration (line 214) | def test_new_image_processor_registration(self): method test_from_pretrained_dynamic_image_processor_conflict (line 245) | def test_from_pretrained_dynamic_image_processor_conflict(self): method test_backend_kwarg_pil (line 286) | def test_backend_kwarg_pil(self): method test_backend_kwarg_torchvision (line 295) | def test_backend_kwarg_torchvision(self): method test_default_to_pil_backend_for_lanczos_processors (line 304) | def test_default_to_pil_backend_for_lanczos_processors(self): method test_explicit_backend_overrides_lanczos_default (line 316) | def test_explicit_backend_overrides_lanczos_default(self): method test_legacy_fast_class_name_in_config (line 327) | def test_legacy_fast_class_name_in_config(self): method test_register_with_image_processor_classes_dict (line 341) | def test_register_with_image_processor_classes_dict(self): method test_register_legacy_slow_fast_params (line 357) | def test_register_legacy_slow_fast_params(self): FILE: tests/models/auto/test_modeling_auto.py class AutoModelTest (line 91) | class AutoModelTest(unittest.TestCase): method setUp (line 92) | def setUp(self): method test_model_from_pretrained (line 96) | def test_model_from_pretrained(self): method test_model_for_pretraining_from_pretrained (line 116) | def test_model_for_pretraining_from_pretrained(self): method test_model_for_causal_lm (line 131) | def test_model_for_causal_lm(self): method test_model_for_masked_lm (line 143) | def test_model_for_masked_lm(self): method test_model_for_encoder_decoder_lm (line 155) | def test_model_for_encoder_decoder_lm(self): method test_sequence_classification_model_from_pretrained (line 167) | def test_sequence_classification_model_from_pretrained(self): method test_question_answering_model_from_pretrained (line 179) | def test_question_answering_model_from_pretrained(self): method test_table_question_answering_model_from_pretrained (line 191) | def test_table_question_answering_model_from_pretrained(self): method test_token_classification_model_from_pretrained (line 203) | def test_token_classification_model_from_pretrained(self): method test_auto_backbone_timm_model_from_pretrained (line 215) | def test_auto_backbone_timm_model_from_pretrained(self): method test_auto_backbone_from_pretrained (line 235) | def test_auto_backbone_from_pretrained(self): method test_from_pretrained_with_tuple_values (line 250) | def test_from_pretrained_with_tuple_values(self): method test_from_pretrained_dynamic_model_local (line 265) | def test_from_pretrained_dynamic_model_local(self): method test_from_pretrained_dynamic_model_distant (line 286) | def test_from_pretrained_dynamic_model_distant(self): method test_from_pretrained_dynamic_model_distant_with_ref (line 341) | def test_from_pretrained_dynamic_model_distant_with_ref(self): method test_from_pretrained_dynamic_model_with_period (line 369) | def test_from_pretrained_dynamic_model_with_period(self): method test_new_model_registration (line 390) | def test_new_model_registration(self): method test_from_pretrained_dynamic_model_conflict (line 441) | def test_from_pretrained_dynamic_model_conflict(self): method test_repo_not_found (line 478) | def test_repo_not_found(self): method test_revision_not_found (line 484) | def test_revision_not_found(self): method test_cached_model_has_minimum_calls_to_head (line 491) | def test_cached_model_has_minimum_calls_to_head(self): method test_attr_not_existing (line 508) | def test_attr_not_existing(self): method test_custom_model_patched_generation_inheritance (line 526) | def test_custom_model_patched_generation_inheritance(self): method test_model_with_dotted_name_and_relative_imports (line 544) | def test_model_with_dotted_name_and_relative_imports(self): method test_adapter_path_not_overwritten_for_complete_model (line 558) | def test_adapter_path_not_overwritten_for_complete_model(self): FILE: tests/models/auto/test_processor_auto.py class AutoFeatureExtractorTest (line 76) | class AutoFeatureExtractorTest(unittest.TestCase): method setUp (line 79) | def setUp(self): method test_processor_from_model_shortcut (line 82) | def test_processor_from_model_shortcut(self): method test_processor_from_local_directory_from_repo (line 86) | def test_processor_from_local_directory_from_repo(self): method test_processor_from_local_subfolder_from_repo (line 99) | def test_processor_from_local_subfolder_from_repo(self): method test_processor_from_local_directory_from_extractor_config (line 108) | def test_processor_from_local_directory_from_extractor_config(self): method test_subcomponent_get_config_dict_saved_as_nested_config (line 119) | def test_subcomponent_get_config_dict_saved_as_nested_config(self): method test_processor_from_processor_class (line 161) | def test_processor_from_processor_class(self): method test_processor_from_tokenizer_processor_class (line 189) | def test_processor_from_tokenizer_processor_class(self): method test_processor_from_local_directory_from_model_config (line 210) | def test_processor_from_local_directory_from_model_config(self): method test_from_pretrained_dynamic_processor (line 224) | def test_from_pretrained_dynamic_processor(self): method test_new_processor_registration (line 255) | def test_new_processor_registration(self): method test_from_pretrained_dynamic_processor_conflict (line 293) | def test_from_pretrained_dynamic_processor_conflict(self): method test_from_pretrained_dynamic_processor_with_extra_attributes (line 360) | def test_from_pretrained_dynamic_processor_with_extra_attributes(self): method test_dynamic_processor_with_specific_dynamic_subcomponents (line 398) | def test_dynamic_processor_with_specific_dynamic_subcomponents(self): method test_auto_processor_creates_tokenizer (line 431) | def test_auto_processor_creates_tokenizer(self): method test_auto_processor_creates_image_processor (line 435) | def test_auto_processor_creates_image_processor(self): method test_auto_processor_save_load (line 439) | def test_auto_processor_save_load(self): method test_processor_with_multiple_tokenizers_save_load (line 446) | def test_processor_with_multiple_tokenizers_save_load(self): method test_processor_with_multiple_image_processors_save_load (line 496) | def test_processor_with_multiple_image_processors_save_load(self): class ProcessorPushToHubTester (line 557) | class ProcessorPushToHubTester(unittest.TestCase): method setUpClass (line 561) | def setUpClass(cls): method test_push_to_hub_via_save_pretrained (line 564) | def test_push_to_hub_via_save_pretrained(self): method test_push_to_hub_in_organization_via_save_pretrained (line 576) | def test_push_to_hub_in_organization_via_save_pretrained(self): method test_push_to_hub_dynamic_processor (line 593) | def test_push_to_hub_dynamic_processor(self): method test_push_to_hub_with_chat_templates (line 644) | def test_push_to_hub_with_chat_templates(self): FILE: tests/models/auto/test_tokenization_auto.py class AutoTokenizerTest (line 76) | class AutoTokenizerTest(unittest.TestCase): method setUp (line 77) | def setUp(self): method test_tokenizer_from_pretrained (line 81) | def test_tokenizer_from_pretrained(self): method test_tokenizer_from_pretrained_identifier (line 94) | def test_tokenizer_from_pretrained_identifier(self): method test_tokenizer_from_model_type (line 99) | def test_tokenizer_from_model_type(self): method test_tokenizer_from_tokenizer_class (line 104) | def test_tokenizer_from_tokenizer_class(self): method test_tokenizer_from_type (line 112) | def test_tokenizer_from_type(self): method test_tokenizer_from_type_fast (line 127) | def test_tokenizer_from_type_fast(self): method test_tokenizer_from_type_incorrect_name (line 141) | def test_tokenizer_from_type_incorrect_name(self): method test_tokenizer_identifier_with_correct_config (line 146) | def test_tokenizer_identifier_with_correct_config(self): method test_tokenizer_identifier_non_existent (line 156) | def test_tokenizer_identifier_non_existent(self): method test_model_name_edge_cases_in_mappings (line 164) | def test_model_name_edge_cases_in_mappings(self): method test_tokenizer_mapping_names_use_single_entries (line 181) | def test_tokenizer_mapping_names_use_single_entries(self): method test_from_pretrained_use_fast_toggle (line 198) | def test_from_pretrained_use_fast_toggle(self): method test_custom_tokenizer_from_hub (line 206) | def test_custom_tokenizer_from_hub(self): method test_remote_code_imports_removed_fast_submodule (line 214) | def test_remote_code_imports_removed_fast_submodule(self): method test_voxtral_tokenizer_converts_from_tekken (line 224) | def test_voxtral_tokenizer_converts_from_tekken(self): method test_do_lower_case (line 239) | def test_do_lower_case(self): method test_PreTrainedTokenizerFast_from_pretrained (line 250) | def test_PreTrainedTokenizerFast_from_pretrained(self): method test_auto_tokenizer_from_local_folder (line 259) | def test_auto_tokenizer_from_local_folder(self): method test_auto_tokenizer_from_local_folder_mistral_detection (line 269) | def test_auto_tokenizer_from_local_folder_mistral_detection(self): method test_auto_tokenizer_from_mistral_patching (line 303) | def test_auto_tokenizer_from_mistral_patching(self): method test_auto_tokenizer_loads_bloom_repo_without_tokenizer_class (line 310) | def test_auto_tokenizer_loads_bloom_repo_without_tokenizer_class(self): method test_auto_tokenizer_loads_sentencepiece_only_repo (line 316) | def test_auto_tokenizer_loads_sentencepiece_only_repo(self): method test_auto_tokenizer_fast_no_slow (line 321) | def test_auto_tokenizer_fast_no_slow(self): method test_get_tokenizer_config (line 326) | def test_get_tokenizer_config(self): method test_new_tokenizer_registration (line 346) | def test_new_tokenizer_registration(self): method test_new_tokenizer_fast_registration (line 370) | def test_new_tokenizer_fast_registration(self): method test_from_pretrained_dynamic_tokenizer (line 416) | def test_from_pretrained_dynamic_tokenizer(self): method test_custom_tokenizer_init (line 480) | def test_custom_tokenizer_init(self): method test_from_pretrained_dynamic_tokenizer_conflict (line 488) | def test_from_pretrained_dynamic_tokenizer_conflict(self): method test_from_pretrained_dynamic_tokenizer_legacy_format (line 528) | def test_from_pretrained_dynamic_tokenizer_legacy_format(self): method test_repo_not_found (line 545) | def test_repo_not_found(self): method test_revision_not_found (line 551) | def test_revision_not_found(self): method test_cached_tokenizer_has_minimum_calls_to_head (line 558) | def test_cached_tokenizer_has_minimum_calls_to_head(self): method test_init_tokenizer_with_trust (line 567) | def test_init_tokenizer_with_trust(self): method test_tokenization_class_priority (line 637) | def test_tokenization_class_priority(self): method test_custom_tokenizer_with_mismatched_tokenizer_class (line 653) | def test_custom_tokenizer_with_mismatched_tokenizer_class(self): FILE: tests/models/auto/test_video_processing_auto.py class AutoVideoProcessorTest (line 40) | class AutoVideoProcessorTest(unittest.TestCase): method setUp (line 41) | def setUp(self): method test_video_processor_from_model_shortcut (line 44) | def test_video_processor_from_model_shortcut(self): method test_video_processor_from_local_directory_from_key (line 48) | def test_video_processor_from_local_directory_from_key(self): method test_video_processor_from_local_directory_from_preprocessor_key (line 64) | def test_video_processor_from_local_directory_from_preprocessor_key(se... method test_video_processor_from_local_directory_from_config (line 81) | def test_video_processor_from_local_directory_from_config(self): method test_video_processor_from_local_file (line 115) | def test_video_processor_from_local_file(self): method test_repo_not_found (line 129) | def test_repo_not_found(self): method test_revision_not_found (line 136) | def test_revision_not_found(self): method test_video_processor_not_found (line 142) | def test_video_processor_not_found(self): method test_from_pretrained_dynamic_video_processor (line 149) | def test_from_pretrained_dynamic_video_processor(self): method test_new_video_processor_registration (line 176) | def test_new_video_processor_registration(self): method test_from_pretrained_dynamic_video_processor_conflict (line 210) | def test_from_pretrained_dynamic_video_processor_conflict(self): FILE: tests/models/autoformer/test_modeling_autoformer.py class AutoformerModelTester (line 42) | class AutoformerModelTester: method __init__ (line 43) | def __init__( method get_config (line 91) | def get_config(self): method prepare_autoformer_inputs_dict (line 114) | def prepare_autoformer_inputs_dict(self, config): method prepare_config_and_inputs (line 136) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 141) | def prepare_config_and_inputs_for_common(self): method check_encoder_decoder_model_standalone (line 145) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class AutoformerModelTest (line 207) | class AutoformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method setUp (line 215) | def setUp(self): method test_batching_equivalence (line 223) | def test_batching_equivalence(self): method test_config (line 226) | def test_config(self): method test_save_load_strict (line 229) | def test_save_load_strict(self): method test_encoder_decoder_model_standalone (line 239) | def test_encoder_decoder_model_standalone(self): method test_resize_tokens_embeddings (line 244) | def test_resize_tokens_embeddings(self): method test_training_gradient_checkpointing (line 248) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 252) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 256) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_main_input_name (line 260) | def test_model_main_input_name(self): method test_forward_signature (line 266) | def test_forward_signature(self): method test_attention_outputs (line 303) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 401) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 405) | def test_model_get_set_embeddings(self): function prepare_batch (line 409) | def prepare_batch(filename="train-batch.pt"): class AutoformerModelIntegrationTests (line 418) | class AutoformerModelIntegrationTests(unittest.TestCase): method test_inference_no_head (line 419) | def test_inference_no_head(self): method test_inference_head (line 443) | def test_inference_head(self): method test_seq_to_seq_generation (line 461) | def test_seq_to_seq_generation(self): FILE: tests/models/aya_vision/test_modeling_aya_vision.py class AyaVisionVisionText2TextModelTester (line 52) | class AyaVisionVisionText2TextModelTester: method __init__ (line 53) | def __init__( method get_config (line 118) | def get_config(self): method prepare_config_and_inputs (line 131) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 137) | def prepare_config_and_inputs_for_common(self): class AyaVisionModelTest (line 155) | class AyaVisionModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method setUp (line 176) | def setUp(self): method test_config (line 180) | def test_config(self): method test_training (line 184) | def test_training(self): method test_training_gradient_checkpointing (line 188) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 192) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 196) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_sdpa_can_compile_dynamic (line 201) | def test_sdpa_can_compile_dynamic(self): method test_batching_equivalence (line 206) | def test_batching_equivalence(self): class AyaVisionIntegrationTest (line 211) | class AyaVisionIntegrationTest(unittest.TestCase): method setUpClass (line 213) | def setUpClass(cls): method tearDownClass (line 218) | def tearDownClass(cls): method tearDown (line 222) | def tearDown(self): method get_model (line 226) | def get_model(cls): method test_small_model_integration_forward (line 245) | def test_small_model_integration_forward(self): method test_small_model_integration_generate_text_only (line 287) | def test_small_model_integration_generate_text_only(self): method test_small_model_integration_generate_chat_template (line 323) | def test_small_model_integration_generate_chat_template(self): method test_small_model_integration_batched_generate (line 359) | def test_small_model_integration_batched_generate(self): method test_small_model_integration_batched_generate_multi_image (line 431) | def test_small_model_integration_batched_generate_multi_image(self): FILE: tests/models/aya_vision/test_processing_aya_vision.py class AyaVisionProcessorTest (line 29) | class AyaVisionProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 34) | def _setup_test_attributes(cls, processor): method _setup_tokenizer (line 38) | def _setup_tokenizer(cls): method _setup_image_processor (line 43) | def _setup_image_processor(cls): method prepare_processor_dict (line 58) | def prepare_processor_dict(): method test_processor_with_multiple_inputs (line 62) | def test_processor_with_multiple_inputs(self): method test_get_num_vision_tokens (line 65) | def test_get_num_vision_tokens(self): method test_process_interleaved_images_videos (line 78) | def test_process_interleaved_images_videos(self): FILE: tests/models/bamba/test_modeling_bamba.py class BambaModelTester (line 53) | class BambaModelTester: method __init__ (line 59) | def __init__( method prepare_config_and_inputs (line 119) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 135) | def prepare_config_and_inputs_for_common(self): method _update_layer_configs (line 146) | def _update_layer_configs(self): method get_config (line 159) | def get_config(self, **kwargs): method create_and_check_model (line 183) | def create_and_check_model( method create_and_check_for_causal_lm (line 197) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 213) | def create_and_check_decoder_model_past_large_inputs( class BambaModelTest (line 266) | class BambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method _get_conv_state_shape (line 282) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 290) | def _get_recurrent_state_shape(self, batch_size: int, config): method setUp (line 293) | def setUp(self): method test_config (line 297) | def test_config(self): method test_model (line 300) | def test_model(self): method test_for_causal_lm (line 304) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 308) | def test_decoder_model_past_with_large_inputs(self): method test_attention_outputs (line 312) | def test_attention_outputs(self): method test_batching_equivalence (line 376) | def test_batching_equivalence(self): method test_left_padding_compatibility (line 384) | def test_left_padding_compatibility(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 392) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 398) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_seq_idx_and_fa_kwargs (line 408) | def test_flash_attention_2_padding_matches_padding_free_with_position_... class BambaModelIntegrationTest (line 494) | class BambaModelIntegrationTest(unittest.TestCase): method setUpClass (line 502) | def setUpClass(cls): method test_simple_generate (line 513) | def test_simple_generate(self): method test_simple_batched_generate_with_padding (line 551) | def test_simple_batched_generate_with_padding(self): FILE: tests/models/bark/test_modeling_bark.py class BarkSemanticModelTester (line 62) | class BarkSemanticModelTester: method __init__ (line 63) | def __init__( method prepare_config_and_inputs (line 107) | def prepare_config_and_inputs(self): method get_config (line 123) | def get_config(self): method get_pipeline_config (line 137) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 143) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 147) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... class BarkCoarseModelTester (line 195) | class BarkCoarseModelTester: method __init__ (line 196) | def __init__( method prepare_config_and_inputs (line 240) | def prepare_config_and_inputs(self): method get_config (line 256) | def get_config(self): method get_pipeline_config (line 270) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 276) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 280) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... class BarkFineModelTester (line 328) | class BarkFineModelTester: method __init__ (line 329) | def __init__( method prepare_config_and_inputs (line 373) | def prepare_config_and_inputs(self): method get_config (line 393) | def get_config(self): method get_pipeline_config (line 407) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 413) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 417) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... class BarkModelTester (line 465) | class BarkModelTester: method __init__ (line 466) | def __init__( method get_config (line 492) | def get_config(self): method get_pipeline_config (line 500) | def get_pipeline_config(self): class BarkSemanticModelTest (line 516) | class BarkSemanticModelTest(ModelTesterMixin, GenerationTesterMixin, uni... method setUp (line 527) | def setUp(self): method test_config (line 531) | def test_config(self): method test_save_load_strict (line 534) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 544) | def test_decoder_model_past_with_large_inputs(self): method test_generate_fp16 (line 549) | def test_generate_fp16(self): method test_model_base_model_prefix (line 559) | def test_model_base_model_prefix(self): class BarkCoarseModelTest (line 564) | class BarkCoarseModelTest(ModelTesterMixin, GenerationTesterMixin, unitt... method setUp (line 575) | def setUp(self): method test_config (line 579) | def test_config(self): method test_save_load_strict (line 582) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 592) | def test_decoder_model_past_with_large_inputs(self): method test_generate_fp16 (line 597) | def test_generate_fp16(self): method test_model_base_model_prefix (line 607) | def test_model_base_model_prefix(self): class BarkFineModelTest (line 612) | class BarkFineModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 620) | def setUp(self): method test_config (line 624) | def test_config(self): method test_save_load_strict (line 627) | def test_save_load_strict(self): method test_inputs_embeds_matches_input_ids (line 638) | def test_inputs_embeds_matches_input_ids(self): method test_inputs_embeds (line 641) | def test_inputs_embeds(self): method test_generate_fp16 (line 662) | def test_generate_fp16(self): method test_forward_signature (line 700) | def test_forward_signature(self): method test_model_get_set_embeddings (line 712) | def test_model_get_set_embeddings(self): method test_resize_tokens_embeddings (line 725) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 776) | def test_resize_embeddings_untied(self): class BarkModelIntegrationTests (line 831) | class BarkModelIntegrationTests(unittest.TestCase): method model (line 833) | def model(self): method processor (line 837) | def processor(self): method inputs (line 841) | def inputs(self): method semantic_generation_config (line 850) | def semantic_generation_config(self): method coarse_generation_config (line 855) | def coarse_generation_config(self): method fine_generation_config (line 860) | def fine_generation_config(self): method test_model_can_generate (line 864) | def test_model_can_generate(self): method test_generate_semantic (line 868) | def test_generate_semantic(self): method test_generate_semantic_early_stop (line 884) | def test_generate_semantic_early_stop(self): method test_generate_coarse (line 926) | def test_generate_coarse(self): method test_generate_fine (line 954) | def test_generate_fine(self): method test_generate_end_to_end (line 1003) | def test_generate_end_to_end(self): method test_generate_end_to_end_with_args (line 1010) | def test_generate_end_to_end_with_args(self): method test_generate_batching (line 1017) | def test_generate_batching(self): method test_generate_end_to_end_with_sub_models_args (line 1047) | def test_generate_end_to_end_with_sub_models_args(self): method test_generate_end_to_end_with_offload (line 1077) | def test_generate_end_to_end_with_offload(self): method assertListAlmostEqual (line 1116) | def assertListAlmostEqual(self, list1, list2, tol=1e-6): FILE: tests/models/bark/test_processing_bark.py class BarkProcessorTest (line 27) | class BarkProcessorTest(unittest.TestCase): method setUp (line 28) | def setUp(self): method get_tokenizer (line 36) | def get_tokenizer(self, **kwargs): method tearDown (line 39) | def tearDown(self): method test_save_load_pretrained_default (line 42) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 53) | def test_save_load_pretrained_additional_features(self): method test_speaker_embeddings (line 82) | def test_speaker_embeddings(self): method test_tokenizer (line 117) | def test_tokenizer(self): FILE: tests/models/bart/test_modeling_bart.py function prepare_bart_inputs_dict (line 56) | def prepare_bart_inputs_dict( class BartModelTester (line 75) | class BartModelTester: method __init__ (line 76) | def __init__( method prepare_config_and_inputs (line 114) | def prepare_config_and_inputs(self): method get_config (line 127) | def get_config(self): method get_pipeline_config (line 145) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 151) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 155) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 188) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class BartHeadTests (line 222) | class BartHeadTests(unittest.TestCase): method _get_config_and_data (line 225) | def _get_config_and_data(self): method test_sequence_classification_forward (line 263) | def test_sequence_classification_forward(self): method test_question_answering_forward (line 273) | def test_question_answering_forward(self): method test_lm_forward (line 289) | def test_lm_forward(self): method test_lm_uneven_forward (line 299) | def test_lm_uneven_forward(self): method test_shift_tokens_right (line 320) | def test_shift_tokens_right(self): method test_tokenization (line 330) | def test_tokenization(self): method test_generate_fp16 (line 342) | def test_generate_fp16(self): method test_dummy_inputs (line 350) | def test_dummy_inputs(self): method test_resize_tokens_embeddings_more (line 355) | def test_resize_tokens_embeddings_more(self): class BartModelTest (line 373) | class BartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 392) | def setUp(self): method test_config (line 396) | def test_config(self): method test_save_load_strict (line 399) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 409) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 413) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 418) | def test_inputs_embeds(self): method test_input_embeddings_support_forward_hook (line 447) | def test_input_embeddings_support_forward_hook(self): method test_generate_fp16 (line 477) | def test_generate_fp16(self): method test_load_save_without_tied_weights (line 489) | def test_load_save_without_tied_weights(self): method test_resize_embeddings_persists_embeddings_type (line 492) | def test_resize_embeddings_persists_embeddings_type(self): function assert_tensors_close (line 505) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 524) | def _long_tensor(tok_lst): class FastIntegrationTests (line 530) | class FastIntegrationTests(unittest.TestCase): method tok (line 534) | def tok(self): method xsum_1_1_model (line 538) | def xsum_1_1_model(self): method test_xsum_1_1_generation (line 541) | def test_xsum_1_1_generation(self): method test_xsum_1_1_batch_generation (line 593) | def test_xsum_1_1_batch_generation(self): method test_encoder_equiv (line 728) | def test_encoder_equiv(self): class BartModelIntegrationTests (line 856) | class BartModelIntegrationTests(unittest.TestCase): method default_tokenizer (line 858) | def default_tokenizer(self): method test_inference_no_head (line 862) | def test_inference_no_head(self): method test_base_mask_filling (line 876) | def test_base_mask_filling(self): method test_large_mask_filling (line 883) | def test_large_mask_filling(self): method test_mnli_inference (line 891) | def test_mnli_inference(self): method test_xsum_summarization_same_as_fairseq (line 919) | def test_xsum_summarization_same_as_fairseq(self): method test_xsum_config_generation_params (line 954) | def test_xsum_config_generation_params(self): method test_cnn_summarization_same_as_fairseq (line 961) | def test_cnn_summarization_same_as_fairseq(self): method test_decoder_attention_mask (line 1203) | def test_decoder_attention_mask(self): class BartStandaloneDecoderModelTester (line 1232) | class BartStandaloneDecoderModelTester: method __init__ (line 1233) | def __init__( method prepare_config_and_inputs (line 1288) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_decoder (line 1324) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_decoder_model_past (line 1344) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 1380) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 1427) | def prepare_config_and_inputs_for_common(self): class BartStandaloneDecoderModelTest (line 1444) | class BartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterM... method setUp (line 1449) | def setUp( method test_config (line 1455) | def test_config(self): method test_decoder_model_past (line 1458) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 1462) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 1467) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 1471) | def test_flex_attention_with_grads(): FILE: tests/models/barthez/test_tokenization_barthez.py class BarthezTokenizationTest (line 25) | class BarthezTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 35) | def setUpClass(cls): FILE: tests/models/bartpho/test_tokenization_bartpho.py class BartphoTokenizerTest (line 28) | class BartphoTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 35) | def setUpClass(cls): method get_tokenizer (line 40) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 55) | def get_input_output_texts(self, tokenizer): method test_full_tokenizer (line 60) | def test_full_tokenizer(self): FILE: tests/models/beit/test_image_processing_beit.py class BeitImageProcessingTester (line 30) | class BeitImageProcessingTester: method __init__ (line 31) | def __init__( method prepare_image_processor_dict (line 65) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 77) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 80) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 92) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 98) | def prepare_semantic_batch_inputs(): class BeitImageProcessingTest (line 105) | class BeitImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 106) | def setUp(self): method image_processor_dict (line 111) | def image_processor_dict(self): method test_image_processor_properties (line 114) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 126) | def test_image_processor_from_dict_with_kwargs(self): method test_call_segmentation_maps (line 140) | def test_call_segmentation_maps(self): method test_reduce_labels (line 247) | def test_reduce_labels(self): method test_backends_equivalence (line 268) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 287) | def test_backends_equivalence_batched(self): FILE: tests/models/beit/test_modeling_beit.py class BeitModelTester (line 61) | class BeitModelTester: method __init__ (line 62) | def __init__( method prepare_config_and_inputs (line 117) | def prepare_config_and_inputs(self): method get_config (line 130) | def get_config(self): method create_and_check_model (line 150) | def create_and_check_model(self, config, pixel_values, labels, pixel_l... method create_and_check_backbone (line 157) | def create_and_check_backbone(self, config, pixel_values, labels, pixe... method create_and_check_for_masked_lm (line 189) | def create_and_check_for_masked_lm(self, config, pixel_values, labels,... method create_and_check_for_image_classification (line 196) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_for_semantic_segmentation (line 214) | def create_and_check_for_semantic_segmentation(self, config, pixel_val... method prepare_config_and_inputs_for_common (line 228) | def prepare_config_and_inputs_for_common(self): class BeitModelTest (line 236) | class BeitModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 265) | def setUp(self): method test_config (line 269) | def test_config(self): method test_inputs_embeds (line 273) | def test_inputs_embeds(self): method test_multi_gpu_data_parallel_forward (line 278) | def test_multi_gpu_data_parallel_forward(self): method test_feed_forward_chunking (line 282) | def test_feed_forward_chunking(self): method test_sdpa_can_compile_dynamic (line 287) | def test_sdpa_can_compile_dynamic(self): method test_model_get_set_embeddings (line 290) | def test_model_get_set_embeddings(self): method test_model (line 299) | def test_model(self): method test_backbone (line 303) | def test_backbone(self): method test_for_masked_lm (line 307) | def test_for_masked_lm(self): method test_for_image_classification (line 311) | def test_for_image_classification(self): method test_for_semantic_segmentation (line 315) | def test_for_semantic_segmentation(self): method test_training (line 319) | def test_training(self): method check_training_gradient_checkpointing (line 342) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_model_from_pretrained (line 372) | def test_model_from_pretrained(self): function prepare_img (line 379) | def prepare_img(): class BeitModelIntegrationTest (line 386) | class BeitModelIntegrationTest(unittest.TestCase): method default_image_processor (line 388) | def default_image_processor(self): method test_inference_masked_image_modeling_head (line 394) | def test_inference_masked_image_modeling_head(self): method test_inference_image_classification_head_imagenet_1k (line 420) | def test_inference_image_classification_head_imagenet_1k(self): method test_inference_image_classification_head_imagenet_22k (line 444) | def test_inference_image_classification_head_imagenet_22k(self): method test_inference_semantic_segmentation (line 470) | def test_inference_semantic_segmentation(self): method test_post_processing_semantic_segmentation (line 500) | def test_post_processing_semantic_segmentation(self): method test_inference_interpolate_pos_encoding (line 525) | def test_inference_interpolate_pos_encoding(self): class BeitBackboneTest (line 546) | class BeitBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 550) | def setUp(self): FILE: tests/models/bert/test_modeling_bert.py class BertModelTester (line 47) | class BertModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 119) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 138) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 165) | def create_and_check_model( method create_and_check_model_as_decoder (line 177) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 210) | def create_and_check_for_causal_lm( method create_and_check_for_masked_lm (line 228) | def create_and_check_for_masked_lm( method create_and_check_model_for_causal_lm_as_decoder (line 237) | def create_and_check_model_for_causal_lm_as_decoder( method create_and_check_decoder_model_past_large_inputs (line 270) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_next_sequence_prediction (line 330) | def create_and_check_for_next_sequence_prediction( method create_and_check_for_pretraining (line 344) | def create_and_check_for_pretraining( method create_and_check_for_question_answering (line 360) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 376) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 386) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 396) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 414) | def prepare_config_and_inputs_for_common(self): class BertModelTest (line 430) | class BertModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method _prepare_for_class (line 461) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method prepare_config_and_inputs_for_generate (line 475) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method setUp (line 480) | def setUp(self): method test_config (line 484) | def test_config(self): method test_model (line 487) | def test_model(self): method test_model_as_decoder (line 491) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 495) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 522) | def test_for_causal_lm(self): method test_for_masked_lm (line 526) | def test_for_masked_lm(self): method test_for_causal_lm_decoder (line 530) | def test_for_causal_lm_decoder(self): method test_decoder_model_past_with_large_inputs (line 534) | def test_decoder_model_past_with_large_inputs(self): method test_for_multiple_choice (line 538) | def test_for_multiple_choice(self): method test_for_next_sequence_prediction (line 542) | def test_for_next_sequence_prediction(self): method test_for_pretraining (line 546) | def test_for_pretraining(self): method test_for_question_answering (line 550) | def test_for_question_answering(self): method test_for_sequence_classification (line 554) | def test_for_sequence_classification(self): method test_for_token_classification (line 558) | def test_for_token_classification(self): method test_model_from_pretrained (line 563) | def test_model_from_pretrained(self): class BertModelIntegrationTest (line 570) | class BertModelIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 572) | def test_inference_no_head_absolute_embedding(self): FILE: tests/models/bert/test_tokenization_bert.py class BertTokenizationTest (line 27) | class BertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/bert_generation/test_modeling_bert_generation.py class BertGenerationEncoderTester (line 33) | class BertGenerationEncoderTester: method __init__ (line 34) | def __init__( method prepare_config_and_inputs (line 72) | def prepare_config_and_inputs(self): method get_config (line 86) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 101) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 122) | def create_and_check_model( method create_and_check_model_as_decoder (line 137) | def create_and_check_model_as_decoder( method create_and_check_decoder_model_past_large_inputs (line 164) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_causal_lm (line 222) | def create_and_check_for_causal_lm( method prepare_config_and_inputs_for_common (line 236) | def prepare_config_and_inputs_for_common(self): class BertGenerationEncoderTest (line 243) | class BertGenerationEncoderTest(ModelTesterMixin, GenerationTesterMixin,... method prepare_config_and_inputs_for_generate (line 252) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method setUp (line 257) | def setUp(self): method test_config (line 261) | def test_config(self): method test_model (line 264) | def test_model(self): method test_model_as_bert (line 268) | def test_model_as_bert(self): method test_model_as_decoder (line 273) | def test_model_as_decoder(self): method test_decoder_model_past_with_large_inputs (line 277) | def test_decoder_model_past_with_large_inputs(self): method test_model_as_decoder_with_default_input_mask (line 281) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 302) | def test_for_causal_lm(self): method test_model_from_pretrained (line 307) | def test_model_from_pretrained(self): class BertGenerationEncoderIntegrationTest (line 313) | class BertGenerationEncoderIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 315) | def test_inference_no_head_absolute_embedding(self): class BertGenerationDecoderIntegrationTest (line 331) | class BertGenerationDecoderIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 333) | def test_inference_no_head_absolute_embedding(self): FILE: tests/models/bert_generation/test_tokenization_bert_generation.py class BertGenerationTokenizationTest (line 30) | class BertGenerationTokenizationTest(TokenizerTesterMixin, unittest.Test... method setUpClass (line 37) | def setUpClass(cls): method test_convert_token_and_id (line 43) | def test_convert_token_and_id(self): method test_get_vocab (line 51) | def test_get_vocab(self): method test_vocab_size (line 59) | def test_vocab_size(self): method test_full_tokenizer (line 62) | def test_full_tokenizer(self): method big_tokenizer (line 135) | def big_tokenizer(self): method test_tokenization_base_easy_symbols (line 139) | def test_tokenization_base_easy_symbols(self): method test_tokenization_base_hard_symbols (line 146) | def test_tokenization_base_hard_symbols(self): method test_torch_encode_plus_sent_to_model (line 211) | def test_torch_encode_plus_sent_to_model(self): method test_tokenizer_integration (line 234) | def test_tokenizer_integration(self): FILE: tests/models/bert_japanese/test_tokenization_bert_japanese.py class BertJapaneseTokenizationTest (line 37) | class BertJapaneseTokenizationTest(TokenizerTesterMixin, unittest.TestCa... method setUpClass (line 44) | def setUpClass(cls): method get_tokenizer (line 84) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method tearDownClass (line 90) | def tearDownClass(cls): method get_input_output_texts (line 95) | def get_input_output_texts(self, tokenizer): method get_clean_sequence (line 100) | def get_clean_sequence(self, tokenizer): method test_pretokenized_inputs (line 106) | def test_pretokenized_inputs(self): method test_maximum_encoding_length_pair_input (line 109) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 112) | def test_maximum_encoding_length_single_input(self): method test_full_tokenizer (line 115) | def test_full_tokenizer(self): method test_mecab_full_tokenizer_with_mecab_kwargs (line 122) | def test_mecab_full_tokenizer_with_mecab_kwargs(self): method test_mecab_tokenizer_ipadic (line 131) | def test_mecab_tokenizer_ipadic(self): method test_mecab_tokenizer_unidic_lite (line 139) | def test_mecab_tokenizer_unidic_lite(self): method test_mecab_tokenizer_unidic (line 150) | def test_mecab_tokenizer_unidic(self): method test_mecab_tokenizer_lower (line 167) | def test_mecab_tokenizer_lower(self): method test_mecab_tokenizer_with_option (line 175) | def test_mecab_tokenizer_with_option(self): method test_mecab_tokenizer_no_normalize (line 189) | def test_mecab_tokenizer_no_normalize(self): method test_sudachi_tokenizer_core (line 198) | def test_sudachi_tokenizer_core(self): method test_sudachi_tokenizer_split_mode_A (line 209) | def test_sudachi_tokenizer_split_mode_A(self): method test_sudachi_tokenizer_split_mode_B (line 215) | def test_sudachi_tokenizer_split_mode_B(self): method test_sudachi_tokenizer_split_mode_C (line 221) | def test_sudachi_tokenizer_split_mode_C(self): method test_sudachi_full_tokenizer_with_sudachi_kwargs_split_mode_B (line 227) | def test_sudachi_full_tokenizer_with_sudachi_kwargs_split_mode_B(self): method test_sudachi_tokenizer_projection (line 235) | def test_sudachi_tokenizer_projection(self): method test_sudachi_full_tokenizer_with_sudachi_kwargs_sudachi_projection (line 243) | def test_sudachi_full_tokenizer_with_sudachi_kwargs_sudachi_projection... method test_sudachi_tokenizer_lower (line 251) | def test_sudachi_tokenizer_lower(self): method test_sudachi_tokenizer_no_normalize (line 257) | def test_sudachi_tokenizer_no_normalize(self): method test_sudachi_tokenizer_trim_whitespace (line 263) | def test_sudachi_tokenizer_trim_whitespace(self): method test_jumanpp_tokenizer (line 272) | def test_jumanpp_tokenizer(self): method test_jumanpp_tokenizer_lower (line 279) | def test_jumanpp_tokenizer_lower(self): method test_jumanpp_tokenizer_no_normalize (line 285) | def test_jumanpp_tokenizer_no_normalize(self): method test_jumanpp_tokenizer_trim_whitespace (line 291) | def test_jumanpp_tokenizer_trim_whitespace(self): method test_jumanpp_full_tokenizer_with_jumanpp_kwargs_trim_whitespace (line 300) | def test_jumanpp_full_tokenizer_with_jumanpp_kwargs_trim_whitespace(se... method test_jumanpp_tokenizer_ext (line 311) | def test_jumanpp_tokenizer_ext(self): method test_wordpiece_tokenizer (line 319) | def test_wordpiece_tokenizer(self): method test_sentencepiece_tokenizer (line 335) | def test_sentencepiece_tokenizer(self): method test_sequence_builders (line 345) | def test_sequence_builders(self): class BertJapaneseCharacterTokenizationTest (line 360) | class BertJapaneseCharacterTokenizationTest(TokenizerTesterMixin, unitte... method setUpClass (line 366) | def setUpClass(cls): method tearDownClass (line 380) | def tearDownClass(cls): method get_tokenizer (line 387) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 392) | def get_input_output_texts(self, tokenizer): method test_pretokenized_inputs (line 397) | def test_pretokenized_inputs(self): method test_maximum_encoding_length_pair_input (line 400) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 403) | def test_maximum_encoding_length_single_input(self): method test_full_tokenizer (line 406) | def test_full_tokenizer(self): method test_character_tokenizer (line 415) | def test_character_tokenizer(self): method test_sequence_builders (line 429) | def test_sequence_builders(self): class AutoTokenizerCustomTest (line 444) | class AutoTokenizerCustomTest(unittest.TestCase): method test_tokenizer_bert_japanese (line 445) | def test_tokenizer_bert_japanese(self): FILE: tests/models/bertweet/test_tokenization_bertweet.py class BertweetTokenizationTest (line 23) | class BertweetTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 29) | def setUpClass(cls): method get_tokenizer (line 46) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 51) | def get_input_output_texts(self, tokenizer): method test_full_tokenizer (line 56) | def test_full_tokenizer(self): FILE: tests/models/big_bird/test_modeling_big_bird.py class BigBirdModelTester (line 46) | class BigBirdModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method get_config (line 129) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 150) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 177) | def create_and_check_model( method create_and_check_for_pretraining (line 188) | def create_and_check_for_pretraining( method create_and_check_model_as_decoder (line 204) | def create_and_check_model_as_decoder( method create_and_check_for_masked_lm (line 236) | def create_and_check_for_masked_lm( method create_and_check_decoder_model_past_large_inputs (line 245) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_question_answering (line 309) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 325) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 335) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 345) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 363) | def prepare_config_and_inputs_for_common(self): method create_and_check_for_auto_padding (line 377) | def create_and_check_for_auto_padding( method create_and_check_for_change_to_full_attn (line 393) | def create_and_check_for_change_to_full_attn( class BigBirdModelTest (line 413) | class BigBirdModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method _prepare_for_class (line 444) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 457) | def setUp(self): method test_config (line 461) | def test_config(self): method test_model (line 464) | def test_model(self): method test_for_pretraining (line 468) | def test_for_pretraining(self): method test_for_masked_lm (line 472) | def test_for_masked_lm(self): method test_for_multiple_choice (line 476) | def test_for_multiple_choice(self): method test_decoder_model_past_with_large_inputs (line 480) | def test_decoder_model_past_with_large_inputs(self): method test_for_question_answering (line 484) | def test_for_question_answering(self): method test_for_sequence_classification (line 488) | def test_for_sequence_classification(self): method test_for_token_classification (line 492) | def test_for_token_classification(self): method test_model_as_decoder (line 496) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 500) | def test_model_as_decoder_with_default_input_mask(self): method test_retain_grad_hidden_states_attentions (line 527) | def test_retain_grad_hidden_states_attentions(self): method test_model_from_pretrained (line 534) | def test_model_from_pretrained(self): method test_model_various_attn_type (line 539) | def test_model_various_attn_type(self): method test_fast_integration (line 545) | def test_fast_integration(self): method test_auto_padding (line 573) | def test_auto_padding(self): method test_for_change_to_full_attn (line 578) | def test_for_change_to_full_attn(self): method test_training_gradient_checkpointing (line 584) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 588) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 592) | def test_training_gradient_checkpointing_use_reentrant_true(self): class BigBirdModelIntegrationTest (line 598) | class BigBirdModelIntegrationTest(unittest.TestCase): method _get_dummy_input_ids (line 602) | def _get_dummy_input_ids(self): method test_inference_block_sparse_pretraining (line 612) | def test_inference_block_sparse_pretraining(self): method test_inference_full_pretraining (line 642) | def test_inference_full_pretraining(self): method test_block_sparse_attention_probs (line 671) | def test_block_sparse_attention_probs(self): method test_block_sparse_context_layer (line 736) | def test_block_sparse_context_layer(self): method test_tokenizer_inference (line 785) | def test_tokenizer_inference(self): method test_inference_question_answering (line 834) | def test_inference_question_answering(self): method test_fill_mask (line 896) | def test_fill_mask(self): method test_auto_padding (line 908) | def test_auto_padding(self): FILE: tests/models/big_bird/test_tokenization_big_bird.py class BigBirdTokenizationTest (line 30) | class BigBirdTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/bigbird_pegasus/test_modeling_bigbird_pegasus.py function prepare_bigbird_pegasus_inputs_dict (line 55) | def prepare_bigbird_pegasus_inputs_dict( class BigBirdPegasusModelTester (line 77) | class BigBirdPegasusModelTester: method __init__ (line 78) | def __init__( method prepare_config_and_inputs (line 127) | def prepare_config_and_inputs(self): method get_config (line 140) | def get_config(self): method prepare_config_and_inputs_for_common (line 163) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 167) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 200) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): method create_and_check_model (line 232) | def create_and_check_model(self, config, inputs_dict): class BigBirdPegasusModelTest (line 241) | class BigBirdPegasusModelTest(ModelTesterMixin, GenerationTesterMixin, P... method is_pipeline_test_to_skip (line 266) | def is_pipeline_test_to_skip( method setUp (line 281) | def setUp(self): method test_config (line 285) | def test_config(self): method test_save_load_strict (line 288) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 298) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 302) | def test_encoder_decoder_model_standalone(self): method test_model_various_attn_type (line 306) | def test_model_various_attn_type(self): method test_generate_without_input_ids (line 312) | def test_generate_without_input_ids(self): method test_retain_grad_hidden_states_attentions (line 319) | def test_retain_grad_hidden_states_attentions(self): method test_inputs_embeds (line 326) | def test_inputs_embeds(self): method test_generate_fp16 (line 360) | def test_generate_fp16(self): method test_batched_forward_original_full (line 370) | def test_batched_forward_original_full(self): method test_batched_forward_block_sparse (line 374) | def test_batched_forward_block_sparse(self): method _check_batched_forward (line 377) | def _check_batched_forward(self, attn_type, tolerance=1e-3): method test_auto_padding (line 416) | def test_auto_padding(self): method test_for_change_to_full_attn (line 438) | def test_for_change_to_full_attn(self): method test_load_save_without_tied_weights (line 458) | def test_load_save_without_tied_weights(self): class BigBirdPegasusModelIntegrationTests (line 466) | class BigBirdPegasusModelIntegrationTests(unittest.TestCase): method _get_dummy_input_ids (line 467) | def _get_dummy_input_ids(self): method _get_dummy_target_ids (line 477) | def _get_dummy_target_ids(self): method test_inference_block_sparse (line 487) | def test_inference_block_sparse(self): method test_inference_full_attn (line 511) | def test_inference_full_attn(self): method test_seq_to_seq_generation (line 532) | def test_seq_to_seq_generation(self): class BigBirdPegasusStandaloneDecoderModelTester (line 579) | class BigBirdPegasusStandaloneDecoderModelTester: method __init__ (line 580) | def __init__( method prepare_config_and_inputs (line 644) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 683) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 719) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 766) | def prepare_config_and_inputs_for_common(self): class BigBirdPegasusStandaloneDecoderModelTest (line 775) | class BigBirdPegasusStandaloneDecoderModelTest(ModelTesterMixin, Generat... method setUp (line 780) | def setUp( method test_config (line 786) | def test_config(self): method test_decoder_model_past (line 789) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 793) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 798) | def test_retain_grad_hidden_states_attentions(self): FILE: tests/models/biogpt/test_modeling_biogpt.py class BioGptModelTester (line 40) | class BioGptModelTester: method __init__ (line 41) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 112) | def get_config(self): method create_and_check_model (line 128) | def create_and_check_model( method create_and_check_biogpt_model_attention_mask_past (line 138) | def create_and_check_biogpt_model_attention_mask_past(self, config, in... method create_and_check_biogpt_model_past_large_inputs (line 178) | def create_and_check_biogpt_model_past_large_inputs(self, config, inpu... method create_and_check_forward_and_backwards (line 211) | def create_and_check_forward_and_backwards( method create_and_check_biogpt_weight_initialization (line 224) | def create_and_check_biogpt_weight_initialization(self, config, *args): method create_and_check_biogpt_for_token_classification (line 232) | def create_and_check_biogpt_for_token_classification(self, config, inp... method prepare_config_and_inputs_for_common (line 240) | def prepare_config_and_inputs_for_common(self): class BioGptModelTest (line 256) | class BioGptModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 274) | def setUp(self): method test_config (line 278) | def test_config(self): method test_model (line 281) | def test_model(self): method test_biogpt_model_att_mask_past (line 285) | def test_biogpt_model_att_mask_past(self): method test_biogpt_gradient_checkpointing (line 289) | def test_biogpt_gradient_checkpointing(self): method test_biogpt_model_past_with_large_inputs (line 293) | def test_biogpt_model_past_with_large_inputs(self): method test_biogpt_weight_initialization (line 297) | def test_biogpt_weight_initialization(self): method test_biogpt_token_classification_model (line 301) | def test_biogpt_token_classification_model(self): method test_batch_generation (line 306) | def test_batch_generation(self): method test_model_from_pretrained (line 353) | def test_model_from_pretrained(self): method test_biogpt_sequence_classification_model (line 359) | def test_biogpt_sequence_classification_model(self): method test_biogpt_sequence_classification_model_for_multi_label (line 372) | def test_biogpt_sequence_classification_model_for_multi_label(self): class BioGptModelIntegrationTest (line 389) | class BioGptModelIntegrationTest(unittest.TestCase): method test_inference_lm_head_model (line 391) | def test_inference_lm_head_model(self): method test_biogpt_generation_beam_search (line 408) | def test_biogpt_generation_beam_search(self): FILE: tests/models/biogpt/test_tokenization_biogpt.py class BioGptTokenizationTest (line 29) | class BioGptTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 35) | def setUpClass(cls): method get_input_output_texts (line 67) | def get_input_output_texts(self, tokenizer): method test_full_tokenizer (line 72) | def test_full_tokenizer(self): method test_sequence_builders (line 122) | def test_sequence_builders(self): FILE: tests/models/bit/test_image_processing_bit.py class BitImageProcessingTester (line 22) | class BitImageProcessingTester: method __init__ (line 23) | def __init__( method prepare_image_processor_dict (line 58) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class BitImageProcessingTest (line 87) | class BitImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 108) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/bit/test_modeling_bit.py class BitModelTester (line 39) | class BitModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 75) | def prepare_config_and_inputs(self): method get_config (line 86) | def get_config(self): method create_and_check_model (line 99) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 109) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_backbone (line 117) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 147) | def prepare_config_and_inputs_for_common(self): class BitModelTest (line 155) | class BitModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 171) | def setUp(self): method test_config (line 177) | def test_config(self): method test_attention_outputs (line 181) | def test_attention_outputs(self): method test_inputs_embeds (line 185) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 189) | def test_model_get_set_embeddings(self): method test_model (line 192) | def test_model(self): method test_backbone (line 196) | def test_backbone(self): method test_hidden_states_output (line 200) | def test_hidden_states_output(self): method test_feed_forward_chunking (line 235) | def test_feed_forward_chunking(self): method test_for_image_classification (line 238) | def test_for_image_classification(self): method test_model_from_pretrained (line 243) | def test_model_from_pretrained(self): function prepare_img (line 250) | def prepare_img(): class BitModelIntegrationTest (line 257) | class BitModelIntegrationTest(unittest.TestCase): method default_image_processor (line 259) | def default_image_processor(self): method test_inference_image_classification_head (line 263) | def test_inference_image_classification_head(self): class BitBackboneTest (line 284) | class BitBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 290) | def setUp(self): FILE: tests/models/bitnet/test_modeling_bitnet.py class BitNetModelTester (line 42) | class BitNetModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method get_config (line 92) | def get_config(self): method create_and_check_model (line 107) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 115) | def prepare_config_and_inputs_for_common(self): class BitNetModelTest (line 127) | class BitNetModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method is_pipeline_test_to_skip (line 146) | def is_pipeline_test_to_skip( method setUp (line 158) | def setUp(self): method test_config (line 162) | def test_config(self): method test_model (line 165) | def test_model(self): class BitNetIntegrationTest (line 171) | class BitNetIntegrationTest(unittest.TestCase): method test_model_logits (line 173) | def test_model_logits(self): method test_model_generation (line 208) | def test_model_generation(self): FILE: tests/models/blenderbot/test_modeling_blenderbot.py function prepare_blenderbot_inputs_dict (line 48) | def prepare_blenderbot_inputs_dict( class BlenderbotModelTester (line 67) | class BlenderbotModelTester: method __init__ (line 68) | def __init__( method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method get_config (line 118) | def get_config(self): method get_pipeline_config (line 136) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 142) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 146) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 179) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class BlenderbotModelTest (line 213) | class BlenderbotModelTest(ModelTesterMixin, GenerationTesterMixin, Pipel... method setUp (line 226) | def setUp(self): method test_config (line 230) | def test_config(self): method test_save_load_strict (line 233) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 243) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 247) | def test_encoder_decoder_model_standalone(self): method test_generate_fp16 (line 252) | def test_generate_fp16(self): function assert_tensors_close (line 262) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): class Blenderbot3BIntegrationTests (line 285) | class Blenderbot3BIntegrationTests(unittest.TestCase): method tokenizer (line 289) | def tokenizer(self): method test_generation_from_short_input_same_as_parlai_3B (line 293) | def test_generation_from_short_input_same_as_parlai_3B(self): class BlenderbotStandaloneDecoderModelTester (line 323) | class BlenderbotStandaloneDecoderModelTester: method __init__ (line 324) | def __init__( method prepare_config_and_inputs (line 379) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 413) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 449) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 497) | def prepare_config_and_inputs_for_common(self): class BlenderbotStandaloneDecoderModelTest (line 514) | class BlenderbotStandaloneDecoderModelTest(ModelTesterMixin, GenerationT... method setUp (line 519) | def setUp( method test_config (line 525) | def test_config(self): method test_decoder_model_past (line 528) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 532) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 537) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 541) | def test_flex_attention_with_grads(): FILE: tests/models/blenderbot/test_tokenization_blenderbot.py class BlenderbotTokenizationTest (line 10) | class BlenderbotTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_pretokenized_inputs (line 19) | def test_pretokenized_inputs(self, *args, **kwargs): FILE: tests/models/blenderbot_small/test_modeling_blenderbot_small.py function prepare_blenderbot_small_inputs_dict (line 45) | def prepare_blenderbot_small_inputs_dict( class BlenderbotSmallModelTester (line 65) | class BlenderbotSmallModelTester: method __init__ (line 66) | def __init__( method prepare_config_and_inputs (line 104) | def prepare_config_and_inputs(self): method get_config (line 116) | def get_config(self): method prepare_config_and_inputs_for_common (line 134) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 138) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 171) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class BlenderbotSmallModelTest (line 205) | class BlenderbotSmallModelTest(ModelTesterMixin, GenerationTesterMixin, ... method is_pipeline_test_to_skip (line 219) | def is_pipeline_test_to_skip( method setUp (line 231) | def setUp(self): method test_config (line 235) | def test_config(self): method test_save_load_strict (line 238) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 248) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 252) | def test_encoder_decoder_model_standalone(self): method test_generate_fp16 (line 257) | def test_generate_fp16(self): function assert_tensors_close (line 267) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): class Blenderbot90MIntegrationTests (line 287) | class Blenderbot90MIntegrationTests(unittest.TestCase): method model (line 291) | def model(self): method tokenizer (line 298) | def tokenizer(self): method test_90_generation_from_long_input (line 302) | def test_90_generation_from_long_input(self): method test_90_generation_from_short_input (line 320) | def test_90_generation_from_short_input(self): class BlenderbotSmallStandaloneDecoderModelTester (line 334) | class BlenderbotSmallStandaloneDecoderModelTester: method __init__ (line 335) | def __init__( method prepare_config_and_inputs (line 390) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 425) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 461) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 508) | def prepare_config_and_inputs_for_common(self): class BlenderbotSmallStandaloneDecoderModelTest (line 525) | class BlenderbotSmallStandaloneDecoderModelTest(ModelTesterMixin, Genera... method setUp (line 530) | def setUp( method test_config (line 536) | def test_config(self): method test_decoder_model_past (line 539) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 543) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 548) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 552) | def test_flex_attention_with_grads(): FILE: tests/models/blenderbot_small/test_tokenization_blenderbot_small.py class BlenderbotSmallTokenizerTest (line 31) | class BlenderbotSmallTokenizerTest(TokenizerTesterMixin, unittest.TestCa... method test_full_blenderbot_small_tokenizer (line 36) | def test_full_blenderbot_small_tokenizer(self): method test_special_tokens_small_tok (line 66) | def test_special_tokens_small_tok(self): method test_empty_word_small_tok (line 75) | def test_empty_word_small_tok(self): FILE: tests/models/blip/test_image_processing_blip.py class BlipImageProcessingTester (line 23) | class BlipImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 55) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 66) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 69) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class BlipImageProcessingTest (line 83) | class BlipImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 84) | def setUp(self): method image_processor_dict (line 89) | def image_processor_dict(self): method test_image_processor_properties (line 92) | def test_image_processor_properties(self): class BlipImageProcessingTestFourChannels (line 105) | class BlipImageProcessingTestFourChannels(ImageProcessingTestMixin, unit... method setUp (line 106) | def setUp(self): method image_processor_dict (line 111) | def image_processor_dict(self): method test_image_processor_properties (line 114) | def test_image_processor_properties(self): FILE: tests/models/blip/test_modeling_blip.py class BlipVisionModelTester (line 64) | class BlipVisionModelTester: method __init__ (line 65) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method get_config (line 109) | def get_config(self): method create_and_check_model (line 124) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 137) | def prepare_config_and_inputs_for_common(self): class BlipVisionModelTest (line 145) | class BlipVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 155) | def setUp(self): method test_config (line 159) | def test_config(self): method test_inputs_embeds (line 163) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 166) | def test_model_get_set_embeddings(self): method test_forward_signature (line 175) | def test_forward_signature(self): method test_model (line 187) | def test_model(self): method test_training (line 192) | def test_training(self): method test_training_gradient_checkpointing (line 196) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 200) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 204) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 208) | def test_model_from_pretrained(self): class BlipTextModelTester (line 214) | class BlipTextModelTester: method __init__ (line 215) | def __init__( method prepare_config_and_inputs (line 255) | def prepare_config_and_inputs(self): method get_config (line 273) | def get_config(self): method create_and_check_model (line 288) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 298) | def prepare_config_and_inputs_for_common(self): class BlipTextModelTest (line 306) | class BlipTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 309) | def setUp(self): method test_config (line 313) | def test_config(self): method test_model (line 316) | def test_model(self): method test_training (line 321) | def test_training(self): method test_inputs_embeds (line 325) | def test_inputs_embeds(self): method test_model_from_pretrained (line 329) | def test_model_from_pretrained(self): class BlipModelTester (line 335) | class BlipModelTester: method __init__ (line 336) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 348) | def prepare_config_and_inputs(self): method get_config (line 356) | def get_config(self): method create_and_check_model (line 363) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 374) | def prepare_config_and_inputs_for_common(self): class BlipModelTest (line 387) | class BlipModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 401) | def setUp(self): method test_model (line 408) | def test_model(self): method test_config (line 412) | def test_config(self): method test_hidden_states_output (line 416) | def test_hidden_states_output(self): method test_inputs_embeds (line 420) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 424) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 428) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 431) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 447) | def test_model_from_pretrained(self): method test_get_image_features (line 452) | def test_get_image_features(self): method test_get_text_features (line 471) | def test_get_text_features(self): method test_get_multimodal_features (line 490) | def test_get_multimodal_features(self): class BlipTextRetrievalModelTester (line 510) | class BlipTextRetrievalModelTester: method __init__ (line 511) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 523) | def prepare_config_and_inputs(self): method get_config (line 531) | def get_config(self): method create_and_check_model (line 538) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 549) | def prepare_config_and_inputs_for_common(self): class BlipTextImageModelsModelTester (line 560) | class BlipTextImageModelsModelTester: method __init__ (line 561) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 574) | def prepare_config_and_inputs(self): method get_config (line 582) | def get_config(self): method create_and_check_model (line 589) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 600) | def prepare_config_and_inputs_for_common(self): class BlipVQAModelTester (line 611) | class BlipVQAModelTester: method __init__ (line 612) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 624) | def prepare_config_and_inputs(self): method get_config (line 632) | def get_config(self): method create_and_check_model (line 639) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 650) | def prepare_config_and_inputs_for_common(self): class BlipVQAModelTest (line 665) | class BlipVQAModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 673) | def setUp(self): method _prepare_inputs_for_vqa (line 676) | def _prepare_inputs_for_vqa(self): method test_class_name_consistency (line 682) | def test_class_name_consistency(self): method test_training (line 693) | def test_training(self): method test_forward_signature (line 707) | def test_forward_signature(self): method test_hidden_states_output (line 730) | def test_hidden_states_output(self): method test_inputs_embeds (line 734) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 738) | def test_model_get_set_embeddings(self): class BlipTextRetrievalModelTest (line 743) | class BlipTextRetrievalModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 749) | def setUp(self): method test_model (line 752) | def test_model(self): method test_hidden_states_output (line 757) | def test_hidden_states_output(self): method test_inputs_embeds (line 761) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 765) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 769) | def test_model_get_set_embeddings(self): method test_forward_signature (line 772) | def test_forward_signature(self): method test_training (line 794) | def test_training(self): method check_training_gradient_checkpointing (line 813) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_load_vision_text_config (line 834) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 850) | def test_model_from_pretrained(self): class BlipTextImageModelTest (line 857) | class BlipTextImageModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 865) | def setUp(self): method test_model (line 868) | def test_model(self): method test_hidden_states_output (line 873) | def test_hidden_states_output(self): method test_inputs_embeds (line 877) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 881) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 885) | def test_model_get_set_embeddings(self): method test_forward_signature (line 888) | def test_forward_signature(self): method test_training (line 910) | def test_training(self): method check_training_gradient_checkpointing (line 929) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_load_vision_text_config (line 950) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 966) | def test_model_from_pretrained(self): function prepare_img (line 973) | def prepare_img(): class BlipModelIntegrationTest (line 982) | class BlipModelIntegrationTest(unittest.TestCase): method test_inference_image_captioning (line 983) | def test_inference_image_captioning(self): method test_inference_image_captioning_fp16 (line 1010) | def test_inference_image_captioning_fp16(self): method test_inference_interpolate_pos_encoding (line 1037) | def test_inference_interpolate_pos_encoding(self): method test_inference_vqa (line 1051) | def test_inference_vqa(self): method test_inference_itm (line 1064) | def test_inference_itm(self): FILE: tests/models/blip/test_modeling_blip_text.py class BlipTextModelTester (line 34) | class BlipTextModelTester: method __init__ (line 35) | def __init__( method prepare_config_and_inputs (line 75) | def prepare_config_and_inputs(self): method get_config (line 93) | def get_config(self): method create_and_check_model (line 108) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 118) | def prepare_config_and_inputs_for_common(self): class BlipTextModelTest (line 126) | class BlipTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 129) | def setUp(self): method test_config (line 133) | def test_config(self): method test_model (line 136) | def test_model(self): method test_training (line 141) | def test_training(self): method test_inputs_embeds (line 145) | def test_inputs_embeds(self): method test_model_from_pretrained (line 149) | def test_model_from_pretrained(self): FILE: tests/models/blip/test_processing_blip.py class BlipProcessorTest (line 27) | class BlipProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 31) | def _setup_tokenizer(cls): FILE: tests/models/blip_2/test_modeling_blip_2.py class Blip2VisionModelTester (line 71) | class Blip2VisionModelTester: method __init__ (line 72) | def __init__( method prepare_config_and_inputs (line 110) | def prepare_config_and_inputs(self): method get_config (line 116) | def get_config(self): method create_and_check_model (line 131) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 144) | def prepare_config_and_inputs_for_common(self): class Blip2VisionModelTest (line 152) | class Blip2VisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 162) | def setUp(self): method test_config (line 168) | def test_config(self): method test_inputs_embeds (line 172) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 175) | def test_model_get_set_embeddings(self): method test_forward_signature (line 184) | def test_forward_signature(self): method test_model (line 195) | def test_model(self): method test_training (line 200) | def test_training(self): method test_training_gradient_checkpointing (line 204) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 208) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 212) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 216) | def test_model_from_pretrained(self): class Blip2QFormerModelTester (line 222) | class Blip2QFormerModelTester: method __init__ (line 223) | def __init__( method prepare_config_and_inputs (line 265) | def prepare_config_and_inputs(self): method get_config (line 283) | def get_config(self): class Blip2TextModelDecoderOnlyTester (line 301) | class Blip2TextModelDecoderOnlyTester: method __init__ (line 302) | def __init__( method prepare_config_and_inputs (line 349) | def prepare_config_and_inputs(self): method get_config (line 359) | def get_config(self): class Blip2ForConditionalGenerationDecoderOnlyModelTester (line 379) | class Blip2ForConditionalGenerationDecoderOnlyModelTester: method __init__ (line 380) | def __init__( method prepare_config_and_inputs (line 407) | def prepare_config_and_inputs(self): method get_config (line 424) | def get_config(self): method create_and_check_for_conditional_generation (line 433) | def create_and_check_for_conditional_generation(self, config, input_id... method prepare_config_and_inputs_for_common (line 444) | def prepare_config_and_inputs_for_common(self): class Blip2ForConditionalGenerationDecoderOnlyTest (line 456) | class Blip2ForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, Gen... method setUp (line 464) | def setUp(self): method test_config (line 471) | def test_config(self): method test_for_conditional_generation (line 474) | def test_for_conditional_generation(self): method test_eager_matches_sdpa_generate (line 481) | def test_eager_matches_sdpa_generate(self): method test_hidden_states_output (line 485) | def test_hidden_states_output(self): method test_inputs_embeds (line 489) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 493) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 497) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 502) | def test_generate_without_input_ids(self): method test_model_base_model_prefix (line 506) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 509) | def test_sdpa_can_dispatch_composite_models(self): method test_forward_signature (line 557) | def test_forward_signature(self): method test_load_vision_qformer_text_config (line 569) | def test_load_vision_qformer_text_config(self): method test_model_from_pretrained (line 585) | def test_model_from_pretrained(self): method _check_generate_outputs (line 591) | def _check_generate_outputs(self, output, config, use_cache=False, num... class Blip2TextModelTester (line 599) | class Blip2TextModelTester: method __init__ (line 600) | def __init__( method prepare_config_and_inputs (line 647) | def prepare_config_and_inputs(self): method get_config (line 672) | def get_config(self): method prepare_config_and_inputs_for_common (line 691) | def prepare_config_and_inputs_for_common(self): class Blip2ModelTester (line 712) | class Blip2ModelTester: method __init__ (line 713) | def __init__( method prepare_config_and_inputs (line 741) | def prepare_config_and_inputs(self): method get_config (line 756) | def get_config(self): method create_and_check_for_conditional_generation (line 765) | def create_and_check_for_conditional_generation( method prepare_config_and_inputs_for_common (line 781) | def prepare_config_and_inputs_for_common(self): class Blip2ModelTest (line 803) | class Blip2ModelTest(ModelTesterMixin, PipelineTesterMixin, GenerationTe... method is_pipeline_test_to_skip (line 821) | def is_pipeline_test_to_skip( method setUp (line 837) | def setUp(self): method test_config (line 844) | def test_config(self): method test_for_conditional_generation (line 847) | def test_for_conditional_generation(self): method test_eager_matches_sdpa_generate (line 854) | def test_eager_matches_sdpa_generate(self): method test_hidden_states_output (line 858) | def test_hidden_states_output(self): method test_inputs_embeds (line 862) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 866) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 870) | def test_model_get_set_embeddings(self): method test_cpu_offload (line 874) | def test_cpu_offload(self): method test_generate_without_input_ids (line 879) | def test_generate_without_input_ids(self): method test_model_base_model_prefix (line 883) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 886) | def test_sdpa_can_dispatch_composite_models(self): method test_forward_signature (line 934) | def test_forward_signature(self): method test_load_vision_qformer_text_config (line 945) | def test_load_vision_qformer_text_config(self): method test_model_from_pretrained (line 961) | def test_model_from_pretrained(self): method test_get_text_features (line 966) | def test_get_text_features(self): method test_get_image_features (line 979) | def test_get_image_features(self): method test_get_qformer_features (line 995) | def test_get_qformer_features(self): method test_internal_model_config_and_subconfig_are_same (line 1012) | def test_internal_model_config_and_subconfig_are_same(self): method test_eager_matches_sdpa_inference (line 1017) | def test_eager_matches_sdpa_inference(self, *args): class Blip2TextModelWithProjectionTester (line 1021) | class Blip2TextModelWithProjectionTester: method __init__ (line 1022) | def __init__(self, parent, vision_kwargs=None, qformer_kwargs=None, is... method get_config (line 1034) | def get_config(self): method prepare_config_and_inputs (line 1040) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 1047) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 1056) | def create_and_check_model(self, config, input_ids, attention_mask): class Blip2TextModelWithProjectionTest (line 1095) | class Blip2TextModelWithProjectionTest(ModelTesterMixin, unittest.TestCa... method setUp (line 1101) | def setUp(self): method test_model (line 1104) | def test_model(self): method test_training (line 1109) | def test_training(self): method test_hidden_states_output (line 1113) | def test_hidden_states_output(self): method test_inputs_embeds (line 1117) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 1121) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 1125) | def test_retain_grad_hidden_states_attentions(self): method test_model_common_attributes (line 1129) | def test_model_common_attributes(self): method test_forward_signature (line 1132) | def test_forward_signature(self): method test_model_from_pretrained (line 1146) | def test_model_from_pretrained(self): class Blip2VisionModelWithProjectionTester (line 1169) | class Blip2VisionModelWithProjectionTester: method __init__ (line 1170) | def __init__(self, parent, vision_kwargs=None, qformer_kwargs=None, is... method get_config (line 1186) | def get_config(self): method prepare_config_and_inputs (line 1192) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 1199) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 1205) | def create_and_check_model(self, config, pixel_values): class Blip2VisionModelWithProjectionTest (line 1247) | class Blip2VisionModelWithProjectionTest(ModelTesterMixin, unittest.Test... method setUp (line 1252) | def setUp(self): method test_model (line 1255) | def test_model(self): method test_training (line 1260) | def test_training(self): method test_training_gradient_checkpointing (line 1264) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 1268) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 1272) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 1276) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 1280) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 1284) | def test_retain_grad_hidden_states_attentions(self): method test_model_common_attributes (line 1287) | def test_model_common_attributes(self): method test_forward_signature (line 1296) | def test_forward_signature(self): method test_model_from_pretrained (line 1310) | def test_model_from_pretrained(self): class Blip2TextRetrievalModelTester (line 1333) | class Blip2TextRetrievalModelTester: method __init__ (line 1334) | def __init__(self, parent, vision_kwargs=None, qformer_kwargs=None, is... method get_config (line 1346) | def get_config(self): method prepare_config_and_inputs (line 1352) | def prepare_config_and_inputs(self): method create_and_check_model (line 1360) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 1381) | def prepare_config_and_inputs_for_common(self): class Blip2TextRetrievalModelTest (line 1393) | class Blip2TextRetrievalModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 1400) | def setUp(self): method test_model (line 1403) | def test_model(self): method test_hidden_states_output (line 1408) | def test_hidden_states_output(self): method test_inputs_embeds (line 1412) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 1416) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 1420) | def test_retain_grad_hidden_states_attentions(self): method test_model_common_attributes (line 1424) | def test_model_common_attributes(self): method test_forward_signature (line 1427) | def test_forward_signature(self): method test_load_vision_qformer_text_config (line 1442) | def test_load_vision_qformer_text_config(self): method test_model_from_pretrained (line 1459) | def test_model_from_pretrained(self): method test_training (line 1490) | def test_training(self): method test_training_gradient_checkpointing (line 1494) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 1498) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 1502) | def test_training_gradient_checkpointing_use_reentrant_true(self): function prepare_img (line 1507) | def prepare_img(): class Blip2ModelIntegrationTest (line 1516) | class Blip2ModelIntegrationTest(unittest.TestCase): method setUp (line 1517) | def setUp(self): method tearDown (line 1520) | def tearDown(self): method test_inference_opt (line 1523) | def test_inference_opt(self): method test_inference_interpolate_pos_encoding (line 1554) | def test_inference_interpolate_pos_encoding(self): method test_inference_opt_batched_beam_search (line 1571) | def test_inference_opt_batched_beam_search(self): method test_inference_t5 (line 1588) | def test_inference_t5(self): method test_inference_t5_batched_beam_search (line 1644) | def test_inference_t5_batched_beam_search(self): method test_inference_opt_multi_accelerator (line 1675) | def test_inference_opt_multi_accelerator(self): method test_inference_t5_multi_accelerator (line 1706) | def test_inference_t5_multi_accelerator(self): method test_inference_itm (line 1761) | def test_inference_itm(self): method test_inference_itm_fp16 (line 1781) | def test_inference_itm_fp16(self): method test_inference_vision_with_projection_fp16 (line 1801) | def test_inference_vision_with_projection_fp16(self): method test_inference_text_with_projection_fp16 (line 1825) | def test_inference_text_with_projection_fp16(self): FILE: tests/models/blip_2/test_processing_blip_2.py class Blip2ProcessorTest (line 27) | class Blip2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 31) | def _setup_tokenizer(cls): method _setup_image_processor (line 36) | def _setup_image_processor(cls): method prepare_processor_dict (line 41) | def prepare_processor_dict(): FILE: tests/models/bloom/test_modeling_bloom.py class BloomModelTester (line 37) | class BloomModelTester(CausalLMModelTester): method create_and_check_bloom_model_past (line 41) | def create_and_check_bloom_model_past(self, config, *args): method create_and_check_bloom_model_attention_mask_past (line 75) | def create_and_check_bloom_model_attention_mask_past(self, config, *ar... method create_and_check_bloom_model_past_large_inputs (line 116) | def create_and_check_bloom_model_past_large_inputs(self, config, *args): method create_and_check_lm_head_model (line 149) | def create_and_check_lm_head_model(self, config, *args): method create_and_check_bloom_weight_initialization (line 159) | def create_and_check_bloom_weight_initialization(self, config, *args): class BloomModelTest (line 169) | class BloomModelTest(CausalLMModelTest, unittest.TestCase): method test_bloom_model_past (line 173) | def test_bloom_model_past(self): method test_bloom_model_att_mask_past (line 177) | def test_bloom_model_att_mask_past(self): method test_bloom_model_past_large_inputs (line 181) | def test_bloom_model_past_large_inputs(self): method test_bloom_lm_head_model (line 185) | def test_bloom_lm_head_model(self): method test_bloom_weight_initialization (line 189) | def test_bloom_weight_initialization(self): method test_custom_4d_attention_mask (line 194) | def test_custom_4d_attention_mask(self): class BloomIntegrationTest (line 199) | class BloomIntegrationTest(unittest.TestCase): method setUp (line 200) | def setUp(self): method test_embeddings (line 205) | def test_embeddings(self): method test_hidden_states_transformers (line 454) | def test_hidden_states_transformers(self): method test_logits (line 481) | def test_logits(self): method test_simple_generation (line 502) | def test_simple_generation(self): method test_batch_generation (line 543) | def test_batch_generation(self): method test_batch_generation_padding (line 565) | def test_batch_generation_padding(self): method test_batch_generated_text (line 596) | def test_batch_generated_text(self): FILE: tests/models/bloom/test_tokenization_bloom.py class BloomTokenizationTest (line 26) | class BloomTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 40) | def setUpClass(cls): method test_encodings_from_sample_data (line 47) | def test_encodings_from_sample_data(self): method test_padding (line 62) | def test_padding(self, max_length=6): method test_encodings_from_xnli_dataset (line 117) | def test_encodings_from_xnli_dataset(self): method test_save_and_load_tokenizer (line 133) | def test_save_and_load_tokenizer(self): FILE: tests/models/blt/test_modeling_blt.py class BltModelTester (line 44) | class BltModelTester(CausalLMModelTester): method __init__ (line 48) | def __init__( method get_config (line 139) | def get_config(self): class BltModelTest (line 169) | class BltModelTest(CausalLMModelTest, unittest.TestCase): method test_generate_from_inputs_embeds (line 184) | def test_generate_from_inputs_embeds(self, _, num_beams): method test_inputs_embeds_matches_input_ids (line 191) | def test_inputs_embeds_matches_input_ids(self): method test_eager_matches_sdpa_inference (line 195) | def test_eager_matches_sdpa_inference( method test_sdpa_can_dispatch_on_flash (line 225) | def test_sdpa_can_dispatch_on_flash(self): class BltIntegrationTest (line 230) | class BltIntegrationTest(unittest.TestCase): method setup (line 231) | def setup(self): method tearDown (line 234) | def tearDown(self): method test_model (line 242) | def test_model(self): method test_model_logits (line 262) | def test_model_logits(self): method test_model_bf16 (line 343) | def test_model_bf16(self): method test_model_logits_bf16 (line 367) | def test_model_logits_bf16(self): method test_model_eager (line 451) | def test_model_eager(self): method test_model_bf16_static_cache (line 473) | def test_model_bf16_static_cache(self): FILE: tests/models/bridgetower/test_image_processing_bridgetower.py class BridgeTowerImageProcessingTester (line 25) | class BridgeTowerImageProcessingTester: method __init__ (line 26) | def __init__( method prepare_image_processor_dict (line 60) | def prepare_image_processor_dict(self): method get_expected_values (line 70) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 73) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 77) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class BridgeTowerImageProcessingTest (line 91) | class BridgeTowerImageProcessingTest(ImageProcessingTestMixin, unittest.... method setUp (line 92) | def setUp(self): method image_processor_dict (line 97) | def image_processor_dict(self): method test_image_processor_properties (line 100) | def test_image_processor_properties(self): method test_backends_equivalence (line 112) | def test_backends_equivalence(self): method test_slow_fast_equivalence_batched (line 133) | def test_slow_fast_equivalence_batched(self): FILE: tests/models/bridgetower/test_modeling_bridgetower.py class BridgeTowerTextModelTester (line 54) | class BridgeTowerTextModelTester: method __init__ (line 55) | def __init__( method prepare_config_and_inputs (line 83) | def prepare_config_and_inputs(self): method get_config (line 91) | def get_config(self): class BridgeTowerImageModelTester (line 106) | class BridgeTowerImageModelTester: method __init__ (line 107) | def __init__( method prepare_config_and_inputs (line 131) | def prepare_config_and_inputs(self): method get_config (line 138) | def get_config(self): class BridgeTowerModelTester (line 154) | class BridgeTowerModelTester: method __init__ (line 155) | def __init__( method prepare_config_and_inputs (line 196) | def prepare_config_and_inputs(self): method get_config (line 204) | def get_config(self): method create_and_check_model (line 220) | def create_and_check_model( method create_and_check_for_image_and_text_retrieval (line 246) | def create_and_check_for_image_and_text_retrieval( method create_and_check_for_masked_language_modeling (line 264) | def create_and_check_for_masked_language_modeling( method prepare_config_and_inputs_for_common (line 283) | def prepare_config_and_inputs_for_common(self): class BridgeTowerModelTest (line 296) | class BridgeTowerModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method test_cpu_offload (line 315) | def test_cpu_offload(self): method test_disk_offload (line 319) | def test_disk_offload(self): method test_model_parallelism (line 323) | def test_model_parallelism(self): method extract_output (line 327) | def extract_output(self, outputs, model_class): method setUp (line 330) | def setUp(self): method test_config (line 334) | def test_config(self): method test_model (line 337) | def test_model(self): method test_for_image_and_text_retrieval (line 341) | def test_for_image_and_text_retrieval(self): method test_for_masked_language_modeling (line 345) | def test_for_masked_language_modeling(self): method test_model_from_pretrained (line 350) | def test_model_from_pretrained(self): method test_hidden_states_output (line 356) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 407) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 439) | def test_model_get_set_embeddings(self): method test_inputs_embeds (line 443) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 447) | def test_inputs_embeds_matches_input_ids(self): function prepare_img (line 452) | def prepare_img(): class BridgeTowerModelIntegrationTest (line 459) | class BridgeTowerModelIntegrationTest(unittest.TestCase): method default_processor (line 461) | def default_processor(self): method test_image_and_text_retrieval (line 469) | def test_image_and_text_retrieval(self): method test_masked_language_modeling (line 496) | def test_masked_language_modeling(self): method test_constrastive_learning (line 524) | def test_constrastive_learning(self): class BridgeTowerModelTrainingTest (line 543) | class BridgeTowerModelTrainingTest(unittest.TestCase): method setUp (line 550) | def setUp(self): method _prepare_inputs_for_training (line 554) | def _prepare_inputs_for_training(self, model_class): method _get_non_used_layer_names (line 564) | def _get_non_used_layer_names(self, model_class): method _is_layer_used (line 575) | def _is_layer_used(self, model_class, layer_name): method test_training (line 582) | def test_training(self): method test_inference_interpolate_pos_encoding (line 598) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/bridgetower/test_processing_bridgetower.py class BridgeTowerProcessorTest (line 29) | class BridgeTowerProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 33) | def _setup_tokenizer(cls): method test_image_processor_defaults_preserved_by_image_kwargs (line 39) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_structured_kwargs_nested_from_dict (line 59) | def test_structured_kwargs_nested_from_dict(self): method test_kwargs_overrides_default_image_processor_kwargs (line 87) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_unstructured_kwargs_batched (line 104) | def test_unstructured_kwargs_batched(self): method test_unstructured_kwargs (line 130) | def test_unstructured_kwargs(self): method test_structured_kwargs_nested (line 156) | def test_structured_kwargs_nested(self): FILE: tests/models/bros/test_modeling_bros.py class BrosModelTester (line 39) | class BrosModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 136) | def get_config(self): method create_and_check_model (line 152) | def create_and_check_model( method create_and_check_for_token_classification (line 172) | def create_and_check_for_token_classification( method create_and_check_for_spade_ee_token_classification (line 193) | def create_and_check_for_spade_ee_token_classification( method create_and_check_for_spade_el_token_classification (line 223) | def create_and_check_for_spade_el_token_classification( method prepare_config_and_inputs_for_common (line 249) | def prepare_config_and_inputs_for_common(self): class BrosModelTest (line 272) | class BrosModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method is_pipeline_test_to_skip (line 293) | def is_pipeline_test_to_skip( method setUp (line 305) | def setUp(self): method _prepare_for_class (line 309) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 343) | def test_config(self): method test_model (line 346) | def test_model(self): method test_multi_gpu_data_parallel_forward (line 351) | def test_multi_gpu_data_parallel_forward(self): method test_for_token_classification (line 354) | def test_for_token_classification(self): method test_for_spade_ee_token_classification (line 358) | def test_for_spade_ee_token_classification(self): method test_for_spade_el_token_classification (line 362) | def test_for_spade_el_token_classification(self): method test_model_from_pretrained (line 367) | def test_model_from_pretrained(self): function prepare_bros_batch_inputs (line 373) | def prepare_bros_batch_inputs(): class BrosModelIntegrationTest (line 421) | class BrosModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 423) | def test_inference_no_head(self): FILE: tests/models/byt5/test_tokenization_byt5.py class ByT5TokenizationTest (line 26) | class ByT5TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 32) | def setUpClass(cls): method t5_base_tokenizer (line 38) | def t5_base_tokenizer(self): method get_tokenizer (line 42) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> ByT5Tokenizer: method get_clean_sequence (line 46) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method test_eos_treatment (line 84) | def test_eos_treatment(self): method test_multibytes_char (line 90) | def test_multibytes_char(self): method test_prepare_batch_integration (line 111) | def test_prepare_batch_integration(self): method test_empty_target_text (line 125) | def test_empty_target_text(self): method test_max_length_integration (line 135) | def test_max_length_integration(self): method test_eos_in_input (line 146) | def test_eos_in_input(self): method test_save_and_load_tokenizer (line 159) | def test_save_and_load_tokenizer(self): method test_decode_single_bytes (line 210) | def test_decode_single_bytes(self): method test_get_vocab (line 224) | def test_get_vocab(self): method test_pretokenized_inputs (line 228) | def test_pretokenized_inputs(self): method test_conversion_reversible (line 232) | def test_conversion_reversible(self): method test_convert_tokens_to_string_format (line 235) | def test_convert_tokens_to_string_format(self): method test_tokenizers_common_ids_setters (line 248) | def test_tokenizers_common_ids_setters(self): FILE: tests/models/camembert/test_modeling_camembert.py class CamembertModelIntegrationTest (line 36) | class CamembertModelIntegrationTest(unittest.TestCase): method test_output_embeds_base_model (line 38) | def test_output_embeds_base_model(self): method test_output_embeds_base_model_sdpa (line 64) | def test_output_embeds_base_model_sdpa(self): FILE: tests/models/camembert/test_tokenization_camembert.py class CamembertTokenizationTest (line 10) | class CamembertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/canine/test_modeling_canine.py class CanineModelTester (line 40) | class CanineModelTester: method __init__ (line 41) | def __init__( method prepare_config_and_inputs (line 93) | def prepare_config_and_inputs(self): method get_config (line 116) | def get_config(self): method create_and_check_model (line 132) | def create_and_check_model( method create_and_check_for_question_answering (line 143) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 159) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 169) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 179) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 197) | def prepare_config_and_inputs_for_common(self): class CanineModelTest (line 213) | class CanineModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 239) | def setUp(self): method test_config (line 244) | def test_config(self): method test_model (line 247) | def test_model(self): method test_for_multiple_choice (line 251) | def test_for_multiple_choice(self): method test_for_question_answering (line 255) | def test_for_question_answering(self): method test_for_sequence_classification (line 259) | def test_for_sequence_classification(self): method test_for_token_classification (line 263) | def test_for_token_classification(self): method test_hidden_states_output (line 267) | def test_hidden_states_output(self): method test_attention_outputs (line 311) | def test_attention_outputs(self): method test_model_outputs_equivalence (line 372) | def test_model_outputs_equivalence(self): method test_inputs_embeds (line 442) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 447) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 451) | def test_model_get_set_embeddings(self): method test_training_gradient_checkpointing (line 455) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 459) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 463) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 467) | def test_model_from_pretrained(self): class CanineModelIntegrationTest (line 474) | class CanineModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 476) | def test_inference_no_head(self): FILE: tests/models/canine/test_tokenization_canine.py class CanineTokenizationTest (line 27) | class CanineTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 34) | def setUpClass(cls): method canine_tokenizer (line 40) | def canine_tokenizer(self): method get_tokenizer (line 44) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> CanineTokeni... method test_prepare_batch_integration (line 51) | def test_prepare_batch_integration(self): method test_encoding_keys (line 66) | def test_encoding_keys(self): method test_max_length_integration (line 76) | def test_max_length_integration(self): method test_save_and_load_tokenizer (line 88) | def test_save_and_load_tokenizer(self): method test_add_special_tokens (line 142) | def test_add_special_tokens(self): method test_tokenize_special_tokens (line 166) | def test_tokenize_special_tokens(self): method test_added_token_serializable (line 184) | def test_added_token_serializable(self): method test_encode_decode_with_spaces (line 200) | def test_encode_decode_with_spaces(self): method test_tokenizers_common_ids_setters (line 214) | def test_tokenizers_common_ids_setters(self): method test_add_tokens_tokenizer (line 251) | def test_add_tokens_tokenizer(self): method test_added_tokens_do_lower_case (line 257) | def test_added_tokens_do_lower_case(self): method test_np_encode_plus_sent_to_model (line 261) | def test_np_encode_plus_sent_to_model(self): method test_torch_encode_plus_sent_to_model (line 265) | def test_torch_encode_plus_sent_to_model(self): method test_get_vocab (line 269) | def test_get_vocab(self): method test_pretokenized_inputs (line 273) | def test_pretokenized_inputs(self): method test_conversion_reversible (line 277) | def test_conversion_reversible(self): FILE: tests/models/chameleon/test_image_processing_chameleon.py class ChameleonImageProcessingTester (line 33) | class ChameleonImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 70) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 84) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 88) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class ChameleonImageProcessingTest (line 102) | class ChameleonImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 104) | def setUp(self): method image_processor_dict (line 110) | def image_processor_dict(self): method test_image_processor_properties (line 113) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 125) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 135) | def test_call_pil(self): method test_call_numpy (line 154) | def test_call_numpy(self): method test_call_pytorch (line 173) | def test_call_pytorch(self): method test_nested_input (line 193) | def test_nested_input(self): FILE: tests/models/chameleon/test_modeling_chameleon.py class ChameleonModelTester (line 50) | class ChameleonModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 119) | def prepare_config_and_inputs(self): method get_config (line 138) | def get_config(self): method get_vq_config (line 172) | def get_vq_config(self): method create_and_check_model (line 186) | def create_and_check_model(self, config, input_ids, input_mask, sequen... method prepare_config_and_inputs_for_common (line 194) | def prepare_config_and_inputs_for_common(self): class ChameleonModelTest (line 209) | class ChameleonModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method setUp (line 220) | def setUp(self): method test_config (line 224) | def test_config(self): method test_model (line 227) | def test_model(self): method test_batching_equivalence (line 232) | def test_batching_equivalence(self): method test_get_image_features_output (line 237) | def test_get_image_features_output(self, return_dict: bool | None): method test_get_image_features_hidden_states (line 241) | def test_get_image_features_hidden_states(self): method test_get_image_features_attentions (line 245) | def test_get_image_features_attentions(self): class ChameleonVision2SeqModelTester (line 249) | class ChameleonVision2SeqModelTester(ChameleonModelTester): method __init__ (line 250) | def __init__(self, parent, image_size=10, **kwargs): method prepare_config_and_inputs (line 255) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 266) | def prepare_config_and_inputs_for_common(self): class ChameleonVision2SeqModelTest (line 274) | class ChameleonVision2SeqModelTest(ModelTesterMixin, GenerationTesterMix... method setUp (line 285) | def setUp(self): method test_config (line 289) | def test_config(self): method test_batching_equivalence (line 293) | def test_batching_equivalence(self): method test_cpu_offload (line 297) | def test_cpu_offload(self): method test_disk_offload_bin (line 301) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 305) | def test_disk_offload_safetensors(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 309) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 313) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 317) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_mismatching_num_image_tokens (line 320) | def test_mismatching_num_image_tokens(self): method _image_features_get_expected_num_hidden_states (line 351) | def _image_features_get_expected_num_hidden_states(self, model_tester=... method _image_features_get_expected_num_attentions (line 357) | def _image_features_get_expected_num_attentions(self, model_tester=None): class ChameleonIntegrationTest (line 371) | class ChameleonIntegrationTest(unittest.TestCase): method test_model_7b (line 374) | def test_model_7b(self): method test_model_7b_batched (line 403) | def test_model_7b_batched(self): method test_model_7b_multi_image (line 449) | def test_model_7b_multi_image(self): FILE: tests/models/chameleon/test_processing_chameleon.py class ChameleonProcessorTest (line 27) | class ChameleonProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 31) | def _setup_test_attributes(cls, processor): method _setup_tokenizer (line 35) | def _setup_tokenizer(cls): method test_tokenizer_defaults (line 45) | def test_tokenizer_defaults(self): method test_special_mm_token_truncation (line 48) | def test_special_mm_token_truncation(self): method prepare_processor_dict (line 74) | def prepare_processor_dict(): method test_get_num_vision_tokens (line 78) | def test_get_num_vision_tokens(self): FILE: tests/models/chinese_clip/test_image_processing_chinese_clip.py class ChineseCLIPImageProcessingTester (line 23) | class ChineseCLIPImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 58) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class ChineseCLIPImageProcessingTest (line 87) | class ChineseCLIPImageProcessingTest(ImageProcessingTestMixin, unittest.... method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 108) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 121) | def test_call_numpy_4_channels(self): class ChineseCLIPImageProcessingTestFourChannels (line 127) | class ChineseCLIPImageProcessingTestFourChannels(ImageProcessingTestMixi... method setUp (line 128) | def setUp(self): method image_processor_dict (line 134) | def image_processor_dict(self): method test_image_processor_properties (line 137) | def test_image_processor_properties(self): method test_call_numpy_4_channels (line 152) | def test_call_numpy_4_channels(self): FILE: tests/models/chinese_clip/test_modeling_chinese_clip.py class ChineseCLIPTextModelTester (line 54) | class ChineseCLIPTextModelTester: method __init__ (line 55) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method get_config (line 126) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 145) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 172) | def create_and_check_model( method create_and_check_model_as_decoder (line 184) | def create_and_check_model_as_decoder( method prepare_config_and_inputs_for_common (line 217) | def prepare_config_and_inputs_for_common(self): class ChineseCLIPVisionModelTester (line 232) | class ChineseCLIPVisionModelTester: method __init__ (line 233) | def __init__( method prepare_config_and_inputs (line 271) | def prepare_config_and_inputs(self): method get_config (line 277) | def get_config(self): method create_and_check_model (line 292) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 305) | def prepare_config_and_inputs_for_common(self): class ChineseCLIPTextModelTest (line 313) | class ChineseCLIPTextModelTest(ModelTesterMixin, unittest.TestCase): method _prepare_for_class (line 317) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 330) | def setUp(self): method test_config (line 334) | def test_config(self): method test_model (line 337) | def test_model(self): method test_model_as_decoder (line 341) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 345) | def test_model_as_decoder_with_default_input_mask(self): method test_model_from_pretrained (line 373) | def test_model_from_pretrained(self): method test_training (line 379) | def test_training(self): method test_training_gradient_checkpointing (line 383) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 387) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 391) | def test_training_gradient_checkpointing_use_reentrant_true(self): class ChineseCLIPVisionModelTest (line 396) | class ChineseCLIPVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 406) | def setUp(self): method test_config (line 412) | def test_config(self): method test_inputs_embeds (line 416) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 419) | def test_model_get_set_embeddings(self): method test_forward_signature (line 428) | def test_forward_signature(self): method test_model (line 440) | def test_model(self): method test_training (line 445) | def test_training(self): method test_model_from_pretrained (line 449) | def test_model_from_pretrained(self): class ChineseCLIPModelTester (line 455) | class ChineseCLIPModelTester: method __init__ (line 456) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 468) | def prepare_config_and_inputs(self): method get_config (line 484) | def get_config(self): method create_and_check_model (line 491) | def create_and_check_model(self, config, input_ids, token_type_ids, at... method prepare_config_and_inputs_for_common (line 502) | def prepare_config_and_inputs_for_common(self): class ChineseCLIPModelTest (line 516) | class ChineseCLIPModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 523) | def setUp(self): method test_model (line 528) | def test_model(self): method test_hidden_states_output (line 533) | def test_hidden_states_output(self): method test_inputs_embeds (line 537) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 541) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 545) | def test_model_get_set_embeddings(self): method test_model_from_pretrained (line 549) | def test_model_from_pretrained(self): function prepare_img (line 556) | def prepare_img(): class ChineseCLIPModelIntegrationTest (line 564) | class ChineseCLIPModelIntegrationTest(unittest.TestCase): method test_inference (line 566) | def test_inference(self): method test_inference_interpolate_pos_encoding (line 596) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/chinese_clip/test_processing_chinese_clip.py class ChineseCLIPProcessorTest (line 30) | class ChineseCLIPProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 34) | def _setup_tokenizer(cls): method _setup_image_processor (line 62) | def _setup_image_processor(cls): FILE: tests/models/chmv2/test_image_processing_chmv2.py class CHMv2ImageProcessingTester (line 22) | class CHMv2ImageProcessingTester: method __init__ (line 23) | def __init__( method prepare_image_processor_dict (line 50) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 61) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 64) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class CHMv2ImageProcessingTest (line 78) | class CHMv2ImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 79) | def setUp(self): method image_processor_dict (line 84) | def image_processor_dict(self): method test_image_processor_save_load_with_autoimageprocessor (line 88) | def test_image_processor_save_load_with_autoimageprocessor(self): FILE: tests/models/chmv2/test_modeling_chmv2.py class CHMv2ModelTester (line 42) | class CHMv2ModelTester: method __init__ (line 43) | def __init__( method get_config (line 85) | def get_config(self): method prepare_config_and_inputs (line 114) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 119) | def prepare_config_and_inputs_for_common(self): method create_and_check_for_depth_estimation (line 124) | def create_and_check_for_depth_estimation(self, config, pixel_values): class CHMv2ModelTest (line 133) | class CHMv2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 139) | def setUp(self): method test_config (line 143) | def test_config(self): method test_inputs_embeds (line 147) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 150) | def test_model_get_set_embeddings(self): method test_for_depth_estimation (line 160) | def test_for_depth_estimation(self): method test_training (line 165) | def test_training(self): method check_training_gradient_checkpointing (line 169) | def check_training_gradient_checkpointing(self, gradient_checkpointing... class CHMv2IntegrationTest (line 176) | class CHMv2IntegrationTest(unittest.TestCase): method test_inference_depth_estimation (line 177) | def test_inference_depth_estimation(self): FILE: tests/models/clap/test_feature_extraction_clap.py function floats_list (line 38) | def floats_list(shape, scale=1.0, rng=None, name=None): class ClapFeatureExtractionTester (line 55) | class ClapFeatureExtractionTester: method __init__ (line 56) | def __init__( method prepare_feat_extract_dict (line 83) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 94) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class ClapFeatureExtractionTest (line 113) | class ClapFeatureExtractionTest(SequenceFeatureExtractionTestMixin, unit... method setUp (line 117) | def setUp(self): method test_call (line 120) | def test_call(self): method test_double_precision_pad (line 151) | def test_double_precision_pad(self): method _load_datasamples (line 165) | def _load_datasamples(self, num_samples): method test_integration_fusion_short_input (line 172) | def test_integration_fusion_short_input(self): method test_integration_rand_trunc_short_input (line 294) | def test_integration_rand_trunc_short_input(self): method test_integration_fusion_long_input (line 413) | def test_integration_fusion_long_input(self): method test_integration_rand_trunc_long_input (line 479) | def test_integration_rand_trunc_long_input(self): FILE: tests/models/clap/test_modeling_clap.py class ClapAudioModelTester (line 50) | class ClapAudioModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 102) | def prepare_config_and_inputs(self): method get_config (line 108) | def get_config(self): method create_and_check_model (line 130) | def create_and_check_model(self, config, input_features): method create_and_check_model_with_projection (line 138) | def create_and_check_model_with_projection(self, config, input_features): method prepare_config_and_inputs_for_common (line 146) | def prepare_config_and_inputs_for_common(self): class ClapAudioModelTest (line 154) | class ClapAudioModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 164) | def setUp(self): method test_config (line 168) | def test_config(self): method test_inputs_embeds (line 172) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 175) | def test_model_get_set_embeddings(self): method test_hidden_states_output (line 184) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 218) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 221) | def test_forward_signature(self): method test_model (line 233) | def test_model(self): method test_model_with_projection (line 237) | def test_model_with_projection(self): method test_training (line 242) | def test_training(self): method test_model_from_pretrained (line 246) | def test_model_from_pretrained(self): method test_model_with_projection_from_pretrained (line 252) | def test_model_with_projection_from_pretrained(self): class ClapTextModelTester (line 259) | class ClapTextModelTester: method __init__ (line 260) | def __init__( method prepare_config_and_inputs (line 300) | def prepare_config_and_inputs(self): method get_config (line 318) | def get_config(self): method create_and_check_model (line 333) | def create_and_check_model(self, config, input_ids, input_mask): method create_and_check_model_with_projection (line 343) | def create_and_check_model_with_projection(self, config, input_ids, in... method prepare_config_and_inputs_for_common (line 353) | def prepare_config_and_inputs_for_common(self): class ClapTextModelTest (line 361) | class ClapTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 364) | def setUp(self): method test_config (line 368) | def test_config(self): method test_model (line 371) | def test_model(self): method test_model_with_projection (line 375) | def test_model_with_projection(self): method test_training (line 380) | def test_training(self): method test_inputs_embeds (line 384) | def test_inputs_embeds(self): method test_model_from_pretrained (line 388) | def test_model_from_pretrained(self): method test_model_with_projection_from_pretrained (line 394) | def test_model_with_projection_from_pretrained(self): class ClapModelTester (line 401) | class ClapModelTester: method __init__ (line 402) | def __init__(self, parent, text_kwargs=None, audio_kwargs=None, is_tra... method prepare_config_and_inputs (line 414) | def prepare_config_and_inputs(self): method get_config (line 422) | def get_config(self): method create_and_check_model (line 429) | def create_and_check_model(self, config, input_ids, attention_mask, in... method prepare_config_and_inputs_for_common (line 440) | def prepare_config_and_inputs_for_common(self): class ClapModelTest (line 453) | class ClapModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 460) | def setUp(self): method test_model (line 467) | def test_model(self): method test_config (line 471) | def test_config(self): method test_hidden_states_output (line 475) | def test_hidden_states_output(self): method test_inputs_embeds (line 479) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 483) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 487) | def test_model_get_set_embeddings(self): method test_load_audio_text_config (line 490) | def test_load_audio_text_config(self): method test_model_from_pretrained (line 506) | def test_model_from_pretrained(self): class ClapModelIntegrationTest (line 514) | class ClapModelIntegrationTest(unittest.TestCase): method test_integration_unfused (line 517) | def test_integration_unfused(self): method test_integration_fused (line 546) | def test_integration_fused(self): method test_batched_fused (line 575) | def test_batched_fused(self): method test_batched_unfused (line 604) | def test_batched_unfused(self): FILE: tests/models/clap/test_processing_clap.py class ClapProcessorTest (line 28) | class ClapProcessorTest(unittest.TestCase): method setUp (line 29) | def setUp(self): method get_tokenizer (line 33) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 36) | def get_feature_extractor(self, **kwargs): method tearDown (line 39) | def tearDown(self): method test_save_load_pretrained_default (line 42) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 57) | def test_save_load_pretrained_additional_features(self): method test_feature_extractor (line 74) | def test_feature_extractor(self): method test_tokenizer (line 88) | def test_tokenizer(self): method test_tokenizer_decode (line 103) | def test_tokenizer_decode(self): FILE: tests/models/clip/test_image_processing_clip.py class CLIPImageProcessingTester (line 23) | class CLIPImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 59) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 71) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 74) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class CLIPImageProcessingTest (line 88) | class CLIPImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 89) | def setUp(self): method image_processor_dict (line 94) | def image_processor_dict(self): method test_image_processor_properties (line 97) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 109) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/clip/test_modeling_clip.py class CLIPVisionModelTester (line 68) | class CLIPVisionModelTester: method __init__ (line 69) | def __init__( method prepare_config_and_inputs (line 107) | def prepare_config_and_inputs(self): method get_config (line 113) | def get_config(self): method create_and_check_model (line 128) | def create_and_check_model(self, config, pixel_values): method create_and_check_model_with_projection (line 141) | def create_and_check_model_with_projection(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 154) | def prepare_config_and_inputs_for_common(self): method test_eager_matches_sdpa_inference (line 161) | def test_eager_matches_sdpa_inference(self, *args): class CLIPModelTesterMixin (line 165) | class CLIPModelTesterMixin(ModelTesterMixin): method test_sdpa_can_dispatch_composite_models (line 172) | def test_sdpa_can_dispatch_composite_models(self): class CLIPVisionModelTest (line 204) | class CLIPVisionModelTest(CLIPModelTesterMixin, unittest.TestCase): method setUp (line 214) | def setUp(self): method test_config (line 218) | def test_config(self): method test_inputs_embeds (line 222) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 225) | def test_model_get_set_embeddings(self): method test_forward_signature (line 234) | def test_forward_signature(self): method test_model (line 246) | def test_model(self): method test_model_with_projection (line 250) | def test_model_with_projection(self): method test_training (line 255) | def test_training(self): method test_training_gradient_checkpointing (line 259) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 263) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 267) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 271) | def test_model_from_pretrained(self): method test_model_with_projection_from_pretrained (line 277) | def test_model_with_projection_from_pretrained(self): method test_eager_matches_sdpa_inference (line 285) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 289) | def test_sdpa_can_dispatch_composite_models(self): class CLIPTextModelTester (line 293) | class CLIPTextModelTester: method __init__ (line 294) | def __init__( method prepare_config_and_inputs (line 332) | def prepare_config_and_inputs(self): method get_config (line 350) | def get_config(self): method create_and_check_model (line 364) | def create_and_check_model(self, config, input_ids, input_mask): method create_and_check_model_with_projection (line 374) | def create_and_check_model_with_projection(self, config, input_ids, in... method prepare_config_and_inputs_for_common (line 384) | def prepare_config_and_inputs_for_common(self): class CLIPTextModelTest (line 392) | class CLIPTextModelTest(CLIPModelTesterMixin, unittest.TestCase): method setUp (line 397) | def setUp(self): method test_config (line 401) | def test_config(self): method test_model (line 404) | def test_model(self): method test_model_with_projection (line 408) | def test_model_with_projection(self): method test_training (line 413) | def test_training(self): method test_training_gradient_checkpointing (line 417) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 421) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 425) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 429) | def test_inputs_embeds(self): method test_model_from_pretrained (line 433) | def test_model_from_pretrained(self): method test_model_with_projection_from_pretrained (line 439) | def test_model_with_projection_from_pretrained(self): method test_eager_matches_sdpa_inference (line 448) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 452) | def test_sdpa_can_dispatch_composite_models(self): method test_sdpa_can_dispatch_on_flash (line 455) | def test_sdpa_can_dispatch_on_flash(self): class CLIPModelTester (line 459) | class CLIPModelTester: method __init__ (line 460) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 472) | def prepare_config_and_inputs(self): method get_config (line 480) | def get_config(self): method create_and_check_model (line 487) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 498) | def prepare_config_and_inputs_for_common(self): class CLIPModelTest (line 511) | class CLIPModelTest(CLIPModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 522) | def setUp(self): method test_model (line 529) | def test_model(self): method test_config (line 533) | def test_config(self): method test_hidden_states_output (line 537) | def test_hidden_states_output(self): method test_inputs_embeds (line 541) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 545) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 549) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 552) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 568) | def test_model_from_pretrained(self): method test_eager_matches_sdpa_inference (line 576) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 580) | def test_sdpa_can_dispatch_composite_models(self): method test_sdpa_can_dispatch_on_flash (line 583) | def test_sdpa_can_dispatch_on_flash(self): method test_sdpa_can_compile_dynamic (line 587) | def test_sdpa_can_compile_dynamic(self): method test_get_text_features_attentions (line 591) | def test_get_text_features_attentions(self): method test_get_text_features_hidden_states (line 596) | def test_get_text_features_hidden_states(self): method test_get_image_features_attentions (line 601) | def test_get_image_features_attentions(self): method test_get_image_features_hidden_states (line 606) | def test_get_image_features_hidden_states(self): class CLIPForImageClassificationModelTester (line 611) | class CLIPForImageClassificationModelTester(CLIPModelTester): method __init__ (line 612) | def __init__(self, parent): method prepare_config_and_inputs (line 619) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 625) | def prepare_config_and_inputs_for_common(self): class CLIPForImageClassificationModelTest (line 633) | class CLIPForImageClassificationModelTest(CLIPModelTesterMixin, Pipeline... method setUp (line 640) | def setUp(self): method test_inputs_embeds (line 644) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 648) | def test_model_get_set_embeddings(self): method test_training_gradient_checkpointing (line 652) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 656) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 660) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_eager_matches_sdpa_inference (line 666) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 670) | def test_sdpa_can_dispatch_composite_models(self): function prepare_img (line 675) | def prepare_img(): class CLIPModelIntegrationTest (line 683) | class CLIPModelIntegrationTest(unittest.TestCase): method test_inference (line 685) | def test_inference(self): method test_inference_interpolate_pos_encoding (line 714) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/clip/test_processing_clip.py class CLIPProcessorTest (line 28) | class CLIPProcessorTest(ProcessorTesterMixin, unittest.TestCase): FILE: tests/models/clip/test_tokenization_clip.py class CLIPTokenizationTest (line 10) | class CLIPTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 20) | def setUpClass(cls): method test_padding_to_multiple_of (line 42) | def test_padding_to_multiple_of(self): FILE: tests/models/clipseg/test_modeling_clipseg.py class CLIPSegVisionModelTester (line 55) | class CLIPSegVisionModelTester: method __init__ (line 56) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 98) | def get_config(self): method create_and_check_model (line 112) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 125) | def prepare_config_and_inputs_for_common(self): class CLIPSegVisionModelTest (line 133) | class CLIPSegVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 143) | def setUp(self): method test_config (line 149) | def test_config(self): method test_inputs_embeds (line 153) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 156) | def test_model_get_set_embeddings(self): method test_forward_signature (line 165) | def test_forward_signature(self): method test_model (line 177) | def test_model(self): method test_training (line 182) | def test_training(self): method test_training_gradient_checkpointing (line 186) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 190) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 194) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 198) | def test_model_from_pretrained(self): class CLIPSegTextModelTester (line 204) | class CLIPSegTextModelTester: method __init__ (line 205) | def __init__( method prepare_config_and_inputs (line 241) | def prepare_config_and_inputs(self): method get_config (line 259) | def get_config(self): method create_and_check_model (line 272) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 282) | def prepare_config_and_inputs_for_common(self): class CLIPSegTextModelTest (line 290) | class CLIPSegTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 295) | def setUp(self): method test_config (line 299) | def test_config(self): method test_model (line 302) | def test_model(self): method test_training (line 307) | def test_training(self): method test_training_gradient_checkpointing (line 311) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 315) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 319) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 323) | def test_inputs_embeds(self): method test_model_from_pretrained (line 327) | def test_model_from_pretrained(self): class CLIPSegModelTester (line 333) | class CLIPSegModelTester: method __init__ (line 334) | def __init__( method prepare_config_and_inputs (line 355) | def prepare_config_and_inputs(self): method get_config (line 363) | def get_config(self): method create_and_check_model (line 372) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method create_and_check_model_for_image_segmentation (line 383) | def create_and_check_model_for_image_segmentation(self, config, input_... method prepare_config_and_inputs_for_common (line 399) | def prepare_config_and_inputs_for_common(self): class CLIPSegModelTest (line 411) | class CLIPSegModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method _prepare_for_class (line 418) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 429) | def setUp(self): method test_model (line 436) | def test_model(self): method test_config (line 440) | def test_config(self): method test_model_for_image_segmentation (line 443) | def test_model_for_image_segmentation(self): method test_hidden_states_output (line 448) | def test_hidden_states_output(self): method test_inputs_embeds (line 452) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 456) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 460) | def test_model_get_set_embeddings(self): method test_training_gradient_checkpointing (line 466) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 472) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 478) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_load_vision_text_config (line 481) | def test_load_vision_text_config(self): method test_training (line 496) | def test_training(self): method test_model_from_pretrained (line 519) | def test_model_from_pretrained(self): function prepare_img (line 526) | def prepare_img(): class CLIPSegModelIntegrationTest (line 534) | class CLIPSegModelIntegrationTest(unittest.TestCase): method test_inference_image_segmentation (line 536) | def test_inference_image_segmentation(self): method test_inference_interpolate_pos_encoding (line 567) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/clipseg/test_processing_clipseg.py class CLIPSegProcessorTest (line 33) | class CLIPSegProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 37) | def _setup_tokenizer(cls): method _setup_image_processor (line 52) | def _setup_image_processor(cls): method test_processor_text (line 65) | def test_processor_text(self): method test_processor_visual_prompt (line 79) | def test_processor_visual_prompt(self): FILE: tests/models/clvp/test_feature_extraction_clvp.py function floats_list (line 44) | def floats_list(shape, scale=1.0, rng=None, name=None): class ClvpFeatureExtractionTester (line 59) | class ClvpFeatureExtractionTester: method __init__ (line 60) | def __init__( method prepare_feat_extract_dict (line 85) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 96) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class ClvpFeatureExtractionTest (line 114) | class ClvpFeatureExtractionTest(SequenceFeatureExtractionTestMixin, unit... method setUp (line 117) | def setUp(self): method tearDown (line 120) | def tearDown(self): method test_feat_extract_from_and_save_pretrained (line 126) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 142) | def test_feat_extract_to_json_file(self): method test_call (line 157) | def test_call(self): method test_double_precision_pad (line 201) | def test_double_precision_pad(self): method _load_datasamples (line 214) | def _load_datasamples(self, num_samples): method test_integration (line 223) | def test_integration(self): FILE: tests/models/clvp/test_modeling_clvp.py class ClvpEncoderTester (line 50) | class ClvpEncoderTester: method __init__ (line 51) | def __init__( method get_config (line 89) | def get_config(self): method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 124) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 130) | def create_and_check_model(self, speech_config, input_ids, input_mask): class ClvpEncoderTest (line 163) | class ClvpEncoderTest(ModelTesterMixin, unittest.TestCase): method setUp (line 166) | def setUp(self): method tearDown (line 170) | def tearDown(self): method test_config (line 175) | def test_config(self): method test_model (line 178) | def test_model(self): method test_training (line 183) | def test_training(self): method test_gradient_checkpointing_enable_disable (line 187) | def test_gradient_checkpointing_enable_disable(self): class ClvpDecoderTester (line 191) | class ClvpDecoderTester: method __init__ (line 192) | def __init__( method get_config (line 226) | def get_config(self): method prepare_config_and_inputs (line 242) | def prepare_config_and_inputs(self): method create_and_check_model (line 260) | def create_and_check_model(self, config, input_ids, attention_mask): method prepare_config_and_inputs_for_common (line 267) | def prepare_config_and_inputs_for_common(self): class ClvpDecoderTest (line 278) | class ClvpDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 282) | def setUp(self): method tearDown (line 286) | def tearDown(self): method test_model (line 291) | def test_model(self): method _prepare_for_class (line 295) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_training (line 303) | def test_training(self): method test_generate_continue_from_inputs_embeds (line 316) | def test_generate_continue_from_inputs_embeds(self): class ClvpModelForConditionalGenerationTester (line 320) | class ClvpModelForConditionalGenerationTester: method __init__ (line 321) | def __init__(self, parent, is_training=False): method get_config (line 328) | def get_config(self): method prepare_config_and_inputs (line 352) | def prepare_config_and_inputs(self): method create_and_check_model (line 370) | def create_and_check_model(self, config, input_ids, attention_mask, in... method prepare_config_and_inputs_for_common (line 378) | def prepare_config_and_inputs_for_common(self): class ClvpModelForConditionalGenerationTest (line 392) | class ClvpModelForConditionalGenerationTest(ModelTesterMixin, unittest.T... method setUp (line 401) | def setUp(self): method test_config (line 408) | def test_config(self): method tearDown (line 411) | def tearDown(self): method test_model (line 416) | def test_model(self): method test_hidden_states_output (line 420) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 473) | def test_retain_grad_hidden_states_attentions(self): method test_inputs_embeds (line 477) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 481) | def test_model_get_set_embeddings(self): method test_load_speech_text_decoder_config (line 484) | def test_load_speech_text_decoder_config(self): method test_model_from_pretrained (line 500) | def test_model_from_pretrained(self): class ClvpIntegrationTest (line 513) | class ClvpIntegrationTest(unittest.TestCase): method setUp (line 514) | def setUp(self): method tearDown (line 532) | def tearDown(self): method test_conditional_encoder (line 537) | def test_conditional_encoder(self): method test_decoder_model_generate (line 554) | def test_decoder_model_generate(self): method test_text_and_speech_encoder_models (line 561) | def test_text_and_speech_encoder_models(self): method test_full_model_integration (line 580) | def test_full_model_integration(self): FILE: tests/models/clvp/test_processing_clvp.py class ClvpProcessorTest (line 28) | class ClvpProcessorTest(unittest.TestCase): method setUp (line 29) | def setUp(self): method tearDown (line 33) | def tearDown(self): method get_tokenizer (line 39) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 43) | def get_feature_extractor(self, **kwargs): method test_save_load_pretrained_default (line 47) | def test_save_load_pretrained_default(self): method test_feature_extractor (line 63) | def test_feature_extractor(self): method test_tokenizer (line 78) | def test_tokenizer(self): method test_tokenizer_decode (line 94) | def test_tokenizer_decode(self): method test_save_load_pretrained_additional_features (line 107) | def test_save_load_pretrained_additional_features(self): FILE: tests/models/clvp/test_tokenization_clvp.py class ClvpTokenizationTest (line 26) | class ClvpTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 35) | def setUpClass(cls): method get_tokenizer (line 82) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 88) | def get_input_output_texts(self, tokenizer): method test_add_special_tokens (line 94) | def test_add_special_tokens(self): method test_rust_and_python_full_tokenizers (line 111) | def test_rust_and_python_full_tokenizers(self): method test_padding (line 142) | def test_padding(self, max_length=15): method test_padding_if_pad_token_set_slow (line 190) | def test_padding_if_pad_token_set_slow(self): method test_special_tokens_mask_input_pairs_and_bos_token (line 242) | def test_special_tokens_mask_input_pairs_and_bos_token(self): method test_token_type_ids (line 267) | def test_token_type_ids(self): method test_full_tokenizer (line 278) | def test_full_tokenizer(self): method test_outputs_with_numbers (line 290) | def test_outputs_with_numbers(self): method test_tokenizer_integration (line 305) | def test_tokenizer_integration(self): FILE: tests/models/code_llama/test_tokenization_code_llama.py class CodeLlamaTokenizationTest (line 42) | class CodeLlamaTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_save_and_load_tokenizer (line 52) | def test_save_and_load_tokenizer(self): method test_no_infilling_init (line 115) | def test_no_infilling_init(self): method test_batch_tokenization (line 121) | def test_batch_tokenization(self): method test_special_tokens_initialization (line 150) | def test_special_tokens_initialization(self): class LlamaIntegrationTest (line 164) | class LlamaIntegrationTest(unittest.TestCase): method setUpClass (line 166) | def setUpClass(cls): method integration_tests (line 173) | def integration_tests(self): method test_fast_special_tokens (line 190) | def test_fast_special_tokens(self): method test_simple_encode_decode (line 213) | def test_simple_encode_decode(self): method test_no_differences_showcase (line 265) | def test_no_differences_showcase(self): method test_no_differences_decode (line 283) | def test_no_differences_decode(self): method test_no_differences_special_tokens (line 290) | def test_no_differences_special_tokens(self): method test_integration_test_xnli (line 300) | def test_integration_test_xnli(self): method test_fill_token (line 334) | def test_fill_token(self): method test_spm_edge_cases (line 352) | def test_spm_edge_cases(self): method test_infilling_tokenization (line 364) | def test_infilling_tokenization(self): FILE: tests/models/codegen/test_modeling_codegen.py class CodeGenModelTester (line 34) | class CodeGenModelTester: method __init__ (line 35) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 125) | def get_config(self): method create_and_check_codegen_model (line 145) | def create_and_check_codegen_model(self, config, input_ids, input_mask... method create_and_check_codegen_model_past (line 157) | def create_and_check_codegen_model_past(self, config, input_ids, input... method create_and_check_codegen_model_attention_mask_past (line 193) | def create_and_check_codegen_model_attention_mask_past(self, config, i... method create_and_check_codegen_model_past_large_inputs (line 233) | def create_and_check_codegen_model_past_large_inputs(self, config, inp... method create_and_check_lm_head_model (line 269) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method create_and_check_forward_and_backwards (line 278) | def create_and_check_forward_and_backwards( method prepare_config_and_inputs_for_common (line 291) | def prepare_config_and_inputs_for_common(self): class CodeGenModelTest (line 311) | class CodeGenModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method _prepare_for_class (line 320) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 324) | def setUp(self): method test_config (line 328) | def test_config(self): method test_codegen_model (line 331) | def test_codegen_model(self): method test_codegen_model_past (line 335) | def test_codegen_model_past(self): method test_codegen_model_att_mask_past (line 339) | def test_codegen_model_att_mask_past(self): method test_codegen_model_past_large_inputs (line 343) | def test_codegen_model_past_large_inputs(self): method test_codegen_lm_head_model (line 347) | def test_codegen_lm_head_model(self): method test_codegen_gradient_checkpointing (line 351) | def test_codegen_gradient_checkpointing(self): method test_batch_generation (line 356) | def test_batch_generation(self): method test_model_from_pretrained (line 413) | def test_model_from_pretrained(self): class CodeGenModelLanguageGenerationTest (line 420) | class CodeGenModelLanguageGenerationTest(unittest.TestCase): method cached_tokenizer (line 422) | def cached_tokenizer(self): method cached_model (line 426) | def cached_model(self): method test_lm_generate_codegen (line 430) | def test_lm_generate_codegen(self): method test_codegen_sample (line 450) | def test_codegen_sample(self): FILE: tests/models/codegen/test_tokenization_codegen.py class CodeGenTokenizationTest (line 11) | class CodeGenTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/cohere/test_modeling_cohere.py class CohereModelTester (line 40) | class CohereModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 120) | def get_config(self): method create_and_check_model (line 137) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 147) | def prepare_config_and_inputs_for_common(self): class CohereModelTest (line 163) | class CohereModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 178) | def setUp(self): method test_config (line 182) | def test_config(self): method test_model (line 185) | def test_model(self): class CohereIntegrationTest (line 192) | class CohereIntegrationTest(unittest.TestCase): method test_batched_4bit (line 195) | def test_batched_4bit(self): method test_batched_small_model_logits (line 214) | def test_batched_small_model_logits(self): FILE: tests/models/cohere/test_tokenization_cohere.py class CohereTokenizationTest (line 28) | class CohereTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_torch_encode_plus_sent_to_model (line 46) | def test_torch_encode_plus_sent_to_model(self): method test_encodings_from_sample_data (line 49) | def test_encodings_from_sample_data(self): method test_pretrained_model_lists (line 71) | def test_pretrained_model_lists(self): method test_tokenization_for_tool_use (line 77) | def test_tokenization_for_tool_use(self): method test_tokenization_for_grounded_generation (line 148) | def test_tokenization_for_grounded_generation(self): method test_add_prefix_space_fast (line 193) | def test_add_prefix_space_fast(self): FILE: tests/models/cohere2/test_modeling_cohere2.py class Cohere2ModelTester (line 55) | class Cohere2ModelTester(CohereModelTester): class Cohere2ModelTest (line 63) | class Cohere2ModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 79) | def setUp(self): method test_config (line 83) | def test_config(self): method test_model (line 86) | def test_model(self): class Cohere2IntegrationTest (line 93) | class Cohere2IntegrationTest(unittest.TestCase): method tearDown (line 96) | def tearDown(self): method test_model_bf16 (line 99) | def test_model_bf16(self): method test_model_fp16 (line 118) | def test_model_fp16(self): method test_model_pipeline_bf16 (line 143) | def test_model_pipeline_bf16(self): method test_model_flash_attn (line 165) | def test_model_flash_attn(self): method test_export_static_cache (line 185) | def test_export_static_cache(self): method test_generation_beyond_sliding_window (line 243) | def test_generation_beyond_sliding_window(self, attn_implementation: s... FILE: tests/models/cohere2_vision/test_image_processing_cohere2_vision.py class Cohere2VisionImageProcessingTester (line 32) | class Cohere2VisionImageProcessingTester(unittest.TestCase): method __init__ (line 33) | def __init__( method prepare_image_processor_dict (line 63) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Cohere2VisionProcessingTest (line 87) | class Cohere2VisionProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_call_pil (line 106) | def test_call_pil(self): method test_call_numpy (line 123) | def test_call_numpy(self): method test_call_pytorch (line 140) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 158) | def test_call_numpy_4_channels(self): method test_crop_to_patches_aspect_ratio (line 188) | def test_crop_to_patches_aspect_ratio(self): method test_get_number_of_image_patches_aspect_ratio (line 265) | def test_get_number_of_image_patches_aspect_ratio(self): FILE: tests/models/cohere2_vision/test_modeling_cohere2_vision.py class Cohere2VisionText2TextModelTester (line 49) | class Cohere2VisionText2TextModelTester: method __init__ (line 50) | def __init__( method get_config (line 110) | def get_config(self): method prepare_config_and_inputs (line 119) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 125) | def prepare_config_and_inputs_for_common(self): class Cohere2ModelTest (line 142) | class Cohere2ModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 163) | def setUp(self): method test_config (line 167) | def test_config(self): class Cohere2IntegrationTest (line 172) | class Cohere2IntegrationTest(unittest.TestCase): method setUp (line 173) | def setUp(self): method tearDown (line 176) | def tearDown(self): method get_model (line 179) | def get_model(self, dummy=True): method test_model_integration_forward (line 199) | def test_model_integration_forward(self): method test_model_integration_generate_text_only (line 241) | def test_model_integration_generate_text_only(self): method test_model_integration_generate_chat_template (line 275) | def test_model_integration_generate_chat_template(self): method test_model_integration_batched_generate (line 309) | def test_model_integration_batched_generate(self): method test_model_integration_batched_generate_multi_image (line 378) | def test_model_integration_batched_generate_multi_image(self): FILE: tests/models/cohere2_vision/test_processing_cohere2_vision.py class Cohere2VisionProcessorTest (line 33) | class Cohere2VisionProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 37) | def _setup_tokenizer(cls): method _setup_image_processor (line 42) | def _setup_image_processor(cls): method test_process_interleaved_images_videos (line 49) | def test_process_interleaved_images_videos(self): FILE: tests/models/cohere_asr/test_modeling_cohere_asr.py class CohereAsrModelTester (line 40) | class CohereAsrModelTester: method __init__ (line 41) | def __init__( method get_encoder_output_length (line 104) | def get_encoder_output_length(self, input_length): method get_config (line 115) | def get_config(self): method prepare_config_and_inputs (line 134) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 142) | def prepare_config_and_inputs_for_common(self): class CohereAsrModelTest (line 155) | class CohereAsrModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method setUp (line 171) | def setUp(self): method test_config (line 175) | def test_config(self): method test_reverse_loading_mapping (line 178) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_resize_tokens_embeddings (line 189) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 238) | def test_resize_embeddings_untied(self): method test_sdpa_can_dispatch_on_flash (line 289) | def test_sdpa_can_dispatch_on_flash(self): method test_generate_without_input_ids (line 293) | def test_generate_without_input_ids(self): class CohereAsrIntegrationTest (line 299) | class CohereAsrIntegrationTest(unittest.TestCase): method setUp (line 302) | def setUp(self): method tearDown (line 305) | def tearDown(self): method test_shortform_english (line 309) | def test_shortform_english(self): method test_shortform_english_no_punctuation (line 337) | def test_shortform_english_no_punctuation(self): method test_longform_english (line 372) | def test_longform_english(self): method test_batched_mixed_lengths (line 400) | def test_batched_mixed_lengths(self): method test_non_english_with_punctuation (line 433) | def test_non_english_with_punctuation(self): FILE: tests/models/colmodernvbert/test_modeling_colmodernvbert.py class ColModernVBertForRetrievalModelTester (line 46) | class ColModernVBertForRetrievalModelTester: method __init__ (line 47) | def __init__( method get_config (line 120) | def get_config(self): method prepare_config_and_inputs (line 127) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 133) | def prepare_config_and_inputs_for_common(self): class ColModernVBertForRetrievalModelTest (line 152) | class ColModernVBertForRetrievalModelTest(ModelTesterMixin, unittest.Tes... method setUp (line 163) | def setUp(self): method test_colmodernvbert_forward_inputs (line 168) | def test_colmodernvbert_forward_inputs(self): method test_multi_gpu_data_parallel_forward (line 184) | def test_multi_gpu_data_parallel_forward(self): class ColModernVBertModelIntegrationTest (line 189) | class ColModernVBertModelIntegrationTest(unittest.TestCase): method setUp (line 192) | def setUp(self): method tearDown (line 204) | def tearDown(self): method test_model_integration_test (line 208) | def test_model_integration_test(self): FILE: tests/models/colmodernvbert/test_processing_colmodernvbert.py class ColModernVBertProcessorTest (line 39) | class ColModernVBertProcessorTest(ProcessorTesterMixin, unittest.TestCase): method setUpClass (line 43) | def setUpClass(cls): method tearDownClass (line 49) | def tearDownClass(cls): method test_process_images (line 54) | def test_process_images(self): method test_process_queries (line 79) | def test_process_queries(self): method test_tokenizer_defaults_preserved_by_kwargs (line 106) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 118) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 140) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 152) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_unstructured_kwargs (line 169) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 188) | def test_unstructured_kwargs_batched(self): method test_doubly_passed_kwargs (line 207) | def test_doubly_passed_kwargs(self): method test_structured_kwargs_nested (line 223) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 244) | def test_structured_kwargs_nested_from_dict(self): method test_model_input_names (line 262) | def test_model_input_names(self): method test_tokenizer_defaults (line 270) | def test_tokenizer_defaults(self): method test_processor_text_has_no_visual (line 274) | def test_processor_text_has_no_visual(self): method test_processor_with_multiple_inputs (line 278) | def test_processor_with_multiple_inputs(self): method test_get_num_multimodal_tokens_matches_processor_call (line 282) | def test_get_num_multimodal_tokens_matches_processor_call(self): method test_chat_template_save_loading (line 286) | def test_chat_template_save_loading(self): method test_apply_chat_template_audio (line 290) | def test_apply_chat_template_audio(self): method test_apply_chat_template_decoded_video (line 294) | def test_apply_chat_template_decoded_video(self): method test_apply_chat_template_video (line 298) | def test_apply_chat_template_video(self): method test_apply_chat_template_image (line 303) | def test_apply_chat_template_image(self, batch_size, return_tensors): method test_apply_chat_template_video_frame_sampling (line 307) | def test_apply_chat_template_video_frame_sampling(self): method test_chat_template_audio_from_video (line 311) | def test_chat_template_audio_from_video(self): method test_chat_template_jinja_kwargs (line 315) | def test_chat_template_jinja_kwargs(self): method test_apply_chat_template_assistant_mask (line 319) | def test_apply_chat_template_assistant_mask(self): FILE: tests/models/colpali/test_modeling_colpali.py class ColPaliForRetrievalModelTester (line 45) | class ColPaliForRetrievalModelTester: method __init__ (line 46) | def __init__( method get_config (line 139) | def get_config(self): method prepare_config_and_inputs (line 145) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 158) | def prepare_config_and_inputs_for_common(self): class ColPaliForRetrievalModelTest (line 178) | class ColPaliForRetrievalModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 188) | def setUp(self): method test_colpali_forward_inputs (line 194) | def test_colpali_forward_inputs(self): method test_model_parallelism (line 212) | def test_model_parallelism(self): method test_model_outputs_equivalence (line 217) | def test_model_outputs_equivalence(self): method test_sdpa_can_dispatch_on_flash (line 221) | def test_sdpa_can_dispatch_on_flash(self): method test_sdpa_can_compile_dynamic (line 226) | def test_sdpa_can_compile_dynamic(self): class ColPaliModelIntegrationTest (line 231) | class ColPaliModelIntegrationTest(unittest.TestCase): method setUp (line 234) | def setUp(self): method tearDown (line 237) | def tearDown(self): method test_model_integration_test (line 242) | def test_model_integration_test(self): FILE: tests/models/colpali/test_processing_colpali.py class ColPaliProcessorTest (line 34) | class ColPaliProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 38) | def _setup_tokenizer(cls): method _setup_image_processor (line 42) | def _setup_image_processor(cls): method test_processor_with_multiple_inputs (line 49) | def test_processor_with_multiple_inputs(self): method test_tokenizer_defaults (line 53) | def test_tokenizer_defaults(self): method test_get_num_vision_tokens (line 56) | def test_get_num_vision_tokens(self): method test_process_images (line 70) | def test_process_images(self): method test_process_queries (line 92) | def test_process_queries(self): method test_tokenizer_defaults_preserved_by_kwargs (line 120) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 132) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 154) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 166) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_unstructured_kwargs (line 183) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 202) | def test_unstructured_kwargs_batched(self): method test_doubly_passed_kwargs (line 221) | def test_doubly_passed_kwargs(self): method test_structured_kwargs_nested (line 237) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 258) | def test_structured_kwargs_nested_from_dict(self): method test_model_input_names (line 277) | def test_model_input_names(self): method test_processor_text_has_no_visual (line 285) | def test_processor_text_has_no_visual(self): method test_get_num_multimodal_tokens_matches_processor_call (line 289) | def test_get_num_multimodal_tokens_matches_processor_call(self): FILE: tests/models/colqwen2/test_modeling_colqwen2.py class ColQwen2ForRetrievalModelTester (line 44) | class ColQwen2ForRetrievalModelTester: method __init__ (line 45) | def __init__( method get_config (line 131) | def get_config(self): method prepare_config_and_inputs (line 138) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 167) | def prepare_config_and_inputs_for_common(self): class ColQwen2ForRetrievalModelTest (line 196) | class ColQwen2ForRetrievalModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 207) | def setUp(self): method test_inputs_embeds (line 211) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 233) | def test_inputs_embeds_matches_input_ids(self): method test_colqwen2_forward_inputs (line 255) | def test_colqwen2_forward_inputs(self): method test_model_parallelism (line 271) | def test_model_parallelism(self): method test_sdpa_can_dispatch_on_flash (line 275) | def test_sdpa_can_dispatch_on_flash(self): method test_sdpa_can_compile_dynamic (line 280) | def test_sdpa_can_compile_dynamic(self): method test_load_save_without_tied_weights (line 284) | def test_load_save_without_tied_weights(self): class ColQwen2ModelIntegrationTest (line 289) | class ColQwen2ModelIntegrationTest(unittest.TestCase): method setUp (line 292) | def setUp(self): method tearDown (line 295) | def tearDown(self): method test_model_integration_test (line 300) | def test_model_integration_test(self): method test_model_integration_test_2 (line 354) | def test_model_integration_test_2(self): FILE: tests/models/colqwen2/test_processing_colqwen2.py class ColQwen2ProcessorTest (line 38) | class ColQwen2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method test_apply_chat_template_image (line 44) | def test_apply_chat_template_image(self, batch_size, return_tensors): method test_processor_with_multiple_inputs (line 48) | def test_processor_with_multiple_inputs(self): method test_tokenizer_defaults (line 52) | def test_tokenizer_defaults(self): method test_get_num_vision_tokens (line 55) | def test_get_num_vision_tokens(self): method test_process_images (line 67) | def test_process_images(self): method test_process_queries (line 87) | def test_process_queries(self): method test_tokenizer_defaults_preserved_by_kwargs (line 115) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 127) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 149) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 161) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_unstructured_kwargs (line 178) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 197) | def test_unstructured_kwargs_batched(self): method test_doubly_passed_kwargs (line 216) | def test_doubly_passed_kwargs(self): method test_structured_kwargs_nested (line 232) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 253) | def test_structured_kwargs_nested_from_dict(self): method test_model_input_names (line 272) | def test_model_input_names(self): method test_processor_text_has_no_visual (line 280) | def test_processor_text_has_no_visual(self): method test_image_processor_defaults (line 284) | def test_image_processor_defaults(self): method test_get_num_multimodal_tokens_matches_processor_call (line 288) | def test_get_num_multimodal_tokens_matches_processor_call(self): FILE: tests/models/conditional_detr/test_image_processing_conditional_detr.py class ConditionalDetrImageProcessingTester (line 35) | class ConditionalDetrImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 68) | def prepare_image_processor_dict(self): method get_expected_values (line 80) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 113) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 117) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class ConditionalDetrImageProcessingTest (line 131) | class ConditionalDetrImageProcessingTest(AnnotationFormatTestMixin, Imag... method setUp (line 132) | def setUp(self): method image_processor_dict (line 137) | def image_processor_dict(self): method test_image_processor_properties (line 140) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 149) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pytorch_with_coco_detection_annotations (line 159) | def test_call_pytorch_with_coco_detection_annotations(self): method test_call_pytorch_with_coco_panoptic_annotations (line 204) | def test_call_pytorch_with_coco_panoptic_annotations(self): method test_batched_coco_detection_annotations (line 256) | def test_batched_coco_detection_annotations(self): method test_batched_coco_panoptic_annotations (line 375) | def test_batched_coco_panoptic_annotations(self): method test_max_width_max_height_resizing_and_pad_strategy (line 499) | def test_max_width_max_height_resizing_and_pad_strategy(self): method test_longest_edge_shortest_edge_resizing_strategy (line 546) | def test_longest_edge_shortest_edge_resizing_strategy(self): FILE: tests/models/conditional_detr/test_modeling_conditional_detr.py class ConditionalDetrModelTester (line 52) | class ConditionalDetrModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs (line 95) | def prepare_config_and_inputs(self): method get_config (line 116) | def get_config(self): method prepare_config_and_inputs_for_common (line 145) | def prepare_config_and_inputs_for_common(self): method create_and_check_conditional_detr_model (line 150) | def create_and_check_conditional_detr_model(self, config, pixel_values... method create_and_check_conditional_detr_object_detection_head_model (line 162) | def create_and_check_conditional_detr_object_detection_head_model(self... class ConditionalDetrModelTest (line 181) | class ConditionalDetrModelTest(ModelTesterMixin, PipelineTesterMixin, un... method _prepare_for_class (line 202) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 228) | def setUp(self): method test_config (line 232) | def test_config(self): method test_conditional_detr_model (line 235) | def test_conditional_detr_model(self): method test_conditional_detr_object_detection_head_model (line 239) | def test_conditional_detr_object_detection_head_model(self): method test_reverse_loading_mapping (line 243) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_multi_gpu_data_parallel_forward (line 327) | def test_multi_gpu_data_parallel_forward(self): method test_inputs_embeds (line 331) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 335) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 339) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 343) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 347) | def test_resize_tokens_embeddings(self): method test_model_outputs_equivalence (line 352) | def test_model_outputs_equivalence(self): method test_attention_outputs (line 355) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 458) | def test_retain_grad_hidden_states_attentions(self): method test_forward_auxiliary_loss (line 494) | def test_forward_auxiliary_loss(self): method test_forward_signature (line 510) | def test_forward_signature(self): method test_backbone_selection (line 527) | def test_backbone_selection(self): function prepare_img (line 582) | def prepare_img(): class ConditionalDetrModelIntegrationTests (line 590) | class ConditionalDetrModelIntegrationTests(unittest.TestCase): method default_image_processor (line 592) | def default_image_processor(self): method test_inference_no_head (line 599) | def test_inference_no_head(self): method test_inference_object_detection_head (line 621) | def test_inference_object_detection_head(self): FILE: tests/models/convbert/test_modeling_convbert.py class ConvBertModelTester (line 41) | class ConvBertModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 90) | def prepare_config_and_inputs(self): method get_config (line 113) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 129) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 156) | def create_and_check_model( method create_and_check_for_masked_lm (line 167) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 176) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 192) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 202) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 212) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 230) | def prepare_config_and_inputs_for_common(self): class ConvBertModelTest (line 246) | class ConvBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 271) | def setUp(self): method test_config (line 275) | def test_config(self): method test_model (line 278) | def test_model(self): method test_for_masked_lm (line 282) | def test_for_masked_lm(self): method test_for_multiple_choice (line 286) | def test_for_multiple_choice(self): method test_for_question_answering (line 290) | def test_for_question_answering(self): method test_for_sequence_classification (line 294) | def test_for_sequence_classification(self): method test_for_token_classification (line 298) | def test_for_token_classification(self): method test_model_from_pretrained (line 303) | def test_model_from_pretrained(self): method test_attention_outputs (line 308) | def test_attention_outputs(self): method test_model_for_input_embeds (line 424) | def test_model_for_input_embeds(self): method test_reducing_attention_heads (line 435) | def test_reducing_attention_heads(self): class ConvBertModelIntegrationTest (line 442) | class ConvBertModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 444) | def test_inference_no_head(self): FILE: tests/models/convnext/test_image_processing_convnext.py class ConvNextImageProcessingTester (line 23) | class ConvNextImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 53) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 63) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 66) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class ConvNextImageProcessingTest (line 80) | class ConvNextImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 81) | def setUp(self): method image_processor_dict (line 86) | def image_processor_dict(self): method test_image_processor_properties (line 89) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 99) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/convnext/test_modeling_convnext.py class ConvNextModelTester (line 41) | class ConvNextModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 78) | def prepare_config_and_inputs(self): method get_config (line 88) | def get_config(self): method create_and_check_model (line 102) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 113) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_backbone (line 120) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 149) | def prepare_config_and_inputs_for_common(self): class ConvNextModelTest (line 157) | class ConvNextModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 181) | def setUp(self): method test_config (line 191) | def test_config(self): method test_inputs_embeds (line 195) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 199) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 203) | def test_feed_forward_chunking(self): method test_model (line 206) | def test_model(self): method test_backbone (line 210) | def test_backbone(self): method test_hidden_states_output (line 214) | def test_hidden_states_output(self): method test_for_image_classification (line 246) | def test_for_image_classification(self): method test_model_from_pretrained (line 251) | def test_model_from_pretrained(self): function prepare_img (line 258) | def prepare_img(): class ConvNextModelIntegrationTest (line 265) | class ConvNextModelIntegrationTest(unittest.TestCase): method default_image_processor (line 267) | def default_image_processor(self): method test_inference_image_classification_head (line 271) | def test_inference_image_classification_head(self): class ConvNextBackboneTest (line 292) | class ConvNextBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 298) | def setUp(self): FILE: tests/models/convnextv2/test_modeling_convnextv2.py class ConvNextV2ModelTester (line 43) | class ConvNextV2ModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 80) | def prepare_config_and_inputs(self): method get_config (line 91) | def get_config(self): method create_and_check_model (line 105) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 116) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 123) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_with_labels (line 129) | def prepare_config_and_inputs_with_labels(self): class ConvNextV2ModelTest (line 137) | class ConvNextV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method setUp (line 161) | def setUp(self): method test_config (line 171) | def test_config(self): method test_inputs_embeds (line 175) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 179) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 183) | def test_feed_forward_chunking(self): method test_training (line 186) | def test_training(self): method cehck_training_gradient_checkpointing (line 207) | def cehck_training_gradient_checkpointing(self, gradient_checkpointing... method test_model (line 231) | def test_model(self): method test_hidden_states_output (line 235) | def test_hidden_states_output(self): method test_for_image_classification (line 267) | def test_for_image_classification(self): method test_model_from_pretrained (line 272) | def test_model_from_pretrained(self): function prepare_img (line 279) | def prepare_img(): class ConvNextV2ModelIntegrationTest (line 286) | class ConvNextV2ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 288) | def default_image_processor(self): method test_inference_image_classification_head (line 292) | def test_inference_image_classification_head(self): class ConvNextV2BackboneTest (line 312) | class ConvNextV2BackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 318) | def setUp(self): FILE: tests/models/cpm/test_tokenization_cpm.py class CpmTokenizationTest (line 21) | class CpmTokenizationTest(unittest.TestCase): method is_pipeline_test_to_skip (line 23) | def is_pipeline_test_to_skip( method test_pre_tokenization (line 35) | def test_pre_tokenization(self): FILE: tests/models/cpmant/test_modeling_cpmant.py class CpmAntModelTester (line 38) | class CpmAntModelTester: method __init__ (line 39) | def __init__( method prepare_config_and_inputs (line 83) | def prepare_config_and_inputs(self): method get_config (line 92) | def get_config(self): method create_and_check_cpmant_model (line 109) | def create_and_check_cpmant_model(self, config, input_ids, *args): method create_and_check_lm_head_model (line 118) | def create_and_check_lm_head_model(self, config, input_ids, *args): method prepare_config_and_inputs_for_common (line 130) | def prepare_config_and_inputs_for_common(self): class CpmAntModelTest (line 136) | class CpmAntModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 148) | def setUp(self): method test_config (line 152) | def test_config(self): method test_inputs_embeds (line 155) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 158) | def test_retain_grad_hidden_states_attentions(self): method test_cpmant_model (line 164) | def test_cpmant_model(self): method test_cpmant_lm_head_model (line 168) | def test_cpmant_lm_head_model(self): class CpmAntModelIntegrationTest (line 174) | class CpmAntModelIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 176) | def test_inference_masked_lm(self): class CpmAntForCausalLMlIntegrationTest (line 191) | class CpmAntForCausalLMlIntegrationTest(unittest.TestCase): method test_inference_causal (line 193) | def test_inference_causal(self): method test_simple_generation (line 207) | def test_simple_generation(self): method test_batch_generation (line 219) | def test_batch_generation(self): FILE: tests/models/cpmant/test_tokenization_cpmant.py class CPMAntTokenizationTest (line 27) | class CPMAntTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 33) | def setUpClass(cls): method test_pre_tokenization (line 64) | def test_pre_tokenization(self): FILE: tests/models/csm/test_modeling_csm.py class CsmModelTester (line 51) | class CsmModelTester: method __init__ (line 52) | def __init__( method get_config (line 122) | def get_config(self): method prepare_config_and_inputs (line 129) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 135) | def prepare_config_and_inputs_for_common(self): class CsmForConditionalGenerationTest (line 141) | class CsmForConditionalGenerationTest(ModelTesterMixin, GenerationTester... method setUp (line 147) | def setUp(self): method test_config (line 151) | def test_config(self): method _prepare_for_class (line 154) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method _get_logits_processor_kwargs (line 173) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method _check_similar_generate_outputs (line 189) | def _check_similar_generate_outputs(self, output_1, output_2, atol=1e-... method test_assisted_decoding_matches_greedy_search (line 219) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_assisted_decoding_sample (line 224) | def test_assisted_decoding_sample(self): method test_beam_sample_generate (line 229) | def test_beam_sample_generate(self): method test_beam_search_generate (line 234) | def test_beam_search_generate(self): method test_beam_search_generate_dict_output (line 239) | def test_beam_search_generate_dict_output(self): method test_beam_search_generate_dict_outputs_use_cache (line 244) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_beam_sample_generate_dict_output (line 249) | def test_beam_sample_generate_dict_output(self): method test_prompt_lookup_decoding_matches_greedy_search (line 254) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_prompt_lookup_decoding_stops_at_eos (line 259) | def test_prompt_lookup_decoding_stops_at_eos(self): method test_model_get_set_embeddings (line 263) | def test_model_get_set_embeddings(self): method test_generate_from_inputs_embeds_1_beam_search (line 268) | def test_generate_from_inputs_embeds_1_beam_search(self, _, num_beams): method test_model_parallel_beam_search (line 273) | def test_model_parallel_beam_search(self): method test_tied_weights_keys (line 277) | def test_tied_weights_keys(self): method test_model_base_model_prefix (line 281) | def test_model_base_model_prefix(self): method _get_custom_4d_mask_test_data (line 284) | def _get_custom_4d_mask_test_data(self): class CsmForConditionalGenerationIntegrationTest (line 322) | class CsmForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 323) | def setUp(self): method tearDown (line 327) | def tearDown(self): method _load_conversation (line 330) | def _load_conversation(self): method test_1b_model_integration_generate (line 338) | def test_1b_model_integration_generate(self): method test_1b_model_integration_generate_no_audio (line 382) | def test_1b_model_integration_generate_no_audio(self): method test_1b_model_integration_generate_multiple_audio (line 443) | def test_1b_model_integration_generate_multiple_audio(self): method test_1b_model_integration_generate_batched (line 502) | def test_1b_model_integration_generate_batched(self): FILE: tests/models/csm/test_processing_csm.py class CsmProcessorTest (line 33) | class CsmProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 39) | def _setup_test_attributes(cls, processor): method test_tokenizer_defaults (line 46) | def test_tokenizer_defaults(self): method prepare_processor_dict (line 50) | def prepare_processor_dict(): method test_chat_template_is_saved (line 53) | def test_chat_template_is_saved(self): method _test_apply_chat_template (line 65) | def _test_apply_chat_template( method test_apply_chat_template (line 172) | def test_apply_chat_template(self): method test_apply_chat_template_assistant_mask (line 248) | def test_apply_chat_template_assistant_mask(self): FILE: tests/models/ctrl/test_modeling_ctrl.py class CTRLModelTester (line 36) | class CTRLModelTester: method __init__ (line 37) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 124) | def get_config(self): method create_and_check_ctrl_model (line 140) | def create_and_check_ctrl_model(self, config, input_ids, input_mask, t... method create_and_check_lm_head_model (line 151) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method prepare_config_and_inputs_for_common (line 160) | def prepare_config_and_inputs_for_common(self): class CTRLModelTest (line 180) | class CTRLModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method is_pipeline_test_to_skip (line 195) | def is_pipeline_test_to_skip( method setUp (line 213) | def setUp(self): method tearDown (line 217) | def tearDown(self): method test_config (line 222) | def test_config(self): method test_ctrl_model (line 225) | def test_ctrl_model(self): method test_ctrl_lm_head_model (line 229) | def test_ctrl_lm_head_model(self): method test_model_from_pretrained (line 234) | def test_model_from_pretrained(self): class CTRLModelLanguageGenerationTest (line 241) | class CTRLModelLanguageGenerationTest(unittest.TestCase): method tearDown (line 242) | def tearDown(self): method test_lm_generate_ctrl (line 248) | def test_lm_generate_ctrl(self): FILE: tests/models/ctrl/test_tokenization_ctrl.py class CTRLTokenizationTest (line 24) | class CTRLTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 31) | def setUpClass(cls): method get_tokenizer (line 48) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 53) | def get_input_output_texts(self, tokenizer): method test_full_tokenizer (line 58) | def test_full_tokenizer(self): FILE: tests/models/cvt/test_modeling_cvt.py class CvtConfigTester (line 41) | class CvtConfigTester(ConfigTester): method create_and_test_config_common_properties (line 42) | def create_and_test_config_common_properties(self): class CvtModelTester (line 48) | class CvtModelTester: method __init__ (line 49) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 99) | def get_config(self): method create_and_check_model (line 116) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 128) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 136) | def prepare_config_and_inputs_for_common(self): class CvtModelTest (line 144) | class CvtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 160) | def setUp(self): method test_config (line 170) | def test_config(self): method test_attention_outputs (line 174) | def test_attention_outputs(self): method test_inputs_embeds (line 178) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 182) | def test_model_get_set_embeddings(self): method test_batching_equivalence (line 186) | def test_batching_equivalence(self, atol=2e-4, rtol=2e-4): method test_model (line 189) | def test_model(self): method test_hidden_states_output (line 193) | def test_hidden_states_output(self): method test_for_image_classification (line 229) | def test_for_image_classification(self): method test_model_from_pretrained (line 234) | def test_model_from_pretrained(self): function prepare_img (line 241) | def prepare_img(): class CvtModelIntegrationTest (line 248) | class CvtModelIntegrationTest(unittest.TestCase): method default_image_processor (line 250) | def default_image_processor(self): method test_inference_image_classification_head (line 254) | def test_inference_image_classification_head(self): FILE: tests/models/cwm/test_configuration_cwm.py class CwmConfigTest (line 25) | class CwmConfigTest(unittest.TestCase): method test_default_config (line 26) | def test_default_config(self): method test_custom_sliding_window_config (line 39) | def test_custom_sliding_window_config(self): method test_custom_layer_types_config (line 44) | def test_custom_layer_types_config(self): method test_invalid_layer_types_length (line 51) | def test_invalid_layer_types_length(self): method test_invalid_layer_type_value (line 58) | def test_invalid_layer_type_value(self): method test_automatic_layer_types_generation (line 62) | def test_automatic_layer_types_generation(self): method test_rope_parameters_config (line 79) | def test_rope_parameters_config(self): method test_config_serialization (line 93) | def test_config_serialization(self): method test_config_inheritance_from_llama (line 108) | def test_config_inheritance_from_llama(self): class CwmConfigTester (line 121) | class CwmConfigTester(ConfigTester): method __init__ (line 122) | def __init__(self, parent, config_class=None, **kwargs): method test_config (line 125) | def test_config(self): FILE: tests/models/cwm/test_modeling_cwm.py class CwmModelTester (line 41) | class CwmModelTester(CausalLMModelTester): method get_config (line 47) | def get_config(self): class CwmModelTest (line 64) | class CwmModelTest(CausalLMModelTest, unittest.TestCase): class CwmIntegrationTest (line 90) | class CwmIntegrationTest(unittest.TestCase): method setUp (line 91) | def setUp(self): method tearDown (line 94) | def tearDown(self): method test_cwm_integration (line 99) | def test_cwm_integration(self): method test_cwm_sliding_window_long_sequence (line 145) | def test_cwm_sliding_window_long_sequence(self): method test_cwm_generation_20_tokens (line 196) | def test_cwm_generation_20_tokens(self): FILE: tests/models/d_fine/test_modeling_d_fine.py class DFineModelTester (line 59) | class DFineModelTester: method __init__ (line 60) | def __init__( method prepare_config_and_inputs (line 170) | def prepare_config_and_inputs(self): method get_config (line 191) | def get_config(self): method prepare_config_and_inputs_for_common (line 253) | def prepare_config_and_inputs_for_common(self): method create_and_check_d_fine_model (line 258) | def create_and_check_d_fine_model(self, config, pixel_values, pixel_ma... method create_and_check_d_fine_object_detection_head_model (line 268) | def create_and_check_d_fine_object_detection_head_model(self, config, ... class DFineModelTest (line 287) | class DFineModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method _prepare_for_class (line 299) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 318) | def setUp(self): method test_config (line 327) | def test_config(self): method test_d_fine_model (line 330) | def test_d_fine_model(self): method test_d_fine_object_detection_head_model (line 334) | def test_d_fine_object_detection_head_model(self): method test_multi_gpu_data_parallel_forward (line 339) | def test_multi_gpu_data_parallel_forward(self): method test_inputs_embeds (line 343) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 347) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 351) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 355) | def test_model_common_attributes(self): method test_resize_tokens_embeddings (line 359) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 363) | def test_feed_forward_chunking(self): method test_load_save_without_tied_weights (line 367) | def test_load_save_without_tied_weights(self): method test_attention_outputs (line 370) | def test_attention_outputs(self): method test_hidden_states_output (line 475) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 526) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 560) | def test_forward_signature(self): method test_backbone_selection (line 570) | def test_backbone_selection(self): method test_inference_with_different_dtypes (line 621) | def test_inference_with_different_dtypes(self, dtype_str): method test_inference_equivalence_for_static_and_dynamic_anchors (line 643) | def test_inference_equivalence_for_static_and_dynamic_anchors(self, dt... function prepare_img (line 684) | def prepare_img(): class DFineModelIntegrationTest (line 692) | class DFineModelIntegrationTest(unittest.TestCase): method default_image_processor (line 694) | def default_image_processor(self): method test_inference_object_detection_head (line 697) | def test_inference_object_detection_head(self): FILE: tests/models/dab_detr/test_modeling_dab_detr.py class DabDetrModelTester (line 48) | class DabDetrModelTester: method __init__ (line 49) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method get_config (line 112) | def get_config(self): method prepare_config_and_inputs_for_common (line 141) | def prepare_config_and_inputs_for_common(self): method create_and_check_dab_detr_model (line 146) | def create_and_check_dab_detr_model(self, config, pixel_values, pixel_... method create_and_check_dab_detr_object_detection_head_model (line 158) | def create_and_check_dab_detr_object_detection_head_model(self, config... class DabDetrModelTest (line 177) | class DabDetrModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method _prepare_for_class (line 193) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 219) | def setUp(self): method test_config (line 223) | def test_config(self): method test_dab_detr_model (line 226) | def test_dab_detr_model(self): method test_dab_detr_object_detection_head_model (line 230) | def test_dab_detr_object_detection_head_model(self): method test_load_save_without_tied_weights (line 234) | def test_load_save_without_tied_weights(self): method test_multi_gpu_data_parallel_forward (line 270) | def test_multi_gpu_data_parallel_forward(self): method test_inputs_embeds (line 274) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 278) | def test_model_get_set_embeddings(self): method test_inputs_embeds_matches_input_ids (line 282) | def test_inputs_embeds_matches_input_ids(self): method test_model_common_attributes (line 286) | def test_model_common_attributes(self): method test_generate_without_input_ids (line 290) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 294) | def test_resize_tokens_embeddings(self): method test_model_outputs_equivalence (line 298) | def test_model_outputs_equivalence(self): method test_hidden_states_output (line 374) | def test_hidden_states_output(self): method test_batching_equivalence (line 430) | def test_batching_equivalence(self): method test_attention_outputs (line 523) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 624) | def test_retain_grad_hidden_states_attentions(self): method test_forward_auxiliary_loss (line 659) | def test_forward_auxiliary_loss(self): method test_training (line 675) | def test_training(self): method test_forward_signature (line 691) | def test_forward_signature(self): method test_backbone_selection (line 707) | def test_backbone_selection(self): function prepare_img (line 750) | def prepare_img(): class DabDetrModelIntegrationTests (line 758) | class DabDetrModelIntegrationTests(unittest.TestCase): method default_image_processor (line 760) | def default_image_processor(self): method test_inference_no_head (line 763) | def test_inference_no_head(self): method test_inference_object_detection_head (line 784) | def test_inference_object_detection_head(self): FILE: tests/models/dac/test_feature_extraction_dac.py function floats_list (line 37) | def floats_list(shape, scale=1.0, rng=None, name=None): class DacFeatureExtractionTester (line 53) | class DacFeatureExtractionTester: method __init__ (line 55) | def __init__( method prepare_feat_extract_dict (line 77) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 85) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class DacFeatureExtractionTest (line 106) | class DacFeatureExtractionTest(SequenceFeatureExtractionTestMixin, unitt... method setUp (line 109) | def setUp(self): method test_call (line 112) | def test_call(self): method test_double_precision_pad (line 130) | def test_double_precision_pad(self): method _load_datasamples (line 141) | def _load_datasamples(self, num_samples): method test_integration (line 150) | def test_integration(self): method test_integration_stereo (line 173) | def test_integration_stereo(self): method test_truncation_and_padding (line 177) | def test_truncation_and_padding(self): FILE: tests/models/dac/test_modeling_dac.py class DacModelTester (line 43) | class DacModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 80) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 86) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_model_class (line 90) | def prepare_config_and_inputs_for_model_class(self, model_class): method get_config (line 98) | def get_config(self): method create_and_check_model_forward (line 112) | def create_and_check_model_forward(self, config, inputs_dict): class DacModelTest (line 122) | class DacModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method _prepare_for_class (line 129) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 138) | def setUp(self): method test_config (line 144) | def test_config(self): method test_model_forward (line 147) | def test_model_forward(self): method test_batching_equivalence (line 153) | def test_batching_equivalence(self): method test_forward_signature (line 156) | def test_forward_signature(self): method test_inputs_embeds (line 170) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 174) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 178) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 182) | def test_attention_outputs(self): method test_hidden_states_output (line 186) | def test_hidden_states_output(self): method test_determinism (line 189) | def test_determinism(self): method test_model_outputs_equivalence (line 215) | def test_model_outputs_equivalence(self): method test_identity_shortcut (line 262) | def test_identity_shortcut(self): method test_quantizer_from_latents (line 267) | def test_quantizer_from_latents(self): function normalize (line 286) | def normalize(arr): function compute_rmse (line 293) | def compute_rmse(arr1, arr2): class DacIntegrationTest (line 788) | class DacIntegrationTest(unittest.TestCase): method test_integration (line 791) | def test_integration(self, model_name): method test_integration_batch (line 847) | def test_integration_batch(self, model_name): method test_quantizer_from_latents_integration (line 907) | def test_quantizer_from_latents_integration(self, model_name): FILE: tests/models/data2vec/test_modeling_data2vec_audio.py class Data2VecAudioModelTester (line 45) | class Data2VecAudioModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 118) | def prepare_config_and_inputs(self): method get_config (line 126) | def get_config(self): method create_and_check_model (line 155) | def create_and_check_model(self, config, input_values, attention_mask): method create_and_check_model_with_adapter (line 164) | def create_and_check_model_with_adapter(self, config, input_values, at... method create_and_check_model_with_adapter_proj_dim (line 174) | def create_and_check_model_with_adapter_proj_dim(self, config, input_v... method check_ctc_loss (line 186) | def check_ctc_loss(self, config, input_values, *args): method check_seq_classifier_loss (line 214) | def check_seq_classifier_loss(self, config, input_values, *args): method check_ctc_training (line 239) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_training (line 268) | def check_seq_classifier_training(self, config, input_values, *args): method check_xvector_training (line 291) | def check_xvector_training(self, config, input_values, *args): method check_labels_out_of_vocab (line 314) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 328) | def prepare_config_and_inputs_for_common(self): class Data2VecAudioModelTest (line 335) | class Data2VecAudioModelTest(ModelTesterMixin, PipelineTesterMixin, unit... method setUp (line 357) | def setUp(self): method test_config (line 361) | def test_config(self): method test_model (line 364) | def test_model(self): method test_model_with_adapter (line 368) | def test_model_with_adapter(self): method test_model_with_adapter_proj_dim (line 372) | def test_model_with_adapter_proj_dim(self): method test_ctc_loss_inference (line 376) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 380) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 384) | def test_ctc_train(self): method test_seq_classifier_train (line 388) | def test_seq_classifier_train(self): method test_xvector_train (line 392) | def test_xvector_train(self): method test_labels_out_of_vocab (line 396) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 401) | def test_inputs_embeds(self): method test_forward_signature (line 405) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 409) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 413) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 416) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 460) | def _mock_init_weights(self, module): method test_mask_feature_prob_ctc (line 474) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 497) | def test_mask_time_prob_ctc(self): method test_feed_forward_chunking (line 521) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 525) | def test_model_from_pretrained(self): class Data2VecAudioUtilsTest (line 531) | class Data2VecAudioUtilsTest(unittest.TestCase): method test_compute_mask_indices (line 532) | def test_compute_mask_indices(self): method test_compute_mask_indices_low_prob (line 543) | def test_compute_mask_indices_low_prob(self): method test_compute_mask_indices_overlap (line 573) | def test_compute_mask_indices_overlap(self): method test_compute_mask_indices_attn_mask_overlap (line 586) | def test_compute_mask_indices_attn_mask_overlap(self): method test_compute_mask_indices_short_audio (line 605) | def test_compute_mask_indices_short_audio(self): class Data2VecAudioModelIntegrationTest (line 626) | class Data2VecAudioModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 627) | def _load_datasamples(self, num_samples): method _load_superb (line 636) | def _load_superb(self, task, num_samples): method test_inference_ctc_normal (line 641) | def test_inference_ctc_normal(self): method test_inference_ctc_batched (line 658) | def test_inference_ctc_batched(self): FILE: tests/models/data2vec/test_modeling_data2vec_text.py class Data2VecTextModelTester (line 43) | class Data2VecTextModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 130) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 157) | def create_and_check_model( method create_and_check_model_as_decoder (line 170) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 203) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 221) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_masked_lm (line 289) | def create_and_check_for_masked_lm( method create_and_check_for_token_classification (line 298) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 308) | def create_and_check_for_multiple_choice( method create_and_check_for_question_answering (line 326) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 342) | def prepare_config_and_inputs_for_common(self): class Data2VecTextModelTest (line 358) | class Data2VecTextModelTest(ModelTesterMixin, GenerationTesterMixin, Pip... method prepare_config_and_inputs_for_generate (line 387) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method setUp (line 392) | def setUp(self): method test_config (line 396) | def test_config(self): method test_model (line 399) | def test_model(self): method test_model_as_decoder (line 403) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 407) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 434) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 438) | def test_decoder_model_past_with_large_inputs(self): method test_for_masked_lm (line 442) | def test_for_masked_lm(self): method test_for_token_classification (line 446) | def test_for_token_classification(self): method test_for_multiple_choice (line 450) | def test_for_multiple_choice(self): method test_for_question_answering (line 454) | def test_for_question_answering(self): method test_model_from_pretrained (line 459) | def test_model_from_pretrained(self): method test_create_position_ids_respects_padding_index (line 464) | def test_create_position_ids_respects_padding_index(self): method test_create_position_ids_from_inputs_embeds (line 482) | def test_create_position_ids_from_inputs_embeds(self): class Data2VecTextModelIntegrationTest (line 505) | class Data2VecTextModelIntegrationTest(TestCasePlus): method test_inference_masked_lm (line 507) | def test_inference_masked_lm(self): method test_inference_no_head (line 521) | def test_inference_no_head(self): FILE: tests/models/data2vec/test_modeling_data2vec_vision.py class Data2VecVisionModelTester (line 57) | class Data2VecVisionModelTester: method __init__ (line 58) | def __init__( method prepare_config_and_inputs (line 111) | def prepare_config_and_inputs(self): method get_config (line 124) | def get_config(self): method create_and_check_model (line 143) | def create_and_check_model(self, config, pixel_values, labels, pixel_l... method create_and_check_for_image_classification (line 152) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_for_image_segmentation (line 160) | def create_and_check_for_image_segmentation(self, config, pixel_values... method prepare_config_and_inputs_for_common (line 174) | def prepare_config_and_inputs_for_common(self): class Data2VecVisionModelTest (line 182) | class Data2VecVisionModelTest(ModelTesterMixin, PipelineTesterMixin, uni... method setUp (line 205) | def setUp(self): method test_config (line 211) | def test_config(self): method test_sdpa_can_compile_dynamic (line 218) | def test_sdpa_can_compile_dynamic(self): method test_inputs_embeds (line 222) | def test_inputs_embeds(self): method test_multi_gpu_data_parallel_forward (line 229) | def test_multi_gpu_data_parallel_forward(self): method test_model_get_set_embeddings (line 232) | def test_model_get_set_embeddings(self): method test_model (line 241) | def test_model(self): method test_for_image_segmentation (line 245) | def test_for_image_segmentation(self): method test_training (line 249) | def test_training(self): method test_training_gradient_checkpointing (line 267) | def test_training_gradient_checkpointing(self): method test_for_image_classification (line 293) | def test_for_image_classification(self): method test_model_from_pretrained (line 298) | def test_model_from_pretrained(self): function prepare_img (line 305) | def prepare_img(): class Data2VecVisionModelIntegrationTest (line 312) | class Data2VecVisionModelIntegrationTest(unittest.TestCase): method default_image_processor (line 314) | def default_image_processor(self): method test_inference_image_classification_head_imagenet_1k (line 322) | def test_inference_image_classification_head_imagenet_1k(self): method test_inference_interpolate_pos_encoding (line 348) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/dbrx/test_modeling_dbrx.py class DbrxModelTester (line 30) | class DbrxModelTester(CausalLMModelTester): method __init__ (line 34) | def __init__( method config_args (line 81) | def config_args(self): class DbrxModelTest (line 86) | class DbrxModelTest(CausalLMModelTest, unittest.TestCase): method test_model_from_pretrained (line 90) | def test_model_from_pretrained(self): method test_cpu_offload (line 98) | def test_cpu_offload(self): method test_disk_offload_safetensors (line 102) | def test_disk_offload_safetensors(self): method test_disk_offload_bin (line 106) | def test_disk_offload_bin(self): class DbrxModelIntegrationTest (line 111) | class DbrxModelIntegrationTest(unittest.TestCase): method test_tiny_model_logits (line 113) | def test_tiny_model_logits(self): FILE: tests/models/deberta/test_modeling_deberta.py class DebertaModelTester (line 36) | class DebertaModelTester: method __init__ (line 37) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method get_config (line 114) | def get_config(self): method get_pipeline_config (line 132) | def get_pipeline_config(self): method check_loss_output (line 137) | def check_loss_output(self, result): method create_and_check_deberta_model (line 140) | def create_and_check_deberta_model( method create_and_check_deberta_for_masked_lm (line 152) | def create_and_check_deberta_for_masked_lm( method create_and_check_deberta_for_sequence_classification (line 162) | def create_and_check_deberta_for_sequence_classification( method create_and_check_deberta_for_token_classification (line 173) | def create_and_check_deberta_for_token_classification( method create_and_check_deberta_for_question_answering (line 183) | def create_and_check_deberta_for_question_answering( method prepare_config_and_inputs_for_common (line 199) | def prepare_config_and_inputs_for_common(self): class DebertaModelTest (line 215) | class DebertaModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 241) | def setUp(self): method test_config (line 245) | def test_config(self): method test_deberta_model (line 248) | def test_deberta_model(self): method test_for_sequence_classification (line 252) | def test_for_sequence_classification(self): method test_for_masked_lm (line 256) | def test_for_masked_lm(self): method test_for_question_answering (line 260) | def test_for_question_answering(self): method test_for_token_classification (line 264) | def test_for_token_classification(self): method test_model_from_pretrained (line 269) | def test_model_from_pretrained(self): class DebertaModelIntegrationTest (line 278) | class DebertaModelIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 280) | def test_inference_masked_lm(self): method test_inference_no_head (line 284) | def test_inference_no_head(self): FILE: tests/models/deberta/test_tokenization_deberta.py class DebertaTokenizationTest (line 23) | class DebertaTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/deberta_v2/test_modeling_deberta_v2.py class DebertaV2ModelTester (line 37) | class DebertaV2ModelTester: method __init__ (line 38) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method check_loss_output (line 133) | def check_loss_output(self, result): method create_and_check_deberta_model (line 136) | def create_and_check_deberta_model( method create_and_check_deberta_for_masked_lm (line 148) | def create_and_check_deberta_for_masked_lm( method create_and_check_deberta_for_sequence_classification (line 158) | def create_and_check_deberta_for_sequence_classification( method create_and_check_deberta_for_token_classification (line 169) | def create_and_check_deberta_for_token_classification( method create_and_check_deberta_for_question_answering (line 179) | def create_and_check_deberta_for_question_answering( method create_and_check_deberta_for_multiple_choice (line 195) | def create_and_check_deberta_for_multiple_choice( method prepare_config_and_inputs_for_common (line 212) | def prepare_config_and_inputs_for_common(self): class DebertaV2ModelTest (line 228) | class DebertaV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method setUp (line 255) | def setUp(self): method test_config (line 259) | def test_config(self): method test_deberta_model (line 262) | def test_deberta_model(self): method test_for_sequence_classification (line 266) | def test_for_sequence_classification(self): method test_for_masked_lm (line 270) | def test_for_masked_lm(self): method test_for_question_answering (line 274) | def test_for_question_answering(self): method test_for_token_classification (line 278) | def test_for_token_classification(self): method test_for_multiple_choice (line 282) | def test_for_multiple_choice(self): method test_model_from_pretrained (line 287) | def test_model_from_pretrained(self): class DebertaV2ModelIntegrationTest (line 296) | class DebertaV2ModelIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 298) | def test_inference_masked_lm(self): method test_inference_no_head (line 302) | def test_inference_no_head(self): FILE: tests/models/deberta_v2/test_tokenization_deberta_v2.py class DebertaV2TokenizationTest (line 29) | class DebertaV2TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_do_lower_case (line 38) | def test_do_lower_case(self): method test_split_by_punct (line 51) | def test_split_by_punct(self): method test_do_lower_case_split_by_punct (line 64) | def test_do_lower_case_split_by_punct(self): method test_do_lower_case_split_by_punct_false (line 78) | def test_do_lower_case_split_by_punct_false(self): method test_do_lower_case_false_split_by_punct (line 93) | def test_do_lower_case_false_split_by_punct(self): method test_do_lower_case_false_split_by_punct_false (line 107) | def test_do_lower_case_false_split_by_punct_false(self): method test_post_processor_adds_special_tokens (line 121) | def test_post_processor_adds_special_tokens(self): FILE: tests/models/decision_transformer/test_modeling_decision_transformer.py class DecisionTransformerModelTester (line 33) | class DecisionTransformerModelTester: method __init__ (line 34) | def __init__( method prepare_config_and_inputs (line 52) | def prepare_config_and_inputs(self): method get_config (line 72) | def get_config(self): method create_and_check_model (line 81) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 103) | def prepare_config_and_inputs_for_common(self): class DecisionTransformerModelTest (line 126) | class DecisionTransformerModelTest(ModelTesterMixin, PipelineTesterMixin... method setUp (line 141) | def setUp(self): method test_config (line 145) | def test_config(self): method test_model (line 148) | def test_model(self): method test_model_from_pretrained (line 153) | def test_model_from_pretrained(self): method test_forward_signature (line 158) | def test_forward_signature(self): method test_model_get_set_embeddings (line 179) | def test_model_get_set_embeddings(self): class DecisionTransformerModelIntegrationTest (line 184) | class DecisionTransformerModelIntegrationTest(unittest.TestCase): method test_autoregressive_prediction (line 186) | def test_autoregressive_prediction(self): FILE: tests/models/deepseek_v2/test_modeling_deepseek_v2.py class DeepseekV2ModelTester (line 31) | class DeepseekV2ModelTester(CausalLMModelTester): method __init__ (line 35) | def __init__( class DeepseekV2ModelTest (line 53) | class DeepseekV2ModelTest(CausalLMModelTest, unittest.TestCase): method _check_past_key_values_for_generate (line 61) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_model_rope_scaling_frequencies (line 78) | def test_model_rope_scaling_frequencies(self): method test_tp_plan_matches_params (line 135) | def test_tp_plan_matches_params(self): class DeepseekV2IntegrationTest (line 149) | class DeepseekV2IntegrationTest(unittest.TestCase): method test_deepseek_v2_lite (line 150) | def test_deepseek_v2_lite(self): method test_logits_eager (line 170) | def test_logits_eager(self): method test_batch_fa2 (line 190) | def test_batch_fa2(self): FILE: tests/models/deepseek_v3/test_modeling_deepseek_v3.py class DeepseekV3ModelTester (line 50) | class DeepseekV3ModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 137) | def prepare_config_and_inputs(self): method get_config (line 160) | def get_config(self): method create_and_check_model (line 191) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 201) | def prepare_config_and_inputs_for_common(self): class DeepseekV3ModelTest (line 217) | class DeepseekV3ModelTest( method setUp (line 250) | def setUp(self): method _check_past_key_values_for_generate (line 254) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_assisted_decoding_matches_greedy_search (line 273) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_prompt_lookup_decoding_matches_greedy_search (line 277) | def test_prompt_lookup_decoding_matches_greedy_search(self, assistant_... method test_assisted_decoding_sample (line 281) | def test_assisted_decoding_sample(self): method test_beam_search_generate_dict_outputs_use_cache (line 285) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_greedy_generate_dict_outputs_use_cache (line 289) | def test_greedy_generate_dict_outputs_use_cache(self): method test_sdpa_can_dispatch_on_flash (line 293) | def test_sdpa_can_dispatch_on_flash(self): method test_config (line 296) | def test_config(self): method test_model (line 299) | def test_model(self): method test_eager_matches_sdpa_generate (line 305) | def test_eager_matches_sdpa_generate(self): method test_flex_attention_with_grads (line 351) | def test_flex_attention_with_grads(self): method test_deepseek_v3_sequence_classification_model (line 379) | def test_deepseek_v3_sequence_classification_model(self): class DeepseekV3IntegrationTest (line 393) | class DeepseekV3IntegrationTest(unittest.TestCase): method tearDown (line 394) | def tearDown(self): method test_compile_static_cache (line 401) | def test_compile_static_cache(self): FILE: tests/models/deepseek_vl/test_image_processing_deepseek_vl.py class DeepseekVLImageProcessingTester (line 24) | class DeepseekVLImageProcessingTester: method __init__ (line 25) | def __init__( method prepare_image_processor_dict (line 52) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 62) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 66) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DeepseekVLImageProcessingTest (line 80) | class DeepseekVLImageProcessingTest(ImageProcessingTestMixin, unittest.T... method setUp (line 81) | def setUp(self): method image_processor_dict (line 86) | def image_processor_dict(self): method test_image_processor_properties (line 89) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 98) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 108) | def test_call_numpy_4_channels(self): FILE: tests/models/deepseek_vl/test_modeling_deepseek_vl.py class DeepseekVLVisionText2TextModelTester (line 37) | class DeepseekVLVisionText2TextModelTester(VLMModelTester): method get_vision_config (line 44) | def get_vision_config(self): class DeepseekVLModelTest (line 51) | class DeepseekVLModelTest(VLMModelTest, unittest.TestCase): class DeepseekVLIntegrationTest (line 67) | class DeepseekVLIntegrationTest(unittest.TestCase): method setUp (line 68) | def setUp(self): method test_model_text_generation (line 71) | def test_model_text_generation(self): method test_model_text_generation_batched (line 103) | def test_model_text_generation_batched(self): method test_model_text_generation_with_multi_image (line 149) | def test_model_text_generation_with_multi_image(self): FILE: tests/models/deepseek_vl/test_processing_deepseek_vl.py class DeepseekVLProcessorTest (line 25) | class DeepseekVLProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 29) | def _setup_tokenizer(cls): method prepare_processor_dict (line 40) | def prepare_processor_dict(): FILE: tests/models/deepseek_vl_hybrid/test_image_processing_deepseek_vl_hybrid.py class DeepseekVLHybridImageProcessingTester (line 32) | class DeepseekVLHybridImageProcessingTester: method __init__ (line 33) | def __init__( method prepare_image_processor_dict (line 67) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 79) | def expected_output_image_shape(self, images): method expected_output_high_res_image_shape (line 83) | def expected_output_high_res_image_shape(self, images): method prepare_image_inputs (line 87) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DeepseekVLHybridImageProcessingTest (line 101) | class DeepseekVLHybridImageProcessingTest(ImageProcessingTestMixin, unit... method setUp (line 102) | def setUp(self): method image_processor_dict (line 107) | def image_processor_dict(self): method test_image_processor_from_dict_with_kwargs (line 110) | def test_image_processor_from_dict_with_kwargs(self): method test_image_processor_properties (line 118) | def test_image_processor_properties(self): method test_call_pil_high_res (line 130) | def test_call_pil_high_res(self): method test_call_numpy_high_res (line 153) | def test_call_numpy_high_res(self): method test_call_pytorch_high_res (line 176) | def test_call_pytorch_high_res(self): method test_backends_equivalence (line 201) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 232) | def test_backends_equivalence_batched(self): method test_call_numpy_4_channels (line 260) | def test_call_numpy_4_channels(self): FILE: tests/models/deepseek_vl_hybrid/test_modeling_deepseek_vl_hybrid.py class DeepseekVLHybridModelTester (line 44) | class DeepseekVLHybridModelTester: method __init__ (line 45) | def __init__( method get_config (line 109) | def get_config(self): method prepare_config_and_inputs (line 117) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 144) | def prepare_config_and_inputs_for_common(self): class DeepseekVLHybridModelTest (line 157) | class DeepseekVLHybridModelTest(ModelTesterMixin, GenerationTesterMixin,... method setUp (line 173) | def setUp(self): method test_inputs_embeds (line 178) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 200) | def test_inputs_embeds_matches_input_ids(self): method test_sdpa_can_dispatch_composite_models (line 221) | def test_sdpa_can_dispatch_composite_models(self): method test_sdpa_can_dispatch_on_flash (line 277) | def test_sdpa_can_dispatch_on_flash(self): class DeepseekVLHybridIntegrationTest (line 286) | class DeepseekVLHybridIntegrationTest(unittest.TestCase): method setUp (line 287) | def setUp(self): method test_model_text_generation (line 290) | def test_model_text_generation(self): method test_model_text_generation_batched (line 324) | def test_model_text_generation_batched(self): method test_model_text_generation_with_multi_image (line 372) | def test_model_text_generation_with_multi_image(self): FILE: tests/models/deepseek_vl_hybrid/test_processing_deepseek_vl_hybrid.py class DeepseekVLHybridProcessorTest (line 25) | class DeepseekVLHybridProcessorTest(ProcessorTesterMixin, unittest.TestC... method _setup_tokenizer (line 29) | def _setup_tokenizer(cls): method prepare_processor_dict (line 40) | def prepare_processor_dict(): FILE: tests/models/deformable_detr/test_image_processing_deformable_detr.py class DeformableDetrImageProcessingTester (line 42) | class DeformableDetrImageProcessingTester: method __init__ (line 43) | def __init__( method prepare_image_processor_dict (line 75) | def prepare_image_processor_dict(self): method get_expected_values (line 87) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 120) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 124) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DeformableDetrImageProcessingTest (line 138) | class DeformableDetrImageProcessingTest(AnnotationFormatTestMixin, Image... method setUp (line 139) | def setUp(self): method image_processor_dict (line 144) | def image_processor_dict(self): method test_image_processor_properties (line 147) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 158) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pytorch_with_coco_detection_annotations (line 168) | def test_call_pytorch_with_coco_detection_annotations(self): method test_call_pytorch_with_coco_panoptic_annotations (line 213) | def test_call_pytorch_with_coco_panoptic_annotations(self): method test_batched_coco_detection_annotations (line 265) | def test_batched_coco_detection_annotations(self): method test_batched_coco_panoptic_annotations (line 384) | def test_batched_coco_panoptic_annotations(self): method test_max_width_max_height_resizing_and_pad_strategy (line 508) | def test_max_width_max_height_resizing_and_pad_strategy(self): method test_longest_edge_shortest_edge_resizing_strategy (line 555) | def test_longest_edge_shortest_edge_resizing_strategy(self): method test_torchvision_processor_equivalence_cpu_accelerator_coco_detection_annotations (line 612) | def test_torchvision_processor_equivalence_cpu_accelerator_coco_detect... method test_torchvision_processor_equivalence_cpu_accelerator_coco_panoptic_annotations (line 672) | def test_torchvision_processor_equivalence_cpu_accelerator_coco_panopt... FILE: tests/models/deformable_detr/test_modeling_deformable_detr.py class DeformableDetrModelTester (line 50) | class DeformableDetrModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 102) | def prepare_config_and_inputs(self): method get_config (line 123) | def get_config(self): method prepare_config_and_inputs_for_common (line 155) | def prepare_config_and_inputs_for_common(self): method create_and_check_deformable_detr_model (line 160) | def create_and_check_deformable_detr_model(self, config, pixel_values,... method create_and_check_deformable_detr_object_detection_head_model (line 170) | def create_and_check_deformable_detr_object_detection_head_model(self,... class DeformableDetrModelTest (line 189) | class DeformableDetrModelTest(ModelTesterMixin, PipelineTesterMixin, uni... method _prepare_for_class (line 201) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 227) | def setUp(self): method test_config (line 236) | def test_config(self): method test_deformable_detr_model (line 239) | def test_deformable_detr_model(self): method test_deformable_detr_object_detection_head_model (line 243) | def test_deformable_detr_object_detection_head_model(self): method test_tie_weights_is_not_modified (line 247) | def test_tie_weights_is_not_modified(self): method test_inputs_embeds (line 267) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 271) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 275) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 279) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 283) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 287) | def test_feed_forward_chunking(self): method test_attention_outputs (line 290) | def test_attention_outputs(self): method test_model_outputs_equivalence (line 390) | def test_model_outputs_equivalence(self): method test_retain_grad_hidden_states_attentions (line 463) | def test_retain_grad_hidden_states_attentions(self): method test_forward_auxiliary_loss (line 500) | def test_forward_auxiliary_loss(self): method test_forward_signature (line 516) | def test_forward_signature(self): method test_backbone_selection (line 532) | def test_backbone_selection(self): method test_two_stage_training (line 579) | def test_two_stage_training(self): method create_and_check_model_fp16_forward (line 594) | def create_and_check_model_fp16_forward(self): method create_and_check_model_bf16_forward (line 607) | def create_and_check_model_bf16_forward(self): function prepare_img (line 623) | def prepare_img(): class DeformableDetrModelIntegrationTests (line 631) | class DeformableDetrModelIntegrationTests(unittest.TestCase): method default_image_processor (line 633) | def default_image_processor(self): method test_inference_object_detection_head (line 636) | def test_inference_object_detection_head(self): method test_inference_object_detection_head_with_box_refine_two_stage (line 685) | def test_inference_object_detection_head_with_box_refine_two_stage(self): method test_inference_object_detection_head_equivalence_cpu_accelerator (line 716) | def test_inference_object_detection_head_equivalence_cpu_accelerator(s... FILE: tests/models/deit/test_image_processing_deit.py class DeiTImageProcessingTester (line 23) | class DeiTImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 57) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 68) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 71) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DeiTImageProcessingTest (line 85) | class DeiTImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 107) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/deit/test_modeling_deit.py class DeiTModelTester (line 60) | class DeiTModelTester: method __init__ (line 61) | def __init__( method prepare_config_and_inputs (line 112) | def prepare_config_and_inputs(self): method get_config (line 123) | def get_config(self): method create_and_check_model (line 141) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_masked_image_modeling (line 148) | def create_and_check_for_masked_image_modeling(self, config, pixel_val... method create_and_check_for_image_classification (line 167) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 185) | def prepare_config_and_inputs_for_common(self): class DeiTModelTest (line 197) | class DeiTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 224) | def setUp(self): method test_multi_gpu_data_parallel_forward (line 232) | def test_multi_gpu_data_parallel_forward(self): method test_config (line 235) | def test_config(self): method test_inputs_embeds (line 239) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 242) | def test_model_get_set_embeddings(self): method test_model (line 251) | def test_model(self): method test_for_masked_image_modeling (line 255) | def test_for_masked_image_modeling(self): method test_for_image_classification (line 259) | def test_for_image_classification(self): method _prepare_for_class (line 264) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_training (line 273) | def test_training(self): method check_training_gradient_checkpointing (line 294) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_problem_types (line 316) | def test_problem_types(self): method test_model_from_pretrained (line 367) | def test_model_from_pretrained(self): function prepare_img (line 374) | def prepare_img(): class DeiTModelIntegrationTest (line 381) | class DeiTModelIntegrationTest(unittest.TestCase): method default_image_processor (line 383) | def default_image_processor(self): method test_inference_image_classification_head (line 391) | def test_inference_image_classification_head(self): method test_inference_interpolate_pos_encoding (line 413) | def test_inference_interpolate_pos_encoding(self): method test_inference_fp16 (line 438) | def test_inference_fp16(self): FILE: tests/models/depth_anything/test_modeling_depth_anything.py class DepthAnythingModelTester (line 39) | class DepthAnythingModelTester: method __init__ (line 41) | def __init__( method prepare_config_and_inputs (line 82) | def prepare_config_and_inputs(self): method get_config (line 93) | def get_config(self): method get_backbone_config (line 103) | def get_backbone_config(self): method create_and_check_for_depth_estimation (line 118) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method prepare_config_and_inputs_for_common (line 127) | def prepare_config_and_inputs_for_common(self): class DepthAnythingModelTest (line 135) | class DepthAnythingModelTest(ModelTesterMixin, PipelineTesterMixin, unit... method setUp (line 146) | def setUp(self): method test_config (line 156) | def test_config(self): method test_inputs_embeds (line 160) | def test_inputs_embeds(self): method test_for_depth_estimation (line 163) | def test_for_depth_estimation(self): method test_model_get_set_embeddings (line 168) | def test_model_get_set_embeddings(self): method test_training (line 172) | def test_training(self): method test_training_gradient_checkpointing (line 176) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 180) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 184) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 188) | def test_model_from_pretrained(self): method test_backbone_selection (line 193) | def test_backbone_selection(self): function prepare_img (line 229) | def prepare_img(): class DepthAnythingModelIntegrationTest (line 237) | class DepthAnythingModelIntegrationTest(unittest.TestCase): method test_inference (line 238) | def test_inference(self): FILE: tests/models/depth_pro/test_image_processing_depth_pro.py class DepthProImageProcessingTester (line 23) | class DepthProImageProcessingTester(unittest.TestCase): method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 54) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 64) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 67) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DepthProImageProcessingTest (line 81) | class DepthProImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 82) | def setUp(self): method image_processor_dict (line 87) | def image_processor_dict(self): method test_image_processor_properties (line 90) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 102) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/depth_pro/test_modeling_depth_pro.py class DepthProModelTester (line 43) | class DepthProModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 115) | def prepare_config_and_inputs(self): method get_config (line 126) | def get_config(self): method create_and_check_model (line 142) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_depth_estimation (line 149) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method create_and_check_for_fov (line 159) | def create_and_check_for_fov(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 189) | def prepare_config_and_inputs_for_common(self): class DepthProModelTest (line 197) | class DepthProModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 215) | def setUp(self): method test_config (line 219) | def test_config(self): method test_sdpa_can_compile_dynamic (line 224) | def test_sdpa_can_compile_dynamic(self): method test_inputs_embeds (line 228) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 231) | def test_model_get_set_embeddings(self): method test_model (line 240) | def test_model(self): method test_for_depth_estimation (line 244) | def test_for_depth_estimation(self): method test_for_fov (line 248) | def test_for_fov(self): method test_training (line 252) | def test_training(self): method check_training_gradient_checkpointing (line 270) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_batching_equivalence (line 291) | def test_batching_equivalence(self, atol=1e-4, rtol=1e-4): method test_model_from_pretrained (line 295) | def test_model_from_pretrained(self): function prepare_img (line 302) | def prepare_img(): class DepthProModelIntegrationTest (line 310) | class DepthProModelIntegrationTest(unittest.TestCase): method test_inference_depth_estimation (line 311) | def test_inference_depth_estimation(self): method test_post_processing_depth_estimation (line 344) | def test_post_processing_depth_estimation(self): FILE: tests/models/detr/test_image_processing_detr.py class DetrImageProcessingTester (line 41) | class DetrImageProcessingTester: method __init__ (line 42) | def __init__( method prepare_image_processor_dict (line 74) | def prepare_image_processor_dict(self): method get_expected_values (line 86) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 119) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 123) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DetrImageProcessingTest (line 137) | class DetrImageProcessingTest(AnnotationFormatTestMixin, ImageProcessing... method setUp (line 138) | def setUp(self): method image_processor_dict (line 143) | def image_processor_dict(self): method test_image_processor_properties (line 146) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 158) | def test_image_processor_from_dict_with_kwargs(self): method test_should_raise_if_annotation_format_invalid (line 167) | def test_should_raise_if_annotation_format_invalid(self): method test_valid_coco_detection_annotations (line 190) | def test_valid_coco_detection_annotations(self): method test_call_pytorch_with_coco_detection_annotations (line 227) | def test_call_pytorch_with_coco_detection_annotations(self): method test_call_pytorch_with_coco_panoptic_annotations (line 272) | def test_call_pytorch_with_coco_panoptic_annotations(self): method test_batched_coco_detection_annotations (line 323) | def test_batched_coco_detection_annotations(self): method test_batched_coco_panoptic_annotations (line 441) | def test_batched_coco_panoptic_annotations(self): method test_max_width_max_height_resizing_and_pad_strategy (line 564) | def test_max_width_max_height_resizing_and_pad_strategy(self): method test_longest_edge_shortest_edge_resizing_strategy (line 611) | def test_longest_edge_shortest_edge_resizing_strategy(self): method test_torchvision_processor_equivalence_cpu_accelerator_coco_detection_annotations (line 667) | def test_torchvision_processor_equivalence_cpu_accelerator_coco_detect... method test_torchvision_processor_equivalence_cpu_accelerator_coco_panoptic_annotations (line 725) | def test_torchvision_processor_equivalence_cpu_accelerator_coco_panopt... FILE: tests/models/detr/test_modeling_detr.py class DetrModelTester (line 56) | class DetrModelTester: method __init__ (line 57) | def __init__( method prepare_config_and_inputs (line 99) | def prepare_config_and_inputs(self): method get_config (line 120) | def get_config(self): method prepare_config_and_inputs_for_common (line 149) | def prepare_config_and_inputs_for_common(self): method create_and_check_detr_model (line 154) | def create_and_check_detr_model(self, config, pixel_values, pixel_mask... method create_and_check_detr_object_detection_head_model (line 166) | def create_and_check_detr_object_detection_head_model(self, config, pi... class DetrModelTest (line 185) | class DetrModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method test_reverse_loading_mapping (line 209) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method _prepare_for_class (line 292) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 318) | def setUp(self): method test_config (line 322) | def test_config(self): method test_detr_model (line 325) | def test_detr_model(self): method test_detr_object_detection_head_model (line 329) | def test_detr_object_detection_head_model(self): method test_multi_gpu_data_parallel_forward (line 335) | def test_multi_gpu_data_parallel_forward(self): method test_inputs_embeds (line 339) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 343) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 347) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 351) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 355) | def test_resize_tokens_embeddings(self): method test_model_outputs_equivalence (line 360) | def test_model_outputs_equivalence(self): method test_attention_outputs (line 363) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 466) | def test_retain_grad_hidden_states_attentions(self): method test_forward_auxiliary_loss (line 502) | def test_forward_auxiliary_loss(self): method test_forward_signature (line 518) | def test_forward_signature(self): method test_backbone_selection (line 534) | def test_backbone_selection(self): method test_greyscale_images (line 584) | def test_greyscale_images(self): method test_eager_matches_sdpa_inference (line 608) | def test_eager_matches_sdpa_inference( function prepare_img (line 622) | def prepare_img(): class DetrModelIntegrationTestsTimmBackbone (line 630) | class DetrModelIntegrationTestsTimmBackbone(unittest.TestCase): method default_image_processor (line 632) | def default_image_processor(self): method test_inference_no_head (line 635) | def test_inference_no_head(self): method test_inference_object_detection_head (line 666) | def test_inference_object_detection_head(self): method test_inference_panoptic_segmentation_head (line 724) | def test_inference_panoptic_segmentation_head(self): FILE: tests/models/dia/test_feature_extraction_dia.py function floats_list (line 37) | def floats_list(shape, scale=1.0, rng=None, name=None): class DiaFeatureExtractionTester (line 52) | class DiaFeatureExtractionTester: method __init__ (line 54) | def __init__( method prepare_feat_extract_dict (line 76) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 85) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class DiaFeatureExtractionTest (line 105) | class DiaFeatureExtractionTest(SequenceFeatureExtractionTestMixin, unitt... method setUp (line 108) | def setUp(self): method test_call (line 112) | def test_call(self): method test_double_precision_pad (line 131) | def test_double_precision_pad(self): method _load_datasamples (line 143) | def _load_datasamples(self, num_samples): method test_integration (line 153) | def test_integration(self): method test_integration_stereo (line 174) | def test_integration_stereo(self): method test_truncation_and_padding (line 193) | def test_truncation_and_padding(self): FILE: tests/models/dia/test_modeling_dia.py class DiaModelTester (line 67) | class DiaModelTester: method __init__ (line 68) | def __init__( method get_config (line 108) | def get_config(self): method prepare_config_and_inputs (line 149) | def prepare_config_and_inputs(self) -> tuple[DiaConfig, dict]: method prepare_config_and_inputs_for_common (line 165) | def prepare_config_and_inputs_for_common(self) -> tuple[DiaConfig, dict]: method create_and_check_model_forward (line 169) | def create_and_check_model_forward(self, config, inputs_dict): method check_encoder_decoder_model_standalone (line 182) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class DiaModelTest (line 215) | class DiaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method setUp (line 228) | def setUp(self): method prepare_config_and_inputs_for_generate (line 234) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method skip_non_greedy_generate (line 258) | def skip_non_greedy_generate(self): method _prepare_for_class (line 273) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 289) | def test_config(self): method test_model_forward (line 297) | def test_model_forward(self): method test_encoder_decoder_model_standalone (line 302) | def test_encoder_decoder_model_standalone(self): method _check_logits (line 308) | def _check_logits(self, batch_size, logits, config): method _check_attentions_for_generate (line 318) | def _check_attentions_for_generate( method _check_encoder_attention_for_generate (line 355) | def _check_encoder_attention_for_generate(self, attentions, batch_size... method _check_hidden_states_for_generate (line 364) | def _check_hidden_states_for_generate( method _check_encoder_hidden_states_for_generate (line 394) | def _check_encoder_hidden_states_for_generate(self, hidden_states, bat... method _check_scores (line 403) | def _check_scores(self, batch_size, scores, generated_length, config): method test_sdpa_can_dispatch_composite_models (line 411) | def test_sdpa_can_dispatch_composite_models(self): method test_generate_continue_from_past_key_values (line 446) | def test_generate_continue_from_past_key_values(self): method test_prepare_inputs_for_generation_kwargs_forwards (line 511) | def test_prepare_inputs_for_generation_kwargs_forwards(self): method test_hidden_states_output (line 515) | def test_hidden_states_output(self): method test_model_get_set_embeddings (line 521) | def test_model_get_set_embeddings(self): method test_multi_gpu_data_parallel_forward (line 525) | def test_multi_gpu_data_parallel_forward(self): class DiaForConditionalGenerationIntegrationTest (line 529) | class DiaForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 537) | def setUp(self): method tearDown (line 554) | def tearDown(self): method test_dia_model_integration_generate_tts (line 561) | def test_dia_model_integration_generate_tts(self): method test_dia_model_integration_generate_audio_context (line 643) | def test_dia_model_integration_generate_audio_context(self): FILE: tests/models/dia/test_processing_dia.py function check_models_equal (line 32) | def check_models_equal(model1, model2): class DiaProcessorTest (line 42) | class DiaProcessorTest(unittest.TestCase): method setUp (line 43) | def setUp(self): method get_tokenizer (line 61) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 64) | def get_feature_extractor(self, **kwargs): method get_audio_tokenizer (line 67) | def get_audio_tokenizer(self, **kwargs): method tearDown (line 70) | def tearDown(self): method test_save_load_pretrained_default (line 74) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 97) | def test_save_load_pretrained_additional_features(self): method test_tokenize (line 122) | def test_tokenize(self): method test_no_audio (line 132) | def test_no_audio(self): method test_audio (line 153) | def test_audio(self): method test_decode_audio (line 185) | def test_decode_audio(self, audio_lens): method test_delay_in_audio (line 207) | def test_delay_in_audio(self, bsz, seq_len, delay_pattern): FILE: tests/models/dia/test_tokenization_dia.py class DiaTokenizerTest (line 29) | class DiaTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 35) | def setUpClass(cls): method test_convert_token_and_id (line 40) | def test_convert_token_and_id(self): method test_get_vocab (line 48) | def test_get_vocab(self): method test_vocab_size (line 56) | def test_vocab_size(self): method test_full_tokenizer (line 60) | def test_full_tokenizer(self): method test_tokenizer_integration (line 83) | def test_tokenizer_integration(self): method test_pretokenized_inputs (line 119) | def test_pretokenized_inputs(self): method test_tokenizer_slow_store_full_signature (line 123) | def test_tokenizer_slow_store_full_signature(self): FILE: tests/models/diffllama/test_modeling_diffllama.py class DiffLlamaModelTester (line 52) | class DiffLlamaModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method get_config (line 126) | def get_config(self): method create_and_check_model (line 143) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 153) | def prepare_config_and_inputs_for_common(self): class DiffLlamaModelTest (line 169) | class DiffLlamaModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method setUp (line 200) | def setUp(self): method test_config (line 204) | def test_config(self): method test_model (line 207) | def test_model(self): method test_diffllama_sequence_classification_model (line 211) | def test_diffllama_sequence_classification_model(self): method test_diffllama_sequence_classification_model_for_single_label (line 223) | def test_diffllama_sequence_classification_model_for_single_label(self): method test_diffllama_sequence_classification_model_for_multi_label (line 236) | def test_diffllama_sequence_classification_model_for_multi_label(self): method test_diffllama_token_classification_model (line 251) | def test_diffllama_token_classification_model(self): method test_model_loading_old_rope_configs (line 266) | def test_model_loading_old_rope_configs(self): method test_flash_attn_2_generate_padding_right (line 327) | def test_flash_attn_2_generate_padding_right(self): method test_use_flash_attention_2_true (line 365) | def test_use_flash_attention_2_true(self): method test_eager_matches_sdpa_generate (line 390) | def test_eager_matches_sdpa_generate(self): class DiffLlamaIntegrationTest (line 449) | class DiffLlamaIntegrationTest(unittest.TestCase): method tearDown (line 450) | def tearDown(self): method test_compile_static_cache (line 457) | def test_compile_static_cache(self): class Mask4DTestHard (line 505) | class Mask4DTestHard(unittest.TestCase): method tearDown (line 506) | def tearDown(self): method setUp (line 510) | def setUp(self): method get_test_data (line 516) | def get_test_data(self): method test_stacked_causal_mask (line 560) | def test_stacked_causal_mask(self): method test_partial_stacked_causal_mask (line 585) | def test_partial_stacked_causal_mask(self): method test_stacked_causal_mask_static_cache (line 629) | def test_stacked_causal_mask_static_cache(self): method test_partial_stacked_causal_mask_static_cache (line 669) | def test_partial_stacked_causal_mask_static_cache(self): FILE: tests/models/dinat/test_modeling_dinat.py class DinatModelTester (line 42) | class DinatModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 108) | def get_config(self): method create_and_check_model (line 132) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 145) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_backbone (line 162) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 189) | def prepare_config_and_inputs_for_common(self): class DinatModelTest (line 198) | class DinatModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 216) | def setUp(self): method test_config (line 222) | def test_config(self): method test_model (line 225) | def test_model(self): method test_for_image_classification (line 229) | def test_for_image_classification(self): method test_backbone (line 233) | def test_backbone(self): method test_inputs_embeds (line 238) | def test_inputs_embeds(self): method test_feed_forward_chunking (line 242) | def test_feed_forward_chunking(self): method test_model_get_set_embeddings (line 245) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 254) | def test_attention_outputs(self): method check_hidden_states_output (line 257) | def check_hidden_states_output(self, inputs_dict, config, model_class,... method test_hidden_states_output (line 300) | def test_hidden_states_output(self): method test_model_from_pretrained (line 320) | def test_model_from_pretrained(self): class DinatModelIntegrationTest (line 329) | class DinatModelIntegrationTest(unittest.TestCase): method default_image_processor (line 331) | def default_image_processor(self): method test_inference_image_classification_head (line 335) | def test_inference_image_classification_head(self): class DinatBackboneTest (line 355) | class DinatBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 359) | def setUp(self): FILE: tests/models/dinov2/test_modeling_dinov2.py class Dinov2ModelTester (line 49) | class Dinov2ModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 98) | def prepare_config_and_inputs(self): method get_config (line 109) | def get_config(self): method create_and_check_model (line 126) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 133) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 180) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 198) | def prepare_config_and_inputs_for_common(self): class Dinov2ModelTest (line 210) | class Dinov2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 233) | def setUp(self): method test_config (line 237) | def test_config(self): method test_inputs_embeds (line 241) | def test_inputs_embeds(self): method test_training_gradient_checkpointing (line 245) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 249) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 253) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_get_set_embeddings (line 256) | def test_model_get_set_embeddings(self): method test_model (line 265) | def test_model(self): method test_backbone (line 269) | def test_backbone(self): method test_for_image_classification (line 273) | def test_for_image_classification(self): method test_feed_forward_chunking (line 278) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 282) | def test_model_from_pretrained(self): function prepare_img (line 289) | def prepare_img(): class Dinov2ModelIntegrationTest (line 296) | class Dinov2ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 298) | def default_image_processor(self): method test_inference_no_head (line 302) | def test_inference_no_head(self): class Dinov2BackboneTest (line 329) | class Dinov2BackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 335) | def setUp(self): FILE: tests/models/dinov2_with_registers/test_modeling_dinov2_with_registers.py class Dinov2WithRegistersModelTester (line 53) | class Dinov2WithRegistersModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 102) | def prepare_config_and_inputs(self): method get_config (line 113) | def get_config(self): method create_and_check_model (line 130) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 137) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 184) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 202) | def prepare_config_and_inputs_for_common(self): class Dinov2WithRegistersModelTest (line 214) | class Dinov2WithRegistersModelTest(ModelTesterMixin, PipelineTesterMixin... method setUp (line 240) | def setUp(self): method test_config (line 246) | def test_config(self): method test_inputs_embeds (line 250) | def test_inputs_embeds(self): method test_training_gradient_checkpointing (line 254) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 258) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 262) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_get_set_embeddings (line 265) | def test_model_get_set_embeddings(self): method test_model (line 274) | def test_model(self): method test_backbone (line 278) | def test_backbone(self): method test_for_image_classification (line 282) | def test_for_image_classification(self): method test_feed_forward_chunking (line 287) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 291) | def test_model_from_pretrained(self): function prepare_img (line 298) | def prepare_img(): class Dinov2WithRegistersModelIntegrationTest (line 305) | class Dinov2WithRegistersModelIntegrationTest(unittest.TestCase): method default_image_processor (line 307) | def default_image_processor(self): method test_inference_no_head (line 315) | def test_inference_no_head(self): class Dinov2WithRegistersBackboneTest (line 345) | class Dinov2WithRegistersBackboneTest(unittest.TestCase, BackboneTesterM... method setUp (line 351) | def setUp(self): FILE: tests/models/dinov3_convnext/test_modeling_dinov3_convnext.py class DINOv3ConvNextModelTester (line 41) | class DINOv3ConvNextModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 72) | def prepare_config_and_inputs(self): method get_config (line 82) | def get_config(self): method create_and_check_model (line 93) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 108) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 151) | def prepare_config_and_inputs_for_common(self): class DINOv3ConvNextModelTest (line 159) | class DINOv3ConvNextModelTest(ModelTesterMixin, PipelineTesterMixin, uni... method setUp (line 171) | def setUp(self): method test_config (line 181) | def test_config(self): method test_inputs_embeds (line 185) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 189) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 193) | def test_feed_forward_chunking(self): method test_model (line 196) | def test_model(self): method test_backbone (line 200) | def test_backbone(self): method test_hidden_states_output (line 204) | def test_hidden_states_output(self): method test_model_from_pretrained (line 236) | def test_model_from_pretrained(self): method test_retain_grad_hidden_states_attentions (line 242) | def test_retain_grad_hidden_states_attentions(self): function prepare_img (line 247) | def prepare_img(): class DINOv3ConvNextModelIntegrationTest (line 254) | class DINOv3ConvNextModelIntegrationTest(unittest.TestCase): method default_image_processor (line 256) | def default_image_processor(self): method test_inference_no_head (line 264) | def test_inference_no_head(self): class DINOv3ConvNextBackboneTest (line 291) | class DINOv3ConvNextBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 297) | def setUp(self): FILE: tests/models/dinov3_vit/test_image_processing_dinov3_vit.py class DINOv3ViTImageProcessingTester (line 22) | class DINOv3ViTImageProcessingTester: method __init__ (line 23) | def __init__( method prepare_image_processor_dict (line 58) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DINOv3ViTImageProcessingTest (line 87) | class DINOv3ViTImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 108) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/dinov3_vit/test_modeling_dinov3_vit.py class DINOv3ViTModelTester (line 41) | class DINOv3ViTModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 100) | def get_config(self): method create_and_check_backbone (line 120) | def create_and_check_backbone(self, config, pixel_values, labels): method test_output_hidden_states (line 139) | def test_output_hidden_states(self): method create_and_check_model (line 162) | def create_and_check_model(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 172) | def prepare_config_and_inputs_for_common(self): class Dinov3ModelTest (line 184) | class Dinov3ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 203) | def setUp(self): method test_backbone (line 207) | def test_backbone(self): method test_config (line 211) | def test_config(self): method test_inputs_embeds (line 215) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 218) | def test_model_get_set_embeddings(self): method test_model (line 227) | def test_model(self): method test_feed_forward_chunking (line 232) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 236) | def test_model_from_pretrained(self): function prepare_img (line 243) | def prepare_img(): class DINOv3ViTModelIntegrationTest (line 250) | class DINOv3ViTModelIntegrationTest(unittest.TestCase): method default_image_processor (line 252) | def default_image_processor(self): method test_inference_no_head (line 260) | def test_inference_no_head(self): FILE: tests/models/distilbert/test_modeling_distilbert.py class DistilBertModelTester (line 41) | class DistilBertModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 90) | def prepare_config_and_inputs(self): method get_config (line 109) | def get_config(self): method create_and_check_distilbert_model (line 123) | def create_and_check_distilbert_model( method create_and_check_distilbert_for_masked_lm (line 133) | def create_and_check_distilbert_for_masked_lm( method create_and_check_distilbert_for_question_answering (line 142) | def create_and_check_distilbert_for_question_answering( method create_and_check_distilbert_for_sequence_classification (line 154) | def create_and_check_distilbert_for_sequence_classification( method create_and_check_distilbert_for_token_classification (line 164) | def create_and_check_distilbert_for_token_classification( method create_and_check_distilbert_for_multiple_choice (line 175) | def create_and_check_distilbert_for_multiple_choice( method prepare_config_and_inputs_for_common (line 191) | def prepare_config_and_inputs_for_common(self): class DistilBertModelTest (line 199) | class DistilBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method setUp (line 226) | def setUp(self): method test_config (line 230) | def test_config(self): method test_distilbert_model (line 233) | def test_distilbert_model(self): method test_distilbert_model_with_sinusoidal_encodings (line 237) | def test_distilbert_model_with_sinusoidal_encodings(self): method test_for_masked_lm (line 246) | def test_for_masked_lm(self): method test_for_question_answering (line 250) | def test_for_question_answering(self): method test_for_sequence_classification (line 254) | def test_for_sequence_classification(self): method test_for_token_classification (line 258) | def test_for_token_classification(self): method test_for_multiple_choice (line 262) | def test_for_multiple_choice(self): method test_model_from_pretrained (line 267) | def test_model_from_pretrained(self): method test_flash_attn_2_inference_equivalence (line 277) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 329) | def test_flash_attn_2_inference_equivalence_right_padding(self): class DistilBertModelIntegrationTest (line 381) | class DistilBertModelIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 383) | def test_inference_no_head_absolute_embedding(self): FILE: tests/models/distilbert/test_tokenization_distilbert.py class DistilBertTokenizationTest (line 25) | class DistilBertTokenizationTest(test_tokenization_bert.BertTokenization... method setUpClass (line 32) | def setUpClass(cls): FILE: tests/models/dit/test_modeling_dit.py class DiTIntegrationTest (line 32) | class DiTIntegrationTest(unittest.TestCase): method test_for_image_classification (line 34) | def test_for_image_classification(self): FILE: tests/models/doge/test_modeling_doge.py class DogeModelTester (line 42) | class DogeModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 87) | def prepare_config_and_inputs(self): method get_config (line 108) | def get_config(self): method create_and_check_model (line 123) | def create_and_check_model(self, config, input_ids, token_type_ids, in... method create_and_check_model_as_decoder (line 131) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 160) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 177) | def create_and_check_decoder_model_past_large_inputs( method prepare_config_and_inputs_for_common (line 238) | def prepare_config_and_inputs_for_common(self): class DogeModelTest (line 253) | class DogeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 283) | def setUp(self): method test_config (line 287) | def test_config(self): method test_model (line 290) | def test_model(self): method test_doge_sequence_classification_model (line 294) | def test_doge_sequence_classification_model(self): method test_doge_sequence_classification_model_for_single_label (line 306) | def test_doge_sequence_classification_model_for_single_label(self): method test_doge_sequence_classification_model_for_multi_label (line 319) | def test_doge_sequence_classification_model_for_multi_label(self): method test_save_load_fast_init_from_base (line 335) | def test_save_load_fast_init_from_base(self): method test_tp_plan_matches_params (line 338) | def test_tp_plan_matches_params(self): class DogeIntegrationTest (line 357) | class DogeIntegrationTest(unittest.TestCase): method setUpClass (line 363) | def setUpClass(cls): method test_Doge_20M_hard (line 369) | def test_Doge_20M_hard(self): FILE: tests/models/donut/test_image_processing_donut.py class DonutImageProcessingTester (line 34) | class DonutImageProcessingTester: method __init__ (line 35) | def __init__( method prepare_image_processor_dict (line 67) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 79) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 82) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class DonutImageProcessingTest (line 96) | class DonutImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 97) | def setUp(self): method image_processor_dict (line 102) | def image_processor_dict(self): method test_image_processor_properties (line 105) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 117) | def test_image_processor_from_dict_with_kwargs(self): method test_image_processor_preprocess_with_kwargs (line 129) | def test_image_processor_preprocess_with_kwargs(self): method test_call_pil (line 149) | def test_call_pil(self): method test_call_numpy (line 181) | def test_call_numpy(self): method test_call_pytorch (line 213) | def test_call_pytorch(self): class DonutImageProcessingAlignAxisTest (line 247) | class DonutImageProcessingAlignAxisTest(DonutImageProcessingTest): method setUp (line 248) | def setUp(self): FILE: tests/models/donut/test_modeling_donut_swin.py class DonutSwinModelTester (line 35) | class DonutSwinModelTester: method __init__ (line 36) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 99) | def get_config(self): method create_and_check_model (line 121) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 132) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 150) | def prepare_config_and_inputs_for_common(self): class DonutSwinModelTest (line 162) | class DonutSwinModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method setUp (line 172) | def setUp(self): method test_config (line 182) | def test_config(self): method test_model (line 185) | def test_model(self): method test_for_image_classification (line 189) | def test_for_image_classification(self): method test_inputs_embeds (line 194) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 197) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 206) | def test_attention_outputs(self): method check_hidden_states_output (line 267) | def check_hidden_states_output(self, inputs_dict, config, model_class,... method test_hidden_states_output (line 308) | def test_hidden_states_output(self): method test_hidden_states_output_with_padding (line 327) | def test_hidden_states_output_with_padding(self): method test_model_from_pretrained (line 355) | def test_model_from_pretrained(self): FILE: tests/models/donut/test_processing_donut.py class DonutProcessorTest (line 23) | class DonutProcessorTest(ProcessorTesterMixin, unittest.TestCase): method test_token2json (line 27) | def test_token2json(self): FILE: tests/models/dots1/test_modeling_dots1.py class Dots1ModelTester (line 41) | class Dots1ModelTester(CausalLMModelTester): method __init__ (line 45) | def __init__( class Dots1ModelTest (line 62) | class Dots1ModelTest(CausalLMModelTest, unittest.TestCase): class Dots1IntegrationTest (line 67) | class Dots1IntegrationTest(unittest.TestCase): method setUpClass (line 73) | def setUpClass(cls): method tearDown (line 78) | def tearDown(self): method test_model_15b_a2b_generation (line 83) | def test_model_15b_a2b_generation(self): FILE: tests/models/dpr/test_modeling_dpr.py class DPRModelTester (line 33) | class DPRModelTester: method __init__ (line 34) | def __init__( method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs(self): method get_config (line 107) | def get_config(self): method create_and_check_context_encoder (line 123) | def create_and_check_context_encoder( method create_and_check_question_encoder (line 134) | def create_and_check_question_encoder( method create_and_check_reader (line 145) | def create_and_check_reader( method prepare_config_and_inputs_for_common (line 160) | def prepare_config_and_inputs_for_common(self): class DPRModelTest (line 176) | class DPRModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 191) | def setUp(self): method test_config (line 195) | def test_config(self): method test_context_encoder_model (line 198) | def test_context_encoder_model(self): method test_question_encoder_model (line 202) | def test_question_encoder_model(self): method test_reader_model (line 206) | def test_reader_model(self): method test_init_changed_config (line 210) | def test_init_changed_config(self): method test_model_from_pretrained (line 224) | def test_model_from_pretrained(self): class DPRModelIntegrationTest (line 243) | class DPRModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 245) | def test_inference_no_head(self): method test_reader_inference (line 275) | def test_reader_inference(self): FILE: tests/models/dpt/test_image_processing_dpt.py class DPTImageProcessingTester (line 31) | class DPTImageProcessingTester: method __init__ (line 32) | def __init__( method prepare_image_processor_dict (line 61) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 71) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 74) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 87) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 94) | def prepare_semantic_batch_inputs(): class DPTImageProcessingTest (line 101) | class DPTImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 102) | def setUp(self): method image_processor_dict (line 107) | def image_processor_dict(self): method test_image_processor_properties (line 110) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 124) | def test_image_processor_from_dict_with_kwargs(self): method test_padding (line 132) | def test_padding(self): method test_keep_aspect_ratio (line 157) | def test_keep_aspect_ratio(self): method test_call_segmentation_maps (line 169) | def test_call_segmentation_maps(self): method test_reduce_labels (line 276) | def test_reduce_labels(self): method test_backends_equivalence (line 305) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 329) | def test_backends_equivalence_batched(self): FILE: tests/models/dpt/test_modeling_dpt.py class DPTModelTester (line 43) | class DPTModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method get_config (line 102) | def get_config(self): method create_and_check_model (line 122) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_depth_estimation (line 129) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method create_and_check_for_semantic_segmentation (line 137) | def create_and_check_for_semantic_segmentation(self, config, pixel_val... method prepare_config_and_inputs_for_common (line 147) | def prepare_config_and_inputs_for_common(self): class DPTModelTest (line 155) | class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 174) | def setUp(self): method test_config (line 178) | def test_config(self): method test_inputs_embeds (line 182) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 185) | def test_model_get_set_embeddings(self): method test_model (line 194) | def test_model(self): method test_for_depth_estimation (line 198) | def test_for_depth_estimation(self): method test_for_semantic_segmentation (line 202) | def test_for_semantic_segmentation(self): method test_training (line 206) | def test_training(self): method check_training_gradient_checkpointing (line 224) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_sdpa_can_compile_dynamic (line 245) | def test_sdpa_can_compile_dynamic(self): method test_backbone_selection (line 248) | def test_backbone_selection(self): method test_model_from_pretrained (line 285) | def test_model_from_pretrained(self): function prepare_img (line 292) | def prepare_img(): class DPTModelIntegrationTest (line 300) | class DPTModelIntegrationTest(unittest.TestCase): method test_inference_depth_estimation (line 301) | def test_inference_depth_estimation(self): method test_inference_semantic_segmentation (line 327) | def test_inference_semantic_segmentation(self): method test_post_processing_semantic_segmentation (line 348) | def test_post_processing_semantic_segmentation(self): method test_post_processing_depth_estimation (line 369) | def test_post_processing_depth_estimation(self): FILE: tests/models/dpt/test_modeling_dpt_auto_backbone.py class DPTModelTester (line 40) | class DPTModelTester: method __init__ (line 41) | def __init__( method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method get_config (line 92) | def get_config(self): method get_backbone_config (line 100) | def get_backbone_config(self): method create_and_check_for_depth_estimation (line 114) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method prepare_config_and_inputs_for_common (line 122) | def prepare_config_and_inputs_for_common(self): class DPTModelTest (line 130) | class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 141) | def setUp(self): method test_config (line 145) | def test_config(self): method test_inputs_embeds (line 149) | def test_inputs_embeds(self): method test_for_depth_estimation (line 152) | def test_for_depth_estimation(self): method test_training (line 156) | def test_training(self): method check_training_gradient_checkpointing (line 174) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_model_get_set_embeddings (line 194) | def test_model_get_set_embeddings(self): method test_model_from_pretrained (line 198) | def test_model_from_pretrained(self): function prepare_img (line 205) | def prepare_img(): class DPTModelIntegrationTest (line 213) | class DPTModelIntegrationTest(unittest.TestCase): method test_inference_depth_estimation_dinov2 (line 214) | def test_inference_depth_estimation_dinov2(self): method test_inference_depth_estimation_beit (line 240) | def test_inference_depth_estimation_beit(self): method test_inference_depth_estimation_swinv2 (line 274) | def test_inference_depth_estimation_swinv2(self): FILE: tests/models/dpt/test_modeling_dpt_hybrid.py class DPTModelTester (line 41) | class DPTModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method get_config (line 102) | def get_config(self): method create_and_check_model (line 135) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_depth_estimation (line 142) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method create_and_check_for_semantic_segmentation (line 150) | def create_and_check_for_semantic_segmentation(self, config, pixel_val... method prepare_config_and_inputs_for_common (line 160) | def prepare_config_and_inputs_for_common(self): class DPTModelTest (line 168) | class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 187) | def setUp(self): method test_config (line 191) | def test_config(self): method test_batching_equivalence (line 194) | def test_batching_equivalence(self, atol=2e-5, rtol=2e-5): method test_inputs_embeds (line 198) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 201) | def test_model_get_set_embeddings(self): method test_model (line 210) | def test_model(self): method test_for_depth_estimation (line 214) | def test_for_depth_estimation(self): method test_for_semantic_segmentation (line 218) | def test_for_semantic_segmentation(self): method test_training (line 222) | def test_training(self): method check_training_gradient_checkpointing (line 240) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_model_from_pretrained (line 260) | def test_model_from_pretrained(self): method test_raise_readout_type (line 265) | def test_raise_readout_type(self): function prepare_img (line 274) | def prepare_img(): class DPTModelIntegrationTest (line 282) | class DPTModelIntegrationTest(unittest.TestCase): method test_inference_depth_estimation (line 283) | def test_inference_depth_estimation(self): FILE: tests/models/edgetam/test_modeling_edgetam.py class EdgeTamPromptEncoderTester (line 55) | class EdgeTamPromptEncoderTester: method __init__ (line 56) | def __init__( method get_config (line 72) | def get_config(self): method prepare_config_and_inputs (line 82) | def prepare_config_and_inputs(self): class EdgeTamMaskDecoderTester (line 89) | class EdgeTamMaskDecoderTester: method __init__ (line 90) | def __init__( method get_config (line 112) | def get_config(self): method prepare_config_and_inputs (line 125) | def prepare_config_and_inputs(self): class EdgeTamModelTester (line 135) | class EdgeTamModelTester: method __init__ (line 136) | def __init__( method prepare_config_and_inputs (line 171) | def prepare_config_and_inputs(self): method get_config (line 177) | def get_config(self): method create_and_check_model (line 210) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 219) | def prepare_config_and_inputs_for_common(self): class EdgeTamModelTest (line 227) | class EdgeTamModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 241) | def setUp(self): method test_config (line 248) | def test_config(self): method test_reverse_loading_mapping (line 252) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_inputs_embeds (line 256) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 260) | def test_model_get_set_embeddings(self): method test_model (line 263) | def test_model(self): method test_can_set_attention_dynamically_composite_model (line 272) | def test_can_set_attention_dynamically_composite_model(self): method test_hidden_states_output (line 276) | def test_hidden_states_output(self): method test_flash_attn_2_can_dispatch_composite_models (line 282) | def test_flash_attn_2_can_dispatch_composite_models(self): method test_can_be_initialized_on_meta (line 286) | def test_can_be_initialized_on_meta(self): method test_can_load_with_meta_device_context_manager (line 290) | def test_can_load_with_meta_device_context_manager(self): method test_eager_matches_fa2_generate (line 297) | def test_eager_matches_fa2_generate(self): method test_eager_matches_fa3_generate (line 301) | def test_eager_matches_fa3_generate(self): method test_flash_attn_2_fp32_ln (line 305) | def test_flash_attn_2_fp32_ln(self): method test_flash_attn_2_from_config (line 309) | def test_flash_attn_2_from_config(self): method test_eager_matches_sdpa_generate_with_dynamic_cache (line 313) | def test_eager_matches_sdpa_generate_with_dynamic_cache(self): method test_flash_attn_2_inference_equivalence_right_padding (line 317) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_flash_attn_3_inference_equivalence_right_padding (line 321) | def test_flash_attn_3_inference_equivalence_right_padding(self): method test_flash_attn_kernels_inference_equivalence (line 325) | def test_flash_attn_kernels_inference_equivalence(self): method test_flash_attn_kernels_mps_inference_equivalence (line 329) | def test_flash_attn_kernels_mps_inference_equivalence(self): method test_eager_matches_sdpa_generate (line 333) | def test_eager_matches_sdpa_generate(self): method test_eager_matches_sdpa_inference (line 338) | def test_eager_matches_sdpa_inference( method test_flash_attn_2_inference_equivalence (line 344) | def test_flash_attn_2_inference_equivalence(self): method test_sdpa_can_dispatch_composite_models (line 348) | def test_sdpa_can_dispatch_composite_models(self): method test_attention_outputs (line 352) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 356) | def test_retain_grad_hidden_states_attentions(self): method test_generate_compilation_all_outputs (line 360) | def test_generate_compilation_all_outputs(self): method test_capture_outputs_decorator (line 364) | def test_capture_outputs_decorator(self): method test_model_from_pretrained (line 368) | def test_model_from_pretrained(self): method test_sdpa_can_compile_dynamic (line 373) | def test_sdpa_can_compile_dynamic(self): method test_model_outputs_equivalence (line 376) | def test_model_outputs_equivalence(self): method test_get_image_features_attentions (line 430) | def test_get_image_features_attentions(self): method test_get_image_features_hidden_states (line 434) | def test_get_image_features_hidden_states(self): function prepare_image (line 438) | def prepare_image(): function prepare_groceries_image (line 444) | def prepare_groceries_image(): function prepare_dog_img (line 450) | def prepare_dog_img(): function prepare_video (line 456) | def prepare_video(): class EdgeTamModelIntegrationTest (line 463) | class EdgeTamModelIntegrationTest(unittest.TestCase): method setUp (line 464) | def setUp(self): method tearDown (line 471) | def tearDown(self): method test_inference_mask_generation_one_point_multimask (line 477) | def test_inference_mask_generation_one_point_multimask(self): method test_inference_mask_generation_one_point_no_multimask (line 505) | def test_inference_mask_generation_one_point_no_multimask(self): method test_inference_mask_generation_batched_images_multi_points (line 530) | def test_inference_mask_generation_batched_images_multi_points(self): method test_inference_mask_generation_batched_images_batched_points_multi_points (line 575) | def test_inference_mask_generation_batched_images_batched_points_multi... method test_inference_batched_images_batched_boxes (line 605) | def test_inference_batched_images_batched_boxes(self): method test_inference_mask_generation_from_existing_points_and_mask (line 649) | def test_inference_mask_generation_from_existing_points_and_mask(self): method test_dummy_pipeline_generation (line 722) | def test_dummy_pipeline_generation(self): FILE: tests/models/edgetam_video/test_modeling_edgetam_video.py function prepare_image (line 42) | def prepare_image(): function prepare_groceries_image (line 48) | def prepare_groceries_image(): function prepare_dog_img (line 54) | def prepare_dog_img(): function prepare_video (line 60) | def prepare_video(): class EdgeTamVideoModelIntegrationTest (line 67) | class EdgeTamVideoModelIntegrationTest(unittest.TestCase): method setUp (line 68) | def setUp(self): method tearDown (line 75) | def tearDown(self): method test_inference_mask_generation_video_one_point (line 81) | def test_inference_mask_generation_video_one_point(self): method test_inference_mask_generation_video_one_point_propagate_in_video_directly (line 135) | def test_inference_mask_generation_video_one_point_propagate_in_video_... method test_inference_mask_generation_video_multi_points (line 175) | def test_inference_mask_generation_video_multi_points(self): method test_inference_mask_generation_video_one_bb (line 231) | def test_inference_mask_generation_video_one_bb(self): method test_inference_mask_generation_video_one_point_one_bb (line 286) | def test_inference_mask_generation_video_one_point_one_bb(self): method test_inference_mask_generation_video_multi_objects_multi_points (line 343) | def test_inference_mask_generation_video_multi_objects_multi_points(se... method test_inference_propagate_video_from_mask_input (line 398) | def test_inference_propagate_video_from_mask_input(self): method test_inference_propagate_on_streamed_video (line 465) | def test_inference_propagate_on_streamed_video(self): method test_inference_with_different_dtypes (line 510) | def test_inference_with_different_dtypes(self): FILE: tests/models/efficientloftr/test_image_processing_efficientloftr.py function random_array (line 38) | def random_array(size): function random_tensor (line 42) | def random_tensor(size): class EfficientLoFTRImageProcessingTester (line 46) | class EfficientLoFTRImageProcessingTester: method __init__ (line 49) | def __init__( method prepare_image_processor_dict (line 72) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 79) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 82) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_keypoint_matching_output (line 97) | def prepare_keypoint_matching_output(self, pixel_values): class EfficientLoFTRImageProcessingTest (line 121) | class EfficientLoFTRImageProcessingTest(ImageProcessingTestMixin, unitte... method setUp (line 122) | def setUp(self) -> None: method image_processor_dict (line 127) | def image_processor_dict(self): method test_image_processing (line 130) | def test_image_processing(self): method test_image_processor_from_dict_with_kwargs (line 139) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 150) | def test_call_numpy_4_channels(self): method test_number_and_format_of_images_in_input (line 153) | def test_number_and_format_of_images_in_input(self): method test_valid_image_shape_in_input (line 201) | def test_valid_image_shape_in_input(self, image_input, output): method test_invalid_image_shape_in_input (line 218) | def test_invalid_image_shape_in_input(self, image_input): method test_input_images_properly_paired (line 225) | def test_input_images_properly_paired(self): method test_input_not_paired_images_raises_error (line 233) | def test_input_not_paired_images_raises_error(self): method test_input_image_properly_converted_to_grayscale (line 240) | def test_input_image_properly_converted_to_grayscale(self): method test_call_numpy (line 251) | def test_call_numpy(self): method test_call_pil (line 281) | def test_call_pil(self): method test_call_pytorch (line 309) | def test_call_pytorch(self): method test_image_processor_with_list_of_two_images (line 339) | def test_image_processor_with_list_of_two_images(self): method test_post_processing_keypoint_matching (line 356) | def test_post_processing_keypoint_matching(self): method test_backends_equivalence (line 402) | def test_backends_equivalence(self): method test_can_compile_torchvision_backend (line 422) | def test_can_compile_torchvision_backend(self): FILE: tests/models/efficientloftr/test_modeling_efficientloftr.py class EfficientLoFTRModelTester (line 44) | class EfficientLoFTRModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs(self): method get_config (line 90) | def get_config(self): method create_and_check_model (line 107) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 126) | def prepare_config_and_inputs_for_common(self): class EfficientLoFTRModelTest (line 134) | class EfficientLoFTRModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 140) | def setUp(self): method test_config (line 144) | def test_config(self): method test_inputs_embeds (line 153) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 157) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 161) | def test_feed_forward_chunking(self): method test_training (line 165) | def test_training(self): method test_training_gradient_checkpointing (line 169) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 173) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 177) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 181) | def test_retain_grad_hidden_states_attentions(self): method test_model (line 184) | def test_model(self): method test_forward_signature (line 188) | def test_forward_signature(self): method test_hidden_states_output (line 200) | def test_hidden_states_output(self): method test_attention_outputs (line 231) | def test_attention_outputs(self): method test_model_from_pretrained (line 272) | def test_model_from_pretrained(self): method test_forward_labels_should_be_none (line 278) | def test_forward_labels_should_be_none(self): method test_batching_equivalence (line 294) | def test_batching_equivalence(self, atol=1e-5, rtol=1e-5): function prepare_imgs (line 399) | def prepare_imgs(): class EfficientLoFTRModelIntegrationTest (line 409) | class EfficientLoFTRModelIntegrationTest(unittest.TestCase): method default_image_processor (line 411) | def default_image_processor(self): method test_inference (line 415) | def test_inference(self): FILE: tests/models/efficientnet/test_image_processing_efficientnet.py class EfficientNetImageProcessorTester (line 31) | class EfficientNetImageProcessorTester: method __init__ (line 32) | def __init__( method prepare_image_processor_dict (line 64) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 74) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 77) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class EfficientNetImageProcessorTest (line 91) | class EfficientNetImageProcessorTest(ImageProcessingTestMixin, unittest.... method setUp (line 92) | def setUp(self): method image_processor_dict (line 97) | def image_processor_dict(self): method test_image_processor_properties (line 100) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 109) | def test_image_processor_from_dict_with_kwargs(self): method test_rescale (line 117) | def test_rescale(self): method test_rescale_normalize (line 144) | def test_rescale_normalize(self): FILE: tests/models/efficientnet/test_modeling_efficientnet.py class EfficientNetModelTester (line 40) | class EfficientNetModelTester: method __init__ (line 41) | def __init__( method prepare_config_and_inputs (line 74) | def prepare_config_and_inputs(self): method get_config (line 84) | def get_config(self): method create_and_check_model (line 98) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 109) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 116) | def prepare_config_and_inputs_for_common(self): class EfficientNetModelTest (line 124) | class EfficientNetModelTest(ModelTesterMixin, PipelineTesterMixin, unitt... method setUp (line 140) | def setUp(self): method test_config (line 150) | def test_config(self): method test_inputs_embeds (line 154) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 158) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 162) | def test_feed_forward_chunking(self): method test_model (line 165) | def test_model(self): method test_hidden_states_output (line 169) | def test_hidden_states_output(self): method test_for_image_classification (line 200) | def test_for_image_classification(self): method test_model_from_pretrained (line 205) | def test_model_from_pretrained(self): method test_pipeline_image_feature_extraction (line 213) | def test_pipeline_image_feature_extraction(self): method test_pipeline_image_feature_extraction_fp16 (line 219) | def test_pipeline_image_feature_extraction_fp16(self): method test_pipeline_image_classification (line 225) | def test_pipeline_image_classification(self): function prepare_img (line 230) | def prepare_img(): class EfficientNetModelIntegrationTest (line 237) | class EfficientNetModelIntegrationTest(unittest.TestCase): method default_image_processor (line 239) | def default_image_processor(self): method test_inference_image_classification_head (line 243) | def test_inference_image_classification_head(self): FILE: tests/models/electra/test_modeling_electra.py class ElectraModelTester (line 44) | class ElectraModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 93) | def prepare_config_and_inputs(self): method get_config (line 126) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 143) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_electra_model (line 171) | def create_and_check_electra_model( method create_and_check_electra_model_as_decoder (line 190) | def create_and_check_electra_model_as_decoder( method create_and_check_electra_for_masked_lm (line 222) | def create_and_check_electra_for_masked_lm( method create_and_check_electra_for_causal_lm (line 239) | def create_and_check_electra_for_causal_lm( method create_and_check_electra_for_token_classification (line 257) | def create_and_check_electra_for_token_classification( method create_and_check_electra_for_pretraining (line 275) | def create_and_check_electra_for_pretraining( method create_and_check_electra_for_sequence_classification (line 293) | def create_and_check_electra_for_sequence_classification( method create_and_check_electra_for_question_answering (line 311) | def create_and_check_electra_for_question_answering( method create_and_check_electra_for_multiple_choice (line 335) | def create_and_check_electra_for_multiple_choice( method prepare_config_and_inputs_for_common (line 361) | def prepare_config_and_inputs_for_common(self): class ElectraModelTest (line 378) | class ElectraModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method prepare_config_and_inputs_for_generate (line 407) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method _prepare_for_class (line 413) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 423) | def setUp(self): method test_config (line 427) | def test_config(self): method test_electra_model (line 430) | def test_electra_model(self): method test_electra_model_as_decoder (line 434) | def test_electra_model_as_decoder(self): method test_for_masked_lm (line 438) | def test_for_masked_lm(self): method test_for_token_classification (line 442) | def test_for_token_classification(self): method test_for_pre_training (line 446) | def test_for_pre_training(self): method test_for_sequence_classification (line 450) | def test_for_sequence_classification(self): method test_for_question_answering (line 454) | def test_for_question_answering(self): method test_for_multiple_choice (line 458) | def test_for_multiple_choice(self): method test_model_from_pretrained (line 463) | def test_model_from_pretrained(self): method test_for_causal_lm (line 468) | def test_for_causal_lm(self): class ElectraModelIntegrationTest (line 474) | class ElectraModelIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 476) | def test_inference_no_head_absolute_embedding(self): FILE: tests/models/emu3/test_modeling_emu3.py class Emu3Text2TextModelTester (line 53) | class Emu3Text2TextModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 96) | def get_config(self): method prepare_config_and_inputs_for_common (line 112) | def prepare_config_and_inputs_for_common(self): class Emu3Text2TextModelTest (line 124) | class Emu3Text2TextModelTest(ModelTesterMixin, GenerationTesterMixin, Pi... method setUp (line 134) | def setUp(self): method test_config (line 138) | def test_config(self): method test_custom_4d_attention_mask (line 142) | def test_custom_4d_attention_mask(self): class Emu3Vision2TextModelTester (line 146) | class Emu3Vision2TextModelTester: method __init__ (line 147) | def __init__( method prepare_config_and_inputs (line 199) | def prepare_config_and_inputs(self): method get_config (line 220) | def get_config(self): method prepare_config_and_inputs_for_common (line 261) | def prepare_config_and_inputs_for_common(self): class Emu3Vision2TextModelTest (line 280) | class Emu3Vision2TextModelTest(ModelTesterMixin, GenerationTesterMixin, ... method setUp (line 298) | def setUp(self): method test_config (line 302) | def test_config(self): method test_disk_offload_safetensors (line 308) | def test_disk_offload_safetensors(self): method test_disk_offload_bin (line 314) | def test_disk_offload_bin(self): method test_cpu_offload (line 320) | def test_cpu_offload(self): method test_generate_with_static_cache (line 325) | def test_generate_with_static_cache(self): method _image_features_get_expected_num_attentions (line 328) | def _image_features_get_expected_num_attentions(self, model_tester=None): method _image_features_get_expected_num_hidden_states (line 335) | def _image_features_get_expected_num_hidden_states(self, model_tester=... class Emu3IntegrationTest (line 345) | class Emu3IntegrationTest(unittest.TestCase): method test_model_generation (line 348) | def test_model_generation(self): method test_model_generation_batched (line 368) | def test_model_generation_batched(self): method test_model_generation_multi_image (line 413) | def test_model_generation_multi_image(self): method test_model_generate_images (line 442) | def test_model_generate_images(self): FILE: tests/models/emu3/test_processing_emu3.py class Emu3ProcessorTest (line 25) | class Emu3ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 29) | def _setup_image_processor(cls): method _setup_tokenizer (line 34) | def _setup_tokenizer(cls): method _setup_test_attributes (line 49) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 53) | def prepare_processor_dict(): method test_processor_for_generation (line 58) | def test_processor_for_generation(self): method test_processor_postprocess (line 75) | def test_processor_postprocess(self): method test_get_num_vision_tokens (line 91) | def test_get_num_vision_tokens(self): FILE: tests/models/encodec/test_feature_extraction_encodec.py function floats_list (line 37) | def floats_list(shape, scale=1.0, rng=None, name=None): class EnCodecFeatureExtractionTester (line 52) | class EnCodecFeatureExtractionTester: method __init__ (line 53) | def __init__( method prepare_feat_extract_dict (line 74) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 82) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class EnCodecFeatureExtractionTest (line 102) | class EnCodecFeatureExtractionTest(SequenceFeatureExtractionTestMixin, u... method setUp (line 105) | def setUp(self): method test_call (line 108) | def test_call(self): method test_double_precision_pad (line 126) | def test_double_precision_pad(self): method _load_datasamples (line 137) | def _load_datasamples(self, num_samples): method test_integration (line 146) | def test_integration(self): method test_integration_stereo (line 163) | def test_integration_stereo(self): method test_truncation_and_padding (line 183) | def test_truncation_and_padding(self): FILE: tests/models/encodec/test_modeling_encodec.py function prepare_inputs_dict (line 44) | def prepare_inputs_dict( class EncodecModelTester (line 63) | class EncodecModelTester: method __init__ (line 64) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 97) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_model_class (line 101) | def prepare_config_and_inputs_for_model_class(self, model_class): method prepare_config_and_inputs_for_normalization (line 110) | def prepare_config_and_inputs_for_normalization(self): method get_config (line 123) | def get_config(self): method create_and_check_model_forward (line 135) | def create_and_check_model_forward(self, config, inputs_dict): class EncodecModelTest (line 144) | class EncodecModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method _prepare_for_class (line 152) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 161) | def setUp(self): method test_config (line 167) | def test_config(self): method test_model_forward (line 170) | def test_model_forward(self): method test_forward_signature (line 174) | def test_forward_signature(self): method test_inputs_embeds (line 187) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 191) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 197) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 203) | def test_attention_outputs(self): method test_feed_forward_chunking (line 206) | def test_feed_forward_chunking(self): method test_hidden_states_output (line 239) | def test_hidden_states_output(self): method test_determinism (line 242) | def test_determinism(self): method test_model_outputs_equivalence (line 268) | def test_model_outputs_equivalence(self): method test_identity_shortcut (line 311) | def test_identity_shortcut(self): method test_model_forward_with_normalization (line 316) | def test_model_forward_with_normalization(self): function normalize (line 321) | def normalize(arr): function compute_rmse (line 327) | def compute_rmse(arr1, arr2): class EncodecIntegrationTest (line 1101) | class EncodecIntegrationTest(unittest.TestCase): method test_integration (line 1109) | def test_integration(self, name, model_id, bandwidth): method test_batch (line 1176) | def test_batch(self, name, model_id, bandwidth): FILE: tests/models/encoder_decoder/test_modeling_encoder_decoder.py class EncoderDecoderMixin (line 62) | class EncoderDecoderMixin: method get_encoder_decoder_model (line 65) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 68) | def prepare_config_and_inputs(self): method get_pretrained_model (line 71) | def get_pretrained_model(self): method check_encoder_decoder_model_from_pretrained_configs (line 74) | def check_encoder_decoder_model_from_pretrained_configs( method check_encoder_decoder_model (line 108) | def check_encoder_decoder_model( method check_encoder_decoder_model_from_pretrained_using_model_paths (line 169) | def check_encoder_decoder_model_from_pretrained_using_model_paths( method check_encoder_decoder_model_from_pretrained (line 214) | def check_encoder_decoder_model_from_pretrained( method check_save_and_load (line 245) | def check_save_and_load( method check_save_and_load_encoder_decoder_model (line 286) | def check_save_and_load_encoder_decoder_model( method check_encoder_decoder_model_labels (line 334) | def check_encoder_decoder_model_labels( method _check_output_with_attentions (line 368) | def _check_output_with_attentions( method check_encoder_decoder_model_output_attentions (line 402) | def check_encoder_decoder_model_output_attentions( method check_encoder_decoder_model_output_attentions_from_config (line 435) | def check_encoder_decoder_model_output_attentions_from_config( method check_encoder_decoder_model_generate (line 490) | def check_encoder_decoder_model_generate(self, input_ids, config, deco... method test_encoder_decoder_model (line 512) | def test_encoder_decoder_model(self): method test_encoder_decoder_model_from_pretrained_configs (line 516) | def test_encoder_decoder_model_from_pretrained_configs(self): method test_encoder_decoder_model_from_pretrained (line 520) | def test_encoder_decoder_model_from_pretrained(self): method test_encoder_decoder_model_from_pretrained_return_dict (line 524) | def test_encoder_decoder_model_from_pretrained_return_dict(self): method test_encoder_decoder_model_from_pretrained_using_model_paths (line 528) | def test_encoder_decoder_model_from_pretrained_using_model_paths(self): method test_save_and_load_from_pretrained (line 532) | def test_save_and_load_from_pretrained(self): method test_save_and_load_from_encoder_decoder_pretrained (line 536) | def test_save_and_load_from_encoder_decoder_pretrained(self): method test_encoder_decoder_model_labels (line 540) | def test_encoder_decoder_model_labels(self): method test_encoder_decoder_model_output_attentions (line 544) | def test_encoder_decoder_model_output_attentions(self): method test_encoder_decoder_model_output_attentions_from_config (line 548) | def test_encoder_decoder_model_output_attentions_from_config(self): method test_encoder_decoder_model_generate (line 552) | def test_encoder_decoder_model_generate(self): method test_training_gradient_checkpointing (line 556) | def test_training_gradient_checkpointing(self): method test_real_model_save_load_from_pretrained (line 583) | def test_real_model_save_load_from_pretrained(self): method test_sdpa_can_dispatch_composite_models (line 613) | def test_sdpa_can_dispatch_composite_models(self): class BertEncoderDecoderModelTest (line 666) | class BertEncoderDecoderModelTest(EncoderDecoderMixin, unittest.TestCase): method get_pretrained_model (line 667) | def get_pretrained_model(self): method get_encoder_decoder_model (line 672) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 677) | def prepare_config_and_inputs(self): method test_bert2bert_summarization (line 720) | def test_bert2bert_summarization(self): method test_bert2bert_default_decoder_attention_mask (line 746) | def test_bert2bert_default_decoder_attention_mask(self): class BertGenerationEncoderDecoderModelTest (line 798) | class BertGenerationEncoderDecoderModelTest(EncoderDecoderMixin, unittes... method get_pretrained_model (line 799) | def get_pretrained_model(self): method get_encoder_decoder_model (line 804) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 809) | def prepare_config_and_inputs(self): method test_roberta2roberta_summarization (line 844) | def test_roberta2roberta_summarization(self): class RoBertaEncoderDecoderModelTest (line 888) | class RoBertaEncoderDecoderModelTest(EncoderDecoderMixin, unittest.TestC... method get_encoder_decoder_model (line 889) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 894) | def prepare_config_and_inputs(self): method get_pretrained_model (line 936) | def get_pretrained_model(self): class GPT2EncoderDecoderModelTest (line 943) | class GPT2EncoderDecoderModelTest(EncoderDecoderMixin, unittest.TestCase): method get_encoder_decoder_model (line 946) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 951) | def prepare_config_and_inputs(self): method get_pretrained_model (line 996) | def get_pretrained_model(self): method test_encoder_decoder_model_shared_weights (line 1002) | def test_encoder_decoder_model_shared_weights(self): method test_bert2gpt2_summarization (line 1007) | def test_bert2gpt2_summarization(self): class ProphetNetEncoderDecoderModelTest (line 1038) | class ProphetNetEncoderDecoderModelTest(EncoderDecoderMixin, unittest.Te... method get_encoder_decoder_model (line 1039) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 1044) | def prepare_config_and_inputs(self): method get_pretrained_model (line 1084) | def get_pretrained_model(self): method test_encoder_decoder_model_shared_weights (line 1090) | def test_encoder_decoder_model_shared_weights(self): class BartEncoderDecoderModelTest (line 1095) | class BartEncoderDecoderModelTest(EncoderDecoderMixin, unittest.TestCase): method get_encoder_decoder_model (line 1096) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 1101) | def prepare_config_and_inputs(self): method get_pretrained_model (line 1141) | def get_pretrained_model(self): method test_encoder_decoder_model_shared_weights (line 1147) | def test_encoder_decoder_model_shared_weights(self): class EncoderDecoderModelTest (line 1152) | class EncoderDecoderModelTest(unittest.TestCase): method get_from_encoderdecoder_pretrained_model (line 1153) | def get_from_encoderdecoder_pretrained_model(self): method get_decoder_config (line 1158) | def get_decoder_config(self): method get_encoderdecoder_model (line 1164) | def get_encoderdecoder_model(self): method get_encoder_decoder_models (line 1167) | def get_encoder_decoder_models(self): method _check_configuration_tie (line 1174) | def _check_configuration_tie(self, model): method test_configuration_tie (line 1179) | def test_configuration_tie(self): FILE: tests/models/eomt/test_image_processing_eomt.py class EomtImageProcessingTester (line 38) | class EomtImageProcessingTester: method __init__ (line 39) | def __init__( method prepare_image_processor_dict (line 73) | def prepare_image_processor_dict(self): method prepare_fake_eomt_outputs (line 84) | def prepare_fake_eomt_outputs(self, batch_size, patch_offsets=None): method prepare_image_inputs (line 91) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 103) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 109) | def prepare_semantic_batch_inputs(): class EomtImageProcessingTest (line 116) | class EomtImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 117) | def setUp(self): method image_processor_dict (line 123) | def image_processor_dict(self): method test_image_processor_properties (line 126) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 138) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy (line 146) | def test_call_numpy(self): method test_call_numpy_4_channels (line 166) | def test_call_numpy_4_channels(self): method test_call_pil (line 169) | def test_call_pil(self): method test_call_pytorch (line 186) | def test_call_pytorch(self): method test_backends_equivalence (line 202) | def test_backends_equivalence(self): method test_slow_fast_equivalence_batched (line 232) | def test_slow_fast_equivalence_batched(self): method test_post_process_semantic_segmentation (line 269) | def test_post_process_semantic_segmentation(self): method test_post_process_panoptic_segmentation (line 289) | def test_post_process_panoptic_segmentation(self): method test_post_process_instance_segmentation (line 307) | def test_post_process_instance_segmentation(self): FILE: tests/models/eomt/test_modeling_eomt.py class EomtForUniversalSegmentationTester (line 37) | class EomtForUniversalSegmentationTester: method __init__ (line 38) | def __init__( method get_config (line 67) | def get_config(self): method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 92) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_training (line 97) | def prepare_config_and_inputs_for_training(self): class EomtForUniversalSegmentationTest (line 104) | class EomtForUniversalSegmentationTest(ModelTesterMixin, PipelineTesterM... method setUp (line 112) | def setUp(self): method test_config (line 116) | def test_config(self): method test_model_with_labels (line 119) | def test_model_with_labels(self): method test_inputs_embeds (line 133) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 137) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 141) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 145) | def test_resize_tokens_embeddings(self): method test_training (line 148) | def test_training(self): class EomtForUniversalSegmentationIntegrationTest (line 169) | class EomtForUniversalSegmentationIntegrationTest(unittest.TestCase): method setUp (line 170) | def setUp(self): method test_inference (line 174) | def test_inference(self): method test_inference_fp16 (line 217) | def test_inference_fp16(self): method test_semantic_segmentation_inference (line 232) | def test_semantic_segmentation_inference(self): method test_panoptic_segmentation_inference (line 270) | def test_panoptic_segmentation_inference(self): method test_instance_segmentation_inference (line 318) | def test_instance_segmentation_inference(self): method test_segmentation_pipeline (line 368) | def test_segmentation_pipeline(self): FILE: tests/models/eomt_dinov3/test_modeling_eomt_dinov3.py class EomtDinov3ForUniversalSegmentationTester (line 44) | class EomtDinov3ForUniversalSegmentationTester: method __init__ (line 45) | def __init__( method get_config (line 74) | def get_config(self): method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 100) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_training (line 105) | def prepare_config_and_inputs_for_training(self): class EomtDinov3ForUniversalSegmentationTest (line 112) | class EomtDinov3ForUniversalSegmentationTest(ModelTesterMixin, PipelineT... method setUp (line 119) | def setUp(self): method test_config (line 123) | def test_config(self): method test_model_with_labels (line 126) | def test_model_with_labels(self): method test_sdpa_can_dispatch_on_flash (line 140) | def test_sdpa_can_dispatch_on_flash(self): method test_inputs_embeds (line 144) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 148) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 152) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 156) | def test_resize_tokens_embeddings(self): method test_training (line 159) | def test_training(self): method test_initialization (line 178) | def test_initialization(self): class EomtDinov3ForUniversalSegmentationIntegrationTest (line 215) | class EomtDinov3ForUniversalSegmentationIntegrationTest(unittest.TestCase): method setUp (line 216) | def setUp(self): method test_inference (line 219) | def test_inference(self): method test_inference_bf16 (line 258) | def test_inference_bf16(self): method test_semantic_segmentation_inference (line 317) | def test_semantic_segmentation_inference(self): method test_panoptic_segmentation_inference (line 374) | def test_panoptic_segmentation_inference(self): method test_instance_segmentation_inference (line 419) | def test_instance_segmentation_inference(self): method test_segmentation_pipeline (line 465) | def test_segmentation_pipeline(self): FILE: tests/models/ernie/test_modeling_ernie.py class ErnieModelTester (line 43) | class ErnieModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 134) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 161) | def create_and_check_model( method create_and_check_model_as_decoder (line 173) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 206) | def create_and_check_for_causal_lm( method create_and_check_for_masked_lm (line 224) | def create_and_check_for_masked_lm( method create_and_check_model_for_causal_lm_as_decoder (line 233) | def create_and_check_model_for_causal_lm_as_decoder( method create_and_check_decoder_model_past_large_inputs (line 266) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_next_sequence_prediction (line 326) | def create_and_check_for_next_sequence_prediction( method create_and_check_for_pretraining (line 340) | def create_and_check_for_pretraining( method create_and_check_for_question_answering (line 356) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 372) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 382) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 392) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 410) | def prepare_config_and_inputs_for_common(self): class ErnieModelTest (line 426) | class ErnieModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method prepare_config_and_inputs_for_generate (line 456) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method _prepare_for_class (line 462) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 475) | def setUp(self): method test_config (line 479) | def test_config(self): method test_model (line 482) | def test_model(self): method test_model_as_decoder (line 486) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 490) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 517) | def test_for_causal_lm(self): method test_for_masked_lm (line 521) | def test_for_masked_lm(self): method test_for_causal_lm_decoder (line 525) | def test_for_causal_lm_decoder(self): method test_decoder_model_past_with_large_inputs (line 529) | def test_decoder_model_past_with_large_inputs(self): method test_for_multiple_choice (line 533) | def test_for_multiple_choice(self): method test_for_next_sequence_prediction (line 537) | def test_for_next_sequence_prediction(self): method test_for_pretraining (line 541) | def test_for_pretraining(self): method test_for_question_answering (line 545) | def test_for_question_answering(self): method test_for_sequence_classification (line 549) | def test_for_sequence_classification(self): method test_for_token_classification (line 553) | def test_for_token_classification(self): method test_model_from_pretrained (line 558) | def test_model_from_pretrained(self): FILE: tests/models/ernie4_5/test_modeling_ernie4_5.py class Ernie4_5ModelTester (line 41) | class Ernie4_5ModelTester(CausalLMModelTester): class Ernie4_5ModelTest (line 47) | class Ernie4_5ModelTest(CausalLMModelTest, unittest.TestCase): class Ernie4_5IntegrationTest (line 59) | class Ernie4_5IntegrationTest(unittest.TestCase): method setup (line 60) | def setup(self): method tearDown (line 63) | def tearDown(self): method test_ernie4_5_0p3B (line 67) | def test_ernie4_5_0p3B(self): FILE: tests/models/ernie4_5_moe/test_modeling_ernie4_5_moe.py class Ernie4_5_MoeModelTester (line 49) | class Ernie4_5_MoeModelTester(CausalLMModelTester): class Ernie4_5_MoeModelTest (line 55) | class Ernie4_5_MoeModelTest(CausalLMModelTest, unittest.TestCase): method test_flash_attn_2_equivalence (line 64) | def test_flash_attn_2_equivalence(self): method test_load_balancing_loss (line 94) | def test_load_balancing_loss(self): class Ernie4_5_MoeIntegrationTest (line 154) | class Ernie4_5_MoeIntegrationTest(unittest.TestCase): method setUpClass (line 156) | def setUpClass(cls): method tearDownClass (line 160) | def tearDownClass(cls): method setup (line 164) | def setup(self): method tearDown (line 167) | def tearDown(self): method get_large_model (line 171) | def get_large_model(cls): method get_small_model (line 182) | def get_small_model(cls): method test_model_21b_a3b_generation (line 191) | def test_model_21b_a3b_generation(self): method test_shortened_model_generation (line 209) | def test_shortened_model_generation(self): FILE: tests/models/ernie4_5_vl_moe/test_image_processing_ernie4_5_vl_moe.py class Ernie4_5_VLMoeImageProcessorTester (line 37) | class Ernie4_5_VLMoeImageProcessorTester: method __init__ (line 38) | def __init__( method prepare_image_processor_dict (line 70) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 80) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Ernie4_5_VLMoeImageProcessingTest (line 95) | class Ernie4_5_VLMoeImageProcessingTest(ImageProcessingTestMixin, unitte... method setUp (line 96) | def setUp(self): method image_processor_dict (line 101) | def image_processor_dict(self): method test_image_processor_properties (line 104) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 116) | def test_image_processor_from_dict_with_kwargs(self): method test_select_best_resolution (line 129) | def test_select_best_resolution(self): method test_call_pil (line 134) | def test_call_pil(self): method test_call_numpy (line 161) | def test_call_numpy(self): method test_call_pytorch (line 188) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 217) | def test_call_numpy_4_channels(self): method test_nested_input (line 220) | def test_nested_input(self): method test_custom_image_size (line 248) | def test_custom_image_size(self): method test_custom_pixels (line 262) | def test_custom_pixels(self): method test_backends_equivalence (line 278) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 299) | def test_backends_equivalence_batched(self): method test_get_num_patches_without_images (line 322) | def test_get_num_patches_without_images(self): FILE: tests/models/ernie4_5_vl_moe/test_modeling_ernie4_5_vl_moe.py class Ernie4_5_VLMoeVisionText2TextModelTester (line 57) | class Ernie4_5_VLMoeVisionText2TextModelTester: method __init__ (line 58) | def __init__( method get_config (line 133) | def get_config(self): method prepare_config_and_inputs (line 145) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 154) | def prepare_config_and_inputs_for_common(self): class Ernie4_5_VLMoeModelTest (line 189) | class Ernie4_5_VLMoeModelTest(ModelTesterMixin, GenerationTesterMixin, u... method setUp (line 202) | def setUp(self): method test_config (line 206) | def test_config(self): method prepare_config_and_inputs_for_generate (line 209) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_inputs_embeds_matches_input_ids (line 249) | def test_inputs_embeds_matches_input_ids(self): method test_multi_gpu_data_parallel_forward (line 271) | def test_multi_gpu_data_parallel_forward(self): method _video_features_prepare_config_and_inputs (line 274) | def _video_features_prepare_config_and_inputs(self): class Ernie4_5_VLMoeIntegrationTest (line 306) | class Ernie4_5_VLMoeIntegrationTest(unittest.TestCase): method setUp (line 311) | def setUp(self): method tearDown (line 340) | def tearDown(self): method load_model (line 343) | def load_model(self, dtype, attn_implementation="sdpa"): method test_small_model_integration_test (line 353) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 388) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_with_video (line 414) | def test_small_model_integration_test_with_video(self): method test_small_model_integration_test_expand (line 451) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_batch_wo_image (line 475) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 509) | def test_small_model_integration_test_batch_different_resolutions(self): class Ernie4_5_VLMoeSmallIntegrationTest (line 544) | class Ernie4_5_VLMoeSmallIntegrationTest(unittest.TestCase): method setUp (line 548) | def setUp(self): method tearDown (line 577) | def tearDown(self): method load_model (line 580) | def load_model(self, dtype, attn_implementation="sdpa"): method test_small_model_integration_test (line 589) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 624) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_with_video (line 661) | def test_small_model_integration_test_with_video(self): method test_small_model_integration_test_expand (line 697) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_batch_wo_image (line 721) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 755) | def test_small_model_integration_test_batch_different_resolutions(self): FILE: tests/models/ernie4_5_vl_moe/test_processing_ernie4_5_vl_moe.py class Ernie4_5_VLMoeProcessorTest (line 40) | class Ernie4_5_VLMoeProcessorTest(ProcessorTesterMixin, unittest.TestCase): method setUpClass (line 44) | def setUpClass(cls): method get_tokenizer (line 54) | def get_tokenizer(self, **kwargs): method get_image_processor (line 57) | def get_image_processor(self, **kwargs): method get_video_processor (line 60) | def get_video_processor(self, **kwargs): method get_processor (line 63) | def get_processor(self, **kwargs): method tearDownClass (line 67) | def tearDownClass(cls): method test_get_num_vision_tokens (line 71) | def test_get_num_vision_tokens(self): method test_save_load_pretrained_default (line 83) | def test_save_load_pretrained_default(self): method test_image_processor (line 99) | def test_image_processor(self): method test_processor (line 116) | def test_processor(self): method _test_apply_chat_template (line 151) | def _test_apply_chat_template( method test_apply_chat_template_video_frame_sampling (line 262) | def test_apply_chat_template_video_frame_sampling(self): method test_kwargs_overrides_custom_image_processor_kwargs (line 367) | def test_kwargs_overrides_custom_image_processor_kwargs(self): FILE: tests/models/ernie4_5_vl_moe/test_video_processing_ernie4_5_vl_moe.py class Ernie4_5_VLMoeVideoProcessingTester (line 35) | class Ernie4_5_VLMoeVideoProcessingTester: method __init__ (line 36) | def __init__( method prepare_video_processor_dict (line 73) | def prepare_video_processor_dict(self): method prepare_video_metadata (line 85) | def prepare_video_metadata(self, videos): method expected_output_video_shape (line 106) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 139) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class Ernie4_5_VLMoeVideoProcessingTest (line 154) | class Ernie4_5_VLMoeVideoProcessingTest(VideoProcessingTestMixin, unitte... method setUp (line 158) | def setUp(self): method video_processor_dict (line 163) | def video_processor_dict(self): method test_video_processor_from_dict_with_kwargs (line 166) | def test_video_processor_from_dict_with_kwargs(self): method test_call_pil (line 175) | def test_call_pil(self): method test_call_numpy (line 197) | def test_call_numpy(self): method test_call_pytorch (line 217) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 236) | def test_call_numpy_4_channels(self): method test_nested_input (line 270) | def test_nested_input(self): method test_call_sample_frames (line 295) | def test_call_sample_frames(self): FILE: tests/models/esm/test_modeling_esm.py class EsmModelTester (line 49) | class EsmModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 119) | def get_config(self): method create_and_check_model (line 136) | def create_and_check_model(self, config, input_ids, input_mask, sequen... method create_and_check_for_masked_lm (line 147) | def create_and_check_for_masked_lm( method create_and_check_for_token_classification (line 156) | def create_and_check_for_token_classification( method create_and_check_forward_and_backwards (line 166) | def create_and_check_forward_and_backwards( method prepare_config_and_inputs_for_common (line 184) | def prepare_config_and_inputs_for_common(self): class EsmModelTest (line 199) | class EsmModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 226) | def setUp(self): method test_config (line 230) | def test_config(self): method test_model (line 233) | def test_model(self): method test_for_masked_lm (line 237) | def test_for_masked_lm(self): method test_for_token_classification (line 241) | def test_for_token_classification(self): method test_esm_gradient_checkpointing (line 245) | def test_esm_gradient_checkpointing(self): method test_model_from_pretrained (line 250) | def test_model_from_pretrained(self): method test_create_position_ids_respects_padding_index (line 255) | def test_create_position_ids_respects_padding_index(self): method test_create_position_ids_from_inputs_embeds (line 279) | def test_create_position_ids_from_inputs_embeds(self): method test_resize_embeddings_untied (line 301) | def test_resize_embeddings_untied(self): method test_resize_tokens_embeddings (line 305) | def test_resize_tokens_embeddings(self): method test_flash_attn_2_equivalence (line 313) | def test_flash_attn_2_equivalence(self): method test_inputs_embeds_matches_input_ids (line 344) | def test_inputs_embeds_matches_input_ids(self): class EsmModelIntegrationTest (line 350) | class EsmModelIntegrationTest(TestCasePlus): method test_inference_masked_lm (line 351) | def test_inference_masked_lm(self): method test_inference_no_head (line 368) | def test_inference_no_head(self): method test_inference_bitsandbytes (line 382) | def test_inference_bitsandbytes(self): FILE: tests/models/esm/test_modeling_esmfold.py class EsmFoldModelTester (line 32) | class EsmFoldModelTester: method __init__ (line 33) | def __init__( method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method get_config (line 100) | def get_config(self): method create_and_check_model (line 141) | def create_and_check_model(self, config, input_ids, input_mask, sequen... method prepare_config_and_inputs_for_common (line 152) | def prepare_config_and_inputs_for_common(self): class EsmFoldModelTest (line 167) | class EsmFoldModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 175) | def setUp(self): method test_config (line 179) | def test_config(self): method test_model (line 182) | def test_model(self): method test_batching_equivalence (line 189) | def test_batching_equivalence(self): method test_attention_outputs (line 193) | def test_attention_outputs(self): method test_correct_missing_keys (line 197) | def test_correct_missing_keys(self): method test_resize_embeddings_untied (line 201) | def test_resize_embeddings_untied(self): method test_resize_tokens_embeddings (line 205) | def test_resize_tokens_embeddings(self): method test_inputs_embeds (line 209) | def test_inputs_embeds(self): method test_hidden_states_output (line 213) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 217) | def test_retain_grad_hidden_states_attentions(self): method test_model_outputs_equivalence (line 221) | def test_model_outputs_equivalence(self): method test_feed_forward_chunking (line 225) | def test_feed_forward_chunking(self): method test_multi_gpu_data_parallel_forward (line 229) | def test_multi_gpu_data_parallel_forward(self): class EsmModelIntegrationTest (line 234) | class EsmModelIntegrationTest(TestCasePlus): method test_inference_protein_folding (line 236) | def test_inference_protein_folding(self): FILE: tests/models/esm/test_tokenization_esm.py class ESMTokenizationTest (line 27) | class ESMTokenizationTest(unittest.TestCase): method setUpClass (line 31) | def setUpClass(cls): method get_tokenizers (line 40) | def get_tokenizers(cls, **kwargs) -> list[PreTrainedTokenizerBase]: method get_tokenizer (line 44) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> PreTrainedTo... method test_tokenizer_single_example (line 48) | def test_tokenizer_single_example(self): method test_tokenizer_encode_single (line 55) | def test_tokenizer_encode_single(self): method test_tokenizer_call_no_pad (line 61) | def test_tokenizer_call_no_pad(self): method test_tokenizer_call_pad (line 69) | def test_tokenizer_call_pad(self): method test_tokenize_special_tokens (line 77) | def test_tokenize_special_tokens(self): method test_add_tokens (line 93) | def test_add_tokens(self): FILE: tests/models/eurobert/test_modeling_eurobert.py class EuroBertModelTester (line 42) | class EuroBertModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 119) | def get_config(self): method create_and_check_model (line 133) | def create_and_check_model( method create_and_check_for_masked_lm (line 144) | def create_and_check_for_masked_lm( method create_and_check_for_sequence_classification (line 153) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 163) | def create_and_check_for_token_classification( method prepare_config_and_inputs_for_common (line 173) | def prepare_config_and_inputs_for_common(self): class EuroBertModelTest (line 189) | class EuroBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 223) | def setUp(self): method test_config (line 227) | def test_config(self): method test_model (line 230) | def test_model(self): method test_model_various_embeddings (line 234) | def test_model_various_embeddings(self): method test_eurobert_sequence_classification_model (line 240) | def test_eurobert_sequence_classification_model(self): method test_eurobert_sequence_classification_model_for_single_label (line 252) | def test_eurobert_sequence_classification_model_for_single_label(self): method test_eurobert_sequence_classification_model_for_multi_label (line 265) | def test_eurobert_sequence_classification_model_for_multi_label(self): method test_for_masked_lm (line 280) | def test_for_masked_lm(self): method test_for_sequence_classification (line 284) | def test_for_sequence_classification(self): method test_for_token_classification (line 288) | def test_for_token_classification(self): method test_save_load_fast_init_from_base (line 293) | def test_save_load_fast_init_from_base(self): method test_model_rope_scaling_from_config (line 297) | def test_model_rope_scaling_from_config(self, scaling_type): method test_model_rope_scaling_frequencies (line 353) | def test_model_rope_scaling_frequencies(self): method test_model_loading_old_rope_configs (line 467) | def test_model_loading_old_rope_configs(self): class EuroBertIntegrationTest (line 523) | class EuroBertIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 525) | def test_inference_masked_lm(self): method test_inference_no_head (line 540) | def test_inference_no_head(self): method test_inference_token_classification (line 557) | def test_inference_token_classification(self): method test_inference_sequence_classification (line 574) | def test_inference_sequence_classification(self): FILE: tests/models/evolla/test_modeling_evolla.py class EvollaModelTester (line 46) | class EvollaModelTester: method __init__ (line 47) | def __init__( method is_encoder_decoder (line 105) | def is_encoder_decoder(self): method prepare_config_and_inputs (line 108) | def prepare_config_and_inputs(self, num_proteins=None): method get_config (line 121) | def get_config(self): method create_and_check_model (line 145) | def create_and_check_model( method create_and_check_model_gen (line 166) | def create_and_check_model_gen( method prepare_config_and_inputs_for_common (line 185) | def prepare_config_and_inputs_for_common(self): class EvollaModelTest (line 198) | class EvollaModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 206) | def setUp(self): method is_encoder_decoder (line 211) | def is_encoder_decoder(self): method _prepare_for_class (line 214) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_model_outputs_equivalence (line 226) | def test_model_outputs_equivalence(self): method test_config (line 235) | def test_config(self): method test_model_single_protein (line 238) | def test_model_single_protein(self): method test_model_multiple_proteins (line 242) | def test_model_multiple_proteins(self): method test_generate_single_protein (line 246) | def test_generate_single_protein(self): method test_generate_multiple_proteins (line 250) | def test_generate_multiple_proteins(self): method test_saprot_output (line 254) | def test_saprot_output(self): method test_protein_encoder_output (line 270) | def test_protein_encoder_output(self): method test_single_forward (line 286) | def test_single_forward(self): method test_eager_matches_sdpa_inference (line 303) | def test_eager_matches_sdpa_inference(self): method test_eager_padding_matches_padding_free_with_position_ids (line 307) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_generation_tester_mixin_inheritance (line 313) | def test_generation_tester_mixin_inheritance(self): method test_flex_attention_with_grads (line 317) | def test_flex_attention_with_grads(self): class EvollaModelIntegrationTest (line 322) | class EvollaModelIntegrationTest(TestCasePlus): method _prepare_for_inputs (line 323) | def _prepare_for_inputs(self): method default_processor (line 339) | def default_processor(self): method test_inference_natural_language_protein_reasoning (line 344) | def test_inference_natural_language_protein_reasoning(self): FILE: tests/models/evolla/test_processing_evolla.py class EvollaProcessorTest (line 37) | class EvollaProcessorTest(ProcessorTesterMixin, unittest.TestCase): method test_processor_with_multiple_inputs (line 43) | def test_processor_with_multiple_inputs(self): method prepare_input_and_expected_output (line 46) | def prepare_input_and_expected_output(self): method get_protein_tokenizer (line 146) | def get_protein_tokenizer(self, **kwargs): method prepare_inputs_single (line 151) | def prepare_inputs_single(self): method prepare_inputs_pair (line 158) | def prepare_inputs_pair(self): method prepare_inputs_long (line 171) | def prepare_inputs_long(self): method prepare_inputs_short (line 184) | def prepare_inputs_short(self): method prepare_inputs_empty (line 197) | def prepare_inputs_empty(self): method prepare_inputs (line 210) | def prepare_inputs(self, protein_types="pair"): method test_model_input_names (line 247) | def test_model_input_names(self): FILE: tests/models/exaone4/test_modeling_exaone4.py class Exaone4ModelTester (line 46) | class Exaone4ModelTester(CausalLMModelTester): method __init__ (line 50) | def __init__(self, parent): class Exaone4ModelTest (line 59) | class Exaone4ModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 64) | def test_tp_generation_quantized(self): class Exaone4IntegrationTest (line 69) | class Exaone4IntegrationTest(unittest.TestCase): method setUp (line 72) | def setUp(self): method tearDown (line 75) | def tearDown(self): method test_model_logits (line 83) | def test_model_logits(self): method test_model_generation_eager (line 103) | def test_model_generation_eager(self): method test_model_generation_sdpa (line 118) | def test_model_generation_sdpa(self): method test_model_generation_long_flash (line 136) | def test_model_generation_long_flash(self): method test_model_generation_beyond_sliding_window (line 149) | def test_model_generation_beyond_sliding_window(self): method test_export_static_cache (line 164) | def test_export_static_cache(self): FILE: tests/models/exaone_moe/test_modeling_exaone_moe.py class ExaoneMoeModelTester (line 45) | class ExaoneMoeModelTester(CausalLMModelTester): class ExaoneMoeModelTest (line 51) | class ExaoneMoeModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 56) | def test_tp_generation_quantized(self): class ExaoneMoeIntegrationTest (line 62) | class ExaoneMoeIntegrationTest(unittest.TestCase): method setUpClass (line 66) | def setUpClass(cls): method tearDownClass (line 70) | def tearDownClass(cls): method setup (line 74) | def setup(self): method tearDown (line 77) | def tearDown(self): method get_model (line 81) | def get_model(cls): method test_model_logits (line 91) | def test_model_logits(self): method test_model_generation_sdpa (line 123) | def test_model_generation_sdpa(self): method test_model_generation_beyond_sliding_window_flash (line 138) | def test_model_generation_beyond_sliding_window_flash(self): FILE: tests/models/falcon/test_modeling_falcon.py class FalconModelTester (line 44) | class FalconModelTester(CausalLMModelTester): method __init__ (line 48) | def __init__(self, parent, new_decoder_architecture=True): class FalconModelTest (line 54) | class FalconModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 58) | def is_pipeline_test_to_skip( method test_sdpa_can_dispatch_on_flash (line 71) | def test_sdpa_can_dispatch_on_flash(self): class FalconLanguageGenerationTest (line 76) | class FalconLanguageGenerationTest(unittest.TestCase): method test_lm_generate_falcon (line 78) | def test_lm_generate_falcon(self): method test_lm_generate_falcon_11b (line 96) | def test_lm_generate_falcon_11b(self): method test_lm_generation_big_models (line 116) | def test_lm_generation_big_models(self): method test_lm_generation_use_cache (line 133) | def test_lm_generation_use_cache(self): method test_batched_generation (line 155) | def test_batched_generation(self): method test_falcon_alibi_sdpa_matches_eager (line 181) | def test_falcon_alibi_sdpa_matches_eager(self): FILE: tests/models/falcon_h1/test_modeling_falcon_h1.py class FalconH1ModelTester (line 42) | class FalconH1ModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 118) | def prepare_config_and_inputs_for_common(self): method get_config (line 129) | def get_config(self): method create_and_check_model (line 162) | def create_and_check_model( method create_and_check_for_causal_lm (line 176) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 192) | def create_and_check_decoder_model_past_large_inputs( class FalconH1ModelTest (line 245) | class FalconH1ModelTest(ModelTesterMixin, GenerationTesterMixin, Pipelin... method _get_conv_state_shape (line 256) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 267) | def _get_recurrent_state_shape(self, batch_size: int, config): method setUp (line 270) | def setUp(self): method test_config (line 274) | def test_config(self): method test_model (line 277) | def test_model(self): method test_for_causal_lm (line 281) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 285) | def test_decoder_model_past_with_large_inputs(self): method test_attention_outputs (line 289) | def test_attention_outputs(self): method test_batching_equivalence (line 353) | def test_batching_equivalence(self): method test_left_padding_compatibility (line 361) | def test_left_padding_compatibility(self): class FalconH1ModelIntegrationTest (line 370) | class FalconH1ModelIntegrationTest(unittest.TestCase): method test_falcon_h1_hard (line 372) | def test_falcon_h1_hard(self): FILE: tests/models/falcon_mamba/test_modeling_falcon_mamba.py class FalconMambaModelTester (line 48) | class FalconMambaModelTester: method __init__ (line 49) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs( method get_config (line 121) | def get_config( method get_pipeline_config (line 140) | def get_pipeline_config(self): method prepare_config_and_inputs_for_decoder (line 145) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_falcon_mamba_model (line 164) | def create_and_check_falcon_mamba_model(self, config, input_ids, *args): method create_and_check_causal_lm (line 175) | def create_and_check_causal_lm(self, config, input_ids, *args): method create_and_check_state_equivalency (line 184) | def create_and_check_state_equivalency(self, config, input_ids, *args): method create_and_check_falcon_mamba_cached_slow_forward_and_backwards (line 209) | def create_and_check_falcon_mamba_cached_slow_forward_and_backwards( method create_and_check_falcon_mamba_lm_head_forward_and_backwards (line 230) | def create_and_check_falcon_mamba_lm_head_forward_and_backwards( method prepare_config_and_inputs_for_common (line 243) | def prepare_config_and_inputs_for_common(self): class FalconMambaModelTest (line 257) | class FalconMambaModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe... method test_enable_input_require_grads (line 268) | def test_enable_input_require_grads(self): method setUp (line 271) | def setUp(self): method assertInterval (line 277) | def assertInterval(self, member, container, msg=None): method test_config (line 299) | def test_config(self): method test_falcon_mamba_model (line 302) | def test_falcon_mamba_model(self): method test_falcon_mamba_lm_head_model (line 306) | def test_falcon_mamba_lm_head_model(self): method test_state_equivalency (line 310) | def test_state_equivalency(self): method test_falcon_mamba_cached_slow_forward_and_backwards (line 314) | def test_falcon_mamba_cached_slow_forward_and_backwards(self): method test_falcon_mamba_lm_head_forward_and_backwards (line 318) | def test_falcon_mamba_lm_head_forward_and_backwards(self): method test_model_from_pretrained (line 324) | def test_model_from_pretrained(self): method test_model_outputs_equivalence (line 328) | def test_model_outputs_equivalence(self): method test_multi_gpu_data_parallel_forward (line 388) | def test_multi_gpu_data_parallel_forward(self): class FalconMambaIntegrationTests (line 395) | class FalconMambaIntegrationTests(unittest.TestCase): method setUp (line 396) | def setUp(self): method tearDown (line 403) | def tearDown(self): method test_generation_fp16 (line 408) | def test_generation_fp16(self): method test_generation_4bit (line 429) | def test_generation_4bit(self): method test_generation_torch_compile (line 444) | def test_generation_torch_compile(self): method test_batched_generation (line 457) | def test_batched_generation(self): method test_training_kernel (line 518) | def test_training_kernel(self): FILE: tests/models/fast_vlm/test_modeling_fast_vlm.py class FastVlmVisionText2TextModelTester (line 50) | class FastVlmVisionText2TextModelTester: method __init__ (line 51) | def __init__( method get_config (line 120) | def get_config(self): method prepare_config_and_inputs (line 131) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 144) | def prepare_config_and_inputs_for_common(self): class FastVlmForConditionalGenerationModelTest (line 161) | class FastVlmForConditionalGenerationModelTest(ModelTesterMixin, Generat... method setUp (line 179) | def setUp(self): method test_enable_input_require_grads (line 186) | def test_enable_input_require_grads(self): method test_config (line 189) | def test_config(self): method test_mismatching_num_image_tokens (line 192) | def test_mismatching_num_image_tokens(self): method test_can_be_initialized_on_meta (line 224) | def test_can_be_initialized_on_meta(self): method test_get_image_features_attentions (line 228) | def test_get_image_features_attentions(self): method test_reverse_loading_mapping (line 232) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method _image_features_get_expected_num_hidden_states (line 235) | def _image_features_get_expected_num_hidden_states(self, model_tester=... class FastVlmForConditionalGenerationIntegrationTest (line 243) | class FastVlmForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 244) | def setUp(self): method tearDown (line 247) | def tearDown(self): method test_small_model_integration_test (line 251) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 272) | def test_small_model_integration_test_batch(self): method test_generation_no_images (line 301) | def test_generation_no_images(self): FILE: tests/models/fastspeech2_conformer/test_modeling_fastspeech2_conformer.py class FastSpeech2ConformerModelTester (line 45) | class FastSpeech2ConformerModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method get_config (line 86) | def get_config(self): method create_and_check_model (line 101) | def create_and_check_model(self, config, input_ids, *args): method prepare_config_and_inputs_for_common (line 119) | def prepare_config_and_inputs_for_common(self): class FastSpeech2ConformerModelTest (line 126) | class FastSpeech2ConformerModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 133) | def setUp(self): method test_config (line 137) | def test_config(self): method test_model (line 140) | def test_model(self): method test_duration_energy_pitch_output (line 144) | def test_duration_energy_pitch_output(self): method test_hidden_states_output (line 163) | def test_hidden_states_output(self): method test_save_load_strict (line 197) | def test_save_load_strict(self): method test_forward_signature (line 206) | def test_forward_signature(self): method test_retain_grad_hidden_states_attentions (line 231) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 265) | def test_attention_outputs(self): method test_model_from_pretrained (line 327) | def test_model_from_pretrained(self): method test_inputs_embeds (line 332) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 336) | def test_model_get_set_embeddings(self): method test_batching_equivalence (line 343) | def test_batching_equivalence(self): class FastSpeech2ConformerModelIntegrationTest (line 350) | class FastSpeech2ConformerModelIntegrationTest(unittest.TestCase): method test_inference_integration (line 351) | def test_inference_integration(self): method test_training_integration (line 399) | def test_training_integration(self): class FastSpeech2ConformerWithHifiGanTester (line 458) | class FastSpeech2ConformerWithHifiGanTester: method __init__ (line 459) | def __init__( method prepare_config_and_inputs (line 496) | def prepare_config_and_inputs(self): method get_config (line 501) | def get_config(self): method create_and_check_model (line 522) | def create_and_check_model(self, config, input_ids, *args): method prepare_config_and_inputs_for_common (line 540) | def prepare_config_and_inputs_for_common(self): class FastSpeech2ConformerWithHifiGanTest (line 547) | class FastSpeech2ConformerWithHifiGanTest(ModelTesterMixin, unittest.Tes... method setUp (line 554) | def setUp(self): method test_model (line 557) | def test_model(self): method _prepare_for_class (line 561) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_duration_energy_pitch_output (line 564) | def test_duration_energy_pitch_output(self): method test_hidden_states_output (line 583) | def test_hidden_states_output(self): method test_save_load_strict (line 617) | def test_save_load_strict(self): method test_forward_signature (line 626) | def test_forward_signature(self): method test_retain_grad_hidden_states_attentions (line 651) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 685) | def test_attention_outputs(self): method test_model_from_pretrained (line 747) | def test_model_from_pretrained(self): method test_inputs_embeds (line 752) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 756) | def test_model_get_set_embeddings(self): method test_batching_equivalence (line 763) | def test_batching_equivalence(self): class FastSpeech2ConformerWithHifiGanIntegrationTest (line 770) | class FastSpeech2ConformerWithHifiGanIntegrationTest(unittest.TestCase): method test_inference_integration (line 771) | def test_inference_integration(self): FILE: tests/models/fastspeech2_conformer/test_tokenization_fastspeech2_conformer.py class FastSpeech2ConformerTokenizerTest (line 25) | class FastSpeech2ConformerTokenizerTest(TokenizerTesterMixin, unittest.T... method setUpClass (line 31) | def setUpClass(cls): method get_input_output_texts (line 36) | def get_input_output_texts(self, tokenizer): method get_clean_sequence (line 42) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, **kwa... method test_convert_token_and_id (line 47) | def test_convert_token_and_id(self): method test_get_vocab (line 55) | def test_get_vocab(self): method test_vocab_size (line 65) | def test_vocab_size(self): method test_added_token_are_matched_longest_first (line 71) | def test_added_token_are_matched_longest_first(self): method test_added_tokens_do_lower_case (line 77) | def test_added_tokens_do_lower_case(self): method test_tokenize_special_tokens (line 83) | def test_tokenize_special_tokens(self): method test_full_tokenizer (line 86) | def test_full_tokenizer(self): method test_tokenizer_integration (line 96) | def test_tokenizer_integration(self): method test_add_tokens_tokenizer (line 144) | def test_add_tokens_tokenizer(self): method test_add_special_tokens (line 150) | def test_add_special_tokens(self): method test_added_token_serializable (line 156) | def test_added_token_serializable(self): method test_save_and_load_tokenizer (line 162) | def test_save_and_load_tokenizer(self): method test_internal_consistency (line 166) | def test_internal_consistency(self): method test_encode_decode_with_spaces (line 170) | def test_encode_decode_with_spaces(self): method test_convert_tokens_to_string_format (line 174) | def test_convert_tokens_to_string_format(self): method test_maximum_encoding_length_pair_input (line 178) | def test_maximum_encoding_length_pair_input(self): method test_pretokenized_inputs (line 184) | def test_pretokenized_inputs(self): method test_maximum_encoding_length_single_input (line 190) | def test_maximum_encoding_length_single_input(self): FILE: tests/models/flaubert/test_modeling_flaubert.py class FlaubertModelTester (line 39) | class FlaubertModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 137) | def get_config(self): method create_and_check_flaubert_model (line 157) | def create_and_check_flaubert_model( method create_and_check_flaubert_lm_head (line 177) | def create_and_check_flaubert_lm_head( method create_and_check_flaubert_simple_qa (line 197) | def create_and_check_flaubert_simple_qa( method create_and_check_flaubert_qa (line 219) | def create_and_check_flaubert_qa( method create_and_check_flaubert_sequence_classif (line 271) | def create_and_check_flaubert_sequence_classif( method create_and_check_flaubert_token_classif (line 293) | def create_and_check_flaubert_token_classif( method create_and_check_flaubert_multiple_choice (line 313) | def create_and_check_flaubert_multiple_choice( method prepare_config_and_inputs_for_common (line 340) | def prepare_config_and_inputs_for_common(self): class FlaubertModelTest (line 363) | class FlaubertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method is_pipeline_test_to_skip (line 392) | def is_pipeline_test_to_skip( method _prepare_for_class (line 415) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 429) | def setUp(self): method test_config (line 433) | def test_config(self): method test_flaubert_model (line 436) | def test_flaubert_model(self): method test_flaubert_model_with_sinusoidal_encodings (line 441) | def test_flaubert_model_with_sinusoidal_encodings(self): method test_flaubert_lm_head (line 448) | def test_flaubert_lm_head(self): method test_flaubert_simple_qa (line 452) | def test_flaubert_simple_qa(self): method test_flaubert_qa (line 456) | def test_flaubert_qa(self): method test_flaubert_sequence_classif (line 460) | def test_flaubert_sequence_classif(self): method test_flaubert_token_classif (line 464) | def test_flaubert_token_classif(self): method test_flaubert_multiple_choice (line 468) | def test_flaubert_multiple_choice(self): method test_model_from_pretrained (line 473) | def test_model_from_pretrained(self): class FlaubertModelIntegrationTest (line 480) | class FlaubertModelIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 482) | def test_inference_no_head_absolute_embedding(self): FILE: tests/models/flaubert/test_tokenization_flaubert.py class FlaubertTokenizationTest (line 28) | class FlaubertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_full_tokenizer (line 34) | def test_full_tokenizer(self): method test_sequence_builders (line 62) | def test_sequence_builders(self): FILE: tests/models/flava/test_image_processing_flava.py class FlavaImageProcessingTester (line 46) | class FlavaImageProcessingTester: method __init__ (line 47) | def __init__( method prepare_image_processor_dict (line 117) | def prepare_image_processor_dict(self): method get_expected_image_size (line 145) | def get_expected_image_size(self): method get_expected_mask_size (line 148) | def get_expected_mask_size(self): method get_expected_codebook_image_size (line 155) | def get_expected_codebook_image_size(self): method prepare_image_inputs (line 158) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class FlavaImageProcessingTest (line 172) | class FlavaImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 175) | def setUp(self): method image_processor_dict (line 180) | def image_processor_dict(self): method test_image_processor_properties (line 183) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 206) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 222) | def test_call_pil(self): method _test_call_framework (line 261) | def _test_call_framework(self, instance_class, prepare_kwargs): method test_call_numpy (line 340) | def test_call_numpy(self): method test_call_numpy_4_channels (line 343) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 356) | def test_call_pytorch(self): method test_masking (line 359) | def test_masking(self): method test_codebook_pixels (line 370) | def test_codebook_pixels(self): method test_slow_fast_equivalence (line 402) | def test_slow_fast_equivalence(self): FILE: tests/models/flava/test_modeling_flava.py class FlavaImageModelTester (line 69) | class FlavaImageModelTester: method __init__ (line 70) | def __init__( method prepare_config_and_inputs (line 108) | def prepare_config_and_inputs(self): method get_config (line 117) | def get_config(self): method create_and_check_model (line 136) | def create_and_check_model(self, config, pixel_values, bool_masked_pos): method prepare_config_and_inputs_for_common (line 149) | def prepare_config_and_inputs_for_common(self): class FlavaImageModelTest (line 157) | class FlavaImageModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 167) | def setUp(self): method test_config (line 171) | def test_config(self): method test_inputs_embeds (line 175) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 178) | def test_model_get_set_embeddings(self): method test_forward_signature (line 187) | def test_forward_signature(self): method test_model (line 199) | def test_model(self): method test_attention_outputs (line 203) | def test_attention_outputs(self): method test_hidden_states_output (line 260) | def test_hidden_states_output(self): method test_training (line 300) | def test_training(self): method test_training_gradient_checkpointing (line 304) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 308) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 312) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 316) | def test_model_from_pretrained(self): class FlavaTextModelTester (line 322) | class FlavaTextModelTester: method __init__ (line 323) | def __init__( method prepare_config_and_inputs (line 367) | def prepare_config_and_inputs(self): method get_config (line 390) | def get_config(self): method create_and_check_model (line 408) | def create_and_check_model(self, config, input_ids, token_type_ids, in... method prepare_config_and_inputs_for_common (line 418) | def prepare_config_and_inputs_for_common(self): class FlavaTextModelTest (line 426) | class FlavaTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 429) | def setUp(self): method test_config (line 433) | def test_config(self): method test_model (line 436) | def test_model(self): method test_training (line 441) | def test_training(self): method test_training_gradient_checkpointing (line 445) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 449) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 453) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 457) | def test_inputs_embeds(self): method test_model_from_pretrained (line 462) | def test_model_from_pretrained(self): class FlavaMultimodalModelTester (line 468) | class FlavaMultimodalModelTester: method __init__ (line 469) | def __init__( method prepare_config_and_inputs (line 505) | def prepare_config_and_inputs(self): method get_config (line 523) | def get_config(self): method create_and_check_model (line 539) | def create_and_check_model(self, config, hidden_states, input_mask): method prepare_config_and_inputs_for_common (line 549) | def prepare_config_and_inputs_for_common(self): class FlavaMultimodalModelTest (line 557) | class FlavaMultimodalModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 562) | def setUp(self): method test_config (line 568) | def test_config(self): method test_model (line 571) | def test_model(self): method test_forward_signature (line 575) | def test_forward_signature(self): method test_model_get_set_embeddings (line 588) | def test_model_get_set_embeddings(self): method test_training (line 592) | def test_training(self): method test_training_gradient_checkpointing (line 596) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 600) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 604) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 608) | def test_inputs_embeds(self): method test_model_from_pretrained (line 612) | def test_model_from_pretrained(self): class FlavaImageCodebookTester (line 618) | class FlavaImageCodebookTester: method __init__ (line 619) | def __init__( method prepare_config_and_inputs (line 637) | def prepare_config_and_inputs(self): method get_config (line 643) | def get_config(self): method create_and_check_model (line 648) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 658) | def prepare_config_and_inputs_for_common(self): class FlavaImageCodebookTest (line 666) | class FlavaImageCodebookTest(ModelTesterMixin, unittest.TestCase): method setUp (line 672) | def setUp(self): method test_model (line 676) | def test_model(self): method test_forward_signature (line 680) | def test_forward_signature(self): method test_attention_outputs (line 693) | def test_attention_outputs(self): method test_model_get_set_embeddings (line 697) | def test_model_get_set_embeddings(self): method test_training (line 701) | def test_training(self): method test_training_gradient_checkpointing (line 705) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 709) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 713) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_hidden_states_output (line 717) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 721) | def test_retain_grad_hidden_states_attentions(self): method test_inputs_embeds (line 725) | def test_inputs_embeds(self): method test_model_outputs_equivalence (line 729) | def test_model_outputs_equivalence(self): method test_model_from_pretrained (line 733) | def test_model_from_pretrained(self): class FlavaModelTester (line 739) | class FlavaModelTester: method __init__ (line 742) | def __init__( method test_config (line 777) | def test_config(self): method prepare_config_and_inputs_for_common (line 780) | def prepare_config_and_inputs_for_common(self): method get_config (line 794) | def get_config(self): method create_and_check_model (line 806) | def create_and_check_model(self, config, inputs): method _test_model (line 811) | def _test_model(self, config, inputs, test_image=False, test_text=False): class FlavaModelTest (line 859) | class FlavaModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 867) | def setUp(self): method test_model (line 874) | def test_model(self): method test_config (line 878) | def test_config(self): method test_hidden_states_output (line 882) | def test_hidden_states_output(self): method test_inputs_embeds (line 886) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 890) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 894) | def test_model_get_set_embeddings(self): method test_load_image_text_config (line 897) | def test_load_image_text_config(self): method test_model_from_pretrained (line 920) | def test_model_from_pretrained(self): class FlavaForPreTrainingTester (line 926) | class FlavaForPreTrainingTester(FlavaModelTester): method prepare_config_and_inputs_for_common (line 929) | def prepare_config_and_inputs_for_common(self): method _test_model (line 958) | def _test_model(self, config, inputs, test_image=False, test_text=False): class FlavaForPreTrainingTest (line 1074) | class FlavaForPreTrainingTest(FlavaModelTest): method test_training_gradient_checkpointing (line 1079) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 1083) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 1087) | def test_training_gradient_checkpointing_use_reentrant_true(self): function prepare_img (line 1092) | def prepare_img(): class FlavaModelIntegrationTest (line 1100) | class FlavaModelIntegrationTest(unittest.TestCase): method test_inference (line 1102) | def test_inference(self): class FlavaForPreTrainingIntegrationTest (line 1128) | class FlavaForPreTrainingIntegrationTest(unittest.TestCase): method test_inference (line 1130) | def test_inference(self): method test_inference_with_itm_labels (line 1178) | def test_inference_with_itm_labels(self): FILE: tests/models/flava/test_processing_flava.py class FlavaProcessorTest (line 36) | class FlavaProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 40) | def _setup_image_processor(cls): method _setup_tokenizer (line 70) | def _setup_tokenizer(cls): FILE: tests/models/flex_olmo/test_modeling_flex_olmo.py class FlexOlmoModelTester (line 40) | class FlexOlmoModelTester(CausalLMModelTester): method __init__ (line 44) | def __init__(self, parent): class FlexOlmoModelTest (line 53) | class FlexOlmoModelTest(CausalLMModelTest, unittest.TestCase): class FlexOlmoIntegrationTest (line 66) | class FlexOlmoIntegrationTest(unittest.TestCase): method setUp (line 67) | def setUp(self): method tearDown (line 70) | def tearDown(self): method test_model_7b_logits (line 74) | def test_model_7b_logits(self): method test_model_7b_greedy_generation (line 98) | def test_model_7b_greedy_generation(self): FILE: tests/models/florence2/test_modeling_florence2.py class Florence2VisionText2TextModelTester (line 48) | class Florence2VisionText2TextModelTester: method __init__ (line 49) | def __init__( method get_config (line 126) | def get_config(self): method prepare_config_and_inputs (line 169) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 195) | def prepare_config_and_inputs_for_common(self): method create_and_check_florence2_model_fp16_forward (line 199) | def create_and_check_florence2_model_fp16_forward(self, config, input_... method test_load_save_without_tied_weights (line 215) | def test_load_save_without_tied_weights(self): method test_sdpa_can_dispatch_on_flash (line 219) | def test_sdpa_can_dispatch_on_flash(self): class Florence2ForConditionalGenerationModelTest (line 224) | class Florence2ForConditionalGenerationModelTest( method setUp (line 245) | def setUp(self): method test_config (line 249) | def test_config(self): method test_load_save_without_tied_weights (line 255) | def test_load_save_without_tied_weights(self): function prepare_img (line 259) | def prepare_img(): class Florence2ForConditionalGenerationIntegrationTest (line 267) | class Florence2ForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 268) | def setUp(self): method tearDown (line 282) | def tearDown(self): method test_base_model_inference_eager (line 285) | def test_base_model_inference_eager(self): method test_base_model_batching_inference_eager (line 309) | def test_base_model_batching_inference_eager(self): method test_base_model_inference_sdpa (line 372) | def test_base_model_inference_sdpa(self): method test_base_model_batching_inference_sdpa (line 404) | def test_base_model_batching_inference_sdpa(self): method test_large_model_inference_eager (line 444) | def test_large_model_inference_eager(self): method test_large_model_batching_inference_eager (line 468) | def test_large_model_batching_inference_eager(self): method test_large_model_inference_sdpa (line 528) | def test_large_model_inference_sdpa(self): method test_large_model_batching_inference_sdpa (line 560) | def test_large_model_batching_inference_sdpa(self): FILE: tests/models/florence2/test_processing_florence2.py class Florence2ProcessorTest (line 29) | class Florence2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 33) | def _setup_image_processor(cls): method _setup_tokenizer (line 40) | def _setup_tokenizer(cls): method test_tokenizer_defaults (line 48) | def test_tokenizer_defaults(self): method prepare_processor_dict (line 52) | def prepare_processor_dict(): method test_construct_prompts (line 69) | def test_construct_prompts(self): method test_quantizer_quantize_dequantize (line 93) | def test_quantizer_quantize_dequantize(self): method test_post_process_parse_description_with_bboxes_from_text_and_spans (line 117) | def test_post_process_parse_description_with_bboxes_from_text_and_span... method test_post_process_parse_description_with_polygons_from_text_and_spans (line 144) | def test_post_process_parse_description_with_polygons_from_text_and_sp... method test_post_process_parse_ocr_from_text_and_spans (line 174) | def test_post_process_parse_ocr_from_text_and_spans(self): method test_post_process_parse_phrase_grounding_from_text_and_spans (line 195) | def test_post_process_parse_phrase_grounding_from_text_and_spans(self): method test_post_process_generation (line 214) | def test_post_process_generation(self): FILE: tests/models/fnet/test_modeling_fnet.py class FNetConfigTester (line 47) | class FNetConfigTester(ConfigTester): method create_and_test_config_common_properties (line 48) | def create_and_test_config_common_properties(self): class FNetModelTester (line 56) | class FNetModelTester: method __init__ (line 57) | def __init__( method prepare_config_and_inputs (line 99) | def prepare_config_and_inputs(self): method get_config (line 118) | def get_config(self): method create_and_check_model (line 132) | def create_and_check_model(self, config, input_ids, token_type_ids, se... method create_and_check_for_pretraining (line 140) | def create_and_check_for_pretraining( method create_and_check_for_masked_lm (line 155) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 164) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 179) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 189) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 199) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 215) | def prepare_config_and_inputs_for_common(self): class FNetModelTest (line 230) | class FNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method is_pipeline_test_to_skip (line 260) | def is_pipeline_test_to_skip( method _prepare_for_class (line 276) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_attention_outputs (line 291) | def test_attention_outputs(self): method test_training_gradient_checkpointing (line 295) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 299) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 303) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_outputs_equivalence (line 306) | def test_model_outputs_equivalence(self): method test_retain_grad_hidden_states_attentions (line 365) | def test_retain_grad_hidden_states_attentions(self): method setUp (line 389) | def setUp(self): method test_config (line 393) | def test_config(self): method test_model (line 396) | def test_model(self): method test_for_pretraining (line 400) | def test_for_pretraining(self): method test_for_masked_lm (line 404) | def test_for_masked_lm(self): method test_for_multiple_choice (line 408) | def test_for_multiple_choice(self): method test_for_question_answering (line 412) | def test_for_question_answering(self): method test_for_sequence_classification (line 416) | def test_for_sequence_classification(self): method test_for_token_classification (line 420) | def test_for_token_classification(self): method test_model_from_pretrained (line 425) | def test_model_from_pretrained(self): class FNetModelIntegrationTest (line 432) | class FNetModelIntegrationTest(unittest.TestCase): method test_inference_for_masked_lm (line 434) | def test_inference_for_masked_lm(self): method test_inference_long_sentence (line 456) | def test_inference_long_sentence(self): method test_inference_for_next_sentence_prediction (line 481) | def test_inference_for_next_sentence_prediction(self): method test_inference_model (line 497) | def test_inference_model(self): FILE: tests/models/focalnet/test_modeling_focalnet.py class FocalNetModelTester (line 47) | class FocalNetModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method get_config (line 117) | def get_config(self): method create_and_check_model (line 142) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 153) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_masked_image_modeling (line 182) | def create_and_check_for_masked_image_modeling(self, config, pixel_val... method create_and_check_for_image_classification (line 201) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 219) | def prepare_config_and_inputs_for_common(self): class FocalNetModelTest (line 228) | class FocalNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 248) | def setUp(self): method test_config (line 258) | def test_config(self): method test_model (line 261) | def test_model(self): method test_backbone (line 265) | def test_backbone(self): method test_for_masked_image_modeling (line 269) | def test_for_masked_image_modeling(self): method test_for_image_classification (line 273) | def test_for_image_classification(self): method test_inputs_embeds (line 278) | def test_inputs_embeds(self): method test_feed_forward_chunking (line 282) | def test_feed_forward_chunking(self): method test_model_get_set_embeddings (line 285) | def test_model_get_set_embeddings(self): method check_hidden_states_output (line 294) | def check_hidden_states_output(self, inputs_dict, config, model_class,... method test_hidden_states_output (line 335) | def test_hidden_states_output(self): method test_hidden_states_output_with_padding (line 354) | def test_hidden_states_output_with_padding(self): method test_model_from_pretrained (line 382) | def test_model_from_pretrained(self): class FocalNetModelIntegrationTest (line 390) | class FocalNetModelIntegrationTest(unittest.TestCase): method default_image_processor (line 392) | def default_image_processor(self): method test_inference_image_classification_head (line 397) | def test_inference_image_classification_head(self): class FocalNetBackboneTest (line 425) | class FocalNetBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 431) | def setUp(self): FILE: tests/models/fsmt/test_modeling_fsmt.py class FSMTModelTester (line 51) | class FSMTModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs (line 98) | def prepare_config_and_inputs(self): method get_config (line 108) | def get_config(self): method prepare_config_and_inputs_for_common (line 129) | def prepare_config_and_inputs_for_common(self): function prepare_fsmt_inputs_dict (line 137) | def prepare_fsmt_inputs_dict( class FSMTModelTest (line 151) | class FSMTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 164) | def setUp(self): method test_config (line 174) | def test_config(self): method test_model_get_set_embeddings (line 178) | def test_model_get_set_embeddings(self): method test_initialization_more (line 188) | def test_initialization_more(self): method test_advanced_inputs (line 206) | def test_advanced_inputs(self): method test_save_load_missing_keys (line 236) | def test_save_load_missing_keys(self): method test_ensure_weights_are_shared (line 247) | def test_ensure_weights_are_shared(self): method test_resize_tokens_embeddings (line 283) | def test_resize_tokens_embeddings(self): method test_inputs_embeds (line 287) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 291) | def test_inputs_embeds_matches_input_ids(self): method test_resize_embeddings_untied (line 295) | def test_resize_embeddings_untied(self): method test_prompt_lookup_decoding_matches_greedy_search (line 299) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_assisted_decoding_sample (line 303) | def test_assisted_decoding_sample(self): method test_assisted_decoding_matches_greedy_search (line 308) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): class FSMTHeadTests (line 313) | class FSMTHeadTests(unittest.TestCase): method _get_config (line 318) | def _get_config(self): method _get_config_and_data (line 336) | def _get_config_and_data(self): method test_shift_tokens_right (line 361) | def test_shift_tokens_right(self): method test_generate_fp16 (line 371) | def test_generate_fp16(self): method test_dummy_inputs (line 379) | def test_dummy_inputs(self): method test_prepare_fsmt_decoder_inputs (line 384) | def test_prepare_fsmt_decoder_inputs(self): function _assert_tensors_equal (line 400) | def _assert_tensors_equal(a, b, atol=1e-12, prefix=""): function _long_tensor (line 414) | def _long_tensor(tok_lst): class FSMTModelIntegrationTests (line 432) | class FSMTModelIntegrationTests(unittest.TestCase): method default_tokenizer (line 438) | def default_tokenizer(self): method default_model (line 442) | def default_model(self): method get_tokenizer (line 445) | def get_tokenizer(self, mname): method get_model (line 450) | def get_model(self, mname): method test_inference_no_head (line 467) | def test_inference_no_head(self): method translation_setup (line 486) | def translation_setup(self, pair): method test_translation_direct (line 510) | def test_translation_direct(self, pair): class TestSinusoidalPositionalEmbeddings (line 521) | class TestSinusoidalPositionalEmbeddings(unittest.TestCase): method test_basic (line 525) | def test_basic(self): method test_odd_embed_dim (line 543) | def test_odd_embed_dim(self): method test_positional_emb_weights_against_marian (line 557) | def test_positional_emb_weights_against_marian(self): FILE: tests/models/fsmt/test_tokenization_fsmt.py class FSMTTokenizationTest (line 31) | class FSMTTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 37) | def setUpClass(cls): method tokenizer_ru_en (line 88) | def tokenizer_ru_en(self): method tokenizer_en_ru (line 92) | def tokenizer_en_ru(self): method test_online_tokenizer_config (line 95) | def test_online_tokenizer_config(self): method test_full_tokenizer (line 104) | def test_full_tokenizer(self): method test_sequence_builders (line 118) | def test_sequence_builders(self): method test_match_encode_decode (line 131) | def test_match_encode_decode(self): method test_tokenizer_lower (line 157) | def test_tokenizer_lower(self): method test_torch_encode_plus_sent_to_model (line 164) | def test_torch_encode_plus_sent_to_model(self): method test_np_encode_plus_sent_to_model (line 168) | def test_np_encode_plus_sent_to_model(self): FILE: tests/models/funnel/test_modeling_funnel.py class FunnelModelTester (line 43) | class FunnelModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 111) | def prepare_config_and_inputs(self): method get_config (line 144) | def get_config(self): method create_and_check_model (line 162) | def create_and_check_model( method create_and_check_base_model (line 189) | def create_and_check_base_model( method create_and_check_for_pretraining (line 216) | def create_and_check_for_pretraining( method create_and_check_for_masked_lm (line 234) | def create_and_check_for_masked_lm( method create_and_check_for_sequence_classification (line 251) | def create_and_check_for_sequence_classification( method create_and_check_for_multiple_choice (line 269) | def create_and_check_for_multiple_choice( method create_and_check_for_token_classification (line 295) | def create_and_check_for_token_classification( method create_and_check_for_question_answering (line 313) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 337) | def prepare_config_and_inputs_for_common(self): class FunnelModelTest (line 354) | class FunnelModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method _prepare_for_class (line 381) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 391) | def setUp(self): method test_config (line 395) | def test_config(self): method test_model (line 398) | def test_model(self): method test_for_pretraining (line 402) | def test_for_pretraining(self): method test_for_masked_lm (line 406) | def test_for_masked_lm(self): method test_for_token_classification (line 410) | def test_for_token_classification(self): method test_for_question_answering (line 414) | def test_for_question_answering(self): method _mock_init_weights (line 419) | def _mock_init_weights(self, module): class FunnelBaseModelTest (line 432) | class FunnelBaseModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 439) | def setUp(self): method test_config (line 443) | def test_config(self): method test_base_model (line 446) | def test_base_model(self): method test_for_sequence_classification (line 450) | def test_for_sequence_classification(self): method test_for_multiple_choice (line 454) | def test_for_multiple_choice(self): method test_training (line 459) | def test_training(self): method _mock_init_weights (line 474) | def _mock_init_weights(self, module): class FunnelModelIntegrationTest (line 489) | class FunnelModelIntegrationTest(unittest.TestCase): method test_inference_tiny_model (line 490) | def test_inference_tiny_model(self): method test_inference_model (line 514) | def test_inference_model(self): FILE: tests/models/funnel/test_tokenization_funnel.py class FunnelTokenizationTest (line 25) | class FunnelTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/fuyu/test_image_processing_fuyu.py class FuyuImageProcessingTester (line 29) | class FuyuImageProcessingTester: method __init__ (line 30) | def __init__( method prepare_image_processor_dict (line 66) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 79) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method expected_output_image_shape (line 109) | def expected_output_image_shape(self, images): class FuyuImageProcessorTest (line 116) | class FuyuImageProcessorTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 120) | def setUp(self): method test_call_pil (line 125) | def test_call_pil(self): method test_call_numpy (line 141) | def test_call_numpy(self): method test_call_pytorch (line 157) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 174) | def test_call_numpy_4_channels(self): method test_backends_equivalence (line 178) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 199) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 221) | def test_can_compile_torchvision_backend(self): method test_image_processor_properties (line 237) | def test_image_processor_properties(self): method test_patches (line 250) | def test_patches(self): method test_patches_match_backends (line 265) | def test_patches_match_backends(self): method test_scale_to_target_aspect_ratio (line 287) | def test_scale_to_target_aspect_ratio(self): method test_apply_transformation_numpy (line 307) | def test_apply_transformation_numpy(self): method test_apply_transformation_pil (line 317) | def test_apply_transformation_pil(self): method test_preprocess_output_structure (line 328) | def test_preprocess_output_structure(self): method test_batch_processing (line 347) | def test_batch_processing(self): method test_pad_image_torchvision (line 365) | def test_pad_image_torchvision(self): method test_preprocess_with_tokenizer_info (line 384) | def test_preprocess_with_tokenizer_info(self): method test_device_handling_torchvision (line 419) | def test_device_handling_torchvision(self): method test_do_not_resize_if_smaller (line 434) | def test_do_not_resize_if_smaller(self): FILE: tests/models/fuyu/test_modeling_fuyu.py class FuyuModelTester (line 46) | class FuyuModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 105) | def prepare_config_and_inputs(self): method get_config (line 124) | def get_config(self): method prepare_config_and_inputs_for_common (line 142) | def prepare_config_and_inputs_for_common(self): class FuyuModelTest (line 159) | class FuyuModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 175) | def setUp(self): method test_mismatching_image_patches (line 178) | def test_mismatching_image_patches(self): method test_assisted_decoding_matches_greedy_search (line 202) | def test_assisted_decoding_matches_greedy_search(self): method test_assisted_decoding_sample (line 207) | def test_assisted_decoding_sample(self): method test_disk_offload_bin (line 212) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 217) | def test_disk_offload_safetensors(self): method test_model_parallelism (line 222) | def test_model_parallelism(self): method test_generate_continue_from_inputs_embeds (line 226) | def test_generate_continue_from_inputs_embeds(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 230) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 234) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 238) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 242) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_model_base_model_prefix (line 246) | def test_model_base_model_prefix(self): method _image_features_prepare_config_and_inputs (line 249) | def _image_features_prepare_config_and_inputs(self): method test_get_image_features_hidden_states (line 260) | def test_get_image_features_hidden_states(self): method test_get_image_features_attentions (line 264) | def test_get_image_features_attentions(self): class FuyuModelIntegrationTest (line 270) | class FuyuModelIntegrationTest(unittest.TestCase): method default_processor (line 272) | def default_processor(self): method default_model (line 276) | def default_model(self): method test_greedy_generation (line 279) | def test_greedy_generation(self): FILE: tests/models/fuyu/test_processing_fuyu.py class FuyuProcessingTest (line 22) | class FuyuProcessingTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 27) | def _setup_test_attributes(cls, processor): method test_image_processor_defaults (line 35) | def test_image_processor_defaults(self): method test_processor_with_multiple_inputs (line 39) | def test_processor_with_multiple_inputs(self): method test_get_num_vision_tokens (line 42) | def test_get_num_vision_tokens(self): method test_fuyu_processing (line 54) | def test_fuyu_processing(self): method test_fuyu_processing_no_image (line 68) | def test_fuyu_processing_no_image(self): method test_fuyu_processing_no_text (line 76) | def test_fuyu_processing_no_text(self): method test_fuyu_processing_multiple_image_sample (line 112) | def test_fuyu_processing_multiple_image_sample(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 178) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 196) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 200) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_tokenizer_defaults_preserved_by_kwargs (line 206) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_structured_kwargs_nested (line 224) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 251) | def test_structured_kwargs_nested_from_dict(self): method test_unstructured_kwargs (line 277) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 302) | def test_unstructured_kwargs_batched(self): method test_processor_text_has_no_visual (line 324) | def test_processor_text_has_no_visual(self): class TestImageTextProcessingUtils (line 348) | class TestImageTextProcessingUtils(unittest.TestCase): method setUp (line 349) | def setUp(self): method test_full_unpacked_stream_to_tensor (line 366) | def test_full_unpacked_stream_to_tensor(self): method test_construct_full_unpacked_stream (line 378) | def test_construct_full_unpacked_stream(self): class TestProcessImagesForModelInput (line 388) | class TestProcessImagesForModelInput(unittest.TestCase): method setUp (line 389) | def setUp(self): method test_process_images_for_model_input_fixed_sized (line 407) | def test_process_images_for_model_input_fixed_sized(self): FILE: tests/models/gemma/test_modeling_gemma.py class GemmaModelTester (line 48) | class GemmaModelTester(CausalLMModelTester): class GemmaModelTest (line 54) | class GemmaModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 61) | def is_pipeline_test_to_skip( class GemmaIntegrationTest (line 76) | class GemmaIntegrationTest(unittest.TestCase): method setUpClass (line 83) | def setUpClass(cls): method setUp (line 86) | def setUp(self): method tearDown (line 89) | def tearDown(self): method test_model_2b_fp16 (line 93) | def test_model_2b_fp16(self): method test_model_2b_bf16 (line 112) | def test_model_2b_bf16(self): method test_model_2b_eager (line 130) | def test_model_2b_eager(self): method test_model_2b_flash_attn (line 152) | def test_model_2b_flash_attn(self): method test_model_2b_4bit (line 173) | def test_model_2b_4bit(self): method test_model_7b_fp32 (line 193) | def test_model_7b_fp32(self): method test_model_7b_fp16 (line 210) | def test_model_7b_fp16(self): method test_model_7b_bf16 (line 230) | def test_model_7b_bf16(self): method test_model_7b_fp16_static_cache (line 260) | def test_model_7b_fp16_static_cache(self): method test_model_7b_4bit (line 291) | def test_model_7b_4bit(self): method test_compile_static_cache (line 322) | def test_compile_static_cache(self): method test_export_static_cache (line 356) | def test_export_static_cache(self): FILE: tests/models/gemma/test_tokenization_gemma.py class GemmaTokenizationTest (line 26) | class GemmaTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/gemma2/test_modeling_gemma2.py class Gemma2ModelTester (line 53) | class Gemma2ModelTester(CausalLMModelTester): class Gemma2ModelTest (line 59) | class Gemma2ModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 65) | def test_tp_generation_quantized(self): class Gemma2IntegrationTest (line 71) | class Gemma2IntegrationTest(unittest.TestCase): method setUp (line 74) | def setUp(self): method tearDown (line 77) | def tearDown(self): method test_model_9b_bf16 (line 81) | def test_model_9b_bf16(self): method test_model_9b_fp16 (line 101) | def test_model_9b_fp16(self): method test_model_9b_pipeline_bf16 (line 121) | def test_model_9b_pipeline_bf16(self): method test_model_2b_pipeline_bf16_flex_attention (line 144) | def test_model_2b_pipeline_bf16_flex_attention(self): method test_model_9b_flash_attn (line 177) | def test_model_9b_flash_attn(self): method test_export_static_cache (line 207) | def test_export_static_cache(self): method test_export_hybrid_cache (line 281) | def test_export_hybrid_cache(self): method test_model_9b_bf16_flex_attention (line 321) | def test_model_9b_bf16_flex_attention(self): method test_generation_beyond_sliding_window (line 341) | def test_generation_beyond_sliding_window(self, attn_implementation: s... method test_generation_beyond_sliding_window_dynamic (line 387) | def test_generation_beyond_sliding_window_dynamic(self, attn_implement... FILE: tests/models/gemma3/test_image_processing_gemma3.py class Gemma3ImageProcessingTester (line 33) | class Gemma3ImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 72) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 86) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 90) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Gemma3ImageProcessingTest (line 104) | class Gemma3ImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 105) | def setUp(self): method image_processor_dict (line 111) | def image_processor_dict(self): method test_image_processor_properties (line 114) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 128) | def test_image_processor_from_dict_with_kwargs(self): method test_without_pan_and_scan (line 136) | def test_without_pan_and_scan(self): method test_pan_and_scan (line 159) | def test_pan_and_scan(self): method test_call_pil (line 189) | def test_call_pil(self): method test_call_numpy (line 208) | def test_call_numpy(self): method test_call_pytorch (line 227) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 248) | def test_call_numpy_4_channels(self): method test_backends_equivalence_batched_pas (line 253) | def test_backends_equivalence_batched_pas(self): FILE: tests/models/gemma3/test_modeling_gemma3.py class Gemma3TextModelTester (line 68) | class Gemma3TextModelTester(CausalLMModelTester): method __init__ (line 74) | def __init__(self, parent): class Gemma3TextModelTest (line 83) | class Gemma3TextModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 89) | def test_tp_generation_quantized(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 93) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 97) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 101) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 105) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_load_with_mismatched_shapes (line 111) | def test_load_with_mismatched_shapes(self): method test_generation_beyond_sliding_window_tiny_model (line 114) | def test_generation_beyond_sliding_window_tiny_model(self): method test_model_rope_scaling_from_config (line 166) | def test_model_rope_scaling_from_config(self): method test_model_rope_scaling_frequencies (line 169) | def test_model_rope_scaling_frequencies(self): class Gemma3Vision2TextModelTester (line 261) | class Gemma3Vision2TextModelTester(VLMModelTester): method __init__ (line 269) | def __init__(self, parent, **kwargs): method create_attention_mask (line 280) | def create_attention_mask(self, input_ids): method get_additional_inputs (line 284) | def get_additional_inputs(self, config, input_ids, pixel_values): class Gemma3Vision2TextModelTest (line 292) | class Gemma3Vision2TextModelTest(VLMModelTest, unittest.TestCase): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 308) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 312) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 316) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 320) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_bidirectional_image_attention (line 323) | def test_bidirectional_image_attention(self): method test_training_gradient_checkpointing (line 364) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 368) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 372) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_load_with_mismatched_shapes (line 376) | def test_load_with_mismatched_shapes(self): method test_automodelforcausallm (line 379) | def test_automodelforcausallm(self): method test_flash_attn_2_from_config (line 395) | def test_flash_attn_2_from_config(self): method test_flash_attn_3_from_config (line 402) | def test_flash_attn_3_from_config(self): method test_flash_attn_4_from_config (line 409) | def test_flash_attn_4_from_config(self): class Gemma3IntegrationTest (line 415) | class Gemma3IntegrationTest(unittest.TestCase): method setUp (line 416) | def setUp(self): method tearDown (line 431) | def tearDown(self): method test_model_4b_bf16 (line 435) | def test_model_4b_bf16(self): method test_model_4b_batch (line 465) | def test_model_4b_batch(self): method test_model_4b_crops (line 533) | def test_model_4b_crops(self): method test_model_4b_batch_crops (line 581) | def test_model_4b_batch_crops(self): method test_model_4b_multiimage (line 653) | def test_model_4b_multiimage(self): method test_model_1b_text_only (line 696) | def test_model_1b_text_only(self): method test_model_4b_flash_attn (line 722) | def test_model_4b_flash_attn(self): method test_generation_beyond_sliding_window (line 753) | def test_generation_beyond_sliding_window(self, attn_implementation: s... method test_export_text_only (line 788) | def test_export_text_only(self): method test_dynamic_sliding_window_is_default (line 830) | def test_dynamic_sliding_window_is_default(self): FILE: tests/models/gemma3/test_processing_gemma3.py class Gemma3ProcessorTest (line 29) | class Gemma3ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 33) | def _setup_test_attributes(cls, processor): method _setup_image_processor (line 37) | def _setup_image_processor(cls): method _setup_tokenizer (line 48) | def _setup_tokenizer(cls): method test_get_num_vision_tokens (line 60) | def test_get_num_vision_tokens(self): method prepare_processor_dict (line 73) | def prepare_processor_dict(): method prepare_image_inputs (line 79) | def prepare_image_inputs(self, batch_size: int | None = None): method test_text_with_image_tokens (line 86) | def test_text_with_image_tokens(self): method test_pan_and_scan (line 114) | def test_pan_and_scan(self): method test_special_mm_token_truncation (line 142) | def test_special_mm_token_truncation(self): method test_get_num_multimodal_tokens_matches_processor_call (line 167) | def test_get_num_multimodal_tokens_matches_processor_call(self): FILE: tests/models/gemma3n/test_feature_extraction_gemma3n.py function floats_list (line 44) | def floats_list(shape, scale=1.0, rng=None): class Gemma3nAudioFeatureExtractionTester (line 58) | class Gemma3nAudioFeatureExtractionTester: method __init__ (line 59) | def __init__( method prepare_feat_extract_dict (line 106) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 124) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class Gemma3nAudioFeatureExtractionTest (line 141) | class Gemma3nAudioFeatureExtractionTest(SequenceFeatureExtractionTestMix... method setUp (line 144) | def setUp(self): method test_feat_extract_from_and_save_pretrained (line 147) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 162) | def test_feat_extract_to_json_file(self): method test_feat_extract_from_pretrained_kwargs (line 177) | def test_feat_extract_from_pretrained_kwargs(self): method test_call (line 198) | def test_call(self, audio_inputs, test_truncation=False): method test_call_unbatched (line 231) | def test_call_unbatched(self): method test_audio_features_attn_mask_consistent (line 238) | def test_audio_features_attn_mask_consistent(self): method test_dither (line 257) | def test_dither(self): method test_double_precision_pad (line 294) | def test_double_precision_pad(self): FILE: tests/models/gemma3n/test_modeling_gemma3n.py class Gemma3nAudioModelTester (line 72) | class Gemma3nAudioModelTester: method __init__ (line 73) | def __init__( method get_feature_extractor_config (line 89) | def get_feature_extractor_config(self): method get_audio_encoder_config (line 100) | def get_audio_encoder_config(self): method get_config (line 112) | def get_config(self): method prepare_config_and_inputs_for_common (line 115) | def prepare_config_and_inputs_for_common(self): class Gemma3nAudioModelTest (line 142) | class Gemma3nAudioModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 150) | def setUp(self): method test_attention_outputs (line 178) | def test_attention_outputs(self): method test_hidden_states_output (line 182) | def test_hidden_states_output(self): method test_model_outputs_equivalence (line 186) | def test_model_outputs_equivalence(self): method test_retain_grad_hidden_states_attentions (line 190) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 194) | def test_model_get_set_embeddings(self): method test_resize_tokens_embeddings (line 198) | def test_resize_tokens_embeddings(self): method test_batching_equivalence (line 202) | def test_batching_equivalence(self): method test_feature_extractor (line 205) | def test_feature_extractor(self): method test_audio_encoder (line 223) | def test_audio_encoder(self): class Gemma3nTextModelTester (line 247) | class Gemma3nTextModelTester(CausalLMModelTester): method __init__ (line 252) | def __init__( class Gemma3nTextModelTest (line 327) | class Gemma3nTextModelTest(CausalLMModelTest, unittest.TestCase): method _check_hidden_states_for_generate (line 333) | def _check_hidden_states_for_generate( method test_eager_matches_sdpa_inference (line 361) | def test_eager_matches_sdpa_inference( method test_reverse_loading_mapping (line 414) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_generate_with_quant_cache (line 419) | def test_generate_with_quant_cache(self): method test_eager_padding_matches_padding_free_with_position_ids (line 423) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 427) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_flash_attn_2_fp32_ln (line 431) | def test_flash_attn_2_fp32_ln(self): method test_generate_from_inputs_embeds_with_static_cache (line 435) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_with_static_cache (line 495) | def test_generate_with_static_cache(self): method test_model_rope_scaling_frequencies (line 563) | def test_model_rope_scaling_frequencies(self): class Gemma3nVision2TextModelTester (line 655) | class Gemma3nVision2TextModelTester: method __init__ (line 659) | def __init__( method get_config (line 732) | def get_config(self): method prepare_config_and_inputs (line 748) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 761) | def prepare_config_and_inputs_for_common(self): class Gemma3nVision2TextModelTest (line 786) | class Gemma3nVision2TextModelTest(ModelTesterMixin, GenerationTesterMixi... method setUp (line 801) | def setUp(self): method test_flex_attention_with_grads (line 813) | def test_flex_attention_with_grads(self): method test_eager_padding_matches_padding_free_with_position_ids (line 817) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 821) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_attention_outputs (line 825) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 829) | def test_retain_grad_hidden_states_attentions(self): method test_get_image_features_attentions (line 833) | def test_get_image_features_attentions(self): method test_training_gradient_checkpointing (line 837) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_true (line 841) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_training_gradient_checkpointing_use_reentrant_false (line 845) | def test_training_gradient_checkpointing_use_reentrant_false(self): method _image_features_get_expected_num_hidden_states (line 848) | def _image_features_get_expected_num_hidden_states(self, model_tester=... method test_get_audio_features_output (line 853) | def test_get_audio_features_output(self, return_dict: bool | None): method test_get_audio_features_hidden_states (line 857) | def test_get_audio_features_hidden_states(self, return_dict: bool | No... method test_get_audio_features_attentions (line 861) | def test_get_audio_features_attentions(self, return_dict: bool | None): method test_generate_with_quant_cache (line 866) | def test_generate_with_quant_cache(self): method test_reverse_loading_mapping (line 872) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method _check_hidden_states_for_generate (line 875) | def _check_hidden_states_for_generate( method test_eager_matches_sdpa_inference (line 906) | def test_eager_matches_sdpa_inference( class Gemma3nIntegrationTest (line 961) | class Gemma3nIntegrationTest(unittest.TestCase): method setUp (line 962) | def setUp(self): method tearDown (line 983) | def tearDown(self): method test_model_4b_bf16 (line 986) | def test_model_4b_bf16(self): method test_model_with_audio (line 1007) | def test_model_with_audio(self): method test_model_4b_batch (line 1049) | def test_model_4b_batch(self): method test_model_4b_image (line 1092) | def test_model_4b_image(self): method test_model_4b_multiimage (line 1120) | def test_model_4b_multiimage(self): method test_model_1b_text_only (line 1161) | def test_model_1b_text_only(self): method test_generation_beyond_sliding_window (line 1174) | def test_generation_beyond_sliding_window(self): method test_generation_beyond_sliding_window_with_generation_config (line 1206) | def test_generation_beyond_sliding_window_with_generation_config(self): FILE: tests/models/gemma3n/test_processing_gemma3n.py class Gemma3nProcessorTest (line 34) | class Gemma3nProcessorTest(ProcessorTesterMixin, unittest.TestCase): method prepare_image_inputs (line 38) | def prepare_image_inputs(self, batch_size: int | None = None, nested: ... method _setup_test_attributes (line 42) | def _setup_test_attributes(cls, processor): method test_audio_feature_extractor (line 45) | def test_audio_feature_extractor(self): FILE: tests/models/git/test_modeling_git.py class GitVisionModelTester (line 42) | class GitVisionModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method get_config (line 87) | def get_config(self): method create_and_check_model (line 102) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 114) | def prepare_config_and_inputs_for_common(self): class GitVisionModelTest (line 122) | class GitVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 132) | def setUp(self): method test_config (line 136) | def test_config(self): method test_inputs_embeds (line 140) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 143) | def test_model_get_set_embeddings(self): method test_forward_signature (line 152) | def test_forward_signature(self): method test_model (line 164) | def test_model(self): method test_training (line 169) | def test_training(self): method test_training_gradient_checkpointing (line 173) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 177) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 181) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 185) | def test_model_from_pretrained(self): class GitModelTester (line 191) | class GitModelTester: method __init__ (line 192) | def __init__( method prepare_config_and_inputs (line 248) | def prepare_config_and_inputs(self): method get_config (line 261) | def get_config(self): method create_and_check_model (line 290) | def create_and_check_model(self, config, input_ids, input_mask, pixel_... method create_and_check_for_causal_lm (line 308) | def create_and_check_for_causal_lm(self, config, input_ids, input_mask... method _test_batched_generate_captioning (line 329) | def _test_batched_generate_captioning(self, config, input_ids, input_m... method prepare_config_and_inputs_for_common (line 348) | def prepare_config_and_inputs_for_common(self): class GitModelTest (line 368) | class GitModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method _prepare_for_class (line 382) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 394) | def setUp(self): method test_config (line 398) | def test_config(self): method test_model (line 401) | def test_model(self): method test_for_causal_lm (line 405) | def test_for_causal_lm(self): method test_batched_generate_captioning (line 409) | def test_batched_generate_captioning(self): method test_past_key_values_format (line 414) | def test_past_key_values_format(self): method _check_attentions_for_generate (line 440) | def _check_attentions_for_generate( method _check_hidden_states_for_generate (line 451) | def _check_hidden_states_for_generate( method test_model_from_pretrained (line 463) | def test_model_from_pretrained(self): method test_beam_search_generate_dict_outputs_use_cache (line 469) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_greedy_generate_dict_outputs_use_cache (line 473) | def test_greedy_generate_dict_outputs_use_cache(self): method test_forward_with_logits_to_keep (line 477) | def test_forward_with_logits_to_keep(self): method test_generate_continue_from_past_key_values (line 483) | def test_generate_continue_from_past_key_values(self): class GitModelIntegrationTest (line 490) | class GitModelIntegrationTest(unittest.TestCase): method test_forward_pass (line 491) | def test_forward_pass(self): method test_inference_image_captioning (line 515) | def test_inference_image_captioning(self): method test_visual_question_answering (line 536) | def test_visual_question_answering(self): method test_batched_generation (line 560) | def test_batched_generation(self): method test_inference_interpolate_pos_encoding (line 579) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/git/test_processing_git.py class GitProcessorTest (line 27) | class GitProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 31) | def _setup_tokenizer(cls): FILE: tests/models/glm/test_modeling_glm.py class GlmModelTester (line 42) | class GlmModelTester(CausalLMModelTester): method __init__ (line 46) | def __init__(self, parent): class GlmModelTest (line 55) | class GlmModelTest(CausalLMModelTest, unittest.TestCase): class GlmIntegrationTest (line 61) | class GlmIntegrationTest(unittest.TestCase): method test_model_9b_fp16 (line 66) | def test_model_9b_fp16(self): method test_model_9b_bf16 (line 84) | def test_model_9b_bf16(self): method test_model_9b_eager (line 102) | def test_model_9b_eager(self): method test_model_9b_sdpa (line 135) | def test_model_9b_sdpa(self): method test_model_9b_flash_attn (line 159) | def test_model_9b_flash_attn(self): FILE: tests/models/glm4/test_modeling_glm4.py class Glm4ModelTester (line 42) | class Glm4ModelTester(CausalLMModelTester): method __init__ (line 46) | def __init__(self, parent): class Glm4ModelTest (line 55) | class Glm4ModelTest(CausalLMModelTest, unittest.TestCase): class Glm4IntegrationTest (line 63) | class Glm4IntegrationTest(unittest.TestCase): method tearDown (line 67) | def tearDown(self): method test_model_9b_fp16 (line 70) | def test_model_9b_fp16(self): method test_model_9b_bf16 (line 96) | def test_model_9b_bf16(self): method test_model_9b_eager (line 122) | def test_model_9b_eager(self): method test_model_9b_sdpa (line 153) | def test_model_9b_sdpa(self): method test_model_9b_flash_attn (line 187) | def test_model_9b_flash_attn(self): FILE: tests/models/glm46v/test_modeling_glm46v.py class Glm46VVisionText2TextModelTester (line 50) | class Glm46VVisionText2TextModelTester: method __init__ (line 51) | def __init__( method get_config (line 118) | def get_config(self): method prepare_config_and_inputs (line 130) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 143) | def prepare_config_and_inputs_for_common(self): class Glm46VModelTest (line 178) | class Glm46VModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.... method setUp (line 184) | def setUp(self): method test_config (line 188) | def test_config(self): method prepare_config_and_inputs_for_generate (line 192) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_sdpa_can_dispatch_on_flash (line 232) | def test_sdpa_can_dispatch_on_flash(self): method test_multi_gpu_data_parallel_forward (line 236) | def test_multi_gpu_data_parallel_forward(self): method test_generate_from_inputs_embeds_with_static_cache (line 240) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_inputs_embeds (line 243) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 263) | def test_inputs_embeds_matches_input_ids(self): class Glm46VIntegrationTest (line 286) | class Glm46VIntegrationTest(unittest.TestCase): method setUp (line 287) | def setUp(self): method tearDown (line 316) | def tearDown(self): method test_small_model_integration_test (line 320) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 359) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_with_video (line 384) | def test_small_model_integration_test_with_video(self): method test_small_model_integration_test_expand (line 423) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_batch_wo_image (line 455) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 488) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_flashatt2 (line 520) | def test_small_model_integration_test_batch_flashatt2(self): method test_small_model_integration_test_batch_wo_image_flashatt2 (line 555) | def test_small_model_integration_test_batch_wo_image_flashatt2(self): FILE: tests/models/glm46v/test_processor_glm46v.py class Glm46VProcessorTest (line 35) | class Glm46VProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 40) | def _setup_test_attributes(cls, processor): method _setup_from_pretrained (line 44) | def _setup_from_pretrained(cls, model_id, **kwargs): method _test_apply_chat_template (line 55) | def _test_apply_chat_template( method test_apply_chat_template_video_frame_sampling (line 156) | def test_apply_chat_template_video_frame_sampling(self): method test_model_input_names (line 257) | def test_model_input_names(self): FILE: tests/models/glm46v/test_video_processing_glm46v.py class Glm46VVideoProcessingTester (line 35) | class Glm46VVideoProcessingTester: method __init__ (line 36) | def __init__( method prepare_video_processor_dict (line 71) | def prepare_video_processor_dict(self): method prepare_video_metadata (line 82) | def prepare_video_metadata(self, videos): method expected_output_video_shape (line 103) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 138) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class Glm46VVideoProcessingTest (line 153) | class Glm46VVideoProcessingTest(VideoProcessingTestMixin, unittest.TestC... method setUp (line 157) | def setUp(self): method video_processor_dict (line 162) | def video_processor_dict(self): method test_video_processor_from_dict_with_kwargs (line 165) | def test_video_processor_from_dict_with_kwargs(self): method test_call_pil (line 174) | def test_call_pil(self): method test_call_numpy (line 196) | def test_call_numpy(self): method test_call_pytorch (line 216) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 235) | def test_call_numpy_4_channels(self): method test_nested_input (line 269) | def test_nested_input(self): method test_call_sample_frames (line 294) | def test_call_sample_frames(self): FILE: tests/models/glm4_moe/test_modeling_glm4_moe.py class Glm4MoeModelTester (line 37) | class Glm4MoeModelTester(CausalLMModelTester): method __init__ (line 41) | def __init__( class Glm4MoeModelTest (line 58) | class Glm4MoeModelTest(CausalLMModelTest, unittest.TestCase): class Glm4MoeIntegrationTest (line 67) | class Glm4MoeIntegrationTest(unittest.TestCase): method tearDown (line 68) | def tearDown(self): method test_compile_static_cache (line 75) | def test_compile_static_cache(self): FILE: tests/models/glm4_moe_lite/test_modeling_glm4_moe_lite.py class Glm4MoeLiteModelTester (line 37) | class Glm4MoeLiteModelTester(CausalLMModelTester): method __init__ (line 41) | def __init__( class Glm4MoeModelTest (line 61) | class Glm4MoeModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 67) | def test_tp_generation_quantized(self): method _check_past_key_values_for_generate (line 70) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... class Glm4MoeIntegrationTest (line 90) | class Glm4MoeIntegrationTest(unittest.TestCase): method tearDown (line 91) | def tearDown(self): method test_compile_static_cache (line 98) | def test_compile_static_cache(self): FILE: tests/models/glm4v/test_image_processing_glm4v.py class Glm4vImageProcessingTester (line 36) | class Glm4vImageProcessingTester: method __init__ (line 37) | def __init__( method prepare_image_processor_dict (line 68) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 80) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 116) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Glm4vImageProcessingTest (line 130) | class Glm4vImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 131) | def setUp(self): method image_processor_dict (line 136) | def image_processor_dict(self): method test_image_processor_properties (line 139) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 148) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 159) | def test_call_pil(self): method test_call_numpy (line 178) | def test_call_numpy(self): method test_call_pytorch (line 197) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 217) | def test_call_numpy_4_channels(self): FILE: tests/models/glm4v/test_modeling_glm4v.py class Glm4vVisionText2TextModelTester (line 50) | class Glm4vVisionText2TextModelTester: method __init__ (line 51) | def __init__( method get_config (line 118) | def get_config(self): method prepare_config_and_inputs (line 130) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 143) | def prepare_config_and_inputs_for_common(self): class Glm4vModelTest (line 178) | class Glm4vModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.T... method setUp (line 184) | def setUp(self): method test_config (line 188) | def test_config(self): method prepare_config_and_inputs_for_generate (line 192) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_sdpa_can_dispatch_on_flash (line 232) | def test_sdpa_can_dispatch_on_flash(self): method test_multi_gpu_data_parallel_forward (line 236) | def test_multi_gpu_data_parallel_forward(self): method test_generate_from_inputs_embeds_with_static_cache (line 240) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_inputs_embeds (line 243) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 263) | def test_inputs_embeds_matches_input_ids(self): class Glm4vIntegrationTest (line 286) | class Glm4vIntegrationTest(unittest.TestCase): method setUp (line 287) | def setUp(self): method tearDown (line 316) | def tearDown(self): method test_small_model_integration_test (line 320) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 359) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_with_video (line 384) | def test_small_model_integration_test_with_video(self): method test_small_model_integration_test_expand (line 423) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_batch_wo_image (line 455) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 488) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_flashatt2 (line 520) | def test_small_model_integration_test_batch_flashatt2(self): method test_small_model_integration_test_batch_wo_image_flashatt2 (line 555) | def test_small_model_integration_test_batch_wo_image_flashatt2(self): FILE: tests/models/glm4v/test_processor_glm4v.py class Glm4vProcessorTest (line 35) | class Glm4vProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 40) | def _setup_test_attributes(cls, processor): method _setup_from_pretrained (line 44) | def _setup_from_pretrained(cls, model_id, **kwargs): method _test_apply_chat_template (line 55) | def _test_apply_chat_template( method test_apply_chat_template_video_frame_sampling (line 156) | def test_apply_chat_template_video_frame_sampling(self): FILE: tests/models/glm4v/test_video_processing_glm4v.py class Glm4vVideoProcessingTester (line 35) | class Glm4vVideoProcessingTester: method __init__ (line 36) | def __init__( method prepare_video_processor_dict (line 71) | def prepare_video_processor_dict(self): method prepare_video_metadata (line 82) | def prepare_video_metadata(self, videos): method expected_output_video_shape (line 103) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 138) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class Glm4vVideoProcessingTest (line 153) | class Glm4vVideoProcessingTest(VideoProcessingTestMixin, unittest.TestCa... method setUp (line 157) | def setUp(self): method video_processor_dict (line 162) | def video_processor_dict(self): method test_video_processor_from_dict_with_kwargs (line 165) | def test_video_processor_from_dict_with_kwargs(self): method test_call_pil (line 174) | def test_call_pil(self): method test_call_numpy (line 196) | def test_call_numpy(self): method test_call_pytorch (line 216) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 235) | def test_call_numpy_4_channels(self): method test_nested_input (line 269) | def test_nested_input(self): method test_call_sample_frames (line 294) | def test_call_sample_frames(self): FILE: tests/models/glm4v_moe/test_modeling_glm4v_moe.py class Glm4vMoeVisionText2TextModelTester (line 49) | class Glm4vMoeVisionText2TextModelTester: method __init__ (line 50) | def __init__( method get_config (line 127) | def get_config(self): method prepare_config_and_inputs (line 139) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 152) | def prepare_config_and_inputs_for_common(self): class Glm4vMoeModelTest (line 187) | class Glm4vMoeModelTest(ModelTesterMixin, GenerationTesterMixin, unittes... method setUp (line 193) | def setUp(self): method test_config (line 197) | def test_config(self): method prepare_config_and_inputs_for_generate (line 201) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_sdpa_can_dispatch_on_flash (line 241) | def test_sdpa_can_dispatch_on_flash(self): method test_multi_gpu_data_parallel_forward (line 245) | def test_multi_gpu_data_parallel_forward(self): method test_generate_compilation_all_outputs (line 249) | def test_generate_compilation_all_outputs(self): method test_generate_from_inputs_embeds_with_static_cache (line 253) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_inputs_embeds (line 256) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 276) | def test_inputs_embeds_matches_input_ids(self): class Glm4vMoeIntegrationTest (line 300) | class Glm4vMoeIntegrationTest(unittest.TestCase): method setUpClass (line 302) | def setUpClass(cls): method get_model (line 306) | def get_model(cls): method tearDownClass (line 314) | def tearDownClass(cls): method setUp (line 319) | def setUp(self): method tearDown (line 367) | def tearDown(self): method test_small_model_integration_test (line 370) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 391) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_with_video (line 418) | def test_small_model_integration_test_with_video(self): method test_small_model_integration_test_batch_flashatt2 (line 442) | def test_small_model_integration_test_batch_flashatt2(self): FILE: tests/models/glm_image/test_modeling_glm_image.py class GlmImageVisionText2TextModelTester (line 57) | class GlmImageVisionText2TextModelTester: method __init__ (line 58) | def __init__( method get_config (line 138) | def get_config(self): method prepare_config_and_inputs (line 148) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 161) | def prepare_config_and_inputs_for_common(self): class GlmImageModelTest (line 195) | class GlmImageModelTest(ModelTesterMixin, GenerationTesterMixin, unittes... method setUp (line 201) | def setUp(self): method test_config (line 205) | def test_config(self): method prepare_config_and_inputs_for_generate (line 209) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_training (line 259) | def test_training(self): method test_generate_without_input_ids (line 283) | def test_generate_without_input_ids(self): method test_eager_matches_sdpa_inference (line 288) | def test_eager_matches_sdpa_inference( method test_sdpa_can_dispatch_on_flash (line 294) | def test_sdpa_can_dispatch_on_flash(self): method test_multi_gpu_data_parallel_forward (line 298) | def test_multi_gpu_data_parallel_forward(self): method test_disk_offload_safetensors (line 304) | def test_disk_offload_safetensors(self): method test_disk_offload_bin (line 310) | def test_disk_offload_bin(self): method test_cpu_offload (line 316) | def test_cpu_offload(self): method test_model_parallelism (line 322) | def test_model_parallelism(self): method test_generate_from_inputs_embeds_with_static_cache (line 326) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_from_inputs_embeds (line 331) | def test_generate_from_inputs_embeds(self, _, num_beams): method test_inputs_embeds_matches_input_ids (line 335) | def test_inputs_embeds_matches_input_ids(self): method test_inputs_embeds (line 339) | def test_inputs_embeds(self): method test_generate_from_random_inputs_embeds (line 343) | def test_generate_from_random_inputs_embeds(self): method test_assisted_decoding_sample (line 347) | def test_assisted_decoding_sample(self): method test_prompt_lookup_decoding_matches_greedy_search (line 351) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_assisted_decoding_matches_greedy_search (line 356) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_training_gradient_checkpointing (line 360) | def test_training_gradient_checkpointing(self): method test_model_outputs_equivalence (line 364) | def test_model_outputs_equivalence(self): method test_training_gradient_checkpointing_use_reentrant (line 370) | def test_training_gradient_checkpointing_use_reentrant(self): method test_training_gradient_checkpointing_use_reentrant_false (line 376) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 382) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 386) | def test_retain_grad_hidden_states_attentions(self): method test_generate_compile_model_forward_fullgraph (line 390) | def test_generate_compile_model_forward_fullgraph(self): method test_flash_attention_2_continue_generate_with_position_ids (line 397) | def test_flash_attention_2_continue_generate_with_position_ids(self): method test_flash_attn_2_fp32_ln (line 404) | def test_flash_attn_2_fp32_ln(self): method test_flash_attn_2_from_config (line 411) | def test_flash_attn_2_from_config(self): method _image_features_prepare_config_and_inputs (line 414) | def _image_features_prepare_config_and_inputs(self): class GlmImageIntegrationTest (line 435) | class GlmImageIntegrationTest(unittest.TestCase): method setUpClass (line 441) | def setUpClass(cls): method get_model (line 445) | def get_model(cls): method tearDownClass (line 453) | def tearDownClass(cls): method setUp (line 458) | def setUp(self): method tearDown (line 484) | def tearDown(self): method test_processor_text_to_image (line 487) | def test_processor_text_to_image(self): method test_processor_image_to_image (line 497) | def test_processor_image_to_image(self): method test_text_to_image_generation (line 525) | def test_text_to_image_generation(self): method test_image_to_image_generation (line 585) | def test_image_to_image_generation(self): method test_flash_attention_generation (line 620) | def test_flash_attention_generation(self): FILE: tests/models/glm_image/test_processor_glm_image.py class GlmImageProcessorTest (line 35) | class GlmImageProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 40) | def _setup_test_attributes(cls, processor): method _setup_from_pretrained (line 44) | def _setup_from_pretrained(cls, model_id, **kwargs): method _setup_image_processor (line 52) | def _setup_image_processor(cls): method _setup_tokenizer (line 64) | def _setup_tokenizer(cls): method prepare_image_inputs (line 68) | def prepare_image_inputs(self, batch_size: int | None = None, nested: ... method _test_apply_chat_template (line 80) | def _test_apply_chat_template( method test_model_input_names (line 180) | def test_model_input_names(self): method test_tokenizer_defaults (line 194) | def test_tokenizer_defaults(self): FILE: tests/models/glm_moe_dsa/test_modeling_glm_moe_dsa.py class GlmMoeDsaModelTester (line 46) | class GlmMoeDsaModelTester(CausalLMModelTester): method __init__ (line 51) | def __init__( class GlmMoeDsaModelTest (line 74) | class GlmMoeDsaModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 80) | def test_tp_generation_quantized(self): method _check_past_key_values_for_generate (line 83) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_default_mlp_layer_types (line 100) | def test_default_mlp_layer_types(self): method test_eager_matches_sdpa_inference (line 108) | def test_eager_matches_sdpa_inference(self, *args): method test_left_padding_compatibility (line 112) | def test_left_padding_compatibility( method test_sdpa_padding_matches_padding_free_with_position_ids (line 118) | def test_sdpa_padding_matches_padding_free_with_position_ids( method test_training_overfit (line 124) | def test_training_overfit( method test_flash_attn_2_inference_equivalence_right_padding (line 131) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_assisted_decoding_matches_greedy_search (line 136) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_assisted_decoding_sample (line 140) | def test_assisted_decoding_sample(self): method test_generate_from_inputs_embeds_with_static_cache (line 144) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_compile_model_forward_fullgraph (line 148) | def test_generate_compile_model_forward_fullgraph(self): method test_generate_compilation_all_outputs (line 152) | def test_generate_compilation_all_outputs(self): method test_generate_with_static_cache (line 156) | def test_generate_with_static_cache(self): class GlmMoeDsaIntegrationTest (line 162) | class GlmMoeDsaIntegrationTest(unittest.TestCase): method test_glm_moe_dsa_fp8_inference (line 164) | def test_glm_moe_dsa_fp8_inference(self): FILE: tests/models/glm_ocr/test_modeling_glm_ocr.py class GlmOcrVisionText2TextModelTester (line 60) | class GlmOcrVisionText2TextModelTester: method __init__ (line 61) | def __init__( method get_config (line 129) | def get_config(self): method prepare_config_and_inputs (line 141) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 154) | def prepare_config_and_inputs_for_common(self): class GlmOcrModelTest (line 189) | class GlmOcrModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.... method setUp (line 195) | def setUp(self): method test_config (line 199) | def test_config(self): method prepare_config_and_inputs_for_generate (line 203) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_inputs_embeds (line 242) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 262) | def test_inputs_embeds_matches_input_ids(self): method test_generate_compile_model_forward_fullgraph (line 286) | def test_generate_compile_model_forward_fullgraph(self): class GlmOcrIntegrationTest (line 415) | class GlmOcrIntegrationTest(unittest.TestCase): method setUp (line 416) | def setUp(self): method tearDown (line 445) | def tearDown(self): method test_small_model_integration_test (line 449) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 486) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_with_video (line 509) | def test_small_model_integration_test_with_video(self): method test_small_model_integration_test_expand (line 548) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_batch_wo_image (line 578) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 609) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_flashatt2 (line 639) | def test_small_model_integration_test_batch_flashatt2(self): method test_small_model_integration_test_batch_wo_image_flashatt2 (line 674) | def test_small_model_integration_test_batch_wo_image_flashatt2(self): FILE: tests/models/glmasr/test_modeling_glmasr.py class GlmAsrModelTester (line 44) | class GlmAsrModelTester: method __init__ (line 45) | def __init__( method get_config (line 95) | def get_config(self): method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 115) | def prepare_config_and_inputs_for_common(self): class GlmAsrForConditionalGenerationModelTest (line 135) | class GlmAsrForConditionalGenerationModelTest( method setUp (line 147) | def setUp(self): method test_inputs_embeds_matches_input_ids (line 154) | def test_inputs_embeds_matches_input_ids(self): method test_sdpa_can_compile_dynamic (line 159) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 163) | def test_sdpa_can_dispatch_on_flash(self): method test_flash_attn_2_inference_equivalence_right_padding (line 167) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_model_base_model_prefix (line 171) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 174) | def test_sdpa_can_dispatch_composite_models(self): class GlmAsrForConditionalGenerationIntegrationTest (line 213) | class GlmAsrForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 214) | def setUp(self): method tearDown (line 218) | def tearDown(self): method test_single_batch_sub_30 (line 222) | def test_single_batch_sub_30(self): method test_single_batch_over_30 (line 263) | def test_single_batch_over_30(self): method test_batched (line 304) | def test_batched(self): FILE: tests/models/glpn/test_image_processing_glpn.py class GLPNImageProcessingTester (line 33) | class GLPNImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 56) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 63) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 76) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_depth_outputs (line 88) | def prepare_depth_outputs(self): class GLPNImageProcessingTest (line 106) | class GLPNImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 107) | def setUp(self): method test_image_processor_properties (line 112) | def test_image_processor_properties(self): method test_call_pil (line 120) | def test_call_pil(self): method test_call_numpy (line 133) | def test_call_numpy(self): method test_call_pytorch (line 147) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 161) | def test_call_numpy_4_channels(self): method test_backends_equivalence_batched (line 180) | def test_backends_equivalence_batched(self): method test_backends_equivalence_post_process_depth (line 201) | def test_backends_equivalence_post_process_depth(self): FILE: tests/models/glpn/test_modeling_glpn.py class GLPNConfigTester (line 39) | class GLPNConfigTester(ConfigTester): method create_and_test_config_common_properties (line 40) | def create_and_test_config_common_properties(self): class GLPNModelTester (line 47) | class GLPNModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 90) | def prepare_config_and_inputs(self): method get_config (line 100) | def get_config(self): method create_and_check_model (line 115) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_depth_estimation (line 125) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method prepare_config_and_inputs_for_common (line 135) | def prepare_config_and_inputs_for_common(self): class GLPNModelTest (line 143) | class GLPNModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 153) | def setUp(self): method test_config (line 157) | def test_config(self): method test_model (line 160) | def test_model(self): method test_batching_equivalence (line 164) | def test_batching_equivalence(self, atol=3e-4, rtol=3e-4): method test_for_depth_estimation (line 167) | def test_for_depth_estimation(self): method test_inputs_embeds (line 172) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 176) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 179) | def test_attention_outputs(self): method test_hidden_states_output (line 249) | def test_hidden_states_output(self): method test_training (line 285) | def test_training(self): method test_model_from_pretrained (line 310) | def test_model_from_pretrained(self): function prepare_img (line 317) | def prepare_img(): class GLPNModelIntegrationTest (line 325) | class GLPNModelIntegrationTest(unittest.TestCase): method test_inference_depth_estimation (line 327) | def test_inference_depth_estimation(self): FILE: tests/models/got_ocr2/test_image_processing_got_ocr2.py class GotOcr2ImageProcessingTester (line 29) | class GotOcr2ImageProcessingTester(unittest.TestCase): method __init__ (line 30) | def __init__( method prepare_image_processor_dict (line 60) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class GotOcr2ProcessingTest (line 87) | class GotOcr2ProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_backends_equivalence_crop_to_patches (line 106) | def test_backends_equivalence_crop_to_patches(self): method test_backends_equivalence_batched_crop_to_patches (line 126) | def test_backends_equivalence_batched_crop_to_patches(self): method test_crop_to_patches (line 150) | def test_crop_to_patches(self): method test_get_num_patches_without_images (line 178) | def test_get_num_patches_without_images(self): FILE: tests/models/got_ocr2/test_modeling_got_ocr2.py class GotOcr2VisionText2TextModelTester (line 45) | class GotOcr2VisionText2TextModelTester: method __init__ (line 46) | def __init__( method get_config (line 107) | def get_config(self): method prepare_config_and_inputs (line 115) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 121) | def prepare_config_and_inputs_for_common(self): class GotOcr2ModelTest (line 139) | class GotOcr2ModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 157) | def setUp(self): method test_config (line 161) | def test_config(self): class GotOcr2IntegrationTest (line 166) | class GotOcr2IntegrationTest(unittest.TestCase): method setUp (line 167) | def setUp(self): method tearDown (line 170) | def tearDown(self): method test_small_model_integration_test_got_ocr_stop_strings (line 174) | def test_small_model_integration_test_got_ocr_stop_strings(self): method test_small_model_integration_test_got_ocr_format (line 197) | def test_small_model_integration_test_got_ocr_format(self): method test_small_model_integration_test_got_ocr_fine_grained (line 213) | def test_small_model_integration_test_got_ocr_fine_grained(self): method test_small_model_integration_test_got_ocr_crop_to_patches (line 229) | def test_small_model_integration_test_got_ocr_crop_to_patches(self): method test_small_model_integration_test_got_ocr_multi_pages (line 245) | def test_small_model_integration_test_got_ocr_multi_pages(self): method test_small_model_integration_test_got_ocr_batched (line 264) | def test_small_model_integration_test_got_ocr_batched(self): FILE: tests/models/got_ocr2/test_processing_got_ocr2.py class GotOcr2ProcessorTest (line 24) | class GotOcr2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 28) | def _setup_tokenizer(cls): method test_image_processor_defaults (line 34) | def test_image_processor_defaults(self): method test_ocr_queries (line 37) | def test_ocr_queries(self): method test_processor_text_has_no_visual (line 64) | def test_processor_text_has_no_visual(self): FILE: tests/models/gpt2/test_modeling_gpt2.py class GPT2ModelTester (line 49) | class GPT2ModelTester(CausalLMModelTester): method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 64) | def prepare_config_and_inputs( method get_config (line 102) | def get_config(self, scale_attn_by_inverse_layer_idx=False, reorder_an... method prepare_config_and_inputs_for_common (line 109) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_decoder (line 116) | def prepare_config_and_inputs_for_decoder(self): class GPT2ModelTest (line 146) | class GPT2ModelTest(CausalLMModelTest, unittest.TestCase): method _prepare_for_class (line 176) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_gpt2_double_lm_head_model (line 200) | def test_gpt2_double_lm_head_model(self): method test_gpt2_scale_attn_by_inverse_layer_idx (line 235) | def test_gpt2_scale_attn_by_inverse_layer_idx(self): method test_gpt2_sdpa_matches_eager_with_scaling_configs (line 250) | def test_gpt2_sdpa_matches_eager_with_scaling_configs(self): method test_gpt2_fa2_matches_eager_with_scaling_configs (line 277) | def test_gpt2_fa2_matches_eager_with_scaling_configs(self): method test_gpt2_reorder_and_upcast_attn (line 303) | def test_gpt2_reorder_and_upcast_attn(self): method test_training_gradient_checkpointing (line 318) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 325) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 332) | def test_training_gradient_checkpointing_use_reentrant_true(self): class GPT2ModelLanguageGenerationTest (line 341) | class GPT2ModelLanguageGenerationTest(unittest.TestCase): method tearDown (line 342) | def tearDown(self): method _test_lm_generate_gpt2_helper (line 347) | def _test_lm_generate_gpt2_helper( method test_lm_generate_gpt2 (line 375) | def test_lm_generate_gpt2(self): method test_lm_generate_gpt2_with_gradient_checkpointing (line 379) | def test_lm_generate_gpt2_with_gradient_checkpointing(self): method test_lm_generate_gpt2_with_reorder_and_upcast_attn (line 383) | def test_lm_generate_gpt2_with_reorder_and_upcast_attn(self): method test_lm_generate_gpt2_with_scale_attn_by_inverse_layer_idx (line 387) | def test_lm_generate_gpt2_with_scale_attn_by_inverse_layer_idx(self): method test_gpt2_sample (line 391) | def test_gpt2_sample(self): method test_flash_attn_2_generate_padding_left (line 428) | def test_flash_attn_2_generate_padding_left(self): method test_batch_generation (line 470) | def test_batch_generation(self): method test_batch_generation_2heads (line 532) | def test_batch_generation_2heads(self): FILE: tests/models/gpt2/test_tokenization_gpt2.py class GPT2TokenizationTest (line 25) | class GPT2TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_pretokenized_inputs (line 36) | def test_pretokenized_inputs(self, *args, **kwargs): method test_padding_different_model_input_name (line 42) | def test_padding_different_model_input_name(self): method test_special_tokens_mask_input_pairs_and_bos_token (line 45) | def test_special_tokens_mask_input_pairs_and_bos_token(self): method test_tokenization_tiktoken (line 71) | def test_tokenization_tiktoken(self): class OPTTokenizationTest (line 89) | class OPTTokenizationTest(unittest.TestCase): method test_serialize_deserialize_fast_opt (line 90) | def test_serialize_deserialize_fast_opt(self): method test_fast_slow_equivalence (line 111) | def test_fast_slow_equivalence(self): method test_users_can_modify_bos (line 122) | def test_users_can_modify_bos(self): FILE: tests/models/gpt_bigcode/test_modeling_gpt_bigcode.py class GPTBigCodeModelTester (line 42) | class GPTBigCodeModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 98) | def prepare_config_and_inputs( method get_config (line 140) | def get_config( method get_pipeline_config (line 167) | def get_pipeline_config(self): method create_and_check_gpt_bigcode_model (line 172) | def create_and_check_gpt_bigcode_model(self, config, input_ids, input_... method create_and_check_gpt_bigcode_model_past (line 184) | def create_and_check_gpt_bigcode_model_past(self, config, input_ids, i... method create_and_check_gpt_bigcode_model_attention_mask_past (line 220) | def create_and_check_gpt_bigcode_model_attention_mask_past( method create_and_check_gpt_bigcode_model_past_large_inputs (line 262) | def create_and_check_gpt_bigcode_model_past_large_inputs( method create_and_check_lm_head_model (line 300) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method create_and_check_forward_and_backwards (line 309) | def create_and_check_forward_and_backwards( method create_and_check_gpt_bigcode_for_sequence_classification (line 326) | def create_and_check_gpt_bigcode_for_sequence_classification( method create_and_check_gpt_bigcode_for_token_classification (line 336) | def create_and_check_gpt_bigcode_for_token_classification( method create_and_check_gpt_bigcode_weight_initialization (line 346) | def create_and_check_gpt_bigcode_weight_initialization(self, config, *... method prepare_config_and_inputs_for_common (line 354) | def prepare_config_and_inputs_for_common(self): class GPTBigCodeModelTest (line 377) | class GPTBigCodeModelTest(ModelTesterMixin, GenerationTesterMixin, Pipel... method _prepare_for_class (line 405) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 410) | def setUp(self): method tearDown (line 414) | def tearDown(self): method test_config (line 419) | def test_config(self): method test_retain_grad_hidden_states_attentions (line 423) | def test_retain_grad_hidden_states_attentions(self): method test_cpu_offload (line 427) | def test_cpu_offload(self): method test_disk_offload (line 431) | def test_disk_offload(self): method test_past_key_values_format (line 435) | def test_past_key_values_format(self): method test_generate_continue_from_inputs_embeds (line 439) | def test_generate_continue_from_inputs_embeds(self): method test_gpt_bigcode_model (line 442) | def test_gpt_bigcode_model(self): method test_gpt_bigcode_model_past (line 446) | def test_gpt_bigcode_model_past(self): method test_gpt_bigcode_model_att_mask_past (line 450) | def test_gpt_bigcode_model_att_mask_past(self): method test_gpt_bigcode_model_past_large_inputs (line 454) | def test_gpt_bigcode_model_past_large_inputs(self): method test_gpt_bigcode_lm_head_model (line 458) | def test_gpt_bigcode_lm_head_model(self): method test_gpt_bigcode_sequence_classification_model (line 462) | def test_gpt_bigcode_sequence_classification_model(self): method test_gpt_bigcode_token_classification_model (line 466) | def test_gpt_bigcode_token_classification_model(self): method test_gpt_bigcode_scale_attn_by_inverse_layer_idx (line 470) | def test_gpt_bigcode_scale_attn_by_inverse_layer_idx(self): method test_gpt_bigcode_reorder_and_upcast_attn (line 474) | def test_gpt_bigcode_reorder_and_upcast_attn(self): method test_gpt_bigcode_weight_initialization (line 478) | def test_gpt_bigcode_weight_initialization(self): class GPTBigCodeMHAModelTest (line 484) | class GPTBigCodeMHAModelTest(GPTBigCodeModelTest): class GPTBigCodeModelLanguageGenerationTest (line 491) | class GPTBigCodeModelLanguageGenerationTest(unittest.TestCase): method test_generate_simple (line 492) | def test_generate_simple(self): method test_generate_batched (line 504) | def test_generate_batched(self): method test_newline_regression (line 523) | def test_newline_regression(self): class GPTBigCodeMQATest (line 541) | class GPTBigCodeMQATest(unittest.TestCase): method get_attention (line 542) | def get_attention(self, multi_query): method test_mqa_reduces_to_mha (line 554) | def test_mqa_reduces_to_mha(self, seed, is_train_mode=True): FILE: tests/models/gpt_neo/test_modeling_gpt_neo.py class GPTNeoModelTester (line 41) | class GPTNeoModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 133) | def get_config(self): method get_pipeline_config (line 148) | def get_pipeline_config(self): method create_and_check_gpt_neo_model (line 153) | def create_and_check_gpt_neo_model(self, config, input_ids, input_mask... method create_and_check_gpt_neo_model_past (line 166) | def create_and_check_gpt_neo_model_past(self, config, input_ids, input... method create_and_check_gpt_neo_model_attention_mask_past (line 202) | def create_and_check_gpt_neo_model_attention_mask_past(self, config, i... method create_and_check_gpt_neo_model_past_large_inputs (line 242) | def create_and_check_gpt_neo_model_past_large_inputs(self, config, inp... method create_and_check_lm_head_model (line 278) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method create_and_check_gpt_neo_for_question_answering (line 287) | def create_and_check_gpt_neo_for_question_answering( method create_and_check_gpt_neo_for_sequence_classification (line 298) | def create_and_check_gpt_neo_for_sequence_classification( method create_and_check_gpt_neo_for_token_classification (line 308) | def create_and_check_gpt_neo_for_token_classification( method create_and_check_forward_and_backwards (line 318) | def create_and_check_forward_and_backwards( method prepare_config_and_inputs_for_common (line 331) | def prepare_config_and_inputs_for_common(self): class GPTNeoModelTest (line 354) | class GPTNeoModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method _prepare_for_class (line 380) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 384) | def setUp(self): method test_config (line 388) | def test_config(self): method test_gpt_neo_model (line 391) | def test_gpt_neo_model(self): method test_gpt_neo_model_past (line 395) | def test_gpt_neo_model_past(self): method test_gpt_neo_model_att_mask_past (line 399) | def test_gpt_neo_model_att_mask_past(self): method test_gpt_neo_model_past_large_inputs (line 403) | def test_gpt_neo_model_past_large_inputs(self): method test_gpt_neo_lm_head_model (line 407) | def test_gpt_neo_lm_head_model(self): method test_gpt_neo_question_answering_model (line 411) | def test_gpt_neo_question_answering_model(self): method test_gpt_neo_sequence_classification_model (line 415) | def test_gpt_neo_sequence_classification_model(self): method test_gpt_neo_token_classification_model (line 419) | def test_gpt_neo_token_classification_model(self): method test_gpt_neo_gradient_checkpointing (line 423) | def test_gpt_neo_gradient_checkpointing(self): method _get_hidden_states (line 427) | def _get_hidden_states(self): method test_local_attn_probs (line 445) | def test_local_attn_probs(self): class GPTNeoModelLanguageGenerationTest (line 473) | class GPTNeoModelLanguageGenerationTest(unittest.TestCase): method model (line 475) | def model(self): method tokenizer (line 479) | def tokenizer(self): method test_lm_generate_gpt_neo (line 483) | def test_lm_generate_gpt_neo(self): method test_gpt_neo_sample (line 498) | def test_gpt_neo_sample(self): method test_batch_generation (line 512) | def test_batch_generation(self): method test_model_from_pretrained (line 559) | def test_model_from_pretrained(self): FILE: tests/models/gpt_neox/test_modeling_gpt_neox.py class GPTNeoXModelTester (line 39) | class GPTNeoXModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 104) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 121) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 128) | def create_and_check_model(self, config, input_ids, input_mask): method create_and_check_model_as_decoder (line 136) | def create_and_check_model_as_decoder(self, config, input_ids, input_m... method create_and_check_for_causal_lm (line 144) | def create_and_check_for_causal_lm(self, config, input_ids, input_mask... method create_and_check_for_question_answering (line 151) | def create_and_check_for_question_answering(self, config, input_ids, i... method create_and_check_for_sequence_classification (line 160) | def create_and_check_for_sequence_classification(self, config, input_i... method create_and_check_for_token_classification (line 169) | def create_and_check_for_token_classification(self, config, input_ids,... method create_and_check_decoder_model_past_large_inputs (line 177) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method create_and_check_cached_forward_with_and_without_attention_mask (line 214) | def create_and_check_cached_forward_with_and_without_attention_mask(se... method prepare_config_and_inputs_for_common (line 253) | def prepare_config_and_inputs_for_common(self): class GPTNeoXModelTest (line 261) | class GPTNeoXModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 287) | def setUp(self): method test_config (line 291) | def test_config(self): method test_model (line 294) | def test_model(self): method test_model_as_decoder (line 298) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 302) | def test_model_as_decoder_with_default_input_mask(self): method test_decoder_model_past_large_inputs (line 309) | def test_decoder_model_past_large_inputs(self): method test_model_for_causal_lm (line 313) | def test_model_for_causal_lm(self): method test_model_for_question_answering (line 317) | def test_model_for_question_answering(self): method test_model_for_sequence_classification (line 321) | def test_model_for_sequence_classification(self): method test_model_for_token_classification (line 325) | def test_model_for_token_classification(self): method test_cached_forward_with_and_without_attention_mask (line 329) | def test_cached_forward_with_and_without_attention_mask(self): method test_feed_forward_chunking (line 334) | def test_feed_forward_chunking(self): class GPTNeoXLanguageGenerationTest (line 339) | class GPTNeoXLanguageGenerationTest(unittest.TestCase): method test_lm_generate_gptneox (line 341) | def test_lm_generate_gptneox(self): method test_lm_generate_flex_attn_gptneox (line 363) | def test_lm_generate_flex_attn_gptneox(self): method pythia_integration_test (line 387) | def pythia_integration_test(self): FILE: tests/models/gpt_neox/test_tokenization_gpt_neox.py class GPTNeoXTokenizationTest (line 24) | class GPTNeoXTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/gpt_neox_japanese/test_modeling_gpt_neox_japanese.py class GPTNeoXJapaneseModelTester (line 34) | class GPTNeoXJapaneseModelTester: method __init__ (line 35) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 104) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 123) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 130) | def create_and_check_model(self, config, input_ids, input_mask): method create_and_check_model_as_decoder (line 138) | def create_and_check_model_as_decoder(self, config, input_ids, input_m... method create_and_check_for_causal_lm (line 146) | def create_and_check_for_causal_lm(self, config, input_ids, input_mask... method create_and_check_decoder_model_past_large_inputs (line 153) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method prepare_config_and_inputs_for_common (line 190) | def prepare_config_and_inputs_for_common(self): class GPTNeoXModelJapaneseTest (line 198) | class GPTNeoXModelJapaneseTest(ModelTesterMixin, GenerationTesterMixin, ... method setUp (line 208) | def setUp(self): method test_config (line 212) | def test_config(self): method test_model (line 215) | def test_model(self): method test_model_as_decoder (line 219) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 223) | def test_model_as_decoder_with_default_input_mask(self): method test_decoder_model_past_large_inputs (line 230) | def test_decoder_model_past_large_inputs(self): method test_model_for_causal_lm (line 234) | def test_model_for_causal_lm(self): method test_generation (line 239) | def test_generation(self): method test_custom_4d_attention_mask (line 264) | def test_custom_4d_attention_mask(self): FILE: tests/models/gpt_neox_japanese/test_tokenization_gpt_neox_japanese.py class GPTNeoXJapaneseTokenizationTest (line 30) | class GPTNeoXJapaneseTokenizationTest(TokenizerTesterMixin, unittest.Tes... method setUpClass (line 37) | def setUpClass(cls): method get_tokenizer (line 75) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 80) | def get_input_output_texts(self, tokenizer): method get_clean_sequence (line 85) | def get_clean_sequence(self, tokenizer): method test_pretokenized_inputs (line 91) | def test_pretokenized_inputs(self): method test_maximum_encoding_length_pair_input (line 94) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 97) | def test_maximum_encoding_length_single_input(self): method test_full_tokenizer (line 100) | def test_full_tokenizer(self): method test_sequence_builders (line 121) | def test_sequence_builders(self): method test_conversion_reversible (line 134) | def test_conversion_reversible(self): method test_padding_different_model_input_name (line 139) | def test_padding_different_model_input_name(self): method test_sequence_ids (line 143) | def test_sequence_ids(self): FILE: tests/models/gpt_oss/test_modeling_gpt_oss.py class GptOssModelTester (line 61) | class GptOssModelTester(CausalLMModelTester): class GptOssModelTest (line 67) | class GptOssModelTest(CausalLMModelTest, unittest.TestCase): method test_default_flash_implementation_auto_correction (line 75) | def test_default_flash_implementation_auto_correction(self): method test_sdpa_can_dispatch_non_composite_models (line 113) | def test_sdpa_can_dispatch_non_composite_models(self): method test_eager_matches_sdpa_generate (line 117) | def test_eager_matches_sdpa_generate(self): method test_flash_attn_2_equivalence (line 121) | def test_flash_attn_2_equivalence(self): method test_eager_padding_matches_padding_free_with_position_ids (line 125) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_flex_attention_with_grads (line 129) | def test_flex_attention_with_grads(self): method test_generate_compile_model_forward_fullgraph (line 133) | def test_generate_compile_model_forward_fullgraph(self): method test_reverse_loading_mapping (line 136) | def test_reverse_loading_mapping(self, check_keys_were_modified=False): function distributed_worker (line 146) | def distributed_worker(quantized, model_size, kernels, attn_impl, mode): class GptOssIntegrationTest (line 233) | class GptOssIntegrationTest(unittest.TestCase): method generate_config_key (line 240) | def generate_config_key(quantized, model, kernels, attn_impl, mode): method setUp (line 244) | def setUp(self): method tearDown (line 247) | def tearDown(self): method load_and_forward (line 253) | def load_and_forward(self, model_id, attn_implementation, input_text, ... method run_distributed_test (line 285) | def run_distributed_test(quantized, model, kernels, attn_impl, mode): method test_model_outputs (line 366) | def test_model_outputs(self, quantized, model, kernels, attn_impl, mode): method test_model_outputs_distributed (line 437) | def test_model_outputs_distributed(self, quantized, model, kernels, at... method test_training_step (line 450) | def test_training_step(self, quantized, model, kernels, attn_impl, mode): method test_model_matches_original_20b (line 496) | def test_model_matches_original_20b(self): method test_model_matches_original_120b (line 561) | def test_model_matches_original_120b(self): FILE: tests/models/gpt_sw3/test_tokenization_gpt_sw3.py class GPTSw3TokenizationTest (line 28) | class GPTSw3TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 36) | def setUpClass(cls): method get_input_output_texts (line 46) | def get_input_output_texts(self, tokenizer): method test_convert_token_and_id (line 51) | def test_convert_token_and_id(self): method test_get_vocab (line 59) | def test_get_vocab(self): method test_vocab_size (line 67) | def test_vocab_size(self): method test_full_tokenizer (line 70) | def test_full_tokenizer(self): method test_fast_encode_decode (line 100) | def test_fast_encode_decode(self): method test_tokenizer_integration (line 117) | def test_tokenizer_integration(self): FILE: tests/models/gptj/test_modeling_gptj.py class GPTJModelTester (line 44) | class GPTJModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 99) | def prepare_config_and_inputs(self): method get_config (line 135) | def get_config(self): method get_pipeline_config (line 155) | def get_pipeline_config(self): method create_and_check_gptj_model (line 160) | def create_and_check_gptj_model(self, config, input_ids, input_mask, t... method create_and_check_gptj_model_past (line 172) | def create_and_check_gptj_model_past(self, config, input_ids, input_ma... method create_and_check_gptj_model_attention_mask_past (line 208) | def create_and_check_gptj_model_attention_mask_past(self, config, inpu... method create_and_check_gptj_model_past_large_inputs (line 248) | def create_and_check_gptj_model_past_large_inputs(self, config, input_... method create_and_check_lm_head_model (line 284) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method create_and_check_forward_and_backwards (line 293) | def create_and_check_forward_and_backwards( method prepare_config_and_inputs_for_common (line 306) | def prepare_config_and_inputs_for_common(self): class GPTJModelTest (line 326) | class GPTJModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method is_pipeline_test_to_skip (line 345) | def is_pipeline_test_to_skip( method _prepare_for_class (line 368) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 372) | def setUp(self): method test_config (line 376) | def test_config(self): method test_gptj_model (line 379) | def test_gptj_model(self): method test_gptj_model_past (line 383) | def test_gptj_model_past(self): method test_gptj_model_att_mask_past (line 387) | def test_gptj_model_att_mask_past(self): method test_gptj_model_past_large_inputs (line 391) | def test_gptj_model_past_large_inputs(self): method test_gptj_lm_head_model (line 395) | def test_gptj_lm_head_model(self): method test_gptj_gradient_checkpointing (line 399) | def test_gptj_gradient_checkpointing(self): method test_batch_generation (line 404) | def test_batch_generation(self): method test_model_from_pretrained (line 464) | def test_model_from_pretrained(self): class GPTJModelLanguageGenerationTest (line 471) | class GPTJModelLanguageGenerationTest(unittest.TestCase): method test_lm_generate_gptj (line 473) | def test_lm_generate_gptj(self): method test_gptj_sample (line 489) | def test_gptj_sample(self): FILE: tests/models/granite/test_modeling_granite.py class GraniteModelTester (line 43) | class GraniteModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self): method get_config (line 117) | def get_config(self): method create_and_check_model (line 134) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 144) | def prepare_config_and_inputs_for_common(self): class GraniteModelTest (line 160) | class GraniteModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 182) | def setUp(self): method test_config (line 186) | def test_config(self): method test_config_int_multiplier_roundtrip (line 189) | def test_config_int_multiplier_roundtrip(self): method test_model (line 197) | def test_model(self): class GraniteIntegrationTest (line 203) | class GraniteIntegrationTest(unittest.TestCase): method test_model_3b_logits_bf16 (line 205) | def test_model_3b_logits_bf16(self): method test_model_3b_logits (line 248) | def test_model_3b_logits(self): FILE: tests/models/granite_speech/test_modeling_granite_speech.py class GraniteSpeechForConditionalGenerationModelTester (line 55) | class GraniteSpeechForConditionalGenerationModelTester: method __init__ (line 56) | def __init__( method get_config (line 145) | def get_config(self): method prepare_config_and_inputs (line 156) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 163) | def prepare_config_and_inputs_for_common(self): method create_and_check_granite_speech_model_fp16_forward (line 179) | def create_and_check_granite_speech_model_fp16_forward(self, config, i... method create_and_check_granite_speech_model_fp16_autocast_forward (line 192) | def create_and_check_granite_speech_model_fp16_autocast_forward( class GraniteSpeechForConditionalGenerationModelTest (line 214) | class GraniteSpeechForConditionalGenerationModelTest( method setUp (line 225) | def setUp(self): method test_inputs_embeds (line 233) | def test_inputs_embeds(self): method test_sdpa_can_dispatch_composite_models (line 254) | def test_sdpa_can_dispatch_composite_models(self): method test_eager_matches_sdpa_generate (line 294) | def test_eager_matches_sdpa_generate(self): method test_model_base_model_prefix (line 298) | def test_model_base_model_prefix(self): class GraniteSpeechForConditionalGenerationIntegrationTest (line 302) | class GraniteSpeechForConditionalGenerationIntegrationTest(unittest.Test... method setUp (line 303) | def setUp(self): method tearDown (line 308) | def tearDown(self): method _get_prompt (line 311) | def _get_prompt(self, tokenizer): method _load_datasamples (line 324) | def _load_datasamples(self, num_samples): method test_small_model_integration_test_single (line 333) | def test_small_model_integration_test_single(self): method test_small_model_integration_test_batch (line 359) | def test_small_model_integration_test_batch(self): FILE: tests/models/granite_speech/test_processing_granite_speech.py class GraniteSpeechProcessorTest (line 38) | class GraniteSpeechProcessorTest(unittest.TestCase): method setUp (line 39) | def setUp(self): method get_tokenizer (line 45) | def get_tokenizer(self, **kwargs): method get_audio_processor (line 48) | def get_audio_processor(self, **kwargs): method tearDown (line 51) | def tearDown(self): method test_save_load_pretrained_default (line 54) | def test_save_load_pretrained_default(self): method test_requires_text (line 72) | def test_requires_text(self): method test_bad_text_fails (line 84) | def test_bad_text_fails(self): method test_bad_nested_text_fails (line 93) | def test_bad_nested_text_fails(self): method test_bad_audio_fails (line 105) | def test_bad_audio_fails(self): method test_nested_bad_audio_fails (line 117) | def test_nested_bad_audio_fails(self): method test_audio_token_filling_same_len_feature_tensors (line 135) | def test_audio_token_filling_same_len_feature_tensors(self, vec_dims, ... method test_audio_token_filling_varying_len_feature_list (line 164) | def test_audio_token_filling_varying_len_feature_list(self): method test_device_placement (line 200) | def test_device_placement(self, device): FILE: tests/models/granitemoe/test_modeling_granitemoe.py class GraniteMoeModelTester (line 41) | class GraniteMoeModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method create_and_check_model (line 132) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 142) | def prepare_config_and_inputs_for_common(self): class GraniteMoeModelTest (line 158) | class GraniteMoeModelTest(ModelTesterMixin, GenerationTesterMixin, unitt... method setUp (line 180) | def setUp(self): method test_config (line 184) | def test_config(self): method test_model (line 187) | def test_model(self): class GraniteMoeIntegrationTest (line 193) | class GraniteMoeIntegrationTest(unittest.TestCase): method test_model_3b_logits (line 195) | def test_model_3b_logits(self): method test_model_3b_generation (line 237) | def test_model_3b_generation(self): FILE: tests/models/granitemoehybrid/test_modeling_granitemoehybrid.py class GraniteMoeHybridModelTester (line 52) | class GraniteMoeHybridModelTester(BambaModelTester): method __init__ (line 58) | def __init__( method _update_layer_configs (line 70) | def _update_layer_configs(self): method get_config (line 77) | def get_config(self): class GraniteMoeHybridModelTest (line 85) | class GraniteMoeHybridModelTest(ModelTesterMixin, GenerationTesterMixin,... method setUp (line 108) | def setUp(self): method test_config (line 112) | def test_config(self): method test_model (line 115) | def test_model(self): method test_for_causal_lm (line 119) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 123) | def test_decoder_model_past_with_large_inputs(self): method test_attention_outputs (line 127) | def test_attention_outputs(self): method test_batching_equivalence (line 191) | def test_batching_equivalence(self): method test_left_padding_compatibility (line 199) | def test_left_padding_compatibility(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 207) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 213) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_seq_idx_and_fa_kwargs (line 223) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method _get_conv_state_shape (line 305) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 313) | def _get_recurrent_state_shape(self, batch_size: int, config): method test_config_requires_mamba_or_attention_layers (line 316) | def test_config_requires_mamba_or_attention_layers(self): class GraniteMoeHybridIntegrationTest (line 323) | class GraniteMoeHybridIntegrationTest(unittest.TestCase): method test_model_logits (line 326) | def test_model_logits(self, device): method test_model_generation (line 359) | def test_model_generation(self, device): FILE: tests/models/granitemoeshared/test_modeling_granitemoeshared.py class GraniteMoeSharedModelTester (line 41) | class GraniteMoeSharedModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self): method get_config (line 117) | def get_config(self): method create_and_check_model (line 135) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 145) | def prepare_config_and_inputs_for_common(self): class GraniteMoeSharedModelTest (line 161) | class GraniteMoeSharedModelTest(ModelTesterMixin, GenerationTesterMixin,... method setUp (line 183) | def setUp(self): method test_config (line 187) | def test_config(self): method test_model (line 190) | def test_model(self): class GraniteMoeSharedIntegrationTest (line 196) | class GraniteMoeSharedIntegrationTest(unittest.TestCase): method test_model_3b_logits (line 198) | def test_model_3b_logits(self): method test_model_3b_generation (line 240) | def test_model_3b_generation(self): FILE: tests/models/grounding_dino/test_image_processing_grounding_dino.py class GroundingDinoImageProcessingTester (line 42) | class GroundingDinoImageProcessingTester: method __init__ (line 43) | def __init__( method prepare_image_processor_dict (line 78) | def prepare_image_processor_dict(self): method get_expected_values (line 91) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 125) | def expected_output_image_shape(self, images): method get_fake_grounding_dino_output (line 129) | def get_fake_grounding_dino_output(self): method prepare_image_inputs (line 137) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class GroundingDinoImageProcessingTest (line 151) | class GroundingDinoImageProcessingTest(AnnotationFormatTestMixin, ImageP... method setUp (line 152) | def setUp(self): method image_processor_dict (line 160) | def image_processor_dict(self): method test_image_processor_properties (line 164) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 176) | def test_image_processor_from_dict_with_kwargs(self): method test_post_process_object_detection (line 185) | def test_post_process_object_detection(self): method test_call_pytorch_with_coco_detection_annotations (line 204) | def test_call_pytorch_with_coco_detection_annotations(self): method test_batched_coco_detection_annotations (line 250) | def test_batched_coco_detection_annotations(self): method test_call_pytorch_with_coco_panoptic_annotations (line 370) | def test_call_pytorch_with_coco_panoptic_annotations(self): method test_batched_coco_panoptic_annotations (line 422) | def test_batched_coco_panoptic_annotations(self): method test_max_width_max_height_resizing_and_pad_strategy (line 546) | def test_max_width_max_height_resizing_and_pad_strategy(self): method test_longest_edge_shortest_edge_resizing_strategy (line 593) | def test_longest_edge_shortest_edge_resizing_strategy(self): FILE: tests/models/grounding_dino/test_modeling_grounding_dino.py function generate_fake_bounding_boxes (line 61) | def generate_fake_bounding_boxes(n_boxes): class GroundingDinoModelTester (line 94) | class GroundingDinoModelTester: method __init__ (line 95) | def __init__( method prepare_config_and_inputs (line 151) | def prepare_config_and_inputs(self): method get_config (line 177) | def get_config(self): method prepare_config_and_inputs_for_common (line 216) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 221) | def create_and_check_model(self, config, pixel_values, pixel_mask, inp... method create_and_check_object_detection_head_model (line 230) | def create_and_check_object_detection_head_model(self, config, pixel_v... class GroundingDinoModelTest (line 248) | class GroundingDinoModelTest(ModelTesterMixin, PipelineTesterMixin, unit... method _prepare_for_class (line 260) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 286) | def setUp(self): method test_config (line 295) | def test_config(self): method test_model (line 298) | def test_model(self): method test_object_detection_head_model (line 302) | def test_object_detection_head_model(self): method test_inputs_embeds (line 307) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 311) | def test_model_get_set_embeddings(self): method test_resize_tokens_embeddings (line 315) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 319) | def test_feed_forward_chunking(self): method test_load_save_without_tied_weights (line 323) | def test_load_save_without_tied_weights(self): method test_tie_weights_is_not_modified (line 326) | def test_tie_weights_is_not_modified(self): method test_attention_outputs (line 339) | def test_attention_outputs(self): method test_hidden_states_output (line 434) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 493) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 523) | def test_forward_signature(self): method test_backbone_selection (line 535) | def test_backbone_selection(self): method test_two_stage_training (line 578) | def test_two_stage_training(self): method test_tied_weights_keys (line 593) | def test_tied_weights_keys(self): function prepare_img (line 630) | def prepare_img(): function prepare_text (line 635) | def prepare_text(): class GroundingDinoModelIntegrationTests (line 643) | class GroundingDinoModelIntegrationTests(unittest.TestCase): method default_processor (line 645) | def default_processor(self): method test_inference_object_detection_head (line 648) | def test_inference_object_detection_head(self): method test_inference_object_detection_head_equivalence_cpu_accelerator (line 725) | def test_inference_object_detection_head_equivalence_cpu_accelerator(s... method test_cross_attention_mask (line 765) | def test_cross_attention_mask(self): method test_grounding_dino_loss (line 791) | def test_grounding_dino_loss(self): FILE: tests/models/grounding_dino/test_processing_grounding_dino.py class GroundingDinoProcessorTest (line 34) | class GroundingDinoProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 43) | def _setup_image_processor(cls): method _setup_tokenizer (line 57) | def _setup_tokenizer(cls): method test_tokenizer_defaults (line 66) | def test_tokenizer_defaults(self): method prepare_text_inputs (line 69) | def prepare_text_inputs(self, batch_size: int | None = None, **kwargs): method get_fake_grounding_dino_output (line 83) | def get_fake_grounding_dino_output(self): method get_fake_grounding_dino_input_ids (line 91) | def get_fake_grounding_dino_input_ids(self): method test_post_process_grounded_object_detection (line 95) | def test_post_process_grounded_object_detection(self): method test_text_preprocessing_equivalence (line 113) | def test_text_preprocessing_equivalence(self): method test_processor_text_has_no_visual (line 136) | def test_processor_text_has_no_visual(self): FILE: tests/models/groupvit/test_modeling_groupvit.py class GroupViTVisionModelTester (line 51) | class GroupViTVisionModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self): method get_config (line 101) | def get_config(self): method create_and_check_model (line 117) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 128) | def prepare_config_and_inputs_for_common(self): class GroupViTVisionModelTest (line 136) | class GroupViTVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 146) | def setUp(self): method test_config (line 152) | def test_config(self): method test_inputs_embeds (line 156) | def test_inputs_embeds(self): method test_batching_equivalence (line 160) | def test_batching_equivalence(self): method test_model_get_set_embeddings (line 163) | def test_model_get_set_embeddings(self): method test_forward_signature (line 172) | def test_forward_signature(self): method test_model (line 184) | def test_model(self): method test_attention_outputs (line 188) | def test_attention_outputs(self): method test_training (line 253) | def test_training(self): method test_training_gradient_checkpointing (line 257) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 261) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 265) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 269) | def test_retain_grad_hidden_states_attentions(self): method test_model_from_pretrained (line 329) | def test_model_from_pretrained(self): class GroupViTTextModelTester (line 335) | class GroupViTTextModelTester: method __init__ (line 336) | def __init__( method prepare_config_and_inputs (line 372) | def prepare_config_and_inputs(self): method get_config (line 391) | def get_config(self): method create_and_check_model (line 404) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 414) | def prepare_config_and_inputs_for_common(self): class GroupViTTextModelTest (line 422) | class GroupViTTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 425) | def setUp(self): method test_config (line 429) | def test_config(self): method test_model (line 432) | def test_model(self): method test_training (line 437) | def test_training(self): method test_training_gradient_checkpointing (line 441) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 445) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 449) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 453) | def test_inputs_embeds(self): method test_model_from_pretrained (line 457) | def test_model_from_pretrained(self): class GroupViTModelTester (line 463) | class GroupViTModelTester: method __init__ (line 464) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 476) | def prepare_config_and_inputs(self): method get_config (line 484) | def get_config(self): method create_and_check_model (line 491) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 502) | def prepare_config_and_inputs_for_common(self): class GroupViTModelTest (line 515) | class GroupViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 522) | def setUp(self): method test_model (line 529) | def test_model(self): method test_config (line 533) | def test_config(self): method test_batching_equivalence (line 537) | def test_batching_equivalence(self): method test_hidden_states_output (line 541) | def test_hidden_states_output(self): method test_inputs_embeds (line 545) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 549) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 553) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 556) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 572) | def test_model_from_pretrained(self): method _image_features_get_expected_num_attentions (line 577) | def _image_features_get_expected_num_attentions(self, model_tester=None): method _image_features_get_expected_num_hidden_states (line 583) | def _image_features_get_expected_num_hidden_states(self, model_tester=... function prepare_img (line 590) | def prepare_img(): class GroupViTModelIntegrationTest (line 598) | class GroupViTModelIntegrationTest(unittest.TestCase): method test_inference (line 600) | def test_inference(self): FILE: tests/models/helium/test_modeling_helium.py class HeliumModelTester (line 37) | class HeliumModelTester(CausalLMModelTester): class HeliumModelTest (line 43) | class HeliumModelTest(CausalLMModelTest, unittest.TestCase): class HeliumIntegrationTest (line 50) | class HeliumIntegrationTest(unittest.TestCase): method test_model_2b (line 53) | def test_model_2b(self): FILE: tests/models/herbert/test_tokenization_herbert.py class HerbertTokenizationTest (line 25) | class HerbertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/hgnet_v2/test_modeling_hgnet_v2.py class HGNetV2ModelTester (line 32) | class HGNetV2ModelTester: method __init__ (line 33) | def __init__( method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs(self): method get_config (line 95) | def get_config(self): method create_and_check_backbone (line 116) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 145) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 153) | def prepare_config_and_inputs_for_common(self): class RTDetrResNetBackboneTest (line 161) | class RTDetrResNetBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 166) | def setUp(self): class HGNetV2ForImageClassificationTest (line 171) | class HGNetV2ForImageClassificationTest(ModelTesterMixin, PipelineTester... method setUp (line 183) | def setUp(self): method test_attention_outputs (line 187) | def test_attention_outputs(self): method test_model_get_set_embeddings (line 191) | def test_model_get_set_embeddings(self): method test_inputs_embeds (line 195) | def test_inputs_embeds(self): method test_model_common_attributes (line 199) | def test_model_common_attributes(self): method test_backbone (line 202) | def test_backbone(self): method test_hidden_states_output (line 206) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 239) | def test_retain_grad_hidden_states_attentions(self): method test_feed_forward_chunking (line 243) | def test_feed_forward_chunking(self): method test_for_image_classification (line 246) | def test_for_image_classification(self): method test_model_from_pretrained (line 251) | def test_model_from_pretrained(self): FILE: tests/models/hiera/test_modeling_hiera.py class HieraModelTester (line 50) | class HieraModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 99) | def prepare_config_and_inputs(self): method get_config (line 110) | def get_config(self): method create_and_check_model (line 130) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 142) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_pretraining (line 174) | def create_and_check_for_pretraining(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 195) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 213) | def prepare_config_and_inputs_for_common(self): class HieraModelTest (line 225) | class HieraModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 250) | def setUp(self): method test_config (line 254) | def test_config(self): method test_batching_equivalence (line 262) | def test_batching_equivalence(self, atol=3e-4, rtol=3e-4): method test_model_get_set_embeddings (line 266) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 276) | def test_attention_outputs(self): method test_hidden_states_output (line 340) | def test_hidden_states_output(self): method test_model_outputs_equivalence (line 399) | def test_model_outputs_equivalence(self): method test_feed_forward_chunking (line 480) | def test_feed_forward_chunking(self): method test_inputs_embeds (line 484) | def test_inputs_embeds(self): method test_model_common_attributes (line 487) | def test_model_common_attributes(self): method test_model (line 496) | def test_model(self): method test_backbone (line 500) | def test_backbone(self): method test_for_pretraining (line 504) | def test_for_pretraining(self): method test_for_image_classification (line 508) | def test_for_image_classification(self): method test_model_from_pretrained (line 513) | def test_model_from_pretrained(self): function prepare_img (line 520) | def prepare_img(): class HieraModelIntegrationTest (line 528) | class HieraModelIntegrationTest(unittest.TestCase): method default_image_processor (line 530) | def default_image_processor(self): method test_inference_image_classification_head (line 533) | def test_inference_image_classification_head(self): method test_inference_interpolate_pos_encoding (line 562) | def test_inference_interpolate_pos_encoding(self): method test_inference_for_pretraining (line 590) | def test_inference_for_pretraining(self): class HieraBackboneTest (line 629) | class HieraBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 633) | def setUp(self): FILE: tests/models/higgs_audio_v2/test_modeling_higgs_audio_v2.py class HiggsAudioV2ModelTester (line 47) | class HiggsAudioV2ModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 132) | def prepare_config_and_inputs(self): method get_config (line 165) | def get_config(self): method create_and_check_model (line 168) | def create_and_check_model(self, config, input_ids): method prepare_config_and_inputs_for_common (line 175) | def prepare_config_and_inputs_for_common(self): class HiggsAudioV2ModelTest (line 187) | class HiggsAudioV2ModelTest(ModelTesterMixin, GenerationTesterMixin, uni... method setUp (line 192) | def setUp(self): method _get_logits_processor_kwargs (line 196) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method test_config (line 212) | def test_config(self): method test_assisted_decoding_matches_greedy_search (line 218) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_assisted_decoding_sample (line 223) | def test_assisted_decoding_sample(self): method test_beam_sample_generate (line 228) | def test_beam_sample_generate(self): method test_beam_search_generate (line 233) | def test_beam_search_generate(self): method test_beam_search_generate_dict_output (line 238) | def test_beam_search_generate_dict_output(self): method test_beam_search_generate_dict_outputs_use_cache (line 243) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_beam_sample_generate_dict_output (line 248) | def test_beam_sample_generate_dict_output(self): method test_generate_from_inputs_embeds_1_beam_search (line 253) | def test_generate_from_inputs_embeds_1_beam_search(self, _, num_beams): method test_model_parallel_beam_search (line 258) | def test_model_parallel_beam_search(self): method test_prompt_lookup_decoding_matches_greedy_search (line 263) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_prompt_lookup_decoding_stops_at_eos (line 268) | def test_prompt_lookup_decoding_stops_at_eos(self): method test_model_get_set_embeddings (line 272) | def test_model_get_set_embeddings(self): method test_tie_model_weights (line 276) | def test_tie_model_weights(self): method test_inputs_embeds_matches_input_ids (line 280) | def test_inputs_embeds_matches_input_ids(self): method test_resize_tokens_embeddings (line 284) | def test_resize_tokens_embeddings(self): method test_tied_weights_keys (line 288) | def test_tied_weights_keys(self): method test_flash_attention_2_continue_generate_with_position_ids (line 294) | def test_flash_attention_2_continue_generate_with_position_ids(self): method _check_scores (line 297) | def _check_scores(self, batch_size, scores, generated_length, config): method _check_logits (line 303) | def _check_logits(self, batch_size, logits, config): method test_greedy_generate (line 311) | def test_greedy_generate(self): method test_sample_generate (line 320) | def test_sample_generate(self): method test_forward_with_logits_to_keep (line 328) | def test_forward_with_logits_to_keep(self): method test_generate_continue_from_past_key_values (line 352) | def test_generate_continue_from_past_key_values(self): class HiggsAudioV2ForConditionalGenerationIntegrationTest (line 441) | class HiggsAudioV2ForConditionalGenerationIntegrationTest(unittest.TestC... method setUp (line 442) | def setUp(self): method tearDown (line 446) | def tearDown(self): method test_single_speaker_smart_voice (line 452) | def test_single_speaker_smart_voice(self): method test_multi_speaker_smart_voice (line 601) | def test_multi_speaker_smart_voice(self): method test_zero_shot_voice_cloning (line 763) | def test_zero_shot_voice_cloning(self): method test_multi_speaker_voice_cloning (line 936) | def test_multi_speaker_voice_cloning(self): method test_batched_inference (line 1103) | def test_batched_inference(self): FILE: tests/models/higgs_audio_v2_tokenizer/test_modeling_higgs_audio_v2_tokenizer.py class HiggsAudioV2TokenizerModelTester (line 45) | class HiggsAudioV2TokenizerModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 74) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 81) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_model_class (line 85) | def prepare_config_and_inputs_for_model_class(self, model_class): method get_config (line 93) | def get_config(self): method create_and_check_model_forward (line 102) | def create_and_check_model_forward(self, config, inputs_dict): class HiggsAudioV2TokenizerModelTest (line 109) | class HiggsAudioV2TokenizerModelTest(ModelTesterMixin, unittest.TestCase): method _prepare_for_class (line 122) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 131) | def setUp(self): method test_config (line 137) | def test_config(self): method test_model_forward (line 140) | def test_model_forward(self): method test_forward_signature (line 144) | def test_forward_signature(self): method test_batching_equivalence (line 156) | def test_batching_equivalence(self, atol=2e-4, rtol=2e-4): method test_gradient_checkpointing_backward_compatibility (line 159) | def test_gradient_checkpointing_backward_compatibility(self): method test_can_load_with_meta_device_context_manager (line 173) | def test_can_load_with_meta_device_context_manager(self): method test_model_is_small (line 177) | def test_model_is_small(self): method test_inputs_embeds (line 181) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 185) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 189) | def test_retain_grad_hidden_states_attentions(self): method test_torchscript_output_attentions (line 193) | def test_torchscript_output_attentions(self): method test_torchscript_output_hidden_state (line 197) | def test_torchscript_output_hidden_state(self): method _create_and_check_torchscript (line 201) | def _create_and_check_torchscript(self, config, inputs_dict): method test_attention_outputs (line 292) | def test_attention_outputs(self): method test_hidden_states_output (line 296) | def test_hidden_states_output(self): method test_determinism (line 300) | def test_determinism(self): method test_model_outputs_equivalence (line 327) | def test_model_outputs_equivalence(self): method test_initialization (line 366) | def test_initialization(self): method test_flash_attn_2_inference_equivalence (line 390) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 418) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_sdpa_can_compile_dynamic (line 422) | def test_sdpa_can_compile_dynamic(self): FILE: tests/models/hubert/test_modeling_hubert.py class HubertModelTester (line 47) | class HubertModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method get_config (line 114) | def get_config(self): method create_and_check_model (line 137) | def create_and_check_model(self, config, input_values, attention_mask): method create_and_check_batch_inference (line 146) | def create_and_check_batch_inference(self, config, input_values, *args): method check_ctc_loss (line 172) | def check_ctc_loss(self, config, input_values, *args): method check_seq_classifier_loss (line 200) | def check_seq_classifier_loss(self, config, input_values, *args): method check_ctc_training (line 225) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_training (line 254) | def check_seq_classifier_training(self, config, input_values, *args): method check_labels_out_of_vocab (line 277) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 291) | def prepare_config_and_inputs_for_common(self): class HubertModelTest (line 298) | class HubertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 310) | def setUp(self): method test_config (line 314) | def test_config(self): method test_model (line 317) | def test_model(self): method test_ctc_loss_inference (line 321) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 325) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 329) | def test_ctc_train(self): method test_seq_classifier_train (line 333) | def test_seq_classifier_train(self): method test_labels_out_of_vocab (line 337) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 342) | def test_inputs_embeds(self): method test_forward_signature (line 346) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 352) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 356) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 359) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 403) | def _mock_init_weights(self, module): method test_feed_forward_chunking (line 416) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 420) | def test_model_from_pretrained(self): class HubertRobustModelTest (line 426) | class HubertRobustModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 429) | def setUp(self): method test_config (line 435) | def test_config(self): method test_model (line 438) | def test_model(self): method test_batched_inference (line 442) | def test_batched_inference(self): method test_ctc_loss_inference (line 446) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 450) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 454) | def test_ctc_train(self): method test_seq_classifier_train (line 458) | def test_seq_classifier_train(self): method test_labels_out_of_vocab (line 462) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 467) | def test_inputs_embeds(self): method test_forward_signature (line 471) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 475) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 479) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 482) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 526) | def _mock_init_weights(self, module): method test_feed_forward_chunking (line 539) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 543) | def test_model_from_pretrained(self): class HubertUtilsTest (line 549) | class HubertUtilsTest(unittest.TestCase): method test_compute_mask_indices (line 550) | def test_compute_mask_indices(self): method test_compute_mask_indices_overlap (line 561) | def test_compute_mask_indices_overlap(self): class HubertModelIntegrationTest (line 578) | class HubertModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 579) | def _load_datasamples(self, num_samples): method _load_superb (line 590) | def _load_superb(self, task, num_samples): method test_inference_ctc_batched (line 597) | def test_inference_ctc_batched(self): method test_inference_keyword_spotting (line 620) | def test_inference_keyword_spotting(self): method test_inference_intent_classification (line 641) | def test_inference_intent_classification(self): method test_inference_speaker_identification (line 680) | def test_inference_speaker_identification(self): method test_inference_emotion_recognition (line 706) | def test_inference_emotion_recognition(self): method test_inference_distilhubert (line 728) | def test_inference_distilhubert(self): method test_inference_hubert_25hz (line 771) | def test_inference_hubert_25hz(self): FILE: tests/models/hunyuan_v1_dense/test_modeling_hunyuan_v1_dense.py class HunYuanDenseV1ModelTester (line 34) | class HunYuanDenseV1ModelTester(CausalLMModelTester): class HunYuanDenseV1ModelTest (line 40) | class HunYuanDenseV1ModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 43) | def is_pipeline_test_to_skip( class HunYuanDenseV1IntegrationTest (line 57) | class HunYuanDenseV1IntegrationTest(unittest.TestCase): method setUp (line 58) | def setUp(self): method tearDown (line 61) | def tearDown(self): method test_model_generation (line 65) | def test_model_generation(self): FILE: tests/models/hunyuan_v1_moe/test_modeling_hunyuan_v1_moe.py class HunYuanMoEV1ModelTester (line 36) | class HunYuanMoEV1ModelTester(CausalLMModelTester): class HunYuanMoEV1ModelTest (line 42) | class HunYuanMoEV1ModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 46) | def is_pipeline_test_to_skip( method test_generate_compilation_all_outputs (line 60) | def test_generate_compilation_all_outputs(self): method test_generate_compile_model_forward (line 65) | def test_generate_compile_model_forward(self): method test_generate_from_inputs_embeds_with_static_cache (line 69) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_with_static_cache (line 73) | def test_generate_with_static_cache(self): class HunYuanMoEV1IntegrationTest (line 78) | class HunYuanMoEV1IntegrationTest(unittest.TestCase): method setUp (line 79) | def setUp(self): method tearDown (line 82) | def tearDown(self): method test_model_generation (line 86) | def test_model_generation(self): FILE: tests/models/ibert/test_modeling_ibert.py class IBertModelTester (line 51) | class IBertModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 123) | def get_config(self): method get_pipeline_config (line 139) | def get_pipeline_config(self): method create_and_check_model (line 144) | def create_and_check_model( method create_and_check_for_masked_lm (line 157) | def create_and_check_for_masked_lm( method create_and_check_for_token_classification (line 166) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 176) | def create_and_check_for_multiple_choice( method create_and_check_for_question_answering (line 194) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 210) | def prepare_config_and_inputs_for_common(self): class IBertModelTest (line 226) | class IBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 254) | def setUp(self): method test_config (line 258) | def test_config(self): method test_model (line 261) | def test_model(self): method test_for_masked_lm (line 265) | def test_for_masked_lm(self): method test_for_token_classification (line 269) | def test_for_token_classification(self): method test_for_multiple_choice (line 273) | def test_for_multiple_choice(self): method test_for_question_answering (line 277) | def test_for_question_answering(self): method test_model_from_pretrained (line 282) | def test_model_from_pretrained(self): method test_create_position_ids_respects_padding_index (line 287) | def test_create_position_ids_respects_padding_index(self): method test_create_position_ids_from_inputs_embeds (line 305) | def test_create_position_ids_from_inputs_embeds(self): method test_model_get_set_embeddings (line 326) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 337) | def test_feed_forward_chunking(self): method test_inputs_embeds (line 341) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 372) | def test_inputs_embeds_matches_input_ids(self): class IBertModelIntegrationTest (line 377) | class IBertModelIntegrationTest(unittest.TestCase): method test_quant_embedding (line 378) | def test_quant_embedding(self): method test_quant_act (line 397) | def test_quant_act(self): method test_quant_linear (line 474) | def test_quant_linear(self): method test_int_gelu (line 507) | def test_int_gelu(self): method test_force_dequant_gelu (line 525) | def test_force_dequant_gelu(self): method test_int_softmax (line 552) | def test_int_softmax(self): method test_force_dequant_softmax (line 582) | def test_force_dequant_softmax(self): method test_int_layernorm (line 611) | def test_int_layernorm(self): method test_force_dequant_layernorm (line 638) | def test_force_dequant_layernorm(self): method quantize (line 671) | def quantize(self, model): method test_inference_masked_lm (line 689) | def test_inference_masked_lm(self): method test_inference_classification_head (line 709) | def test_inference_classification_head(self): FILE: tests/models/idefics/test_image_processing_idefics.py class IdeficsImageProcessingTester (line 43) | class IdeficsImageProcessingTester: method __init__ (line 44) | def __init__( method prepare_image_processor_dict (line 64) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 71) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 74) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class IdeficsImageProcessingTest (line 88) | class IdeficsImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 89) | def setUp(self): method image_processor_dict (line 94) | def image_processor_dict(self): method test_image_processor_properties (line 97) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 104) | def test_image_processor_from_dict_with_kwargs(self): method test_torchvision_numpy_transforms_equivalency (line 113) | def test_torchvision_numpy_transforms_equivalency(self): method test_backends_equivalence (line 150) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 175) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 198) | def test_can_compile_torchvision_backend(self): method test_call_numpy (line 213) | def test_call_numpy(self): method test_call_numpy_4_channels (line 217) | def test_call_numpy_4_channels(self): method test_call_pil (line 221) | def test_call_pil(self): method test_call_pytorch (line 225) | def test_call_pytorch(self): FILE: tests/models/idefics/test_modeling_idefics.py class IdeficsModelTester (line 56) | class IdeficsModelTester: method __init__ (line 57) | def __init__( method prepare_config_and_inputs (line 158) | def prepare_config_and_inputs(self, num_images=1, interpolate_pos_enco... method prepare_config_and_inputs_gate_tests (line 179) | def prepare_config_and_inputs_gate_tests(self): method get_config (line 230) | def get_config(self): method create_and_check_model (line 253) | def create_and_check_model( method create_and_check_model_gen (line 276) | def create_and_check_model_gen( method prepare_config_and_inputs_for_common (line 297) | def prepare_config_and_inputs_for_common(self): method prepare_pixel_values (line 316) | def prepare_pixel_values(self): class IdeficsModelTest (line 321) | class IdeficsModelTest(ModelTesterMixin, PipelineTesterMixin, Generation... method _prepare_for_class (line 333) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_eager_matches_sdpa_inference (line 347) | def test_eager_matches_sdpa_inference( method test_model_outputs_equivalence (line 352) | def test_model_outputs_equivalence(self): method setUp (line 361) | def setUp(self): method test_config (line 365) | def test_config(self): method test_model_single_image (line 368) | def test_model_single_image(self): method test_model_multiple_images (line 374) | def test_model_multiple_images(self): method test_model_with_image_pos_embeddings_interpolation_single_image (line 380) | def test_model_with_image_pos_embeddings_interpolation_single_image(se... method test_model_with_image_pos_embeddings_interpolation_multiple_images (line 390) | def test_model_with_image_pos_embeddings_interpolation_multiple_images... method test_generate_with_image_pos_embeddings_interpolation_single_image (line 400) | def test_generate_with_image_pos_embeddings_interpolation_single_image... method test_generate_with_image_pos_embeddings_interpolation_multiple_images (line 406) | def test_generate_with_image_pos_embeddings_interpolation_multiple_ima... method test_cross_attention_gates (line 412) | def test_cross_attention_gates(self): method test_training (line 432) | def test_training(self): method check_training_gradient_checkpointing (line 452) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_retain_grad_hidden_states_attentions (line 475) | def test_retain_grad_hidden_states_attentions(self): method test_generate_without_input_ids (line 480) | def test_generate_without_input_ids(self): method test_generate_continue_from_inputs_embeds (line 485) | def test_generate_continue_from_inputs_embeds(self): method test_generate_continue_from_past_key_values (line 489) | def test_generate_continue_from_past_key_values(self): method test_attention_outputs (line 555) | def test_attention_outputs(self): method test_hidden_states_output (line 602) | def test_hidden_states_output(self): method test_model_from_pretrained (line 638) | def test_model_from_pretrained(self): method test_sdpa_can_dispatch_non_composite_models (line 644) | def test_sdpa_can_dispatch_non_composite_models(self): method test_generate_from_random_inputs_embeds (line 648) | def test_generate_from_random_inputs_embeds( method test_left_padding_compatibility (line 654) | def test_left_padding_compatibility(self): method test_eager_padding_matches_padding_free_with_position_ids (line 673) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 677) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): class IdeficsForVisionText2TextTest (line 682) | class IdeficsForVisionText2TextTest(IdeficsModelTest, GenerationTesterMi... method setUp (line 685) | def setUp(self): method test_eager_matches_sdpa_inference (line 694) | def test_eager_matches_sdpa_inference( method test_generate_continue_from_past_key_values (line 700) | def test_generate_continue_from_past_key_values(self): method test_generate_without_input_ids (line 767) | def test_generate_without_input_ids(self): method test_generate_continue_from_inputs_embeds (line 792) | def test_generate_continue_from_inputs_embeds(self): method _check_caches_are_similar (line 846) | def _check_caches_are_similar(self, cache1, cache2): method _check_attentions_for_generate (line 869) | def _check_attentions_for_generate( method test_custom_4d_attention_mask (line 879) | def test_custom_4d_attention_mask(self): method test_generate_with_static_cache (line 883) | def test_generate_with_static_cache(self): method test_model (line 887) | def test_model(self): method test_for_token_classification (line 891) | def test_for_token_classification(self): method test_retain_grad_hidden_states_attentions (line 895) | def test_retain_grad_hidden_states_attentions(self): method test_sdpa_can_dispatch_non_composite_models (line 899) | def test_sdpa_can_dispatch_non_composite_models(self): method test_generation_tester_mixin_inheritance (line 905) | def test_generation_tester_mixin_inheritance(self): method test_generate_from_random_inputs_embeds (line 909) | def test_generate_from_random_inputs_embeds( class IdeficsModelIntegrationTest (line 917) | class IdeficsModelIntegrationTest(TestCasePlus): method default_processor (line 919) | def default_processor(self): method test_inference_natural_language_visual_reasoning (line 928) | def test_inference_natural_language_visual_reasoning(self): FILE: tests/models/idefics/test_processing_idefics.py class IdeficsProcessorTest (line 37) | class IdeficsProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 42) | def _setup_image_processor(cls): method _setup_tokenizer (line 47) | def _setup_tokenizer(cls): method prepare_prompts (line 51) | def prepare_prompts(self): method test_save_load_pretrained_additional_features (line 93) | def test_save_load_pretrained_additional_features(self): method test_tokenizer_padding (line 106) | def test_tokenizer_padding(self): method test_tokenizer_left_padding (line 134) | def test_tokenizer_left_padding(self): method test_tokenizer_defaults (line 159) | def test_tokenizer_defaults(self): FILE: tests/models/idefics2/test_image_processing_idefics2.py class Idefics2ImageProcessingTester (line 32) | class Idefics2ImageProcessingTester: method __init__ (line 33) | def __init__( method prepare_image_processor_dict (line 72) | def prepare_image_processor_dict(self): method get_expected_values (line 86) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 120) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 125) | def prepare_image_inputs( class Idefics2ImageProcessingTest (line 172) | class Idefics2ImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 173) | def setUp(self): method image_processor_dict (line 178) | def image_processor_dict(self): method test_image_processor_properties (line 181) | def test_image_processor_properties(self): method test_call_numpy (line 195) | def test_call_numpy(self): method test_call_numpy_4_channels (line 213) | def test_call_numpy_4_channels(self): method test_call_pil (line 240) | def test_call_pil(self): method test_call_pytorch (line 258) | def test_call_pytorch(self): method test_image_splitting (line 278) | def test_image_splitting(self): method test_pixel_attention_mask (line 300) | def test_pixel_attention_mask(self): method test_convert_rgb (line 322) | def test_convert_rgb(self): method test_backends_equivalence_batched (line 344) | def test_backends_equivalence_batched(self): FILE: tests/models/idefics2/test_modeling_idefics2.py class Idefics2VisionText2TextModelTester (line 57) | class Idefics2VisionText2TextModelTester: method __init__ (line 58) | def __init__( method get_config (line 130) | def get_config(self): method prepare_config_and_inputs (line 141) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 155) | def prepare_config_and_inputs_for_common(self): class Idefics2ModelTest (line 174) | class Idefics2ModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 186) | def setUp(self): method test_config (line 192) | def test_config(self): method test_inputs_embeds (line 196) | def test_inputs_embeds(): method test_inputs_embeds_matches_input_ids (line 200) | def test_inputs_embeds_matches_input_ids(self): method test_flash_attn_2_generate_padding_right (line 204) | def test_flash_attn_2_generate_padding_right(self): method test_flash_attn_2_inference_padding_right (line 208) | def test_flash_attn_2_inference_padding_right(self): method test_resize_tokens_embeddings (line 212) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 292) | def test_resize_embeddings_untied(self): method test_sdpa_can_dispatch_composite_models (line 338) | def test_sdpa_can_dispatch_composite_models(self): class Idefics2ForConditionalGenerationModelTest (line 365) | class Idefics2ForConditionalGenerationModelTest(GenerationTesterMixin, M... method setUp (line 378) | def setUp(self): method test_inputs_embeds (line 383) | def test_inputs_embeds(): method test_flash_attn_2_generate_padding_right (line 387) | def test_flash_attn_2_generate_padding_right(self): method test_flash_attn_2_inference_padding_right (line 391) | def test_flash_attn_2_inference_padding_right(self): method test_eager_matches_sdpa_generate (line 399) | def test_eager_matches_sdpa_generate(self): method test_resize_tokens_embeddings (line 403) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 476) | def test_resize_embeddings_untied(self): class Idefics2ForConditionalGenerationIntegrationTest (line 520) | class Idefics2ForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 521) | def setUp(self): method tearDown (line 541) | def tearDown(self): method test_integration_test (line 546) | def test_integration_test(self): method test_integration_test_4bit (line 568) | def test_integration_test_4bit(self): method test_integration_test_4bit_batch2 (line 594) | def test_integration_test_4bit_batch2(self): method test_flash_attn_2_eager_equivalence (line 630) | def test_flash_attn_2_eager_equivalence(self): FILE: tests/models/idefics2/test_processing_idefics2.py class Idefics2ProcessorTest (line 33) | class Idefics2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 38) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 61) | def prepare_processor_dict(): method test_process_interleaved_images_prompts_no_image_splitting (line 64) | def test_process_interleaved_images_prompts_no_image_splitting(self): method test_process_interleaved_images_prompts_image_splitting (line 124) | def test_process_interleaved_images_prompts_image_splitting(self): method test_add_special_tokens_processor (line 183) | def test_add_special_tokens_processor(self): method test_non_nested_images_with_batched_text (line 203) | def test_non_nested_images_with_batched_text(self): method test_process_interleaved_images_prompts_image_error (line 222) | def test_process_interleaved_images_prompts_image_error(self): method test_apply_chat_template (line 264) | def test_apply_chat_template(self): FILE: tests/models/idefics3/test_image_processing_idefics3.py class Idefics3ImageProcessingTester (line 36) | class Idefics3ImageProcessingTester: method __init__ (line 37) | def __init__( method prepare_image_processor_dict (line 79) | def prepare_image_processor_dict(self): method get_expected_values (line 94) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 101) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 108) | def prepare_image_inputs( class Idefics3ImageProcessingTest (line 164) | class Idefics3ImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 165) | def setUp(self): method image_processor_dict (line 170) | def image_processor_dict(self): method test_image_processor_properties (line 173) | def test_image_processor_properties(self): method test_call_numpy (line 190) | def test_call_numpy(self): method test_call_numpy_4_channels (line 212) | def test_call_numpy_4_channels(self): method test_call_pil (line 237) | def test_call_pil(self): method test_call_pytorch (line 259) | def test_call_pytorch(self): method test_backends_equivalence (line 285) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 313) | def test_backends_equivalence_batched(self): method test_get_num_patches_without_images (line 350) | def test_get_num_patches_without_images(self): FILE: tests/models/idefics3/test_modeling_idefics3.py class Idefics3VisionText2TextModelTester (line 55) | class Idefics3VisionText2TextModelTester: method __init__ (line 56) | def __init__( method get_config (line 120) | def get_config(self): method prepare_config_and_inputs (line 131) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 145) | def prepare_config_and_inputs_for_common(self): class Idefics3ModelTest (line 164) | class Idefics3ModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 175) | def setUp(self): method test_config (line 181) | def test_config(self): method test_inputs_embeds (line 185) | def test_inputs_embeds(): method test_inputs_embeds_matches_input_ids (line 189) | def test_inputs_embeds_matches_input_ids(self): method test_flash_attn_2_inference_padding_right (line 193) | def test_flash_attn_2_inference_padding_right(self): method test_sdpa_can_compile_dynamic (line 198) | def test_sdpa_can_compile_dynamic(self): method test_resize_tokens_embeddings (line 202) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 282) | def test_resize_embeddings_untied(self): class Idefics3ForConditionalGenerationModelTest (line 330) | class Idefics3ForConditionalGenerationModelTest(GenerationTesterMixin, M... method setUp (line 343) | def setUp(self): method test_inputs_embeds (line 348) | def test_inputs_embeds(): method test_flash_attn_2_inference_padding_right (line 352) | def test_flash_attn_2_inference_padding_right(self): method test_eager_matches_sdpa_generate (line 360) | def test_eager_matches_sdpa_generate(self): method test_sdpa_can_compile_dynamic (line 365) | def test_sdpa_can_compile_dynamic(self): method test_resize_tokens_embeddings (line 369) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 442) | def test_resize_embeddings_untied(self): class Idefics3ForConditionalGenerationIntegrationTest (line 486) | class Idefics3ForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 487) | def setUp(self): method tearDown (line 507) | def tearDown(self): method test_integration_test (line 512) | def test_integration_test(self): method test_integration_test_4bit (line 534) | def test_integration_test_4bit(self): FILE: tests/models/idefics3/test_processing_idefics3.py class Idefics3ProcessorTest (line 28) | class Idefics3ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method get_processor (line 32) | def get_processor(self): method _setup_test_attributes (line 39) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 66) | def prepare_processor_dict(): method test_get_num_multimodal_tokens_matches_processor_call (line 69) | def test_get_num_multimodal_tokens_matches_processor_call(self): method get_split_image_expected_tokens (line 100) | def get_split_image_expected_tokens(self, processor, image_rows, image... method test_process_interleaved_images_prompts_no_image_splitting (line 121) | def test_process_interleaved_images_prompts_no_image_splitting(self): method test_process_interleaved_images_prompts_image_splitting (line 181) | def test_process_interleaved_images_prompts_image_splitting(self): method test_add_special_tokens_processor (line 245) | def test_add_special_tokens_processor(self): method test_non_nested_images_with_batched_text (line 264) | def test_non_nested_images_with_batched_text(self): method test_process_interleaved_images_prompts_image_error (line 284) | def test_process_interleaved_images_prompts_image_error(self): method test_apply_chat_template (line 326) | def test_apply_chat_template(self): method test_text_only_inference (line 363) | def test_text_only_inference(self): method test_missing_images_error (line 404) | def test_missing_images_error(self): FILE: tests/models/ijepa/test_modeling_ijepa.py class IJepaModelTester (line 52) | class IJepaModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method get_config (line 121) | def get_config(self): method create_and_check_model (line 139) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 149) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 173) | def prepare_config_and_inputs_for_common(self): class IJepaModelTest (line 185) | class IJepaModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 207) | def setUp(self): method test_multi_gpu_data_parallel_forward (line 220) | def test_multi_gpu_data_parallel_forward(self): method test_config (line 223) | def test_config(self): method test_inputs_embeds (line 227) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 230) | def test_model_get_set_embeddings(self): method test_model (line 239) | def test_model(self): method test_for_image_classification (line 243) | def test_for_image_classification(self): method test_model_from_pretrained (line 248) | def test_model_from_pretrained(self): function prepare_img (line 255) | def prepare_img(): class IJepaModelIntegrationTest (line 262) | class IJepaModelIntegrationTest(unittest.TestCase): method default_image_processor (line 264) | def default_image_processor(self): method test_inference_no_head (line 268) | def test_inference_no_head(self): method test_inference_fp16 (line 293) | def test_inference_fp16(self): method test_inference_interpolate_pos_encoding (line 313) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/imagegpt/test_image_processing_imagegpt.py class ImageGPTImageProcessingTester (line 47) | class ImageGPTImageProcessingTester: method __init__ (line 48) | def __init__( method prepare_image_processor_dict (line 71) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 85) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 88) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class ImageGPTImageProcessingTest (line 102) | class ImageGPTImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 103) | def setUp(self): method image_processor_dict (line 108) | def image_processor_dict(self): method test_can_compile_torchvision_backend (line 115) | def test_can_compile_torchvision_backend(self): method test_image_processor_properties (line 131) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 139) | def test_image_processor_from_dict_with_kwargs(self): method test_image_processor_to_json_string (line 147) | def test_image_processor_to_json_string(self): method test_image_processor_to_json_file (line 157) | def test_image_processor_to_json_file(self): method test_image_processor_from_and_save_pretrained (line 173) | def test_image_processor_from_and_save_pretrained(self): method test_image_processor_save_load_with_autoimageprocessor (line 188) | def test_image_processor_save_load_with_autoimageprocessor(self): method test_init_without_params (line 208) | def test_init_without_params(self): method test_call_pil (line 212) | def test_call_pil(self): method test_call_numpy (line 233) | def test_call_numpy(self): method test_call_numpy_4_channels (line 254) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 258) | def test_call_pytorch(self): method test_backends_equivalence (line 283) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 308) | def test_backends_equivalence_batched(self): method test_can_compile_fast_image_processor (line 338) | def test_can_compile_fast_image_processor(self): function prepare_images (line 354) | def prepare_images(): class ImageGPTImageProcessorIntegrationTest (line 369) | class ImageGPTImageProcessorIntegrationTest(unittest.TestCase): method test_image (line 371) | def test_image(self): FILE: tests/models/imagegpt/test_modeling_imagegpt.py class ImageGPTModelTester (line 45) | class ImageGPTModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs( method get_config (line 138) | def get_config( method get_pipeline_config (line 159) | def get_pipeline_config(self): method create_and_check_imagegpt_model (line 165) | def create_and_check_imagegpt_model(self, config, input_ids, input_mas... method create_and_check_lm_head_model (line 177) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method create_and_check_imagegpt_for_image_classification (line 188) | def create_and_check_imagegpt_for_image_classification( method prepare_config_and_inputs_for_common (line 198) | def prepare_config_and_inputs_for_common(self): class ImageGPTModelTest (line 221) | class ImageGPTModelTest(ModelTesterMixin, GenerationTesterMixin, Pipelin... method _prepare_for_class (line 233) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method _check_scores (line 245) | def _check_scores(self, batch_size, scores, generated_length, config): method test_beam_search_generate_dict_outputs_use_cache (line 255) | def test_beam_search_generate_dict_outputs_use_cache(self): method setUp (line 258) | def setUp(self): method test_config (line 262) | def test_config(self): method test_imagegpt_model (line 265) | def test_imagegpt_model(self): method test_imagegpt_causal_lm (line 269) | def test_imagegpt_causal_lm(self): method test_imagegpt_image_classification (line 273) | def test_imagegpt_image_classification(self): method test_model_from_pretrained (line 278) | def test_model_from_pretrained(self): method test_forward_signature (line 283) | def test_forward_signature(self): method test_past_key_values_format (line 296) | def test_past_key_values_format(self): function prepare_img (line 301) | def prepare_img(): class ImageGPTModelIntegrationTest (line 308) | class ImageGPTModelIntegrationTest(unittest.TestCase): method default_image_processor (line 310) | def default_image_processor(self): method test_inference_causal_lm_head (line 314) | def test_inference_causal_lm_head(self): FILE: tests/models/informer/test_modeling_informer.py class InformerModelTester (line 47) | class InformerModelTester: method __init__ (line 48) | def __init__( method get_config (line 95) | def get_config(self): method prepare_informer_inputs_dict (line 118) | def prepare_informer_inputs_dict(self, config): method prepare_config_and_inputs (line 143) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 148) | def prepare_config_and_inputs_for_common(self): method check_encoder_decoder_model_standalone (line 152) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class InformerModelTest (line 194) | class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 202) | def setUp(self): method test_config (line 211) | def test_config(self): method test_save_load_strict (line 214) | def test_save_load_strict(self): method test_encoder_decoder_model_standalone (line 224) | def test_encoder_decoder_model_standalone(self): method test_hidden_states_output (line 228) | def test_hidden_states_output(self): method test_resize_tokens_embeddings (line 282) | def test_resize_tokens_embeddings(self): method test_model_outputs_equivalence (line 286) | def test_model_outputs_equivalence(self): method test_determinism (line 290) | def test_determinism(self): method test_batching_equivalence (line 294) | def test_batching_equivalence(self): method test_training_gradient_checkpointing (line 298) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 302) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 306) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_main_input_name (line 310) | def test_model_main_input_name(self): method test_forward_signature (line 316) | def test_forward_signature(self): method test_attention_outputs (line 354) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 452) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 456) | def test_model_get_set_embeddings(self): function prepare_batch (line 460) | def prepare_batch(filename="train-batch.pt"): class InformerModelIntegrationTests (line 469) | class InformerModelIntegrationTests(unittest.TestCase): method test_inference_no_head (line 470) | def test_inference_no_head(self): method test_inference_head (line 493) | def test_inference_head(self): method test_seq_to_seq_generation (line 516) | def test_seq_to_seq_generation(self): FILE: tests/models/instructblip/test_modeling_instructblip.py class InstructBlipVisionModelTester (line 65) | class InstructBlipVisionModelTester: method __init__ (line 66) | def __init__( method prepare_config_and_inputs (line 104) | def prepare_config_and_inputs(self): method get_config (line 110) | def get_config(self): method create_and_check_model (line 125) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 138) | def prepare_config_and_inputs_for_common(self): class InstructBlipVisionModelTest (line 146) | class InstructBlipVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 156) | def setUp(self): method test_config (line 165) | def test_config(self): method test_inputs_embeds (line 169) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 172) | def test_model_get_set_embeddings(self): method test_forward_signature (line 181) | def test_forward_signature(self): method test_model (line 193) | def test_model(self): method test_training (line 198) | def test_training(self): method test_training_gradient_checkpointing (line 202) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 206) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 210) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 214) | def test_model_from_pretrained(self): class InstructBlipQFormerModelTester (line 220) | class InstructBlipQFormerModelTester: method __init__ (line 221) | def __init__( method prepare_config_and_inputs (line 261) | def prepare_config_and_inputs(self): method get_config (line 281) | def get_config(self): class InstructBlipTextModelDecoderOnlyTester (line 298) | class InstructBlipTextModelDecoderOnlyTester: method __init__ (line 299) | def __init__( method prepare_config_and_inputs (line 346) | def prepare_config_and_inputs(self): method get_config (line 356) | def get_config(self): class InstructBlipForConditionalGenerationDecoderOnlyModelTester (line 376) | class InstructBlipForConditionalGenerationDecoderOnlyModelTester: method __init__ (line 377) | def __init__( method prepare_config_and_inputs (line 404) | def prepare_config_and_inputs(self): method get_config (line 421) | def get_config(self): method create_and_check_for_conditional_generation (line 430) | def create_and_check_for_conditional_generation( method prepare_config_and_inputs_for_common (line 449) | def prepare_config_and_inputs_for_common(self): class InstructBlipForConditionalGenerationDecoderOnlyTest (line 463) | class InstructBlipForConditionalGenerationDecoderOnlyTest(ModelTesterMix... method setUp (line 479) | def setUp(self): method test_config (line 488) | def test_config(self): method test_for_conditional_generation (line 491) | def test_for_conditional_generation(self): method test_eager_matches_sdpa_generate (line 498) | def test_eager_matches_sdpa_generate(self): method test_hidden_states_output (line 502) | def test_hidden_states_output(self): method test_inputs_embeds (line 506) | def test_inputs_embeds(self): method test_tied_weights_keys (line 510) | def test_tied_weights_keys(self): method test_retain_grad_hidden_states_attentions (line 514) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 518) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 523) | def test_generate_without_input_ids(self): method test_model_base_model_prefix (line 527) | def test_model_base_model_prefix(self): method test_forward_signature (line 530) | def test_forward_signature(self): method test_load_vision_qformer_text_config (line 542) | def test_load_vision_qformer_text_config(self): method test_model_from_pretrained (line 558) | def test_model_from_pretrained(self): method _check_generate_outputs (line 564) | def _check_generate_outputs(self, output, config, use_cache=False, num... method test_sdpa_can_dispatch_composite_models (line 570) | def test_sdpa_can_dispatch_composite_models(self): method _image_features_prepare_config_and_inputs (line 618) | def _image_features_prepare_config_and_inputs(self): function prepare_img (line 632) | def prepare_img(): class InstructBlipModelIntegrationTest (line 641) | class InstructBlipModelIntegrationTest(unittest.TestCase): method tearDown (line 642) | def tearDown(self): method test_inference_vicuna_7b (line 647) | def test_inference_vicuna_7b(self): method test_inference_flant5_xl (line 681) | def test_inference_flant5_xl(self): method test_inference_interpolate_pos_encoding (line 718) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/instructblip/test_processing_instructblip.py class InstructBlipProcessorTest (line 29) | class InstructBlipProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 33) | def _setup_tokenizer(cls): method _setup_qformer_tokenizer (line 38) | def _setup_qformer_tokenizer(cls): method prepare_processor_dict (line 43) | def prepare_processor_dict(): FILE: tests/models/instructblipvideo/test_modeling_instructblipvideo.py class InstructBlipVideoVisionModelTester (line 63) | class InstructBlipVideoVisionModelTester: method __init__ (line 64) | def __init__( method prepare_config_and_inputs (line 104) | def prepare_config_and_inputs(self): method get_config (line 112) | def get_config(self): method create_and_check_model (line 127) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 142) | def prepare_config_and_inputs_for_common(self): class InstructBlipVideoVisionModelTest (line 150) | class InstructBlipVideoVisionModelTest(ModelTesterMixin, unittest.TestCa... method setUp (line 160) | def setUp(self): method test_config (line 167) | def test_config(self): method test_inputs_embeds (line 171) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 175) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 178) | def test_model_common_attributes(self): method test_forward_signature (line 187) | def test_forward_signature(self): method test_model (line 199) | def test_model(self): method test_training (line 204) | def test_training(self): method test_training_gradient_checkpointing (line 208) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 212) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 216) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 220) | def test_model_from_pretrained(self): class InstructBlipVideoQFormerModelTester (line 226) | class InstructBlipVideoQFormerModelTester: method __init__ (line 227) | def __init__( method prepare_config_and_inputs (line 267) | def prepare_config_and_inputs(self): method get_config (line 287) | def get_config(self): class InstructBlipVideoTextModelDecoderOnlyTester (line 304) | class InstructBlipVideoTextModelDecoderOnlyTester: method __init__ (line 305) | def __init__( method prepare_config_and_inputs (line 352) | def prepare_config_and_inputs(self): method get_config (line 362) | def get_config(self): class InstructBlipVideoForConditionalGenerationDecoderOnlyModelTester (line 382) | class InstructBlipVideoForConditionalGenerationDecoderOnlyModelTester: method __init__ (line 383) | def __init__( method prepare_config_and_inputs (line 412) | def prepare_config_and_inputs(self): method get_config (line 434) | def get_config(self): method create_and_check_for_conditional_generation (line 443) | def create_and_check_for_conditional_generation( method prepare_config_and_inputs_for_common (line 464) | def prepare_config_and_inputs_for_common(self): class InstructBlipVideoForConditionalGenerationDecoderOnlyTest (line 478) | class InstructBlipVideoForConditionalGenerationDecoderOnlyTest( method setUp (line 492) | def setUp(self): method test_for_conditional_generation (line 499) | def test_for_conditional_generation(self): method test_config (line 503) | def test_config(self): method test_eager_matches_sdpa_generate (line 509) | def test_eager_matches_sdpa_generate(self): method test_hidden_states_output (line 513) | def test_hidden_states_output(self): method test_inputs_embeds (line 517) | def test_inputs_embeds(self): method test_tied_weights_keys (line 521) | def test_tied_weights_keys(self): method test_retain_grad_hidden_states_attentions (line 525) | def test_retain_grad_hidden_states_attentions(self): method test_model_common_attributes (line 529) | def test_model_common_attributes(self): method test_generate_without_input_ids (line 534) | def test_generate_without_input_ids(self): method test_model_base_model_prefix (line 538) | def test_model_base_model_prefix(self): method test_forward_signature (line 541) | def test_forward_signature(self): method test_load_vision_qformer_text_config (line 552) | def test_load_vision_qformer_text_config(self): method test_model_from_pretrained (line 568) | def test_model_from_pretrained(self): method _check_generate_outputs (line 574) | def _check_generate_outputs(self, output, config, use_cache=False, num... method test_sdpa_can_dispatch_composite_models (line 580) | def test_sdpa_can_dispatch_composite_models(self): method _video_features_prepare_config_and_inputs (line 628) | def _video_features_prepare_config_and_inputs(self): function prepare_video (line 642) | def prepare_video(): class InstructBlipVideoModelIntegrationTest (line 655) | class InstructBlipVideoModelIntegrationTest(unittest.TestCase): method test_inference_vicuna_7b (line 656) | def test_inference_vicuna_7b(self): FILE: tests/models/instructblipvideo/test_processing_instructblipvideo.py class InstructBlipVideoProcessorTest (line 33) | class InstructBlipVideoProcessorTest(ProcessorTesterMixin, unittest.Test... method _setup_tokenizer (line 37) | def _setup_tokenizer(cls): method _setup_qformer_tokenizer (line 42) | def _setup_qformer_tokenizer(cls): method prepare_processor_dict (line 47) | def prepare_processor_dict(): method test_processor_with_multiple_inputs (line 51) | def test_processor_with_multiple_inputs(self): FILE: tests/models/instructblipvideo/test_video_processing_instructblipvideo.py class InstructBlipVideoVideoProcessingTester (line 29) | class InstructBlipVideoVideoProcessingTester: method __init__ (line 30) | def __init__( method prepare_video_processor_dict (line 60) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 70) | def expected_output_video_shape(self, images): method prepare_video_inputs (line 73) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class InstructBlipVideoProcessingTest (line 89) | class InstructBlipVideoProcessingTest(VideoProcessingTestMixin, unittest... method setUp (line 93) | def setUp(self): method video_processor_dict (line 98) | def video_processor_dict(self): method test_image_processor_properties (line 101) | def test_image_processor_properties(self): method test_video_processor_from_dict_with_kwargs (line 110) | def test_video_processor_from_dict_with_kwargs(self): FILE: tests/models/internvl/test_modeling_internvl.py class InternVLVisionText2TextModelTester (line 57) | class InternVLVisionText2TextModelTester: method __init__ (line 58) | def __init__( method get_config (line 123) | def get_config(self): method prepare_config_and_inputs (line 133) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 139) | def prepare_config_and_inputs_for_common(self): method create_and_check_model_fp16_forward (line 155) | def create_and_check_model_fp16_forward(self, config, input_ids, pixel... method create_and_check_model_fp16_autocast_forward (line 168) | def create_and_check_model_fp16_autocast_forward(self, config, input_i... class InternVLModelTest (line 184) | class InternVLModelTest(ModelTesterMixin, GenerationTesterMixin, Pipelin... method setUp (line 195) | def setUp(self): method test_flex_attention_with_grads (line 202) | def test_flex_attention_with_grads(self): method test_config (line 205) | def test_config(self): method test_sdpa_can_compile_dynamic (line 210) | def test_sdpa_can_compile_dynamic(self): method test_flash_attn_2_fp32_ln (line 214) | def test_flash_attn_2_fp32_ln(self): class InternVLQwen2IntegrationTest (line 220) | class InternVLQwen2IntegrationTest(unittest.TestCase): method setUp (line 221) | def setUp(self): method tearDown (line 226) | def tearDown(self): method test_qwen2_small_model_integration_generate (line 230) | def test_qwen2_small_model_integration_generate(self): method test_qwen2_small_model_integration_forward (line 260) | def test_qwen2_small_model_integration_forward(self): method test_qwen2_small_model_integration_generate_text_only (line 295) | def test_qwen2_small_model_integration_generate_text_only(self): method test_qwen2_small_model_integration_generate_chat_template (line 319) | def test_qwen2_small_model_integration_generate_chat_template(self): method test_qwen2_small_model_integration_batched_generate (line 347) | def test_qwen2_small_model_integration_batched_generate(self): method test_qwen2_small_model_integration_batched_generate_multi_image (line 397) | def test_qwen2_small_model_integration_batched_generate_multi_image(se... method test_qwen2_medium_model_integration_video (line 465) | def test_qwen2_medium_model_integration_video(self): method test_qwen2_small_model_integration_interleaved_images_videos (line 512) | def test_qwen2_small_model_integration_interleaved_images_videos(self): class InternVLLlamaIntegrationTest (line 622) | class InternVLLlamaIntegrationTest(unittest.TestCase): method setUp (line 623) | def setUp(self): method tearDown (line 628) | def tearDown(self): method test_llama_small_model_integration_generate (line 631) | def test_llama_small_model_integration_generate(self): method test_llama_small_model_integration_forward (line 651) | def test_llama_small_model_integration_forward(self): method test_llama_small_model_integration_generate_text_only (line 692) | def test_llama_small_model_integration_generate_text_only(self): method test_llama_small_model_integration_generate_chat_template (line 716) | def test_llama_small_model_integration_generate_chat_template(self): method test_llama_small_model_integration_batched_generate (line 742) | def test_llama_small_model_integration_batched_generate(self): method test_llama_small_model_integration_batched_generate_multi_image (line 792) | def test_llama_small_model_integration_batched_generate_multi_image(se... method test_llama_medium_model_integration_video (line 846) | def test_llama_medium_model_integration_video(self): method test_llama_small_model_integration_interleaved_images_videos (line 885) | def test_llama_small_model_integration_interleaved_images_videos(self): FILE: tests/models/internvl/test_processing_internvl.py class InternVLProcessorTest (line 32) | class InternVLProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 37) | def _setup_image_processor(cls): method _setup_video_processor (line 52) | def _setup_video_processor(cls): method _setup_tokenizer (line 66) | def _setup_tokenizer(cls): method _setup_test_attributes (line 71) | def _setup_test_attributes(cls, processor): method test_video_processor_defaults (line 76) | def test_video_processor_defaults(self): method prepare_processor_dict (line 80) | def prepare_processor_dict(): method test_get_num_vision_tokens (line 84) | def test_get_num_vision_tokens(self): method test_process_interleaved_images_videos (line 98) | def test_process_interleaved_images_videos(self): method test_apply_chat_template_video_frame_sampling (line 186) | def test_apply_chat_template_video_frame_sampling(self): method _test_apply_chat_template (line 265) | def _test_apply_chat_template( method test_frames_binding (line 373) | def test_frames_binding(self, batch_size: int): FILE: tests/models/internvl/test_video_processing_internvl.py class InternVLVideoProcessingTester (line 29) | class InternVLVideoProcessingTester: method __init__ (line 30) | def __init__( method prepare_video_processor_dict (line 59) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 69) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 72) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class InternVLVideoProcessingTest (line 87) | class InternVLVideoProcessingTest(VideoProcessingTestMixin, unittest.Tes... method setUp (line 90) | def setUp(self): method video_processor_dict (line 95) | def video_processor_dict(self): method test_video_processor_from_dict_with_kwargs (line 98) | def test_video_processor_from_dict_with_kwargs(self): FILE: tests/models/jais2/test_modeling_jais2.py class Jais2ModelTester (line 42) | class Jais2ModelTester(CausalLMModelTester): class Jais2ModelTest (line 54) | class Jais2ModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 58) | def test_tp_generation_quantized(self): class Jais2IntegrationTest (line 84) | class Jais2IntegrationTest(unittest.TestCase): method setUp (line 85) | def setUp(self): method tearDown (line 88) | def tearDown(self): method test_model_logits (line 92) | def test_model_logits(self): method test_model_generation (line 131) | def test_model_generation(self): FILE: tests/models/jamba/test_modeling_jamba.py class JambaConfigTester (line 49) | class JambaConfigTester(ConfigTester): method _create_attn_config (line 50) | def _create_attn_config(self, attn_layer_offset: int, attn_layer_perio... method _create_expert_config (line 56) | def _create_expert_config(self, expert_layer_offset: int, expert_layer... method test_attn_offsets (line 62) | def test_attn_offsets(self): method test_expert_offsets (line 72) | def test_expert_offsets(self): method test_jamba_offset_properties (line 82) | def test_jamba_offset_properties(self): method run_common_tests (line 86) | def run_common_tests(self): class JambaModelTester (line 91) | class JambaModelTester: method __init__ (line 92) | def __init__( method prepare_config_and_inputs (line 144) | def prepare_config_and_inputs(self): method get_config (line 163) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 184) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 205) | def create_and_check_model(self, config, input_ids, input_mask, sequen... method create_and_check_for_causal_lm (line 213) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 231) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_sequence_classification (line 279) | def create_and_check_for_sequence_classification( method prepare_config_and_inputs_for_common (line 289) | def prepare_config_and_inputs_for_common(self): class JambaModelTest (line 304) | class JambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method _get_conv_state_shape (line 325) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 328) | def _get_recurrent_state_shape(self, batch_size: int, config): method setUp (line 331) | def setUp(self): method test_config (line 335) | def test_config(self): method test_model (line 338) | def test_model(self): method test_for_causal_lm (line 342) | def test_for_causal_lm(self): method test_for_sequence_classification (line 346) | def test_for_sequence_classification(self): method test_decoder_model_past_with_large_inputs (line 350) | def test_decoder_model_past_with_large_inputs(self): method test_load_balancing_loss (line 356) | def test_load_balancing_loss(self): method test_attention_outputs (line 397) | def test_attention_outputs(self): method test_flash_attn_2_fp32_ln (line 469) | def test_flash_attn_2_fp32_ln(self): method test_multi_gpu_data_parallel_forward (line 503) | def test_multi_gpu_data_parallel_forward(self): class JambaModelIntegrationTest (line 509) | class JambaModelIntegrationTest(unittest.TestCase): method setUpClass (line 517) | def setUpClass(cls): method test_simple_generate (line 527) | def test_simple_generate(self): method test_simple_batched_generate_with_padding (line 552) | def test_simple_batched_generate_with_padding(self): FILE: tests/models/janus/test_image_processing_janus.py class JanusImageProcessingTester (line 32) | class JanusImageProcessingTester: method __init__ (line 33) | def __init__( method prepare_image_processor_dict (line 62) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 74) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class JanusImageProcessingTest (line 88) | class JanusImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 89) | def setUp(self): method image_processor_dict (line 95) | def image_processor_dict(self): method test_image_processor_properties (line 98) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 108) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 120) | def test_call_pil(self): method test_call_numpy (line 137) | def test_call_numpy(self): method test_call_pytorch (line 152) | def test_call_pytorch(self): method test_nested_input (line 168) | def test_nested_input(self): method test_backends_equivalence_postprocess (line 189) | def test_backends_equivalence_postprocess(self): method test_call_numpy_4_channels (line 205) | def test_call_numpy_4_channels(self): FILE: tests/models/janus/test_modeling_janus.py class JanusVisionText2TextModelTester (line 58) | class JanusVisionText2TextModelTester: method __init__ (line 59) | def __init__( method get_vq_config (line 139) | def get_vq_config(self): method get_config (line 152) | def get_config(self): method prepare_config_and_inputs (line 160) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 172) | def prepare_config_and_inputs_for_common(self): class JanusVisionText2TextModelTest (line 193) | class JanusVisionText2TextModelTest(ModelTesterMixin, GenerationTesterMi... method _prepare_config_headdim (line 204) | def _prepare_config_headdim(config, requested_dim): method setUp (line 217) | def setUp(self): method test_sdpa_can_dispatch_composite_models (line 221) | def test_sdpa_can_dispatch_composite_models(self): method check_training_gradient_checkpointing (line 262) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_generate_compile_model_forward_fullgraph (line 315) | def test_generate_compile_model_forward_fullgraph(self): class JanusVQModelTester (line 319) | class JanusVQModelTester: method __init__ (line 320) | def __init__( method prepare_config_and_inputs (line 345) | def prepare_config_and_inputs(self): method get_config (line 350) | def get_config(self): method prepare_config_and_inputs_for_common (line 363) | def prepare_config_and_inputs_for_common(self): class JanusVQModelTest (line 371) | class JanusVQModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 377) | def setUp(self): method test_config (line 386) | def test_config(self): method test_cpu_offload (line 390) | def test_cpu_offload(self): method test_disk_offload_bin (line 394) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 398) | def test_disk_offload_safetensors(self): method test_hidden_states_output (line 402) | def test_hidden_states_output(self): method test_model_outputs_equivalence (line 406) | def test_model_outputs_equivalence(self): method test_model_get_set_embeddings (line 410) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 414) | def test_retain_grad_hidden_states_attentions(self): method test_gradient_checkpointing_enable_disable (line 418) | def test_gradient_checkpointing_enable_disable(self): class JanusIntegrationTest (line 422) | class JanusIntegrationTest(unittest.TestCase): method setUp (line 423) | def setUp(self): method test_model_text_generation (line 428) | def test_model_text_generation(self): method test_model_text_generation_batched (line 448) | def test_model_text_generation_batched(self): method test_model_text_generation_with_multi_image (line 486) | def test_model_text_generation_with_multi_image(self): method test_model_generate_images (line 509) | def test_model_generate_images(self): FILE: tests/models/janus/test_processing_janus.py class JanusProcessorTest (line 25) | class JanusProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_from_pretrained (line 30) | def _setup_from_pretrained(cls, model_id, **kwargs): method test_chat_template_single (line 42) | def test_chat_template_single(self): method test_chat_template_batched (line 211) | def test_chat_template_batched(self): method test_chat_template_accepts_processing_kwargs (line 374) | def test_chat_template_accepts_processing_kwargs(self): method test_processor_postprocess (line 437) | def test_processor_postprocess(self): FILE: tests/models/jetmoe/test_modeling_jetmoe.py class JetMoeModelTester (line 42) | class JetMoeModelTester(CausalLMModelTester): method __init__ (line 46) | def __init__( class JetMoeModelTest (line 102) | class JetMoeModelTest(CausalLMModelTest, unittest.TestCase): method test_flash_attn_2_inference_equivalence_right_padding (line 113) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_model_base_model_prefix (line 117) | def test_model_base_model_prefix(self): class JetMoeIntegrationTest (line 122) | class JetMoeIntegrationTest(unittest.TestCase): method setUp (line 123) | def setUp(self): method tearDown (line 126) | def tearDown(self): method test_model_8b_logits (line 130) | def test_model_8b_logits(self): method test_model_8b_generation (line 144) | def test_model_8b_generation(self): method test_model_8b_batched_generation (line 157) | def test_model_8b_batched_generation(self): FILE: tests/models/jina_embeddings_v3/test_modeling_jina_embeddings_v3.py class JinaEmbeddingsV3ModelTester (line 42) | class JinaEmbeddingsV3ModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 110) | def get_config(self): method create_and_check_model (line 125) | def create_and_check_model(self, config, input_ids, token_type_ids, in... method create_and_check_for_masked_lm (line 141) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 150) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 166) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 176) | def create_and_check_for_token_classification( method prepare_config_and_inputs_for_common (line 192) | def prepare_config_and_inputs_for_common(self): class JinaEmbeddingsV3ModelTest (line 212) | class JinaEmbeddingsV3ModelTest(ModelTesterMixin, PipelineTesterMixin, u... method setUp (line 236) | def setUp(self): method test_config (line 240) | def test_config(self): method test_model (line 243) | def test_model(self): method test_for_masked_lm (line 247) | def test_for_masked_lm(self): method test_for_question_answering (line 251) | def test_for_question_answering(self): method test_for_sequence_classification (line 255) | def test_for_sequence_classification(self): method test_for_token_classification (line 259) | def test_for_token_classification(self): class JinaEmbeddingsV3ModelIntegrationTest (line 265) | class JinaEmbeddingsV3ModelIntegrationTest(unittest.TestCase): method setup (line 269) | def setup(self): method tearDown (line 272) | def tearDown(self): method _prepare_inputs (line 275) | def _prepare_inputs(self): method test_inference_no_head_absolute_embedding (line 281) | def test_inference_no_head_absolute_embedding(self): method test_inference_retrieval_query_adapter (line 305) | def test_inference_retrieval_query_adapter(self): method test_inference_retrieval_passage_adapter (line 330) | def test_inference_retrieval_passage_adapter(self): method test_inference_separation_adapter (line 357) | def test_inference_separation_adapter(self): method test_inference_classification_adapter (line 383) | def test_inference_classification_adapter(self): method test_inference_text_matching_adapter (line 409) | def test_inference_text_matching_adapter(self): FILE: tests/models/kosmos2/test_modeling_kosmos2.py class Kosmos2VisionModelTester (line 64) | class Kosmos2VisionModelTester: method __init__ (line 65) | def __init__( method prepare_config_and_inputs (line 101) | def prepare_config_and_inputs(self): method get_config (line 107) | def get_config(self): method prepare_config_and_inputs_for_common (line 121) | def prepare_config_and_inputs_for_common(self): class Kosmos2TextModelTester (line 128) | class Kosmos2TextModelTester: method __init__ (line 129) | def __init__( method prepare_config_and_inputs (line 163) | def prepare_config_and_inputs(self): method get_config (line 181) | def get_config(self): method prepare_config_and_inputs_for_common (line 193) | def prepare_config_and_inputs_for_common(self): class Kosmos2ModelTester (line 200) | class Kosmos2ModelTester: method __init__ (line 201) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, laten... method prepare_config_and_inputs (line 215) | def prepare_config_and_inputs(self): method get_config (line 227) | def get_config(self): method create_and_check_model (line 234) | def create_and_check_model(self, config, input_ids, attention_mask, im... method prepare_config_and_inputs_for_common (line 247) | def prepare_config_and_inputs_for_common(self): class Kosmos2ModelTest (line 260) | class Kosmos2ModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method is_pipeline_test_to_skip (line 277) | def is_pipeline_test_to_skip( method _prepare_for_class (line 292) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 305) | def setUp(self): method test_config (line 312) | def test_config(self): method test_model (line 315) | def test_model(self): method test_forward_signature (line 319) | def test_forward_signature(self): method test_load_save_without_tied_weights (line 331) | def test_load_save_without_tied_weights(self): method test_hidden_states_output (line 351) | def test_hidden_states_output(self): method test_eager_matches_sdpa_inference (line 390) | def test_eager_matches_sdpa_inference( method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 396) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 400) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 404) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 408) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_model_base_model_prefix (line 412) | def test_model_base_model_prefix(self): method test_generate_without_input_ids (line 417) | def test_generate_without_input_ids(self): method test_left_padding_compatibility (line 421) | def test_left_padding_compatibility(self): method test_model_from_pretrained (line 442) | def test_model_from_pretrained(self): method test_generate_from_inputs_embeds (line 449) | def test_generate_from_inputs_embeds(self, _, num_beams): function prepare_img (line 496) | def prepare_img(): class Kosmos2ModelIntegrationTest (line 505) | class Kosmos2ModelIntegrationTest(unittest.TestCase): method run_example (line 506) | def run_example(self, prompt, image, model, processor): method test_snowman_image_captioning (line 531) | def test_snowman_image_captioning(self): method test_snowman_image_captioning_batch (line 677) | def test_snowman_image_captioning_batch(self): method test_inference_interpolate_pos_encoding (line 751) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/kosmos2/test_processing_kosmos2.py class Kosmos2ProcessorTest (line 53) | class Kosmos2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 57) | def _setup_tokenizer(cls): method get_tokenizer (line 63) | def get_tokenizer(self, **kwargs): method get_image_processor (line 66) | def get_image_processor(self, **kwargs): method _setup_image_processor (line 70) | def _setup_image_processor(cls): method test_tokenizer_defaults (line 75) | def test_tokenizer_defaults(self): method test_image_processor_load_save_reload (line 78) | def test_image_processor_load_save_reload(self): method test_full_processor (line 88) | def test_full_processor(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 375) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_structured_kwargs_nested (line 400) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 426) | def test_structured_kwargs_nested_from_dict(self): method test_tokenizer_defaults_preserved_by_kwargs (line 450) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_unstructured_kwargs (line 468) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 493) | def test_unstructured_kwargs_batched(self): FILE: tests/models/kosmos2_5/test_image_processing_kosmos2_5.py class Kosmos2_5ImageProcessingTester (line 41) | class Kosmos2_5ImageProcessingTester: method __init__ (line 42) | def __init__( method prepare_image_processor_dict (line 68) | def prepare_image_processor_dict(self): method prepare_dummy_image (line 71) | def prepare_dummy_image(self): method prepare_image_inputs (line 78) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Kosmos2_5ImageProcessingTest (line 92) | class Kosmos2_5ImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 93) | def setUp(self): method image_processor_dict (line 101) | def image_processor_dict(self): method test_backends_equivalence (line 108) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 132) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 164) | def test_can_compile_torchvision_backend(self): method test_image_processor_properties (line 179) | def test_image_processor_properties(self): method test_expected_patches (line 185) | def test_expected_patches(self): method test_call_pil (line 197) | def test_call_pil(self): method test_call_numpy (line 230) | def test_call_numpy(self): method test_call_numpy_4_channels (line 262) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 296) | def test_call_pytorch(self): class Kosmos2_5ImageProcessingTestFourChannels (line 332) | class Kosmos2_5ImageProcessingTestFourChannels(ImageProcessingTestMixin,... method setUp (line 333) | def setUp(self): method image_processor_dict (line 342) | def image_processor_dict(self): method test_backends_equivalence (line 350) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 371) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 375) | def test_can_compile_torchvision_backend(self): method test_image_processor_properties (line 378) | def test_image_processor_properties(self): method test_call_pil (line 384) | def test_call_pil(self): method test_call_numpy (line 418) | def test_call_numpy(self): method test_call_pytorch (line 422) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 428) | def test_call_numpy_4_channels(self): FILE: tests/models/kosmos2_5/test_modeling_kosmos2_5.py class Kosmos2_5VisionModelTester (line 62) | class Kosmos2_5VisionModelTester: method __init__ (line 63) | def __init__( method prepare_config_and_inputs (line 98) | def prepare_config_and_inputs(self): method get_config (line 104) | def get_config(self): method prepare_config_and_inputs_for_common (line 118) | def prepare_config_and_inputs_for_common(self): class Kosmos2_5TextModelTester (line 125) | class Kosmos2_5TextModelTester: method __init__ (line 126) | def __init__( method prepare_config_and_inputs (line 160) | def prepare_config_and_inputs(self): method get_config (line 178) | def get_config(self): method prepare_config_and_inputs_for_common (line 190) | def prepare_config_and_inputs_for_common(self): class Kosmos2_5ModelTester (line 197) | class Kosmos2_5ModelTester: method __init__ (line 198) | def __init__( method prepare_config_and_inputs (line 219) | def prepare_config_and_inputs(self): method get_config (line 237) | def get_config(self): method create_and_check_model (line 244) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 272) | def prepare_config_and_inputs_for_common(self): class Kosmos2_5ModelTest (line 291) | class Kosmos2_5ModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method is_pipeline_test_to_skip (line 306) | def is_pipeline_test_to_skip( method _prepare_for_class (line 316) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 343) | def setUp(self): method test_eager_padding_matches_padding_free_with_position_ids (line 348) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 352) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_assisted_decoding_matches_greedy_search (line 360) | def test_assisted_decoding_matches_greedy_search(self): method test_assisted_decoding_sample (line 367) | def test_assisted_decoding_sample(self): method test_prompt_lookup_decoding_matches_greedy_search (line 373) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_model_base_model_prefix (line 377) | def test_model_base_model_prefix(self): method test_model (line 380) | def test_model(self): method test_forward_signature (line 384) | def test_forward_signature(self): method test_load_save_without_tied_weights (line 396) | def test_load_save_without_tied_weights(self): method test_hidden_states_output (line 418) | def test_hidden_states_output(self): method test_model_from_pretrained (line 456) | def test_model_from_pretrained(self): method test_model_parallelism (line 462) | def test_model_parallelism(self): method test_sdpa_can_dispatch_on_flash (line 469) | def test_sdpa_can_dispatch_on_flash(self): method test_eager_matches_sdpa_inference_24_fp32_pad_left_output_attentions (line 474) | def test_eager_matches_sdpa_inference_24_fp32_pad_left_output_attentio... method test_flash_attn_2_from_config (line 479) | def test_flash_attn_2_from_config(self): method test_flash_attn_2_fp32_ln (line 483) | def test_flash_attn_2_fp32_ln(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 487) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attn_2_generate_reuse_cache (line 491) | def test_flash_attn_2_generate_reuse_cache(self): method test_generate_from_inputs_embeds (line 499) | def test_generate_from_inputs_embeds(self): method test_left_padding_compatibility (line 503) | def test_left_padding_compatibility(self): class Kosmos2_5ModelIntegrationTest (line 527) | class Kosmos2_5ModelIntegrationTest(unittest.TestCase): method setUpClass (line 533) | def setUpClass(cls): method run_example (line 538) | def run_example(self, prompt, image, model, processor): method test_eager (line 552) | def test_eager(self): method test_sdpa (line 583) | def test_sdpa(self): method test_FA2 (line 624) | def test_FA2(self): FILE: tests/models/kosmos2_5/test_processor_kosmos2_5.py class Kosmos2_5ProcessorTest (line 44) | class Kosmos2_5ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method test_image_processor_defaults (line 50) | def test_image_processor_defaults(self): method test_image_procesor_load_save_reload (line 53) | def test_image_procesor_load_save_reload(self): method test_can_load_various_tokenizers (line 62) | def test_can_load_various_tokenizers(self): method test_model_input_names (line 69) | def test_model_input_names(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 97) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 115) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_unstructured_kwargs (line 133) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 159) | def test_unstructured_kwargs_batched(self): method test_structured_kwargs_nested (line 186) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 215) | def test_structured_kwargs_nested_from_dict(self): method test_full_processor (line 241) | def test_full_processor(self): FILE: tests/models/kyutai_speech_to_text/test_modeling_kyutai_speech_to_text.py class KyutaiSpeechToTextModelTester (line 60) | class KyutaiSpeechToTextModelTester: method __init__ (line 61) | def __init__( method get_config (line 153) | def get_config(self): method create_and_check_model (line 182) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs (line 190) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_generate (line 203) | def prepare_config_and_inputs_generate(self): method prepare_config_and_inputs_for_common (line 212) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_common_generate (line 222) | def prepare_config_and_inputs_for_common_generate(self): class KyutaiSpeechToTextModelTest (line 239) | class KyutaiSpeechToTextModelTest(ModelTesterMixin, GenerationTesterMixi... method setUp (line 262) | def setUp(self): method test_config (line 266) | def test_config(self): method test_model (line 269) | def test_model(self): method _prepare_for_class (line 273) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method prepare_config_and_inputs_for_generate (line 278) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_model_get_set_embeddings (line 296) | def test_model_get_set_embeddings(self): method test_resize_embeddings_untied (line 300) | def test_resize_embeddings_untied(self): method test_resize_tokens_embeddings (line 304) | def test_resize_tokens_embeddings(self): method test_tied_weights_keys (line 308) | def test_tied_weights_keys(self): method test_generate_without_input_ids (line 312) | def test_generate_without_input_ids(self): method test_eager_matches_sdpa_inference (line 316) | def test_eager_matches_sdpa_inference( method test_cpu_offload (line 325) | def test_cpu_offload(self): method test_disk_offload_bin (line 329) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 333) | def test_disk_offload_safetensors(self): method test_left_padding_compatibility (line 337) | def test_left_padding_compatibility(self): method test_generate_continue_from_past_key_values (line 344) | def test_generate_continue_from_past_key_values(self): method flash_attn_inference_equivalence (line 431) | def flash_attn_inference_equivalence( method _test_attention_implementation (line 444) | def _test_attention_implementation(self, attn_implementation): class KyutaiSpeechToTextBf16Test (line 530) | class KyutaiSpeechToTextBf16Test(unittest.TestCase): method test_bf16_fp32_conversion (line 531) | def test_bf16_fp32_conversion(self): class KyutaiSpeechToTextForConditionalGenerationIntegrationTests (line 598) | class KyutaiSpeechToTextForConditionalGenerationIntegrationTests(unittes... method setUp (line 601) | def setUp(self): method tearDown (line 604) | def tearDown(self): method _load_dataset (line 608) | def _load_dataset(cls): method _load_datasamples (line 617) | def _load_datasamples(self, num_samples): method test_generation (line 625) | def test_generation(self): method test_generation_batched (line 655) | def test_generation_batched(self): FILE: tests/models/lasr/test_modeling_lasr.py class LasrEncoderModelTester (line 47) | class LasrEncoderModelTester: method __init__ (line 48) | def __init__( method _get_output_seq_length (line 90) | def _get_output_seq_length(self, seq_length): method prepare_config_and_inputs (line 101) | def prepare_config_and_inputs(self): method get_config (line 108) | def get_config(self): method create_and_check_model (line 122) | def create_and_check_model(self, config, input_features, attention_mask): method prepare_config_and_inputs_for_common (line 133) | def prepare_config_and_inputs_for_common(self): method check_ctc_loss (line 141) | def check_ctc_loss(self, config, input_values, *args): class LasrEncoderModelTest (line 171) | class LasrEncoderModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 177) | def setUp(self): method test_config (line 181) | def test_config(self): method test_model (line 184) | def test_model(self): method test_model_get_set_embeddings (line 189) | def test_model_get_set_embeddings(self): class LasrForCTCModelTester (line 193) | class LasrForCTCModelTester: method __init__ (line 194) | def __init__(self, parent, encoder_kwargs=None, is_training=True, voca... method prepare_config_and_inputs (line 212) | def prepare_config_and_inputs(self): method get_config (line 217) | def get_config(self): method create_and_check_model (line 224) | def create_and_check_model(self, config, input_features, attention_mask): method prepare_config_and_inputs_for_common (line 232) | def prepare_config_and_inputs_for_common(self): method test_ctc_loss_inference (line 240) | def test_ctc_loss_inference(self): class LasrForCTCModelTest (line 246) | class LasrForCTCModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 264) | def setUp(self): method test_config (line 268) | def test_config(self): method test_model (line 271) | def test_model(self): method test_model_get_set_embeddings (line 276) | def test_model_get_set_embeddings(self): method test_sdpa_can_dispatch_composite_models (line 281) | def test_sdpa_can_dispatch_composite_models(self): class LasrForCTCIntegrationTest (line 307) | class LasrForCTCIntegrationTest(unittest.TestCase): method setUp (line 311) | def setUp(cls): method tearDown (line 316) | def tearDown(self): method _load_dataset (line 320) | def _load_dataset(cls): method _load_datasamples (line 328) | def _load_datasamples(self, num_samples): method test_model_integration (line 336) | def test_model_integration(self): method test_model_integration_batched (line 362) | def test_model_integration_batched(self): method test_model_integration_pipe_with_chunk (line 401) | def test_model_integration_pipe_with_chunk(self): FILE: tests/models/layoutlm/test_modeling_layoutlm.py class LayoutLMModelTester (line 38) | class LayoutLMModelTester: method __init__ (line 41) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method get_config (line 127) | def get_config(self): method create_and_check_model (line 142) | def create_and_check_model( method create_and_check_for_masked_lm (line 154) | def create_and_check_for_masked_lm( method create_and_check_for_sequence_classification (line 163) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 175) | def create_and_check_for_token_classification( method create_and_check_for_question_answering (line 185) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 202) | def prepare_config_and_inputs_for_common(self): class LayoutLMModelTest (line 224) | class LayoutLMModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 249) | def setUp(self): method test_config (line 253) | def test_config(self): method test_model (line 256) | def test_model(self): method test_for_masked_lm (line 260) | def test_for_masked_lm(self): method test_for_sequence_classification (line 264) | def test_for_sequence_classification(self): method test_for_token_classification (line 268) | def test_for_token_classification(self): method test_for_question_answering (line 272) | def test_for_question_answering(self): method test_training_gradient_checkpointing (line 277) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 281) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 285) | def test_training_gradient_checkpointing_use_reentrant_true(self): function prepare_layoutlm_batch_inputs (line 289) | def prepare_layoutlm_batch_inputs(): class LayoutLMModelIntegrationTest (line 304) | class LayoutLMModelIntegrationTest(unittest.TestCase): method test_forward_pass_no_head (line 306) | def test_forward_pass_no_head(self): method test_forward_pass_sequence_classification (line 328) | def test_forward_pass_sequence_classification(self): method test_forward_pass_token_classification (line 356) | def test_forward_pass_token_classification(self): method test_forward_pass_question_answering (line 381) | def test_forward_pass_question_answering(self): FILE: tests/models/layoutlmv2/test_image_processing_layoutlmv2.py class LayoutLMv2ImageProcessingTester (line 43) | class LayoutLMv2ImageProcessingTester: method __init__ (line 44) | def __init__( method prepare_image_processor_dict (line 67) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class LayoutLMv2ImageProcessingTest (line 87) | class LayoutLMv2ImageProcessingTest(ImageProcessingTestMixin, unittest.T... method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 103) | def test_image_processor_from_dict_with_kwargs(self): method test_layoutlmv2_integration_test (line 112) | def test_layoutlmv2_integration_test(self): method test_backends_equivalence (line 146) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 171) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 202) | def test_can_compile_torchvision_backend(self): FILE: tests/models/layoutlmv2/test_modeling_layoutlmv2.py class LayoutLMv2ModelTester (line 49) | class LayoutLMv2ModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 118) | def prepare_config_and_inputs(self): method create_and_check_model (line 174) | def create_and_check_model( method create_and_check_for_sequence_classification (line 190) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 207) | def create_and_check_for_token_classification( method create_and_check_for_question_answering (line 224) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 242) | def prepare_config_and_inputs_for_common(self): class LayoutLMv2ModelTest (line 267) | class LayoutLMv2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method setUp (line 286) | def setUp(self): method test_config (line 290) | def test_config(self): method test_model (line 293) | def test_model(self): method test_multi_gpu_data_parallel_forward (line 304) | def test_multi_gpu_data_parallel_forward(self): method test_model_forward_default_config_values (line 308) | def test_model_forward_default_config_values(self): method test_for_sequence_classification (line 311) | def test_for_sequence_classification(self): method test_for_token_classification (line 315) | def test_for_token_classification(self): method test_for_question_answering (line 319) | def test_for_question_answering(self): method test_attention_outputs (line 323) | def test_attention_outputs(self): method test_hidden_states_output (line 386) | def test_hidden_states_output(self): method test_model_from_pretrained (line 426) | def test_model_from_pretrained(self): method test_batching_equivalence (line 431) | def test_batching_equivalence(self): function prepare_layoutlmv2_batch_inputs (line 490) | def prepare_layoutlmv2_batch_inputs(): class LayoutLMv2ModelIntegrationTest (line 505) | class LayoutLMv2ModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 507) | def test_inference_no_head(self): FILE: tests/models/layoutlmv2/test_processing_layoutlmv2.py class LayoutLMv2ProcessorTest (line 36) | class LayoutLMv2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 40) | def _setup_image_processor(cls): method _setup_tokenizer (line 49) | def _setup_tokenizer(cls): method test_image_processor_defaults (line 73) | def test_image_processor_defaults(self): method test_processor_with_multiple_inputs (line 77) | def test_processor_with_multiple_inputs(self): method test_save_load_pretrained_additional_features (line 80) | def test_save_load_pretrained_additional_features(self): method test_overflowing_tokens (line 113) | def test_overflowing_tokens(self): class LayoutLMv2ProcessorIntegrationTests (line 149) | class LayoutLMv2ProcessorIntegrationTests(unittest.TestCase): method get_images (line 151) | def get_images(self): method get_tokenizers (line 159) | def get_tokenizers(self): method test_processor_case_1 (line 165) | def test_processor_case_1(self): method test_processor_case_2 (line 212) | def test_processor_case_2(self): method test_processor_case_3 (line 266) | def test_processor_case_3(self): method test_processor_case_4 (line 331) | def test_processor_case_4(self): method test_processor_case_5 (line 378) | def test_processor_case_5(self): FILE: tests/models/layoutlmv2/test_tokenization_layoutlmv2.py class LayoutLMv2TokenizationTest (line 56) | class LayoutLMv2TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method get_words_and_boxes (line 65) | def get_words_and_boxes(self): method get_words_and_boxes_batch (line 71) | def get_words_and_boxes_batch(self): method get_question_words_and_boxes (line 80) | def get_question_words_and_boxes(self): method get_question_words_and_boxes_batch (line 87) | def get_question_words_and_boxes_batch(self): method get_empty_words_and_boxes (line 97) | def get_empty_words_and_boxes(self): method get_empty_words_and_boxes_batch (line 103) | def get_empty_words_and_boxes_batch(self): method get_empty_question_words_and_boxes (line 112) | def get_empty_question_words_and_boxes(self): method get_empty_question_words_and_boxes_batch (line 119) | def get_empty_question_words_and_boxes_batch(self): method setUpClass (line 130) | def setUpClass(cls): method get_input_output_texts (line 164) | def get_input_output_texts(self, tokenizer): method convert_batch_encode_plus_format_to_encode_plus (line 169) | def convert_batch_encode_plus_format_to_encode_plus(self, batch_encode... method test_chat_template_batched (line 187) | def test_chat_template_batched(self): method test_bos_token_with_add_bos_token_false (line 191) | def test_bos_token_with_add_bos_token_false(self): method test_bos_token_with_add_bos_token_true (line 195) | def test_bos_token_with_add_bos_token_true(self): method test_encode_basic_padding (line 199) | def test_encode_basic_padding(self): method test_pad_token_initialization (line 203) | def test_pad_token_initialization(self): method test_clean_text (line 206) | def test_clean_text(self): method test_sequence_builders (line 213) | def test_sequence_builders(self): method test_offsets_with_special_characters (line 229) | def test_offsets_with_special_characters(self): method test_add_special_tokens (line 258) | def test_add_special_tokens(self): method test_add_tokens_tokenizer (line 274) | def test_add_tokens_tokenizer(self): method test_encode_decode_with_spaces (line 334) | def test_encode_decode_with_spaces(self): method test_right_and_left_truncation (line 352) | def test_right_and_left_truncation(self): method test_split_special_tokens (line 356) | def test_split_special_tokens(self): method test_encode_plus_with_padding (line 360) | def test_encode_plus_with_padding(self, use_padding_as_call_kwarg: bool): method test_internal_consistency (line 469) | def test_internal_consistency(self): method test_mask_output (line 490) | def test_mask_output(self): method test_number_of_added_tokens (line 504) | def test_number_of_added_tokens(self): method test_padding (line 532) | def test_padding(self, max_length=50): method test_call (line 711) | def test_call(self): method test_batch_encode_plus_batch_sequence_length (line 734) | def test_batch_encode_plus_batch_sequence_length(self): method test_batch_encode_plus_overflowing_tokens (line 796) | def test_batch_encode_plus_overflowing_tokens(self): method test_batch_encode_plus_padding (line 799) | def test_batch_encode_plus_padding(self): method test_padding_to_multiple_of (line 847) | def test_padding_to_multiple_of(self): method test_special_tokens_mask_input_pairs (line 884) | def test_special_tokens_mask_input_pairs(self): method test_special_tokens_mask (line 907) | def test_special_tokens_mask(self): method test_save_and_load_tokenizer (line 924) | def test_save_and_load_tokenizer(self): method test_right_and_left_padding (line 951) | def test_right_and_left_padding(self): method test_token_type_ids (line 1014) | def test_token_type_ids(self): method test_offsets_mapping (line 1046) | def test_offsets_mapping(self): method test_torch_encode_plus_sent_to_model (line 1095) | def test_torch_encode_plus_sent_to_model(self): method test_compare_add_special_tokens (line 1141) | def test_compare_add_special_tokens(self): method test_layoutlmv2_truncation_integration_test (line 1178) | def test_layoutlmv2_truncation_integration_test(self): method test_sequence_ids (line 1197) | def test_sequence_ids(self): method test_special_tokens_initialization (line 1221) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 1239) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 1272) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_prepare_for_model (line 1366) | def test_prepare_for_model(self): method test_batch_encode_dynamic_overflowing (line 1380) | def test_batch_encode_dynamic_overflowing(self): method test_alignment_methods (line 1437) | def test_alignment_methods(self): method get_clean_sequence (line 1440) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method test_maximum_encoding_length_pair_input (line 1475) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 1837) | def test_maximum_encoding_length_single_input(self): method test_pretokenized_inputs (line 1959) | def test_pretokenized_inputs(self): method test_compare_pretokenized_inputs (line 1963) | def test_compare_pretokenized_inputs(self): method test_compare_prepare_for_model (line 1967) | def test_compare_prepare_for_model(self): method test_only_label_first_subword (line 1971) | def test_only_label_first_subword(self): method test_layoutlmv2_integration_test (line 1999) | def test_layoutlmv2_integration_test(self): method test_np_encode_plus_sent_to_model (line 2076) | def test_np_encode_plus_sent_to_model(self): method test_chat_template (line 2080) | def test_chat_template(self): method test_chat_template_return_assistant_tokens_mask (line 2084) | def test_chat_template_return_assistant_tokens_mask(self): method test_chat_template_return_assistant_tokens_mask_truncated (line 2088) | def test_chat_template_return_assistant_tokens_mask_truncated(self): method test_empty_input_string (line 2091) | def test_empty_input_string(self): method test_integration (line 2136) | def test_integration(self): method test_integration_from_extractor (line 2184) | def test_integration_from_extractor(self): FILE: tests/models/layoutlmv3/test_image_processing_layoutlmv3.py class LayoutLMv3ImageProcessingTester (line 23) | class LayoutLMv3ImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 47) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 50) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 53) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class LayoutLMv3ImageProcessingTest (line 67) | class LayoutLMv3ImageProcessingTest(ImageProcessingTestMixin, unittest.T... method setUp (line 68) | def setUp(self): method image_processor_dict (line 73) | def image_processor_dict(self): method test_image_processor_properties (line 76) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 83) | def test_image_processor_from_dict_with_kwargs(self): method test_LayoutLMv3_integration_test (line 91) | def test_LayoutLMv3_integration_test(self): FILE: tests/models/layoutlmv3/test_modeling_layoutlmv3.py class LayoutLMv3ModelTester (line 50) | class LayoutLMv3ModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 116) | def prepare_config_and_inputs(self): method create_and_check_model (line 168) | def create_and_check_model( method create_and_check_for_sequence_classification (line 197) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 214) | def create_and_check_for_token_classification( method create_and_check_for_question_answering (line 231) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 249) | def prepare_config_and_inputs_for_common(self): class LayoutLMv3ModelTest (line 272) | class LayoutLMv3ModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method is_pipeline_test_to_skip (line 292) | def is_pipeline_test_to_skip( method setUp (line 308) | def setUp(self): method _prepare_for_class (line 312) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 348) | def test_config(self): method test_model (line 351) | def test_model(self): method test_for_sequence_classification (line 355) | def test_for_sequence_classification(self): method test_for_token_classification (line 359) | def test_for_token_classification(self): method test_for_question_answering (line 363) | def test_for_question_answering(self): method test_model_from_pretrained (line 368) | def test_model_from_pretrained(self): function prepare_img (line 375) | def prepare_img(): class LayoutLMv3ModelIntegrationTest (line 381) | class LayoutLMv3ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 383) | def default_image_processor(self): method test_inference_no_head (line 387) | def test_inference_no_head(self): FILE: tests/models/layoutlmv3/test_processing_layoutlmv3.py class LayoutLMv3ProcessorTest (line 34) | class LayoutLMv3ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 38) | def _setup_image_processor(cls): method _setup_tokenizer (line 47) | def _setup_tokenizer(cls): method test_image_processor_defaults (line 64) | def test_image_processor_defaults(self): class LayoutLMv3ProcessorIntegrationTests (line 71) | class LayoutLMv3ProcessorIntegrationTests(unittest.TestCase): method get_images (line 73) | def get_images(self): method get_tokenizers (line 81) | def get_tokenizers(self): method test_processor_case_1 (line 87) | def test_processor_case_1(self): method test_processor_case_2 (line 138) | def test_processor_case_2(self): method test_processor_case_3 (line 192) | def test_processor_case_3(self): method test_processor_case_4 (line 257) | def test_processor_case_4(self): method test_processor_case_5 (line 304) | def test_processor_case_5(self): FILE: tests/models/layoutlmv3/test_tokenization_layoutlmv3.py class LayoutLMv3TokenizationTest (line 50) | class LayoutLMv3TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method get_words_and_boxes (line 60) | def get_words_and_boxes(self): method test_integration (line 66) | def test_integration(self): method test_integration_from_extractor (line 112) | def test_integration_from_extractor(self): method get_words_and_boxes_batch (line 157) | def get_words_and_boxes_batch(self): method get_question_words_and_boxes (line 166) | def get_question_words_and_boxes(self): method get_question_words_and_boxes_batch (line 173) | def get_question_words_and_boxes_batch(self): method get_empty_words_and_boxes (line 183) | def get_empty_words_and_boxes(self): method get_empty_words_and_boxes_batch (line 189) | def get_empty_words_and_boxes_batch(self): method get_empty_question_words_and_boxes (line 198) | def get_empty_question_words_and_boxes(self): method get_empty_question_words_and_boxes_batch (line 205) | def get_empty_question_words_and_boxes_batch(self): method setUpClass (line 216) | def setUpClass(cls): method get_tokenizer (line 254) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_rust_tokenizer (line 260) | def get_rust_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 265) | def get_input_output_texts(self, tokenizer): method convert_batch_encode_plus_format_to_encode_plus (line 270) | def convert_batch_encode_plus_format_to_encode_plus(self, batch_encode... method test_chat_template_batched (line 288) | def test_chat_template_batched(self): method test_bos_token_with_add_bos_token_false (line 292) | def test_bos_token_with_add_bos_token_false(self): method test_bos_token_with_add_bos_token_true (line 296) | def test_bos_token_with_add_bos_token_true(self): method test_encode_basic_padding (line 300) | def test_encode_basic_padding(self): method test_pad_token_initialization (line 304) | def test_pad_token_initialization(self): method test_full_tokenizer (line 307) | def test_full_tokenizer(self): method test_sequence_builders (line 319) | def test_sequence_builders(self): method test_add_special_tokens (line 335) | def test_add_special_tokens(self): method test_add_tokens_tokenizer (line 351) | def test_add_tokens_tokenizer(self): method test_encode_decode_with_spaces (line 411) | def test_encode_decode_with_spaces(self): method test_right_and_left_truncation (line 429) | def test_right_and_left_truncation(self): method test_split_special_tokens (line 433) | def test_split_special_tokens(self): method test_encode_plus_with_padding (line 437) | def test_encode_plus_with_padding(self, use_padding_as_call_kwarg: bool): method test_internal_consistency (line 546) | def test_internal_consistency(self): method test_mask_output (line 567) | def test_mask_output(self): method test_number_of_added_tokens (line 581) | def test_number_of_added_tokens(self): method test_padding (line 609) | def test_padding(self, max_length=50): method test_call (line 792) | def test_call(self): method test_batch_encode_plus_batch_sequence_length (line 815) | def test_batch_encode_plus_batch_sequence_length(self): method test_batch_encode_plus_overflowing_tokens (line 880) | def test_batch_encode_plus_overflowing_tokens(self): method test_batch_encode_plus_padding (line 883) | def test_batch_encode_plus_padding(self): method test_padding_to_multiple_of (line 935) | def test_padding_to_multiple_of(self): method test_special_tokens_mask_input_pairs (line 972) | def test_special_tokens_mask_input_pairs(self): method test_special_tokens_mask (line 995) | def test_special_tokens_mask(self): method test_save_and_load_tokenizer (line 1012) | def test_save_and_load_tokenizer(self): method test_right_and_left_padding (line 1039) | def test_right_and_left_padding(self): method test_token_type_ids (line 1102) | def test_token_type_ids(self): method test_offsets_mapping (line 1133) | def test_offsets_mapping(self): method test_compare_add_special_tokens (line 1179) | def test_compare_add_special_tokens(self): method test_layoutlmv3_truncation_integration_test (line 1216) | def test_layoutlmv3_truncation_integration_test(self): method test_sequence_ids (line 1235) | def test_sequence_ids(self): method test_special_tokens_initialization (line 1259) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 1277) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 1314) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_prepare_for_model (line 1415) | def test_prepare_for_model(self): method test_batch_encode_dynamic_overflowing (line 1418) | def test_batch_encode_dynamic_overflowing(self): method test_alignment_methods (line 1480) | def test_alignment_methods(self): method get_clean_sequence (line 1483) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method test_added_token_with_space_before (line 1517) | def test_added_token_with_space_before(self): method test_maximum_encoding_length_pair_input (line 1547) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 1909) | def test_maximum_encoding_length_single_input(self): method test_pretokenized_inputs (line 2032) | def test_pretokenized_inputs(self): method test_compare_pretokenized_inputs (line 2036) | def test_compare_pretokenized_inputs(self): method test_compare_prepare_for_model (line 2040) | def test_compare_prepare_for_model(self): method test_only_label_first_subword (line 2044) | def test_only_label_first_subword(self): method test_layoutlmv3_integration_test (line 2075) | def test_layoutlmv3_integration_test(self): method test_np_encode_plus_sent_to_model (line 2139) | def test_np_encode_plus_sent_to_model(self): method test_chat_template (line 2143) | def test_chat_template(self): method test_chat_template_return_assistant_tokens_mask (line 2147) | def test_chat_template_return_assistant_tokens_mask(self): method test_chat_template_return_assistant_tokens_mask_truncated (line 2151) | def test_chat_template_return_assistant_tokens_mask_truncated(self): method test_empty_input_string (line 2154) | def test_empty_input_string(self): FILE: tests/models/layoutxlm/test_processing_layoutxlm.py class LayoutXLMProcessorTest (line 42) | class LayoutXLMProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 46) | def _setup_image_processor(cls): method _setup_tokenizer (line 56) | def _setup_tokenizer(cls): method test_image_processor_defaults (line 62) | def test_image_processor_defaults(self): method test_processor_with_multiple_inputs (line 66) | def test_processor_with_multiple_inputs(self): method test_save_load_pretrained_additional_features (line 70) | def test_save_load_pretrained_additional_features(self): method test_overflowing_tokens (line 106) | def test_overflowing_tokens(self): class LayoutXLMProcessorIntegrationTests (line 144) | class LayoutXLMProcessorIntegrationTests(unittest.TestCase): method get_images (line 146) | def get_images(self): method get_tokenizers (line 154) | def get_tokenizers(self): method test_processor_case_1 (line 160) | def test_processor_case_1(self): method test_processor_case_2 (line 211) | def test_processor_case_2(self): method test_processor_case_3 (line 265) | def test_processor_case_3(self): method test_processor_case_4 (line 330) | def test_processor_case_4(self): method test_processor_case_5 (line 377) | def test_processor_case_5(self): FILE: tests/models/layoutxlm/test_tokenization_layoutxlm.py class LayoutXLMTokenizationTest (line 55) | class LayoutXLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method get_words_and_boxes (line 66) | def get_words_and_boxes(self): method get_words_and_boxes_batch (line 72) | def get_words_and_boxes_batch(self): method get_question_words_and_boxes (line 81) | def get_question_words_and_boxes(self): method get_question_words_and_boxes_batch (line 88) | def get_question_words_and_boxes_batch(self): method get_empty_words_and_boxes (line 98) | def get_empty_words_and_boxes(self): method get_empty_words_and_boxes_batch (line 104) | def get_empty_words_and_boxes_batch(self): method get_empty_question_words_and_boxes (line 113) | def get_empty_question_words_and_boxes(self): method get_empty_question_words_and_boxes_batch (line 120) | def get_empty_question_words_and_boxes_batch(self): method setUpClass (line 131) | def setUpClass(cls): method convert_batch_encode_plus_format_to_encode_plus (line 142) | def convert_batch_encode_plus_format_to_encode_plus(self, batch_encode... method get_input_output_texts (line 159) | def get_input_output_texts(self, tokenizer): method test_chat_template_batched (line 165) | def test_chat_template_batched(self): method test_bos_token_with_add_bos_token_true (line 168) | def test_bos_token_with_add_bos_token_true(self): method test_bos_token_with_add_bos_token_false (line 181) | def test_bos_token_with_add_bos_token_false(self): method test_pad_token_initialization (line 194) | def test_pad_token_initialization(self): method test_encode_basic_padding (line 218) | def test_encode_basic_padding(self): method test_save_sentencepiece_tokenizer (line 254) | def test_save_sentencepiece_tokenizer(self) -> None: method test_split_special_tokens (line 290) | def test_split_special_tokens(self): method test_sequence_builders (line 318) | def test_sequence_builders(self): method test_offsets_with_special_characters (line 334) | def test_offsets_with_special_characters(self): method test_add_special_tokens (line 363) | def test_add_special_tokens(self): method test_add_tokens_tokenizer (line 379) | def test_add_tokens_tokenizer(self): method test_encode_decode_with_spaces (line 439) | def test_encode_decode_with_spaces(self): method test_encode_plus_with_padding (line 457) | def test_encode_plus_with_padding(self, use_padding_as_call_kwarg: bool): method test_internal_consistency (line 566) | def test_internal_consistency(self): method test_mask_output (line 587) | def test_mask_output(self): method test_number_of_added_tokens (line 601) | def test_number_of_added_tokens(self): method test_padding (line 629) | def test_padding(self, max_length=50): method test_call (line 812) | def test_call(self): method test_batch_encode_plus_batch_sequence_length (line 835) | def test_batch_encode_plus_batch_sequence_length(self): method test_batch_encode_plus_overflowing_tokens (line 900) | def test_batch_encode_plus_overflowing_tokens(self): method test_batch_encode_plus_padding (line 903) | def test_batch_encode_plus_padding(self): method test_padding_to_multiple_of (line 955) | def test_padding_to_multiple_of(self): method test_tokenizer_slow_store_full_signature (line 992) | def test_tokenizer_slow_store_full_signature(self): method test_build_inputs_with_special_tokens (line 1000) | def test_build_inputs_with_special_tokens(self): method test_special_tokens_mask_input_pairs (line 1016) | def test_special_tokens_mask_input_pairs(self): method test_special_tokens_mask (line 1039) | def test_special_tokens_mask(self): method test_save_and_load_tokenizer (line 1056) | def test_save_and_load_tokenizer(self): method test_right_and_left_truncation (line 1084) | def test_right_and_left_truncation(self): method test_right_and_left_padding (line 1087) | def test_right_and_left_padding(self): method test_token_type_ids (line 1150) | def test_token_type_ids(self): method test_offsets_mapping (line 1182) | def test_offsets_mapping(self): method test_torch_encode_plus_sent_to_model (line 1230) | def test_torch_encode_plus_sent_to_model(self): method test_rust_and_python_full_tokenizers (line 1271) | def test_rust_and_python_full_tokenizers(self): method test_tokenization_python_rust_equals (line 1279) | def test_tokenization_python_rust_equals(self): method test_embedded_special_tokens (line 1284) | def test_embedded_special_tokens(self): method test_compare_add_special_tokens (line 1289) | def test_compare_add_special_tokens(self): method test_layoutxlm_truncation_integration_test (line 1326) | def test_layoutxlm_truncation_integration_test(self): method test_sequence_ids (line 1345) | def test_sequence_ids(self): method test_special_tokens_initialization (line 1369) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 1387) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 1427) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_prepare_for_model (line 1538) | def test_prepare_for_model(self): method test_padding_different_model_input_name (line 1552) | def test_padding_different_model_input_name(self): method test_batch_encode_dynamic_overflowing (line 1557) | def test_batch_encode_dynamic_overflowing(self): method test_save_pretrained (line 1614) | def test_save_pretrained(self): method test_alignment_methods (line 1620) | def test_alignment_methods(self): method test_maximum_encoding_length_pair_input (line 1624) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 1628) | def test_maximum_encoding_length_single_input(self): method test_pretokenized_inputs (line 1632) | def test_pretokenized_inputs(self): method test_compare_pretokenized_inputs (line 1636) | def test_compare_pretokenized_inputs(self): method test_compare_prepare_for_model (line 1640) | def test_compare_prepare_for_model(self): method test_only_label_first_subword (line 1644) | def test_only_label_first_subword(self): method test_layoutxlm_integration_test (line 1659) | def test_layoutxlm_integration_test(self): method test_np_encode_plus_sent_to_model (line 1722) | def test_np_encode_plus_sent_to_model(self): method test_sentencepiece_tokenize_and_convert_tokens_to_string (line 1726) | def test_sentencepiece_tokenize_and_convert_tokens_to_string(self): method test_sentencepiece_tokenize_and_decode (line 1730) | def test_sentencepiece_tokenize_and_decode(self): method test_chat_template (line 1734) | def test_chat_template(self): method test_chat_template_return_assistant_tokens_mask (line 1738) | def test_chat_template_return_assistant_tokens_mask(self): method test_chat_template_return_assistant_tokens_mask_truncated (line 1742) | def test_chat_template_return_assistant_tokens_mask_truncated(self): method test_empty_input_string (line 1745) | def test_empty_input_string(self): FILE: tests/models/led/test_modeling_led.py function prepare_led_inputs_dict (line 51) | def prepare_led_inputs_dict( class LEDModelTester (line 71) | class LEDModelTester: method __init__ (line 72) | def __init__( method prepare_config_and_inputs (line 125) | def prepare_config_and_inputs(self): method get_config (line 138) | def get_config(self): method get_pipeline_config (line 157) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 163) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 171) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 204) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): method check_global_attention (line 238) | def check_global_attention(self, config, inputs_dict): class LEDModelTest (line 264) | class LEDModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method is_pipeline_test_to_skip (line 281) | def is_pipeline_test_to_skip( method setUp (line 296) | def setUp(self): method test_config (line 300) | def test_config(self): method test_save_load_strict (line 303) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 313) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 317) | def test_encoder_decoder_model_standalone(self): method test_global_attention (line 321) | def test_global_attention(self): method prepare_config_and_inputs_for_generate (line 325) | def prepare_config_and_inputs_for_generate(self, *args, **kwargs): method test_inputs_embeds (line 331) | def test_inputs_embeds(self): method test_generate_fp16 (line 361) | def test_generate_fp16(self): method test_retain_grad_hidden_states_attentions (line 371) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 374) | def test_attention_outputs(self): method _check_encoder_attention_for_generate (line 448) | def _check_encoder_attention_for_generate(self, attentions, batch_size... function assert_tensors_close (line 463) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 482) | def _long_tensor(tok_lst): class LEDModelIntegrationTests (line 493) | class LEDModelIntegrationTests(unittest.TestCase): method default_tokenizer (line 502) | def default_tokenizer(self): method test_inference_no_head (line 505) | def test_inference_no_head(self): method test_inference_head (line 522) | def test_inference_head(self): method test_seq_to_seq_generation (line 539) | def test_seq_to_seq_generation(self): FILE: tests/models/levit/test_image_processing_levit.py class LevitImageProcessingTester (line 23) | class LevitImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 56) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 67) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 70) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class LevitImageProcessingTest (line 84) | class LevitImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 85) | def setUp(self): method image_processor_dict (line 90) | def image_processor_dict(self): method test_image_processor_properties (line 93) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 103) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/levit/test_modeling_levit.py class LevitConfigTester (line 50) | class LevitConfigTester(ConfigTester): method create_and_test_config_common_properties (line 51) | def create_and_test_config_common_properties(self): class LevitModelTester (line 57) | class LevitModelTester: method __init__ (line 58) | def __init__( method prepare_config_and_inputs (line 105) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method create_and_check_model (line 134) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 149) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 157) | def prepare_config_and_inputs_for_common(self): class LevitModelTest (line 165) | class LevitModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 188) | def setUp(self): method test_config (line 194) | def test_config(self): method test_inputs_embeds (line 198) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 202) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 206) | def test_attention_outputs(self): method test_hidden_states_output (line 209) | def test_hidden_states_output(self): method _prepare_for_class (line 261) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_model (line 270) | def test_model(self): method test_for_image_classification (line 274) | def test_for_image_classification(self): method test_training (line 279) | def test_training(self): method test_training_gradient_checkpointing (line 300) | def test_training_gradient_checkpointing(self): method test_problem_types (line 322) | def test_problem_types(self): method test_model_from_pretrained (line 372) | def test_model_from_pretrained(self): function prepare_img (line 379) | def prepare_img(): class LevitModelIntegrationTest (line 386) | class LevitModelIntegrationTest(unittest.TestCase): method default_image_processor (line 388) | def default_image_processor(self): method test_inference_image_classification_head (line 392) | def test_inference_image_classification_head(self): FILE: tests/models/lfm2/test_modeling_lfm2.py class Lfm2ModelTester (line 35) | class Lfm2ModelTester(CausalLMModelTester): method __init__ (line 39) | def __init__( class Lfm2ModelTest (line 49) | class Lfm2ModelTest(CausalLMModelTest, unittest.TestCase): method _get_conv_state_shape (line 54) | def _get_conv_state_shape(self, batch_size: int, config): method test_attention_outputs (line 57) | def test_attention_outputs(self): class Lfm2IntegrationTest (line 102) | class Lfm2IntegrationTest(unittest.TestCase): FILE: tests/models/lfm2_moe/test_modeling_lfm2_moe.py class Lfm2MoeModelTester (line 38) | class Lfm2MoeModelTester(CausalLMModelTester): method __init__ (line 44) | def __init__( class Lfm2MoeModelTest (line 58) | class Lfm2MoeModelTest(CausalLMModelTest, unittest.TestCase): method _get_conv_state_shape (line 72) | def _get_conv_state_shape(self, batch_size: int, config): method test_attention_outputs (line 75) | def test_attention_outputs(self): class Lfm2MoeIntegrationTest (line 120) | class Lfm2MoeIntegrationTest(unittest.TestCase): method setUpClass (line 122) | def setUpClass(cls): method tearDownClass (line 126) | def tearDownClass(cls): method tearDown (line 130) | def tearDown(self): method get_model (line 134) | def get_model(cls): method test_model_1a8b_logits (line 145) | def test_model_1a8b_logits(self): method test_model_1a8b_generation (line 178) | def test_model_1a8b_generation(self): method test_model_1a8b_batched_chat_generation (line 194) | def test_model_1a8b_batched_chat_generation(self): FILE: tests/models/lfm2_vl/test_image_processing_lfm2_vl.py class Lfm2VlImageProcessingTester (line 39) | class Lfm2VlImageProcessingTester: method __init__ (line 40) | def __init__( method prepare_image_processor_dict (line 77) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 91) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Lfm2VlImageProcessingTest (line 106) | class Lfm2VlImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 107) | def setUp(self): method image_processor_dict (line 112) | def image_processor_dict(self): method test_image_processor_properties (line 115) | def test_image_processor_properties(self): method test_smart_resize (line 129) | def test_smart_resize(self): method test_get_grid_layout (line 145) | def test_get_grid_layout(self): method test_find_closest_aspect_ratio (line 168) | def test_find_closest_aspect_ratio(self): method test_call_numpy (line 176) | def test_call_numpy(self): method test_call_numpy_4_channels (line 203) | def test_call_numpy_4_channels(self): method test_call_pil (line 233) | def test_call_pil(self): method test_call_pytorch (line 260) | def test_call_pytorch(self): method test_small_image_no_tiling_no_thumbnail (line 288) | def test_small_image_no_tiling_no_thumbnail(self): method test_small_image_tiling_enabled_no_thumbnail (line 304) | def test_small_image_tiling_enabled_no_thumbnail(self): method test_large_image_no_tiling_smart_resize (line 322) | def test_large_image_no_tiling_smart_resize(self): method test_large_image_tiling_enabled_thumbnail_disabled (line 338) | def test_large_image_tiling_enabled_thumbnail_disabled(self): method test_large_image_tiling_enabled_thumbnail_enabled (line 363) | def test_large_image_tiling_enabled_thumbnail_enabled(self): method test_landscape_image_aspect_ratio (line 388) | def test_landscape_image_aspect_ratio(self): method test_extreme_aspect_ratio_wide (line 407) | def test_extreme_aspect_ratio_wide(self): method test_extreme_aspect_ratio_tall (line 426) | def test_extreme_aspect_ratio_tall(self): method test_image_sizes_returned_with_row_col_info (line 447) | def test_image_sizes_returned_with_row_col_info(self): method test_output_consistency_across_formats (line 464) | def test_output_consistency_across_formats(self): method test_multiple_images_per_sample (line 485) | def test_multiple_images_per_sample(self): method test_mixed_image_counts_across_batch (line 500) | def test_mixed_image_counts_across_batch(self): method test_multiple_images_different_sizes (line 515) | def test_multiple_images_different_sizes(self): method test_forced_grid_config_min_equals_max (line 532) | def test_forced_grid_config_min_equals_max(self): method test_min_tiles_greater_than_max_tiles_raises_error (line 554) | def test_min_tiles_greater_than_max_tiles_raises_error(self): method test_very_small_image (line 570) | def test_very_small_image(self): method test_grayscale_image (line 584) | def test_grayscale_image(self): method test_rgba_4_channel_image (line 598) | def test_rgba_4_channel_image(self): method test_numpy_4_channel_rgba (line 611) | def test_numpy_4_channel_rgba(self): method test_single_pixel_image (line 625) | def test_single_pixel_image(self): method test_round_by_factor (line 637) | def test_round_by_factor(self): method test_is_image_too_large_small_image (line 655) | def test_is_image_too_large_small_image(self): method test_is_image_too_large_large_image (line 674) | def test_is_image_too_large_large_image(self): method test_batch_mixed_image_sizes (line 695) | def test_batch_mixed_image_sizes(self): method test_batch_mixed_aspect_ratios (line 724) | def test_batch_mixed_aspect_ratios(self): method test_disable_grouping_single_image (line 755) | def test_disable_grouping_single_image(self): method test_disable_grouping_batch (line 782) | def test_disable_grouping_batch(self): method test_batch_with_tiling (line 797) | def test_batch_with_tiling(self): method test_batch_tiling (line 830) | def test_batch_tiling(self): FILE: tests/models/lfm2_vl/test_modeling_lfm2_vl.py class Lfm2VlModelTester (line 49) | class Lfm2VlModelTester(CausalLMModelTester): method __init__ (line 55) | def __init__( method get_config (line 108) | def get_config(self): method prepare_config_and_inputs (line 117) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 131) | def prepare_config_and_inputs_for_common(self): class Lfm2VlModelTest (line 152) | class Lfm2VlModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.... method setUp (line 167) | def setUp(self): method _get_conv_state_shape (line 174) | def _get_conv_state_shape(self, batch_size: int, config): method test_config (line 177) | def test_config(self): method test_attention_outputs (line 183) | def test_attention_outputs(self): method test_sdpa_can_compile_dynamic (line 190) | def test_sdpa_can_compile_dynamic(self): method test_training_gradient_checkpointing (line 194) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 198) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 202) | def test_training_gradient_checkpointing_use_reentrant_true(self): class Lfm2VlForConditionalGenerationIntegrationTest (line 208) | class Lfm2VlForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 209) | def setUp(self): method tearDown (line 223) | def tearDown(self): method test_integration_test (line 226) | def test_integration_test(self): method test_integration_test_high_resolution (line 245) | def test_integration_test_high_resolution(self): method test_integration_test_batched (line 266) | def test_integration_test_batched(self): class Lfm2_5VlForConditionalGenerationIntegrationTest (line 291) | class Lfm2_5VlForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 292) | def setUp(self): method tearDown (line 306) | def tearDown(self): method test_integration_test (line 309) | def test_integration_test(self): method test_integration_test_high_resolution (line 330) | def test_integration_test_high_resolution(self): method test_integration_test_batched (line 349) | def test_integration_test_batched(self): FILE: tests/models/lfm2_vl/test_processing_lfm2_vl.py class Lfm2VlProcessorTest (line 36) | class Lfm2VlProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 40) | def _setup_image_processor(cls): method _setup_tokenizer (line 51) | def _setup_tokenizer(cls): method _setup_test_attributes (line 57) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 73) | def prepare_processor_dict(): method test_tokenizer_defaults (line 97) | def test_tokenizer_defaults(self): method prepare_image_inputs (line 101) | def prepare_image_inputs(self, batch_size=None): method get_split_image_expected_tokens (line 108) | def get_split_image_expected_tokens(self, processor, image_rows, image... method test_process_interleaved_images_prompts_no_image_splitting_single_image (line 123) | def test_process_interleaved_images_prompts_no_image_splitting_single_... method test_process_interleaved_images_prompts_no_image_splitting_single_image_with_text (line 147) | def test_process_interleaved_images_prompts_no_image_splitting_single_... method test_process_interleaved_images_prompts_no_image_splitting_multiple_images (line 171) | def test_process_interleaved_images_prompts_no_image_splitting_multipl... method test_process_interleaved_images_prompts_image_splitting (line 217) | def test_process_interleaved_images_prompts_image_splitting(self): method test_add_special_tokens_processor_image_splitting (line 260) | def test_add_special_tokens_processor_image_splitting(self): method test_add_special_tokens_processor_image_splitting_large_image (line 275) | def test_add_special_tokens_processor_image_splitting_large_image(self): method test_add_special_tokens_processor_image_no_splitting (line 290) | def test_add_special_tokens_processor_image_no_splitting(self): method test_process_interleaved_images_prompts_image_error (line 305) | def test_process_interleaved_images_prompts_image_error(self): method test_apply_chat_template (line 355) | def test_apply_chat_template(self): method test_text_only_inference (line 389) | def test_text_only_inference(self): method test_missing_images_error (line 432) | def test_missing_images_error(self): method test_single_tile_image_with_thumbnail_disabled (line 460) | def test_single_tile_image_with_thumbnail_disabled(self): method test_multi_image (line 502) | def test_multi_image(self): method test_multi_turn_multi_image (line 530) | def test_multi_turn_multi_image(self): FILE: tests/models/lightglue/test_image_processing_lightglue.py function random_array (line 31) | def random_array(size): function random_tensor (line 35) | def random_tensor(size): class LightGlueImageProcessingTester (line 39) | class LightGlueImageProcessingTester(SuperGlueImageProcessingTester): method __init__ (line 42) | def __init__( method prepare_keypoint_matching_output (line 58) | def prepare_keypoint_matching_output(self, pixel_values): class LightGlueImageProcessingTest (line 88) | class LightGlueImageProcessingTest(SuperGlueImageProcessingTest, unittes... method setUp (line 89) | def setUp(self) -> None: FILE: tests/models/lightglue/test_modeling_lightglue.py class LightGlueModelTester (line 37) | class LightGlueModelTester: method __init__ (line 38) | def __init__( method prepare_config_and_inputs (line 76) | def prepare_config_and_inputs(self): method get_config (line 82) | def get_config(self): method create_and_check_model (line 95) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 118) | def prepare_config_and_inputs_for_common(self): class LightGlueModelTest (line 126) | class LightGlueModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 134) | def setUp(self): method test_config (line 138) | def test_config(self): method test_batching_equivalence (line 146) | def test_batching_equivalence(self, atol=1e-5, rtol=1e-5): method test_inputs_embeds (line 154) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 158) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 162) | def test_feed_forward_chunking(self): method test_training (line 166) | def test_training(self): method test_training_gradient_checkpointing (line 170) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 174) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 178) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 182) | def test_retain_grad_hidden_states_attentions(self): method test_model (line 185) | def test_model(self): method test_forward_signature (line 189) | def test_forward_signature(self): method test_hidden_states_output (line 201) | def test_hidden_states_output(self): method test_attention_outputs (line 241) | def test_attention_outputs(self): method test_model_from_pretrained (line 274) | def test_model_from_pretrained(self): method test_forward_labels_should_be_none (line 281) | def test_forward_labels_should_be_none(self): function prepare_imgs (line 298) | def prepare_imgs(): class LightGlueModelIntegrationTest (line 309) | class LightGlueModelIntegrationTest(unittest.TestCase): method default_image_processor (line 311) | def default_image_processor(self): method test_inference (line 315) | def test_inference(self): method test_inference_without_early_stop (line 391) | def test_inference_without_early_stop(self): method test_inference_without_early_stop_and_keypoint_pruning (line 480) | def test_inference_without_early_stop_and_keypoint_pruning(self): method test_inference_order_with_early_stop (line 555) | def test_inference_order_with_early_stop(self): FILE: tests/models/lighton_ocr/test_modeling_lighton_ocr.py class LightOnOcrVisionText2TextModelTester (line 48) | class LightOnOcrVisionText2TextModelTester: method __init__ (line 49) | def __init__( method get_config (line 127) | def get_config(self): method prepare_config_and_inputs (line 135) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 148) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_generate (line 172) | def prepare_config_and_inputs_for_generate(self, batch_size=None): class LightOnOcrForConditionalGenerationModelTest (line 214) | class LightOnOcrForConditionalGenerationModelTest(ModelTesterMixin, Gene... method setUp (line 234) | def setUp(self): method _prepare_for_class (line 241) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method prepare_config_and_inputs_for_generate (line 256) | def prepare_config_and_inputs_for_generate(self, batch_size=1): method test_config (line 260) | def test_config(self): method test_mismatching_num_image_tokens (line 263) | def test_mismatching_num_image_tokens(self): method test_spatial_merge_size (line 297) | def test_spatial_merge_size(self): method test_forward_pass_with_image_sizes (line 323) | def test_forward_pass_with_image_sizes(self): method test_model_outputs_equivalence (line 364) | def test_model_outputs_equivalence(self): method test_vision_projection (line 382) | def test_vision_projection(self): method test_get_image_features (line 413) | def test_get_image_features(self): class LightOnOcrForConditionalGenerationIntegrationTest (line 439) | class LightOnOcrForConditionalGenerationIntegrationTest(unittest.TestCase): method tearDown (line 440) | def tearDown(self): method test_lightonocr_ocr_integration (line 444) | def test_lightonocr_ocr_integration(self): method test_model_can_generate_without_images (line 503) | def test_model_can_generate_without_images(self): method test_model_forward_with_images (line 542) | def test_model_forward_with_images(self): FILE: tests/models/lighton_ocr/test_processor_lighton_ocr.py class LightOnOcrProcessorTest (line 36) | class LightOnOcrProcessorTest(ProcessorTesterMixin, unittest.TestCase): method setUp (line 42) | def setUp(self): method prepare_image_inputs (line 47) | def prepare_image_inputs(self, batch_size=None): method test_processor_creation (line 54) | def test_processor_creation(self): method test_processor_with_text_only (line 61) | def test_processor_with_text_only(self): method test_processor_with_image_and_text (line 72) | def test_processor_with_image_and_text(self): method test_processor_image_token_expansion (line 90) | def test_processor_image_token_expansion(self): method test_processor_batch_processing (line 106) | def test_processor_batch_processing(self): method test_processor_model_input_names (line 117) | def test_processor_model_input_names(self): method test_processor_without_images (line 128) | def test_processor_without_images(self): method test_processor_special_tokens (line 140) | def test_processor_special_tokens(self): method test_processor_return_types (line 154) | def test_processor_return_types(self): method test_image_sizes_output (line 173) | def test_image_sizes_output(self): FILE: tests/models/lilt/test_modeling_lilt.py class LiltModelTester (line 39) | class LiltModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 122) | def get_config(self): method create_and_check_model (line 137) | def create_and_check_model( method create_and_check_for_token_classification (line 157) | def create_and_check_for_token_classification( method create_and_check_for_question_answering (line 176) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 200) | def prepare_config_and_inputs_for_common(self): class LiltModelTest (line 221) | class LiltModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method is_pipeline_test_to_skip (line 244) | def is_pipeline_test_to_skip( method setUp (line 256) | def setUp(self): method test_config (line 260) | def test_config(self): method test_model (line 263) | def test_model(self): method test_for_token_classification (line 267) | def test_for_token_classification(self): method test_for_question_answering (line 271) | def test_for_question_answering(self): method test_training_gradient_checkpointing (line 276) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 280) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_model_from_pretrained (line 284) | def test_model_from_pretrained(self): class LiltModelIntegrationTest (line 292) | class LiltModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 293) | def test_inference_no_head(self): FILE: tests/models/llama/test_modeling_llama.py class LlamaModelTester (line 44) | class LlamaModelTester(CausalLMModelTester): class LlamaModelTest (line 50) | class LlamaModelTest(CausalLMModelTest, unittest.TestCase): class LlamaIntegrationTest (line 62) | class LlamaIntegrationTest(unittest.TestCase): method setup (line 63) | def setup(self): method tearDown (line 66) | def tearDown(self): method test_llama_3_1_hard (line 74) | def test_llama_3_1_hard(self): method test_model_7b_logits_bf16 (line 99) | def test_model_7b_logits_bf16(self): method test_model_7b_logits (line 144) | def test_model_7b_logits(self): method test_compile_static_cache (line 193) | def test_compile_static_cache(self): method test_export_static_cache (line 229) | def test_export_static_cache(self): class Mask4DTestHard (line 293) | class Mask4DTestHard(unittest.TestCase): method tearDown (line 294) | def tearDown(self): method setUp (line 297) | def setUp(self): method get_test_data (line 304) | def get_test_data(self): method test_stacked_causal_mask (line 348) | def test_stacked_causal_mask(self): method test_partial_stacked_causal_mask (line 373) | def test_partial_stacked_causal_mask(self): method test_stacked_causal_mask_static_cache (line 417) | def test_stacked_causal_mask_static_cache(self): method test_partial_stacked_causal_mask_static_cache (line 457) | def test_partial_stacked_causal_mask_static_cache(self): FILE: tests/models/llama/test_tokenization_llama.py class LlamaTokenizationTest (line 12) | class LlamaTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 27) | def setUpClass(cls): method get_tokenizers (line 36) | def get_tokenizers(self, **kwargs): method test_load_tiktoken_tokenizer (line 40) | def test_load_tiktoken_tokenizer(self): FILE: tests/models/llama4/test_image_processing_llama4.py class Llama4ImageProcessingTester (line 23) | class Llama4ImageProcessingTester(unittest.TestCase): method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 58) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Llama4ImageProcessingTest (line 87) | class Llama4ImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 88) | def setUp(self): method image_processor_dict (line 93) | def image_processor_dict(self): method test_image_processor_properties (line 96) | def test_image_processor_properties(self): method test_split_tiles (line 106) | def test_split_tiles(self): FILE: tests/models/llama4/test_modeling_llama4.py class Llama4IntegrationTest (line 39) | class Llama4IntegrationTest(unittest.TestCase): method setUpClass (line 43) | def setUpClass(cls): method setUp (line 51) | def setUp(self): method tearDown (line 84) | def tearDown(self): method test_model_17b_16e_fp32 (line 87) | def test_model_17b_16e_fp32(self): method test_model_17b_16e_batch (line 105) | def test_model_17b_16e_batch(self): FILE: tests/models/llama4/test_processing_llama4.py class Llama4ProcessorTest (line 24) | class Llama4ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 28) | def _setup_image_processor(cls): method _setup_tokenizer (line 33) | def _setup_tokenizer(cls): method _setup_test_attributes (line 38) | def _setup_test_attributes(cls, processor): FILE: tests/models/llava/test_configuration_llava.py class LlavaConfigTest (line 7) | class LlavaConfigTest(unittest.TestCase): method test_llava_reload (line 8) | def test_llava_reload(self): method test_pixtral_reload (line 19) | def test_pixtral_reload(self): method test_arbitrary_reload (line 57) | def test_arbitrary_reload(self): FILE: tests/models/llava/test_image_processing_llava.py class LlavaImageProcessingTester (line 33) | class LlavaImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 71) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 85) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 89) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class LlavaImageProcessingTest (line 104) | class LlavaImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 105) | def setUp(self): method image_processor_dict (line 110) | def image_processor_dict(self): method test_image_processor_properties (line 114) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 127) | def test_image_processor_from_dict_with_kwargs(self): method test_padding (line 138) | def test_padding(self): method test_call_numpy_4_channels (line 239) | def test_call_numpy_4_channels(self): FILE: tests/models/llava/test_modeling_llava.py class LlavaVisionText2TextModelTester (line 58) | class LlavaVisionText2TextModelTester: method __init__ (line 59) | def __init__( method get_config (line 130) | def get_config(self): method prepare_config_and_inputs (line 142) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 155) | def prepare_config_and_inputs_for_common(self): class LlavaForConditionalGenerationModelTest (line 173) | class LlavaForConditionalGenerationModelTest( method setUp (line 199) | def setUp(self): method test_config (line 206) | def test_config(self): method test_mismatching_num_image_tokens (line 209) | def test_mismatching_num_image_tokens(self): method test_vision_feature_layers (line 247) | def test_vision_feature_layers(self, vision_feature_layer): method test_training_gradient_checkpointing (line 268) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 272) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 276) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 282) | def test_flash_attention_2_padding_matches_padding_free_with_position_... class LlavaForConditionalGenerationIntegrationTest (line 288) | class LlavaForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 289) | def setUp(self): method tearDown (line 292) | def tearDown(self): method test_small_model_integration_test (line 297) | def test_small_model_integration_test(self): method test_small_model_integration_test_llama_single (line 326) | def test_small_model_integration_test_llama_single(self): method test_small_model_integration_test_llama_batched (line 356) | def test_small_model_integration_test_llama_batched(self): method test_small_model_integration_test_batch (line 407) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_llama_batched_regression (line 457) | def test_small_model_integration_test_llama_batched_regression(self): method test_batched_generation (line 516) | def test_batched_generation(self): method test_tokenizer_integration (line 568) | def test_tokenizer_integration(self): method test_generation_no_images (line 587) | def test_generation_no_images(self): method test_generation_siglip_backbone (line 601) | def test_generation_siglip_backbone(self): method test_pixtral (line 628) | def test_pixtral(self): method test_pixtral_4bit (line 652) | def test_pixtral_4bit(self): method test_pixtral_batched (line 684) | def test_pixtral_batched(self): FILE: tests/models/llava/test_processing_llava.py class LlavaProcessorTest (line 24) | class LlavaProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 28) | def _setup_image_processor(cls): method _setup_tokenizer (line 33) | def _setup_tokenizer(cls): method _setup_test_attributes (line 44) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 48) | def prepare_processor_dict(): method test_get_num_vision_tokens (line 55) | def test_get_num_vision_tokens(self): method test_chat_template_is_saved (line 67) | def test_chat_template_is_saved(self): method test_can_load_various_tokenizers (line 78) | def test_can_load_various_tokenizers(self): method test_special_mm_token_truncation (line 84) | def test_special_mm_token_truncation(self): FILE: tests/models/llava_next/test_image_processing_llava_next.py class LlavaNextImageProcessingTester (line 34) | class LlavaNextImageProcessingTester: method __init__ (line 35) | def __init__( method prepare_image_processor_dict (line 70) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 83) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 87) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class LlavaNextImageProcessingTest (line 101) | class LlavaNextImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 103) | def setUp(self): method image_processor_dict (line 109) | def image_processor_dict(self): method test_image_processor_properties (line 112) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 126) | def test_image_processor_from_dict_with_kwargs(self): method test_select_best_resolution (line 136) | def test_select_best_resolution(self): method test_call_pil (line 143) | def test_call_pil(self): method test_call_numpy (line 162) | def test_call_numpy(self): method test_call_pytorch (line 181) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 204) | def test_call_numpy_4_channels(self): method test_nested_input (line 207) | def test_nested_input(self): method test_pad_for_patching (line 226) | def test_pad_for_patching(self): method test_call_without_padding (line 255) | def test_call_without_padding(self): FILE: tests/models/llava_next/test_modeling_llava_next.py class LlavaNextVisionText2TextModelTester (line 56) | class LlavaNextVisionText2TextModelTester(VLMModelTester): method __init__ (line 63) | def __init__(self, parent, **kwargs): method create_pixel_values (line 75) | def create_pixel_values(self): method get_additional_inputs (line 87) | def get_additional_inputs(self, config, input_ids, pixel_values): method get_config (line 93) | def get_config(self): class LlavaNextForConditionalGenerationModelTest (line 101) | class LlavaNextForConditionalGenerationModelTest(VLMModelTest, unittest.... method test_training_gradient_checkpointing (line 111) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 115) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 119) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 125) | def test_flash_attention_2_padding_matches_padding_free_with_position_... class LlavaNextForConditionalGenerationIntegrationTest (line 130) | class LlavaNextForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 131) | def setUp(self): method tearDown (line 138) | def tearDown(self): method test_small_model_integration_test (line 143) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 187) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_unk_token (line 212) | def test_small_model_integration_test_unk_token(self): method test_small_model_integration_test_batch_different_resolutions (line 238) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_matches_single (line 278) | def test_small_model_integration_test_batch_matches_single(self): method test_small_model_integration_test_full_vision_state_selection (line 307) | def test_small_model_integration_test_full_vision_state_selection(self): method test_granite_vision (line 327) | def test_granite_vision(self): FILE: tests/models/llava_next/test_processing_llava_next.py class LlavaNextProcessorTest (line 29) | class LlavaNextProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 33) | def _setup_tokenizer(cls): method _setup_test_attributes (line 44) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 48) | def prepare_processor_dict(): method test_get_num_vision_tokens (line 56) | def test_get_num_vision_tokens(self): method test_chat_template_is_saved (line 69) | def test_chat_template_is_saved(self): method test_image_token_filling (line 80) | def test_image_token_filling(self): FILE: tests/models/llava_next_video/test_modeling_llava_next_video.py class LlavaNextVideoVisionText2TextModelTester (line 59) | class LlavaNextVideoVisionText2TextModelTester: method __init__ (line 60) | def __init__( method get_config (line 135) | def get_config(self): method prepare_config_and_inputs (line 150) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 173) | def prepare_config_and_inputs_for_common(self): class LlavaNextVideoForConditionalGenerationModelTest (line 196) | class LlavaNextVideoForConditionalGenerationModelTest(ModelTesterMixin, ... method setUp (line 217) | def setUp(self): method test_config (line 224) | def test_config(self): method test_mismatching_num_image_tokens (line 227) | def test_mismatching_num_image_tokens(self): method test_odd_sized_image (line 261) | def test_odd_sized_image(self): method test_vision_feature_layers (line 290) | def test_vision_feature_layers(self, vision_feature_layer): method test_training_gradient_checkpointing (line 311) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 315) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 319) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_flash_attn_2_fp32_ln (line 323) | def test_flash_attn_2_fp32_ln(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 329) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method _video_features_prepare_config_and_inputs (line 332) | def _video_features_prepare_config_and_inputs(self): class LlavaNextVideoForConditionalGenerationIntegrationTest (line 345) | class LlavaNextVideoForConditionalGenerationIntegrationTest(unittest.Tes... method setUp (line 346) | def setUp(self): method tearDown (line 359) | def tearDown(self): method test_small_model_integration_test (line 364) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 392) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_batch_different_vision_types (line 422) | def test_small_model_integration_test_batch_different_vision_types(self): method test_small_model_integration_test_batch_matches_single (line 458) | def test_small_model_integration_test_batch_matches_single(self): FILE: tests/models/llava_next_video/test_processing_llava_next_video.py class LlavaNextVideoProcessorTest (line 33) | class LlavaNextVideoProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 37) | def _setup_tokenizer(cls): method _setup_test_attributes (line 44) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 49) | def prepare_processor_dict(cls): method test_get_num_vision_tokens (line 58) | def test_get_num_vision_tokens(self): method test_chat_template_is_saved (line 71) | def test_chat_template_is_saved(self): method test_image_token_filling (line 82) | def test_image_token_filling(self): FILE: tests/models/llava_next_video/test_video_processing_llava_next_video.py class LlavaNextVideoProcessingTester (line 29) | class LlavaNextVideoProcessingTester: method __init__ (line 30) | def __init__( method prepare_video_processor_dict (line 64) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 76) | def expected_output_video_shape(self, images): method prepare_video_inputs (line 79) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class LlavaNextVideoProcessingTest (line 94) | class LlavaNextVideoProcessingTest(VideoProcessingTestMixin, unittest.Te... method setUp (line 97) | def setUp(self): method video_processor_dict (line 102) | def video_processor_dict(self): method test_video_processor_properties (line 105) | def test_video_processor_properties(self): method test_video_processor_from_dict_with_kwargs (line 116) | def test_video_processor_from_dict_with_kwargs(self): FILE: tests/models/llava_onevision/test_image_processing_llava_onevision.py class LlavaOnevisionImageProcessingTester (line 34) | class LlavaOnevisionImageProcessingTester: method __init__ (line 35) | def __init__( method prepare_image_processor_dict (line 65) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 75) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 79) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class LlavaOnevisionImageProcessingTest (line 93) | class LlavaOnevisionImageProcessingTest(ImageProcessingTestMixin, unitte... method setUp (line 94) | def setUp(self): method image_processor_dict (line 100) | def image_processor_dict(self): method test_image_processor_properties (line 103) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 114) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 122) | def test_call_pil(self): method test_call_numpy (line 141) | def test_call_numpy(self): method test_call_pytorch (line 160) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 183) | def test_call_numpy_4_channels(self): method test_nested_input (line 186) | def test_nested_input(self): method test_multi_images (line 205) | def test_multi_images(self): method test_can_compile_fast_image_processor (line 242) | def test_can_compile_fast_image_processor(self): method test_pad_for_patching (line 245) | def test_pad_for_patching(self): method test_call_without_padding (line 274) | def test_call_without_padding(self): FILE: tests/models/llava_onevision/test_modeling_llava_onevision.py class LlavaOnevisionVisionText2TextModelTester (line 58) | class LlavaOnevisionVisionText2TextModelTester: method __init__ (line 59) | def __init__( method get_config (line 133) | def get_config(self): method prepare_config_and_inputs (line 146) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 160) | def prepare_config_and_inputs_for_common(self): class LlavaOnevisionForConditionalGenerationModelTest (line 183) | class LlavaOnevisionForConditionalGenerationModelTest(ModelTesterMixin, ... method setUp (line 218) | def setUp(self): method test_config (line 225) | def test_config(self): method test_odd_sized_image (line 228) | def test_odd_sized_image(self): method test_vision_feature_layers (line 257) | def test_vision_feature_layers(self, vision_feature_layer): method test_training_gradient_checkpointing (line 278) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 282) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 286) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 292) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method _video_features_prepare_config_and_inputs (line 295) | def _video_features_prepare_config_and_inputs(self): class LlavaOnevisionForConditionalGenerationIntegrationTest (line 317) | class LlavaOnevisionForConditionalGenerationIntegrationTest(unittest.Tes... method setUp (line 318) | def setUp(self): method tearDown (line 333) | def tearDown(self): method test_small_model_integration_test (line 338) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 370) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_video (line 394) | def test_small_model_integration_test_video(self): method test_small_model_integration_test_multi_image (line 417) | def test_small_model_integration_test_multi_image(self): method test_small_model_integration_test_multi_image_nested (line 451) | def test_small_model_integration_test_multi_image_nested(self): method test_small_model_integration_test_multi_video (line 499) | def test_small_model_integration_test_multi_video(self): method test_small_model_integration_test_batch_different_resolutions (line 523) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_matches_single (line 553) | def test_small_model_integration_test_batch_matches_single(self): FILE: tests/models/llava_onevision/test_processing_llava_onevision.py class LlavaOnevisionProcessorTest (line 35) | class LlavaOnevisionProcessorTest(ProcessorTesterMixin, unittest.TestCase): method setUpClass (line 39) | def setUpClass(cls): method _setup_tokenizer (line 76) | def _setup_tokenizer(cls): method _setup_image_processor (line 96) | def _setup_image_processor(cls): method _setup_test_attributes (line 101) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 106) | def prepare_processor_dict(): method test_get_num_vision_tokens (line 114) | def test_get_num_vision_tokens(self): method test_chat_template_is_saved (line 127) | def test_chat_template_is_saved(self): method test_image_token_filling (line 138) | def test_image_token_filling(self): method test_apply_chat_template_video_frame_sampling (line 169) | def test_apply_chat_template_video_frame_sampling(self): FILE: tests/models/llava_onevision/test_video_processing_llava_onevision.py class LlavaOnevisionVideoProcessingTester (line 29) | class LlavaOnevisionVideoProcessingTester: method __init__ (line 30) | def __init__( method prepare_video_processor_dict (line 59) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 69) | def expected_output_video_shape(self, video): method prepare_video_inputs (line 72) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class LlavaOnevisionVideoProcessingTest (line 87) | class LlavaOnevisionVideoProcessingTest(VideoProcessingTestMixin, unitte... method setUp (line 90) | def setUp(self): method video_processor_dict (line 95) | def video_processor_dict(self): method test_video_processor_properties (line 98) | def test_video_processor_properties(self): method test_video_processor_from_dict_with_kwargs (line 107) | def test_video_processor_from_dict_with_kwargs(self): FILE: tests/models/longcat_flash/test_modeling_longcat_flash.py class LongcatFlashModelTester (line 43) | class LongcatFlashModelTester(CausalLMModelTester): method __init__ (line 47) | def __init__( method get_config (line 120) | def get_config(self): method create_and_check_model (line 146) | def create_and_check_model( method create_and_check_for_causal_lm (line 155) | def create_and_check_for_causal_lm( method prepare_config_and_inputs (line 173) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 202) | def prepare_config_and_inputs_for_common(self): class LongcatFlashModelTest (line 211) | class LongcatFlashModelTest(CausalLMModelTest, unittest.TestCase): method test_save_load_fast_init_from_base (line 217) | def test_save_load_fast_init_from_base(self): method test_save_load_fast_init_to_base (line 221) | def test_save_load_fast_init_to_base(self): method _check_past_key_values_for_generate (line 224) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_cpu_offload (line 238) | def test_cpu_offload(self): method test_disk_offload_bin (line 242) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 246) | def test_disk_offload_safetensors(self): method test_eager_padding_matches_padding_free_with_position_ids (line 250) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_can_dispatch_on_flash (line 254) | def test_sdpa_can_dispatch_on_flash(self): method _prepare_config_headdim (line 258) | def _prepare_config_headdim(config, requested_dim): method test_flash_attn_2_fp32_ln (line 280) | def test_flash_attn_2_fp32_ln(self): class LongcatFlashIntegrationTest (line 330) | class LongcatFlashIntegrationTest(unittest.TestCase): method test_shortcat_generation (line 338) | def test_shortcat_generation(self): method test_longcat_generation_cpu (line 364) | def test_longcat_generation_cpu(self): FILE: tests/models/longformer/test_modeling_longformer.py class LongformerModelTester (line 47) | class LongformerModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method get_config (line 129) | def get_config(self): method get_pipeline_config (line 145) | def get_pipeline_config(self): method create_and_check_attention_mask_determinism (line 150) | def create_and_check_attention_mask_determinism( method create_and_check_model (line 162) | def create_and_check_model( method create_and_check_model_with_global_attention_mask (line 174) | def create_and_check_model_with_global_attention_mask( method create_and_check_for_masked_lm (line 196) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 205) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 222) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 232) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 242) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 262) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_question_answering (line 284) | def prepare_config_and_inputs_for_question_answering(self): class LongformerModelTest (line 306) | class LongformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method is_pipeline_test_to_skip (line 336) | def is_pipeline_test_to_skip( method setUp (line 358) | def setUp(self): method test_attention_outputs (line 367) | def test_attention_outputs(self): method test_config (line 370) | def test_config(self): method test_model (line 373) | def test_model(self): method test_model_attention_mask_determinism (line 377) | def test_model_attention_mask_determinism(self): method test_model_global_attention_mask (line 381) | def test_model_global_attention_mask(self): method test_for_masked_lm (line 385) | def test_for_masked_lm(self): method test_for_question_answering (line 389) | def test_for_question_answering(self): method test_for_sequence_classification (line 393) | def test_for_sequence_classification(self): method test_for_token_classification (line 397) | def test_for_token_classification(self): method test_for_multiple_choice (line 401) | def test_for_multiple_choice(self): method test_retain_grad_hidden_states_attentions (line 406) | def test_retain_grad_hidden_states_attentions(self): method test_batching_equivalence (line 410) | def test_batching_equivalence(self): class LongformerModelIntegrationTest (line 417) | class LongformerModelIntegrationTest(unittest.TestCase): method _get_hidden_states (line 418) | def _get_hidden_states(self): method test_diagonalize (line 468) | def test_diagonalize(self): method test_pad_and_transpose_last_two_dims (line 502) | def test_pad_and_transpose_last_two_dims(self): method test_chunk (line 516) | def test_chunk(self): method test_mask_invalid_locations (line 539) | def test_mask_invalid_locations(self): method test_layer_local_attn (line 564) | def test_layer_local_attn(self): method test_layer_global_attn (line 598) | def test_layer_global_attn(self): method test_layer_attn_probs (line 649) | def test_layer_attn_probs(self): method test_inference_no_head (line 738) | def test_inference_no_head(self): method test_inference_no_head_long (line 754) | def test_inference_no_head_long(self): method test_inference_masked_lm_long (line 775) | def test_inference_masked_lm_long(self): FILE: tests/models/longt5/test_modeling_longt5.py class LongT5ModelTester (line 42) | class LongT5ModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 99) | def prepare_config_and_inputs(self): method get_pipeline_config (line 124) | def get_pipeline_config(self): method get_config (line 145) | def get_config(self): method check_prepare_lm_labels_via_shift_left (line 166) | def check_prepare_lm_labels_via_shift_left( method create_and_check_model (line 205) | def create_and_check_model( method create_and_check_with_lm_head (line 233) | def create_and_check_with_lm_head( method create_and_check_decoder_model_past (line 253) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 290) | def create_and_check_decoder_model_attention_mask_past( method create_and_check_decoder_model_past_large_inputs (line 341) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_generate_with_past_key_values (line 379) | def create_and_check_generate_with_past_key_values( method prepare_config_and_inputs_for_common (line 397) | def prepare_config_and_inputs_for_common(self): class LongT5ModelTest (line 419) | class LongT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 432) | def setUp(self): method test_config (line 436) | def test_config(self): method test_shift_right (line 439) | def test_shift_right(self): method test_model (line 443) | def test_model(self): method test_with_lm_head (line 447) | def test_with_lm_head(self): method test_decoder_model_past (line 451) | def test_decoder_model_past(self): method test_decoder_model_past_with_attn_mask (line 455) | def test_decoder_model_past_with_attn_mask(self): method test_decoder_model_past_with_3d_attn_mask (line 459) | def test_decoder_model_past_with_3d_attn_mask(self): method test_custom_4d_attention_mask (line 488) | def test_custom_4d_attention_mask(self): method test_decoder_model_past_with_large_inputs (line 522) | def test_decoder_model_past_with_large_inputs(self): method test_generate_with_past_key_values (line 526) | def test_generate_with_past_key_values(self): method test_model_from_pretrained (line 531) | def test_model_from_pretrained(self): method test_attention_outputs (line 536) | def test_attention_outputs(self): method _check_encoder_attention_for_generate (line 645) | def _check_encoder_attention_for_generate(self, attentions, batch_size... method test_load_save_without_tied_weights (line 657) | def test_load_save_without_tied_weights(self): method test_model_base_model_prefix (line 661) | def test_model_base_model_prefix(self): class LongT5TGlobalModelTest (line 666) | class LongT5TGlobalModelTest(LongT5ModelTest): method setUp (line 667) | def setUp(self): method test_attention_outputs (line 673) | def test_attention_outputs(self): method _check_encoder_attention_for_generate (line 784) | def _check_encoder_attention_for_generate(self, attentions, batch_size... method test_model_base_model_prefix (line 802) | def test_model_base_model_prefix(self): class LongT5EncoderOnlyModelTester (line 806) | class LongT5EncoderOnlyModelTester: method __init__ (line 807) | def __init__( method prepare_config_and_inputs (line 857) | def prepare_config_and_inputs(self): method create_and_check_model (line 889) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 907) | def prepare_config_and_inputs_for_common(self): class LongT5EncoderOnlyModelTest (line 922) | class LongT5EncoderOnlyModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 927) | def setUp(self): method test_config (line 931) | def test_config(self): method test_model (line 934) | def test_model(self): method test_attention_outputs (line 938) | def test_attention_outputs(self): method test_load_save_without_tied_weights (line 1005) | def test_load_save_without_tied_weights(self): class LongT5EncoderOnlyTGlobalModelTest (line 1009) | class LongT5EncoderOnlyTGlobalModelTest(LongT5EncoderOnlyModelTest): method setUp (line 1010) | def setUp(self): method test_attention_outputs (line 1016) | def test_attention_outputs(self): function use_task_specific_params (line 1084) | def use_task_specific_params(model, task): class LongT5ModelIntegrationTests (line 1091) | class LongT5ModelIntegrationTests(unittest.TestCase): method model (line 1093) | def model(self): method tokenizer (line 1099) | def tokenizer(self): method expected_summary (line 1102) | def expected_summary(self): method test_summarization (line 1114) | def test_summarization(self): method test_inference_hidden_states (line 1200) | def test_inference_hidden_states(self): FILE: tests/models/luke/test_modeling_luke.py class LukeModelTester (line 45) | class LukeModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 122) | def prepare_config_and_inputs(self): method get_config (line 194) | def get_config(self): method create_and_check_model (line 213) | def create_and_check_model( method create_and_check_for_masked_lm (line 254) | def create_and_check_for_masked_lm( method create_and_check_for_entity_classification (line 296) | def create_and_check_for_entity_classification( method create_and_check_for_entity_pair_classification (line 331) | def create_and_check_for_entity_pair_classification( method create_and_check_for_entity_span_classification (line 366) | def create_and_check_for_entity_span_classification( method create_and_check_for_question_answering (line 408) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 443) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 477) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 511) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 558) | def prepare_config_and_inputs_for_common(self): class LukeModelTest (line 590) | class LukeModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method is_pipeline_test_to_skip (line 621) | def is_pipeline_test_to_skip( method _prepare_for_class (line 636) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 694) | def setUp(self): method test_config (line 698) | def test_config(self): method test_model (line 701) | def test_model(self): method test_model_from_pretrained (line 706) | def test_model_from_pretrained(self): method test_for_masked_lm (line 711) | def test_for_masked_lm(self): method test_for_masked_lm_with_word_only (line 715) | def test_for_masked_lm_with_word_only(self): method test_for_question_answering (line 720) | def test_for_question_answering(self): method test_for_sequence_classification (line 724) | def test_for_sequence_classification(self): method test_for_token_classification (line 728) | def test_for_token_classification(self): method test_for_multiple_choice (line 732) | def test_for_multiple_choice(self): method test_for_entity_classification (line 736) | def test_for_entity_classification(self): method test_for_entity_pair_classification (line 740) | def test_for_entity_pair_classification(self): method test_for_entity_span_classification (line 744) | def test_for_entity_span_classification(self): method test_attention_outputs (line 748) | def test_attention_outputs(self): method test_entity_hidden_states_output (line 806) | def test_entity_hidden_states_output(self): method test_retain_grad_entity_hidden_states (line 841) | def test_retain_grad_entity_hidden_states(self): method test_training_gradient_checkpointing (line 865) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 869) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 873) | def test_training_gradient_checkpointing_use_reentrant_true(self): class LukeModelIntegrationTests (line 878) | class LukeModelIntegrationTests(unittest.TestCase): method test_inference_base_model (line 880) | def test_inference_base_model(self): method test_inference_large_model (line 915) | def test_inference_large_model(self): FILE: tests/models/luke/test_tokenization_luke.py class LukeTokenizerTest (line 28) | class LukeTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method test_sequence_builders (line 39) | def test_sequence_builders(self): method get_clean_sequence (line 58) | def get_clean_sequence(self, tokenizer, max_length=20) -> tuple[str, l... method test_padding_entity_inputs (line 63) | def test_padding_entity_inputs(self): class LukeTokenizerIntegrationTests (line 81) | class LukeTokenizerIntegrationTests(unittest.TestCase): method setUp (line 85) | def setUp(self): method test_single_text_no_padding_or_truncation (line 88) | def test_single_text_no_padding_or_truncation(self): method test_single_text_only_entity_spans_no_padding_or_truncation (line 129) | def test_single_text_only_entity_spans_no_padding_or_truncation(self): method test_single_text_padding_pytorch_tensors (line 163) | def test_single_text_padding_pytorch_tensors(self): method test_text_pair_no_padding_or_truncation (line 191) | def test_text_pair_no_padding_or_truncation(self): method test_text_pair_only_entity_spans_no_padding_or_truncation (line 243) | def test_text_pair_only_entity_spans_no_padding_or_truncation(self): method test_text_pair_padding_pytorch_tensors (line 285) | def test_text_pair_padding_pytorch_tensors(self): method test_entity_classification_no_padding_or_truncation (line 319) | def test_entity_classification_no_padding_or_truncation(self): method test_entity_classification_padding_pytorch_tensors (line 355) | def test_entity_classification_padding_pytorch_tensors(self): method test_entity_pair_classification_no_padding_or_truncation (line 383) | def test_entity_pair_classification_no_padding_or_truncation(self): method test_entity_pair_classification_padding_pytorch_tensors (line 418) | def test_entity_pair_classification_padding_pytorch_tensors(self): method test_entity_span_classification_no_padding_or_truncation (line 448) | def test_entity_span_classification_no_padding_or_truncation(self): method test_entity_span_classification_padding_pytorch_tensors (line 478) | def test_entity_span_classification_padding_pytorch_tensors(self): FILE: tests/models/lw_detr/test_modeling_lw_detr.py class LwDetrVitModelTester (line 54) | class LwDetrVitModelTester: method __init__ (line 55) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method get_config (line 102) | def get_config(self): method prepare_config_and_inputs_for_common (line 115) | def prepare_config_and_inputs_for_common(self): method create_and_check_backbone (line 121) | def create_and_check_backbone(self, config, pixel_values, labels): class LwDetrViTBackboneTest (line 163) | class LwDetrViTBackboneTest(ModelTesterMixin, BackboneTesterMixin, unitt... method setUp (line 170) | def setUp(self): method test_backbone (line 173) | def test_backbone(self): method test_model_get_set_embeddings (line 177) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 186) | def test_attention_outputs(self): method test_hidden_states_output (line 239) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 275) | def test_retain_grad_hidden_states_attentions(self): function prepare_img (line 300) | def prepare_img(): class LwDetrModelTester (line 305) | class LwDetrModelTester: method __init__ (line 306) | def __init__( method prepare_config_and_inputs (line 361) | def prepare_config_and_inputs(self): method get_config (line 379) | def get_config(self): method prepare_config_and_inputs_for_common (line 408) | def prepare_config_and_inputs_for_common(self): method create_and_check_lw_detr_model (line 413) | def create_and_check_lw_detr_model(self, config, pixel_values, pixel_m... method create_and_check_lw_detr_object_detection_head_model (line 423) | def create_and_check_lw_detr_object_detection_head_model(self, config,... class LwDetrModelTest (line 442) | class LwDetrModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method _prepare_for_class (line 455) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 474) | def setUp(self): method test_config (line 483) | def test_config(self): method test_lw_detr_model (line 486) | def test_lw_detr_model(self): method test_lw_detr_object_detection_head_model (line 490) | def test_lw_detr_object_detection_head_model(self): method test_inputs_embeds (line 495) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 499) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 503) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 507) | def test_model_common_attributes(self): method test_resize_tokens_embeddings (line 511) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 515) | def test_feed_forward_chunking(self): method test_attention_outputs (line 518) | def test_attention_outputs(self): method test_hidden_states_output (line 575) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 611) | def test_retain_grad_hidden_states_attentions(self): method test_forward_auxiliary_loss (line 637) | def test_forward_auxiliary_loss(self): class LwDetrModelIntegrationTest (line 656) | class LwDetrModelIntegrationTest(unittest.TestCase): method default_image_processor (line 658) | def default_image_processor(self): method test_inference_object_detection_head_tiny (line 666) | def test_inference_object_detection_head_tiny(self): method test_inference_object_detection_head_xlarge (line 741) | def test_inference_object_detection_head_xlarge(self): FILE: tests/models/lxmert/test_modeling_lxmert.py class LxmertModelTester (line 42) | class LxmertModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 124) | def prepare_config_and_inputs(self): method get_config (line 182) | def get_config(self): method create_and_check_lxmert_model (line 216) | def create_and_check_lxmert_model( method create_and_check_lxmert_for_question_answering (line 258) | def create_and_check_lxmert_for_question_answering( method create_and_check_lxmert_for_pretraining (line 306) | def create_and_check_lxmert_for_pretraining( method resize_lxmert_num_qa_labels (line 392) | def resize_lxmert_num_qa_labels( method prepare_config_and_inputs_for_common (line 491) | def prepare_config_and_inputs_for_common(self, return_obj_labels=False): class LxmertModelTest (line 524) | class LxmertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method _prepare_for_class (line 529) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 544) | def setUp(self): method test_config (line 548) | def test_config(self): method test_lxmert_model (line 551) | def test_lxmert_model(self): method test_lxmert_question_answering (line 555) | def test_lxmert_question_answering(self): method test_lxmert_pretraining (line 559) | def test_lxmert_pretraining(self): method test_lxmert_question_answering_labels_resize (line 563) | def test_lxmert_question_answering_labels_resize(self): method test_model_from_pretrained (line 568) | def test_model_from_pretrained(self): method test_attention_outputs (line 574) | def test_attention_outputs(self): method test_hidden_states_output (line 658) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 695) | def test_retain_grad_hidden_states_attentions(self): method test_load_save_without_tied_weights (line 731) | def test_load_save_without_tied_weights(self): class LxmertModelIntegrationTest (line 736) | class LxmertModelIntegrationTest(unittest.TestCase): method test_inference_no_head_absolute_embedding (line 738) | def test_inference_no_head_absolute_embedding(self): FILE: tests/models/m2m_100/test_modeling_m2m_100.py function prepare_m2m_100_inputs_dict (line 48) | def prepare_m2m_100_inputs_dict( class M2M100ModelTester (line 67) | class M2M100ModelTester: method __init__ (line 68) | def __init__( method prepare_config_and_inputs (line 110) | def prepare_config_and_inputs(self): method get_config (line 129) | def get_config(self): method prepare_config_and_inputs_for_common (line 149) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 153) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 186) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class M2M100ModelTest (line 220) | class M2M100ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 239) | def setUp(self): method test_config (line 243) | def test_config(self): method test_save_load_strict (line 246) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 256) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 260) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 264) | def test_inputs_embeds(self): method test_generate_fp16 (line 294) | def test_generate_fp16(self): method test_load_save_without_tied_weights (line 306) | def test_load_save_without_tied_weights(self): function _long_tensor (line 310) | def _long_tensor(tok_lst): class M2M100ModelIntegrationTests (line 321) | class M2M100ModelIntegrationTests(unittest.TestCase): method default_tokenizer (line 323) | def default_tokenizer(self): method test_inference_no_head (line 326) | def test_inference_no_head(self): method test_inference_head (line 342) | def test_inference_head(self): method test_seq_to_seq_generation (line 360) | def test_seq_to_seq_generation(self): method test_flash_attn_2_seq_to_seq_generation (line 403) | def test_flash_attn_2_seq_to_seq_generation(self): FILE: tests/models/m2m_100/test_tokenization_m2m_100.py class M2M100TokenizationTest (line 51) | class M2M100TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 59) | def setUpClass(cls): method get_tokenizer (line 80) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 84) | def get_input_output_texts(self, tokenizer): method test_convert_token_and_id (line 90) | def test_convert_token_and_id(self): method test_get_vocab (line 98) | def test_get_vocab(self): method test_full_tokenizer (line 108) | def test_full_tokenizer(self): method test_tokenizer_integration (line 126) | def test_tokenizer_integration(self): class M2M100TokenizerIntegrationTest (line 139) | class M2M100TokenizerIntegrationTest(unittest.TestCase): method setUpClass (line 153) | def setUpClass(cls): method check_language_codes (line 160) | def check_language_codes(self): method test_get_vocab (line 166) | def test_get_vocab(self): method test_tokenizer_batch_encode_plus (line 172) | def test_tokenizer_batch_encode_plus(self): method test_tokenizer_decode_ignores_language_codes (line 177) | def test_tokenizer_decode_ignores_language_codes(self): method test_special_tokens_unaffacted_by_save_load (line 185) | def test_special_tokens_unaffacted_by_save_load(self): method test_batch_fairseq_parity (line 193) | def test_batch_fairseq_parity(self): method test_src_lang_setter (line 215) | def test_src_lang_setter(self): method test_tokenizer_target_mode (line 225) | def test_tokenizer_target_mode(self): method test_tokenizer_translation (line 241) | def test_tokenizer_translation(self): FILE: tests/models/mamba/test_modeling_mamba.py class MambaModelTester (line 37) | class MambaModelTester: method __init__ (line 38) | def __init__( method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs( method get_config (line 110) | def get_config( method get_pipeline_config (line 129) | def get_pipeline_config(self): method create_and_check_mamba_model (line 134) | def create_and_check_mamba_model(self, config, input_ids, *args): method create_and_check_causal_lm (line 145) | def create_and_check_causal_lm(self, config, input_ids, *args): method create_and_check_state_equivalency (line 154) | def create_and_check_state_equivalency(self, config, input_ids, *args): method create_and_check_mamba_cached_slow_forward_and_backwards (line 179) | def create_and_check_mamba_cached_slow_forward_and_backwards( method create_and_check_mamba_lm_head_forward_and_backwards (line 200) | def create_and_check_mamba_lm_head_forward_and_backwards( method prepare_config_and_inputs_for_common (line 213) | def prepare_config_and_inputs_for_common(self): class MambaModelTest (line 227) | class MambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method setUp (line 236) | def setUp(self): method test_enable_input_require_grads (line 242) | def test_enable_input_require_grads(self): method assertInterval (line 245) | def assertInterval(self, member, container, msg=None): method test_config (line 267) | def test_config(self): method test_mamba_model (line 270) | def test_mamba_model(self): method test_mamba_lm_head_model (line 274) | def test_mamba_lm_head_model(self): method test_state_equivalency (line 278) | def test_state_equivalency(self): method test_mamba_cached_slow_forward_and_backwards (line 282) | def test_mamba_cached_slow_forward_and_backwards(self): method test_mamba_lm_head_forward_and_backwards (line 286) | def test_mamba_lm_head_forward_and_backwards(self): method test_model_from_pretrained (line 291) | def test_model_from_pretrained(self): method test_model_outputs_equivalence (line 295) | def test_model_outputs_equivalence(self): method test_beam_sample_generate (line 355) | def test_beam_sample_generate(self): method test_multi_gpu_data_parallel_forward (line 359) | def test_multi_gpu_data_parallel_forward(self): class MambaIntegrationTests (line 365) | class MambaIntegrationTests(unittest.TestCase): method setUp (line 366) | def setUp(self): method test_simple_generate (line 371) | def test_simple_generate(self, device): method test_simple_generate_cuda_kernels_tiny (line 399) | def test_simple_generate_cuda_kernels_tiny(self, device): method test_simple_generate_cuda_kernels_small (line 411) | def test_simple_generate_cuda_kernels_small(self, device): method test_simple_generate_cuda_kernels_mid (line 423) | def test_simple_generate_cuda_kernels_mid(self, device): method test_simple_generate_cuda_kernels_big (line 435) | def test_simple_generate_cuda_kernels_big(self, device): method test_compile_mamba_cache (line 447) | def test_compile_mamba_cache(self): method test_compile_associative_scan_no_cache (line 465) | def test_compile_associative_scan_no_cache(self): method test_associative_scan_matches_sequential (line 490) | def test_associative_scan_matches_sequential(self): FILE: tests/models/mamba2/test_modeling_mamba2.py class Mamba2ConfigTester (line 41) | class Mamba2ConfigTester(ConfigTester): method _create_config (line 42) | def _create_config(self, hidden_size: int, num_heads: int, expand: int... method test_hidden_size_compatibility (line 50) | def test_hidden_size_compatibility(self): method run_common_tests (line 59) | def run_common_tests(self): class Mamba2ModelTester (line 64) | class Mamba2ModelTester: method __init__ (line 65) | def __init__( method prepare_config_and_inputs (line 118) | def prepare_config_and_inputs( method get_config (line 148) | def get_config(self, gradient_checkpointing=False): method prepare_config_and_inputs_for_common (line 170) | def prepare_config_and_inputs_for_common(self): method create_and_check_mamba2_caching (line 182) | def create_and_check_mamba2_caching(self, config, input_ids, attention... method create_and_check_mamba2_slow_vs_fast_forward (line 209) | def create_and_check_mamba2_slow_vs_fast_forward(self, config, input_i... class Mamba2ModelTest (line 232) | class Mamba2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 241) | def setUp(self): method _get_conv_state_shape (line 247) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 256) | def _get_recurrent_state_shape(self, batch_size: int, config): method test_mamba2_caching (line 259) | def test_mamba2_caching(self): method test_mamba2_slow_vs_fast_forward (line 263) | def test_mamba2_slow_vs_fast_forward(self): method test_mamba2_slow_vs_fast_forward_grouped (line 270) | def test_mamba2_slow_vs_fast_forward_grouped(self): method test_multi_gpu_data_parallel_forward (line 276) | def test_multi_gpu_data_parallel_forward(self): method test_model_outputs_equivalence (line 279) | def test_model_outputs_equivalence(self): method test_tied_weight_embeddings (line 338) | def test_tied_weight_embeddings(self): class Mamba2IntegrationTest (line 361) | class Mamba2IntegrationTest(unittest.TestCase): method setUp (line 362) | def setUp(self): method test_simple_generate (line 369) | def test_simple_generate(self): method test_batched_equivalence_with_cache (line 398) | def test_batched_equivalence_with_cache(self): method test_batched_equivalence_without_cache (line 428) | def test_batched_equivalence_without_cache(self): method test_mamba2_mixer_train_vs_eval_equivalence (line 458) | def test_mamba2_mixer_train_vs_eval_equivalence(self): FILE: tests/models/marian/test_modeling_marian.py function prepare_marian_inputs_dict (line 55) | def prepare_marian_inputs_dict( class MarianModelTester (line 75) | class MarianModelTester: method __init__ (line 76) | def __init__( method prepare_config_and_inputs (line 116) | def prepare_config_and_inputs(self): method get_config (line 128) | def get_config(self): method prepare_config_and_inputs_for_common (line 147) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 151) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 184) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class MarianModelTest (line 218) | class MarianModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 231) | def setUp(self): method test_config (line 235) | def test_config(self): method test_save_load_strict (line 238) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 248) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 252) | def test_encoder_decoder_model_standalone(self): method test_generate_fp16 (line 257) | def test_generate_fp16(self): method test_share_encoder_decoder_embeddings (line 266) | def test_share_encoder_decoder_embeddings(self): method test_resize_decoder_token_embeddings (line 303) | def test_resize_decoder_token_embeddings(self): method test_tie_word_embeddings_decoder (line 327) | def test_tie_word_embeddings_decoder(self): method test_training_gradient_checkpointing (line 331) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 335) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 339) | def test_training_gradient_checkpointing_use_reentrant_true(self): function assert_tensors_close (line 343) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 362) | def _long_tensor(tok_lst): class MarianIntegrationTest (line 369) | class MarianIntegrationTest(unittest.TestCase): method setUpClass (line 391) | def setUpClass(cls) -> None: method tokenizer (line 396) | def tokenizer(self): method eos_token_id (line 400) | def eos_token_id(self) -> int: method model (line 404) | def model(self): method _assert_generated_batch_equal_expected (line 417) | def _assert_generated_batch_equal_expected(self, **tokenizer_kwargs): method translate_src_text (line 421) | def translate_src_text(self, **tokenizer_kwargs): class TestMarian_EN_DE_More (line 439) | class TestMarian_EN_DE_More(MarianIntegrationTest): method test_forward (line 441) | def test_forward(self): method test_unk_support (line 465) | def test_unk_support(self): method test_pad_not_split (line 472) | def test_pad_not_split(self): method test_batch_generation_en_de (line 478) | def test_batch_generation_en_de(self): method test_auto_config (line 481) | def test_auto_config(self): class TestMarian_EN_FR (line 488) | class TestMarian_EN_FR(MarianIntegrationTest): method test_batch_generation_en_fr (line 501) | def test_batch_generation_en_fr(self): class TestMarian_FR_EN (line 507) | class TestMarian_FR_EN(MarianIntegrationTest): method test_batch_generation_fr_en (line 520) | def test_batch_generation_fr_en(self): class TestMarian_RU_FR (line 526) | class TestMarian_RU_FR(MarianIntegrationTest): method test_batch_generation_ru_fr (line 533) | def test_batch_generation_ru_fr(self): class TestMarian_MT_EN (line 539) | class TestMarian_MT_EN(MarianIntegrationTest): method test_batch_generation_mt_en (line 548) | def test_batch_generation_mt_en(self): class TestMarian_en_zh (line 554) | class TestMarian_en_zh(MarianIntegrationTest): method test_batch_generation_eng_zho (line 561) | def test_batch_generation_eng_zho(self): class TestMarian_en_ROMANCE (line 567) | class TestMarian_en_ROMANCE(MarianIntegrationTest): method test_batch_generation_en_ROMANCE_multi (line 584) | def test_batch_generation_en_ROMANCE_multi(self): class TestMarian_FI_EN_V2 (line 590) | class TestMarian_FI_EN_V2(MarianIntegrationTest): method setUpClass (line 600) | def setUpClass(cls) -> None: method test_batch_generation_fi_en (line 605) | def test_batch_generation_fi_en(self): class MarianStandaloneDecoderModelTester (line 609) | class MarianStandaloneDecoderModelTester: method __init__ (line 610) | def __init__( method prepare_config_and_inputs (line 665) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 700) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 736) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 783) | def prepare_config_and_inputs_for_common(self): class MarianStandaloneDecoderModelTest (line 800) | class MarianStandaloneDecoderModelTest(ModelTesterMixin, GenerationTeste... method setUp (line 805) | def setUp( method test_config (line 811) | def test_config(self): method test_decoder_model_past (line 814) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 818) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 823) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 827) | def test_flex_attention_with_grads(): FILE: tests/models/marian/test_tokenization_marian.py class MarianTokenizationTest (line 39) | class MarianTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 46) | def setUpClass(cls): method get_tokenizer (line 62) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> MarianTokeni... method get_input_output_texts (line 66) | def get_input_output_texts(self, tokenizer): method test_convert_token_and_id (line 72) | def test_convert_token_and_id(self): method test_get_vocab (line 80) | def test_get_vocab(self): method test_vocab_size (line 88) | def test_vocab_size(self): method test_tokenizer_equivalence_en_de (line 91) | def test_tokenizer_equivalence_en_de(self): method test_outputs_not_longer_than_maxlen (line 104) | def test_outputs_not_longer_than_maxlen(self): method test_outputs_can_be_shorter (line 113) | def test_outputs_can_be_shorter(self): method test_tokenizer_integration (line 120) | def test_tokenizer_integration(self): method test_tokenizer_integration_separate_vocabs (line 129) | def test_tokenizer_integration_separate_vocabs(self): method test_tokenizer_decode (line 147) | def test_tokenizer_decode(self): method test_internal_consistency (line 154) | def test_internal_consistency(self): FILE: tests/models/markuplm/test_feature_extraction_markuplm.py class MarkupLMFeatureExtractionTester (line 28) | class MarkupLMFeatureExtractionTester: method __init__ (line 29) | def __init__(self, parent): method prepare_feat_extract_dict (line 32) | def prepare_feat_extract_dict(self): function get_html_strings (line 36) | def get_html_strings(): class MarkupLMFeatureExtractionTest (line 75) | class MarkupLMFeatureExtractionTest(FeatureExtractionSavingTestMixin, un... method setUp (line 78) | def setUp(self): method feat_extract_dict (line 82) | def feat_extract_dict(self): method test_call (line 85) | def test_call(self): FILE: tests/models/markuplm/test_modeling_markuplm.py class MarkupLMModelTester (line 41) | class MarkupLMModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 138) | def get_config(self): method create_and_check_model (line 158) | def create_and_check_model( method create_and_check_for_sequence_classification (line 179) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 204) | def create_and_check_for_token_classification( method create_and_check_for_question_answering (line 229) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 255) | def prepare_config_and_inputs_for_common(self): class MarkupLMModelTest (line 278) | class MarkupLMModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method is_pipeline_test_to_skip (line 301) | def is_pipeline_test_to_skip( method setUp (line 315) | def setUp(self): method test_config (line 319) | def test_config(self): method test_model (line 322) | def test_model(self): method test_for_sequence_classification (line 326) | def test_for_sequence_classification(self): method test_for_token_classification (line 330) | def test_for_token_classification(self): method test_for_question_answering (line 334) | def test_for_question_answering(self): function prepare_html_string (line 339) | def prepare_html_string(): class MarkupLMModelIntegrationTest (line 359) | class MarkupLMModelIntegrationTest(unittest.TestCase): method default_processor (line 361) | def default_processor(self): method test_forward_pass_no_head (line 369) | def test_forward_pass_no_head(self): FILE: tests/models/markuplm/test_processing_markuplm.py class MarkupLMProcessorTest (line 43) | class MarkupLMProcessorTest(unittest.TestCase): method setUp (line 47) | def setUp(self): method get_tokenizer (line 71) | def get_tokenizer(self, **kwargs) -> PythonBackend: method get_rust_tokenizer (line 74) | def get_rust_tokenizer(self, **kwargs) -> PreTrainedTokenizerFast: method get_tokenizers (line 77) | def get_tokenizers(self, **kwargs) -> list[PreTrainedTokenizerBase]: method get_feature_extractor (line 80) | def get_feature_extractor(self, **kwargs): method tearDown (line 83) | def tearDown(self): method test_save_load_pretrained_default (line 86) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 101) | def test_save_load_pretrained_additional_features(self): class MarkupLMProcessorIntegrationTests (line 137) | class MarkupLMProcessorIntegrationTests(unittest.TestCase): method get_html_strings (line 139) | def get_html_strings(self): method get_tokenizers (line 171) | def get_tokenizers(self): method test_processor_case_1 (line 177) | def test_processor_case_1(self): method test_processor_case_2 (line 212) | def test_processor_case_2(self): method test_processor_case_3 (line 257) | def test_processor_case_3(self): method test_processor_case_4 (line 335) | def test_processor_case_4(self): method test_processor_case_5 (line 387) | def test_processor_case_5(self): FILE: tests/models/markuplm/test_tokenization_markuplm.py class MarkupLMTokenizationTest (line 43) | class MarkupLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 59) | def setUpClass(cls): method _run_integration_checks (line 80) | def _run_integration_checks(self, tokenizer, tokenizer_type): method get_nodes_and_xpaths (line 106) | def get_nodes_and_xpaths(self): method get_nodes_and_xpaths_batch (line 112) | def get_nodes_and_xpaths_batch(self): method get_question_nodes_and_xpaths (line 121) | def get_question_nodes_and_xpaths(self): method get_extracted_tokenizer (line 128) | def get_extracted_tokenizer(self, reference_tokenizer=None): method get_question_nodes_and_xpaths_batch (line 165) | def get_question_nodes_and_xpaths_batch(self): method get_empty_nodes_and_xpaths (line 175) | def get_empty_nodes_and_xpaths(self): method get_empty_nodes_and_xpaths_batch (line 181) | def get_empty_nodes_and_xpaths_batch(self): method get_empty_question_nodes_and_xpaths (line 195) | def get_empty_question_nodes_and_xpaths(self): method get_empty_question_nodes_and_xpaths_batch (line 202) | def get_empty_question_nodes_and_xpaths_batch(self): method test_chat_template_batched (line 218) | def test_chat_template_batched(self): method get_input_output_texts (line 221) | def get_input_output_texts(self, tokenizer): method convert_batch_encode_plus_format_to_encode_plus (line 226) | def convert_batch_encode_plus_format_to_encode_plus(self, batch_encode... method test_add_special_tokens (line 238) | def test_add_special_tokens(self): method test_add_tokens_tokenizer (line 254) | def test_add_tokens_tokenizer(self): method test_encode_decode_with_spaces (line 318) | def test_encode_decode_with_spaces(self): method test_right_and_left_truncation (line 336) | def test_right_and_left_truncation(self): method test_encode_plus_with_padding (line 340) | def test_encode_plus_with_padding(self, use_padding_as_call_kwarg: bool): method test_internal_consistency (line 449) | def test_internal_consistency(self): method test_mask_output (line 467) | def test_mask_output(self): method test_number_of_added_tokens (line 481) | def test_number_of_added_tokens(self): method test_padding (line 509) | def test_padding(self, max_length=50): method test_call (line 684) | def test_call(self): method test_batch_encode_plus_batch_sequence_length (line 707) | def test_batch_encode_plus_batch_sequence_length(self): method test_batch_encode_plus_overflowing_tokens (line 774) | def test_batch_encode_plus_overflowing_tokens(self): method test_batch_encode_plus_padding (line 777) | def test_batch_encode_plus_padding(self): method test_padding_to_multiple_of (line 829) | def test_padding_to_multiple_of(self): method test_special_tokens_mask_input_pairs (line 868) | def test_special_tokens_mask_input_pairs(self): method test_special_tokens_mask (line 891) | def test_special_tokens_mask(self): method test_save_and_load_tokenizer (line 908) | def test_save_and_load_tokenizer(self): method test_right_and_left_padding (line 935) | def test_right_and_left_padding(self): method test_token_type_ids (line 998) | def test_token_type_ids(self): method test_offsets_mapping (line 1029) | def test_offsets_mapping(self): method test_embedded_special_tokens (line 1075) | def test_embedded_special_tokens(self): method test_compare_add_special_tokens (line 1094) | def test_compare_add_special_tokens(self): method test_markuplm_truncation_integration_test (line 1131) | def test_markuplm_truncation_integration_test(self): method test_sequence_ids (line 1150) | def test_sequence_ids(self): method test_special_tokens_initialization (line 1174) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 1190) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 1229) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_batch_encode_dynamic_overflowing (line 1327) | def test_batch_encode_dynamic_overflowing(self): method test_alignment_methods (line 1384) | def test_alignment_methods(self): method get_clean_sequence (line 1387) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method test_maximum_encoding_length_pair_input (line 1424) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 1803) | def test_maximum_encoding_length_single_input(self): method test_pretokenized_inputs (line 1924) | def test_pretokenized_inputs(self): method test_compare_pretokenized_inputs (line 1928) | def test_compare_pretokenized_inputs(self): method test_compare_prepare_for_model (line 1932) | def test_compare_prepare_for_model(self): method test_only_label_first_subword (line 1936) | def test_only_label_first_subword(self): method test_markuplm_integration_test (line 1959) | def test_markuplm_integration_test(self): method test_np_encode_plus_sent_to_model (line 2036) | def test_np_encode_plus_sent_to_model(self): method test_chat_template (line 2040) | def test_chat_template(self): method test_added_tokens_serialization (line 2044) | def test_added_tokens_serialization(self): method test_chat_template_return_assistant_tokens_mask (line 2048) | def test_chat_template_return_assistant_tokens_mask(self): method test_chat_template_return_assistant_tokens_mask_truncated (line 2052) | def test_chat_template_return_assistant_tokens_mask_truncated(self): method test_empty_input_string (line 2055) | def test_empty_input_string(self): FILE: tests/models/mask2former/test_image_processing_mask2former.py class Mask2FormerImageProcessingTester (line 39) | class Mask2FormerImageProcessingTester: method __init__ (line 40) | def __init__( method prepare_image_processor_dict (line 77) | def prepare_image_processor_dict(self): method get_expected_values (line 90) | def get_expected_values(self, image_inputs, batched=False): method get_fake_mask2former_outputs (line 123) | def get_fake_mask2former_outputs(self): method expected_output_image_shape (line 130) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 134) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 147) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 154) | def prepare_semantic_batch_inputs(): class Mask2FormerImageProcessingTest (line 161) | class Mask2FormerImageProcessingTest(ImageProcessingTestMixin, unittest.... method setUp (line 162) | def setUp(self): method image_processor_dict (line 167) | def image_processor_dict(self): method test_image_processor_properties (line 170) | def test_image_processor_properties(self): method comm_get_image_processing_inputs (line 181) | def comm_get_image_processing_inputs( method test_with_size_divisor (line 224) | def test_with_size_divisor(self): method test_call_with_segmentation_maps (line 238) | def test_call_with_segmentation_maps(self): method test_integration_instance_segmentation (line 292) | def test_integration_instance_segmentation(self): method test_integration_semantic_segmentation (line 353) | def test_integration_semantic_segmentation(self): method test_integration_panoptic_segmentation (line 396) | def test_integration_panoptic_segmentation(self): method test_binary_mask_to_rle (line 458) | def test_binary_mask_to_rle(self): method test_post_process_semantic_segmentation (line 469) | def test_post_process_semantic_segmentation(self): method test_post_process_instance_segmentation (line 484) | def test_post_process_instance_segmentation(self): method test_post_process_panoptic_segmentation (line 509) | def test_post_process_panoptic_segmentation(self): method test_post_process_label_fusing (line 522) | def test_post_process_label_fusing(self): method test_backends_equivalence (line 550) | def test_backends_equivalence(self): method test_slow_fast_equivalence_batched (line 573) | def test_slow_fast_equivalence_batched(self): FILE: tests/models/mask2former/test_modeling_mask2former.py class Mask2FormerModelTester (line 53) | class Mask2FormerModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 83) | def prepare_config_and_inputs(self): method get_config (line 98) | def get_config(self): method prepare_config_and_inputs_for_common (line 126) | def prepare_config_and_inputs_for_common(self): method check_output_hidden_state (line 131) | def check_output_hidden_state(self, output, config): method create_and_check_mask2former_model (line 140) | def create_and_check_mask2former_model(self, config, pixel_values, pix... method create_and_check_mask2former_instance_segmentation_head_model (line 160) | def create_and_check_mask2former_instance_segmentation_head_model( class Mask2FormerModelTest (line 200) | class Mask2FormerModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 208) | def setUp(self): method test_config (line 212) | def test_config(self): method test_mask2former_model (line 215) | def test_mask2former_model(self): method test_mask2former_instance_segmentation_head_model (line 219) | def test_mask2former_instance_segmentation_head_model(self): method test_inputs_embeds (line 224) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 228) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 232) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 236) | def test_resize_tokens_embeddings(self): method test_multi_gpu_data_parallel_forward (line 243) | def test_multi_gpu_data_parallel_forward(self): method test_model_from_pretrained (line 247) | def test_model_from_pretrained(self): method test_model_with_labels (line 252) | def test_model_with_labels(self): method test_hidden_states_output (line 265) | def test_hidden_states_output(self): method test_attention_outputs (line 269) | def test_attention_outputs(self): method test_training (line 277) | def test_training(self): method test_retain_grad_hidden_states_attentions (line 291) | def test_retain_grad_hidden_states_attentions(self): method test_backbone_selection (line 322) | def test_backbone_selection(self): function prepare_img (line 364) | def prepare_img(): class Mask2FormerModelIntegrationTest (line 371) | class Mask2FormerModelIntegrationTest(unittest.TestCase): method model_checkpoints (line 373) | def model_checkpoints(self): method default_image_processor (line 377) | def default_image_processor(self): method test_inference_no_head (line 380) | def test_inference_no_head(self): method test_inference_universal_segmentation_head (line 442) | def test_inference_universal_segmentation_head(self): method test_inference_fp16 (line 500) | def test_inference_fp16(self): method test_with_segmentation_maps_and_loss (line 513) | def test_with_segmentation_maps_and_loss(self): FILE: tests/models/maskformer/test_image_processing_maskformer.py class MaskFormerImageProcessingTester (line 39) | class MaskFormerImageProcessingTester: method __init__ (line 40) | def __init__( method prepare_image_processor_dict (line 77) | def prepare_image_processor_dict(self): method get_expected_values (line 90) | def get_expected_values(self, image_inputs, batched=False): method get_fake_maskformer_outputs (line 123) | def get_fake_maskformer_outputs(self): method expected_output_image_shape (line 130) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 134) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 147) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 154) | def prepare_semantic_batch_inputs(): class MaskFormerImageProcessingTest (line 161) | class MaskFormerImageProcessingTest(ImageProcessingTestMixin, unittest.T... method setUp (line 162) | def setUp(self): method image_processor_dict (line 167) | def image_processor_dict(self): method test_image_processor_properties (line 170) | def test_image_processor_properties(self): method comm_get_image_processing_inputs (line 181) | def comm_get_image_processing_inputs( method test_with_size_divisor (line 210) | def test_with_size_divisor(self): method test_call_with_segmentation_maps (line 224) | def test_call_with_segmentation_maps(self): method test_integration_instance_segmentation (line 249) | def test_integration_instance_segmentation(self): method test_integration_semantic_segmentation (line 310) | def test_integration_semantic_segmentation(self): method test_integration_panoptic_segmentation (line 353) | def test_integration_panoptic_segmentation(self): method test_binary_mask_to_rle (line 415) | def test_binary_mask_to_rle(self): method test_post_process_semantic_segmentation (line 426) | def test_post_process_semantic_segmentation(self): method test_post_process_instance_segmentation (line 447) | def test_post_process_instance_segmentation(self): method test_post_process_panoptic_segmentation (line 477) | def test_post_process_panoptic_segmentation(self): method test_post_process_label_fusing (line 492) | def test_post_process_label_fusing(self): method test_backends_equivalence (line 520) | def test_backends_equivalence(self): method test_slow_fast_equivalence_batched (line 547) | def test_slow_fast_equivalence_batched(self): FILE: tests/models/maskformer/test_modeling_maskformer.py class MaskFormerModelTester (line 54) | class MaskFormerModelTester: method __init__ (line 55) | def __init__( method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs(self): method get_config (line 99) | def get_config(self): method prepare_config_and_inputs_for_common (line 124) | def prepare_config_and_inputs_for_common(self): method check_output_hidden_state (line 129) | def check_output_hidden_state(self, output, config): method create_and_check_maskformer_model (line 138) | def create_and_check_maskformer_model(self, config, pixel_values, pixe... method create_and_check_maskformer_instance_segmentation_head_model (line 159) | def create_and_check_maskformer_instance_segmentation_head_model( class MaskFormerModelTest (line 199) | class MaskFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method setUp (line 212) | def setUp(self): method _prepare_for_class (line 216) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 237) | def test_config(self): method test_maskformer_model (line 240) | def test_maskformer_model(self): method test_maskformer_instance_segmentation_head_model (line 244) | def test_maskformer_instance_segmentation_head_model(self): method test_reverse_loading_mapping (line 251) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_inputs_embeds (line 255) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 259) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 263) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 267) | def test_resize_tokens_embeddings(self): method test_multi_gpu_data_parallel_forward (line 274) | def test_multi_gpu_data_parallel_forward(self): method test_model_from_pretrained (line 278) | def test_model_from_pretrained(self): method test_model_with_labels (line 283) | def test_model_with_labels(self): method test_hidden_states_output (line 295) | def test_hidden_states_output(self): method test_attention_outputs (line 299) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 343) | def test_retain_grad_hidden_states_attentions(self): method test_forward_auxiliary_loss (line 375) | def test_forward_auxiliary_loss(self): method test_batching_equivalence (line 393) | def test_batching_equivalence(self): method test_backbone_selection (line 455) | def test_backbone_selection(self): function prepare_img (line 497) | def prepare_img(): class MaskFormerModelIntegrationTest (line 504) | class MaskFormerModelIntegrationTest(unittest.TestCase): method default_image_processor (line 506) | def default_image_processor(self): method test_inference_no_head (line 513) | def test_inference_no_head(self): method test_inference_instance_segmentation_head (line 566) | def test_inference_instance_segmentation_head(self): method test_inference_instance_segmentation_head_resnet_backbone (line 629) | def test_inference_instance_segmentation_head_resnet_backbone(self): method test_inference_fp16 (line 686) | def test_inference_fp16(self): method test_with_segmentation_maps_and_loss (line 699) | def test_with_segmentation_maps_and_loss(self): FILE: tests/models/maskformer/test_modeling_maskformer_swin.py class MaskFormerSwinModelTester (line 37) | class MaskFormerSwinModelTester: method __init__ (line 38) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self): method get_config (line 105) | def get_config(self): method create_and_check_model (line 129) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 140) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 159) | def prepare_config_and_inputs_for_common(self): class MaskFormerSwinModelTest (line 167) | class MaskFormerSwinModelTest(ModelTesterMixin, PipelineTesterMixin, uni... method setUp (line 180) | def setUp(self): method test_multi_gpu_data_parallel_forward (line 197) | def test_multi_gpu_data_parallel_forward(self): method test_config (line 200) | def test_config(self): method test_model (line 203) | def test_model(self): method test_backbone (line 207) | def test_backbone(self): method test_inputs_embeds (line 212) | def test_inputs_embeds(self): method test_feed_forward_chunking (line 216) | def test_feed_forward_chunking(self): method test_model_get_set_embeddings (line 219) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 229) | def test_attention_outputs(self): method check_hidden_states_output (line 232) | def check_hidden_states_output(self, inputs_dict, config, model_class,... method test_hidden_states_output (line 261) | def test_hidden_states_output(self): method test_hidden_states_output_with_padding (line 280) | def test_hidden_states_output_with_padding(self): method test_model_from_pretrained (line 308) | def test_model_from_pretrained(self): method test_gradient_checkpointing_backward_compatibility (line 312) | def test_gradient_checkpointing_backward_compatibility(self): method test_model_outputs_equivalence (line 315) | def test_model_outputs_equivalence(self): class MaskFormerSwinBackboneTest (line 376) | class MaskFormerSwinBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 380) | def setUp(self): method test_backbone_outputs (line 384) | def test_backbone_outputs(self): FILE: tests/models/mbart/test_modeling_mbart.py function prepare_mbart_inputs_dict (line 52) | def prepare_mbart_inputs_dict( class MBartModelTester (line 71) | class MBartModelTester: method __init__ (line 72) | def __init__( method prepare_config_and_inputs (line 110) | def prepare_config_and_inputs(self): method get_config (line 123) | def get_config(self): method prepare_config_and_inputs_for_common (line 141) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 145) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 178) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class MBartModelTest (line 212) | class MBartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method is_pipeline_test_to_skip (line 234) | def is_pipeline_test_to_skip( method setUp (line 249) | def setUp(self): method test_config (line 253) | def test_config(self): method test_save_load_strict (line 256) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 266) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 270) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 275) | def test_inputs_embeds(self): method test_generate_fp16 (line 305) | def test_generate_fp16(self): method test_ensure_weights_are_shared (line 314) | def test_ensure_weights_are_shared(self): method test_load_save_without_tied_weights (line 354) | def test_load_save_without_tied_weights(self): method test_resize_embeddings_persists_embeddings_type (line 357) | def test_resize_embeddings_persists_embeddings_type(self): function assert_tensors_close (line 370) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 389) | def _long_tensor(tok_lst): class AbstractSeq2SeqIntegrationTest (line 396) | class AbstractSeq2SeqIntegrationTest(unittest.TestCase): method setUpClass (line 401) | def setUpClass(cls): method model (line 406) | def model(self): class MBartEnroIntegrationTest (line 418) | class MBartEnroIntegrationTest(AbstractSeq2SeqIntegrationTest): method test_enro_generate_one (line 432) | def test_enro_generate_one(self): method test_enro_generate_batch (line 441) | def test_enro_generate_batch(self): method test_mbart_enro_config (line 449) | def test_mbart_enro_config(self): method test_mbart_fast_forward (line 461) | def test_mbart_fast_forward(self): class MBartCC25IntegrationTest (line 488) | class MBartCC25IntegrationTest(AbstractSeq2SeqIntegrationTest): method test_cc25_generate (line 497) | def test_cc25_generate(self): method test_fill_mask (line 506) | def test_fill_mask(self): class MBartStandaloneDecoderModelTester (line 517) | class MBartStandaloneDecoderModelTester: method __init__ (line 518) | def __init__( method prepare_config_and_inputs (line 573) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 608) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 644) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 691) | def prepare_config_and_inputs_for_common(self): class MBartStandaloneDecoderModelTest (line 708) | class MBartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTester... method setUp (line 713) | def setUp( method test_config (line 719) | def test_config(self): method test_decoder_model_past (line 722) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 726) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 731) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 735) | def test_flex_attention_with_grads(self): FILE: tests/models/mbart/test_tokenization_mbart.py class MBartTokenizationTest (line 42) | class MBartTokenizationTest(TokenizerTesterMixin, unittest.TestCase): class MBartEnroIntegrationTest (line 55) | class MBartEnroIntegrationTest(unittest.TestCase): method setUpClass (line 70) | def setUpClass(cls): method check_language_codes (line 77) | def check_language_codes(self): method test_enro_tokenizer_batch_encode_plus (line 82) | def test_enro_tokenizer_batch_encode_plus(self): method test_enro_tokenizer_decode_ignores_language_codes (line 86) | def test_enro_tokenizer_decode_ignores_language_codes(self): method test_enro_tokenizer_truncation (line 94) | def test_enro_tokenizer_truncation(self): method test_mask_token (line 103) | def test_mask_token(self): method test_special_tokens_unaffacted_by_save_load (line 106) | def test_special_tokens_unaffacted_by_save_load(self): method test_batch_fairseq_parity (line 114) | def test_batch_fairseq_parity(self): method test_enro_tokenizer_prepare_batch (line 125) | def test_enro_tokenizer_prepare_batch(self): method test_seq2seq_max_length (line 148) | def test_seq2seq_max_length(self): method test_tokenizer_translation (line 160) | def test_tokenizer_translation(self): FILE: tests/models/mbart50/test_tokenization_mbart50.py class MBart50TokenizationTest (line 41) | class MBart50TokenizationTest(TokenizerTesterMixin, unittest.TestCase): class MBart50OneToManyIntegrationTest (line 54) | class MBart50OneToManyIntegrationTest(unittest.TestCase): method setUpClass (line 69) | def setUpClass(cls): method check_language_codes (line 76) | def check_language_codes(self): method test_tokenizer_batch_encode_plus (line 82) | def test_tokenizer_batch_encode_plus(self): method test_tokenizer_decode_ignores_language_codes (line 86) | def test_tokenizer_decode_ignores_language_codes(self): method test_tokenizer_truncation (line 94) | def test_tokenizer_truncation(self): method test_mask_token (line 103) | def test_mask_token(self): method test_special_tokens_unaffacted_by_save_load (line 106) | def test_special_tokens_unaffacted_by_save_load(self): method test_batch_fairseq_parity (line 114) | def test_batch_fairseq_parity(self): method test_tokenizer_prepare_batch (line 126) | def test_tokenizer_prepare_batch(self): method test_seq2seq_max_target_length (line 148) | def test_seq2seq_max_target_length(self): method test_tokenizer_translation (line 160) | def test_tokenizer_translation(self): FILE: tests/models/megatron_bert/test_modeling_megatron_bert.py class MegatronBertModelTester (line 47) | class MegatronBertModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 98) | def prepare_config_and_inputs(self): method get_config (line 121) | def get_config(self): method create_and_check_megatron_bert_model (line 138) | def create_and_check_megatron_bert_model( method create_and_check_megatron_bert_for_masked_lm (line 151) | def create_and_check_megatron_bert_for_masked_lm( method create_and_check_megatron_bert_for_next_sequence_prediction (line 160) | def create_and_check_megatron_bert_for_next_sequence_prediction( method create_and_check_megatron_bert_for_pretraining (line 174) | def create_and_check_megatron_bert_for_pretraining( method create_and_check_megatron_bert_for_question_answering (line 190) | def create_and_check_megatron_bert_for_question_answering( method create_and_check_megatron_bert_for_sequence_classification (line 206) | def create_and_check_megatron_bert_for_sequence_classification( method create_and_check_megatron_bert_for_token_classification (line 216) | def create_and_check_megatron_bert_for_token_classification( method create_and_check_megatron_bert_for_multiple_choice (line 226) | def create_and_check_megatron_bert_for_multiple_choice( method prepare_config_and_inputs_for_common (line 244) | def prepare_config_and_inputs_for_common(self): class MegatronBertModelTest (line 260) | class MegatronBertModelTest(ModelTesterMixin, PipelineTesterMixin, unitt... method _prepare_for_class (line 293) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 306) | def setUp(self): method test_config (line 310) | def test_config(self): method test_megatron_bert_model (line 313) | def test_megatron_bert_model(self): method test_for_masked_lm (line 317) | def test_for_masked_lm(self): method test_for_multiple_choice (line 321) | def test_for_multiple_choice(self): method test_for_next_sequence_prediction (line 325) | def test_for_next_sequence_prediction(self): method test_for_pretraining (line 329) | def test_for_pretraining(self): method test_for_question_answering (line 333) | def test_for_question_answering(self): method test_for_sequence_classification (line 337) | def test_for_sequence_classification(self): method test_for_token_classification (line 341) | def test_for_token_classification(self): function _long_tensor (line 346) | def _long_tensor(tok_lst): class MegatronBertModelIntegrationTests (line 360) | class MegatronBertModelIntegrationTests(unittest.TestCase): method test_inference_no_head (line 363) | def test_inference_no_head(self): FILE: tests/models/megatron_gpt2/test_modeling_megatron_gpt2.py class MegatronGPT2IntegrationTest (line 31) | class MegatronGPT2IntegrationTest(unittest.TestCase): method test_inference_no_head (line 34) | def test_inference_no_head(self): FILE: tests/models/metaclip_2/test_modeling_metaclip_2.py class MetaClip2VisionModelTester (line 68) | class MetaClip2VisionModelTester: method __init__ (line 69) | def __init__( method prepare_config_and_inputs (line 107) | def prepare_config_and_inputs(self): method get_config (line 113) | def get_config(self): method create_and_check_model (line 128) | def create_and_check_model(self, config, pixel_values): method create_and_check_model_with_projection (line 141) | def create_and_check_model_with_projection(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 154) | def prepare_config_and_inputs_for_common(self): method test_eager_matches_sdpa_inference (line 161) | def test_eager_matches_sdpa_inference(self, *args): class MetaClip2ModelTesterMixin (line 165) | class MetaClip2ModelTesterMixin(ModelTesterMixin): method test_sdpa_can_dispatch_composite_models (line 172) | def test_sdpa_can_dispatch_composite_models(self): class MetaClip2VisionModelTest (line 204) | class MetaClip2VisionModelTest(MetaClip2ModelTesterMixin, unittest.TestC... method setUp (line 214) | def setUp(self): method test_config (line 220) | def test_config(self): method test_inputs_embeds (line 224) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 227) | def test_model_get_set_embeddings(self): method test_forward_signature (line 236) | def test_forward_signature(self): method test_model (line 248) | def test_model(self): method test_model_with_projection (line 252) | def test_model_with_projection(self): method test_training (line 257) | def test_training(self): method test_training_gradient_checkpointing (line 261) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 265) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 269) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 273) | def test_model_from_pretrained(self): method test_model_with_projection_from_pretrained (line 279) | def test_model_with_projection_from_pretrained(self): method test_eager_matches_sdpa_inference (line 287) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 291) | def test_sdpa_can_dispatch_composite_models(self): class MetaClip2TextModelTester (line 295) | class MetaClip2TextModelTester: method __init__ (line 296) | def __init__( method prepare_config_and_inputs (line 336) | def prepare_config_and_inputs(self): method get_config (line 356) | def get_config(self): method create_and_check_model (line 371) | def create_and_check_model(self, config, input_ids, input_mask): method create_and_check_model_with_projection (line 381) | def create_and_check_model_with_projection(self, config, input_ids, in... method prepare_config_and_inputs_for_common (line 391) | def prepare_config_and_inputs_for_common(self): class MetaClip2TextModelTest (line 399) | class MetaClip2TextModelTest(MetaClip2ModelTesterMixin, unittest.TestCase): method setUp (line 404) | def setUp(self): method test_config (line 408) | def test_config(self): method test_model (line 411) | def test_model(self): method test_model_with_projection (line 415) | def test_model_with_projection(self): method test_training (line 420) | def test_training(self): method test_training_gradient_checkpointing (line 424) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 428) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 432) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 436) | def test_inputs_embeds(self): method test_model_from_pretrained (line 440) | def test_model_from_pretrained(self): method test_model_with_projection_from_pretrained (line 446) | def test_model_with_projection_from_pretrained(self): method test_eager_matches_sdpa_inference (line 455) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 459) | def test_sdpa_can_dispatch_composite_models(self): method test_sdpa_can_dispatch_on_flash (line 462) | def test_sdpa_can_dispatch_on_flash(self): class MetaClip2ModelTester (line 468) | class MetaClip2ModelTester: method __init__ (line 469) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 481) | def prepare_config_and_inputs(self): method get_config (line 489) | def get_config(self): method create_and_check_model (line 496) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 507) | def prepare_config_and_inputs_for_common(self): class MetaClip2ModelTest (line 520) | class MetaClip2ModelTest(MetaClip2ModelTesterMixin, PipelineTesterMixin,... method setUp (line 533) | def setUp(self): method test_model (line 540) | def test_model(self): method test_config (line 544) | def test_config(self): method test_hidden_states_output (line 548) | def test_hidden_states_output(self): method test_inputs_embeds (line 552) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 556) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 560) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 563) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 579) | def test_model_from_pretrained(self): method test_eager_matches_sdpa_inference (line 587) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 591) | def test_sdpa_can_dispatch_composite_models(self): method test_sdpa_can_dispatch_on_flash (line 594) | def test_sdpa_can_dispatch_on_flash(self): method test_sdpa_can_compile_dynamic (line 599) | def test_sdpa_can_compile_dynamic(self): method test_get_text_features_attentions (line 603) | def test_get_text_features_attentions(self): method test_get_text_features_hidden_states (line 608) | def test_get_text_features_hidden_states(self): method test_get_image_features_attentions (line 613) | def test_get_image_features_attentions(self): method test_get_image_features_hidden_states (line 618) | def test_get_image_features_hidden_states(self): class MetaClip2ForImageClassificationModelTester (line 623) | class MetaClip2ForImageClassificationModelTester(MetaClip2ModelTester): method __init__ (line 624) | def __init__(self, parent): method prepare_config_and_inputs (line 631) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 637) | def prepare_config_and_inputs_for_common(self): class MetaClip2ForImageClassificationModelTest (line 645) | class MetaClip2ForImageClassificationModelTest(MetaClip2ModelTesterMixin... method setUp (line 652) | def setUp(self): method test_inputs_embeds (line 656) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 660) | def test_model_get_set_embeddings(self): method test_training_gradient_checkpointing (line 664) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 668) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 672) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_eager_matches_sdpa_inference (line 678) | def test_eager_matches_sdpa_inference(self, *args): method test_sdpa_can_dispatch_composite_models (line 682) | def test_sdpa_can_dispatch_composite_models(self): function prepare_img (line 687) | def prepare_img(): class MetaClip2ModelIntegrationTest (line 695) | class MetaClip2ModelIntegrationTest(unittest.TestCase): method test_inference (line 697) | def test_inference(self): FILE: tests/models/mgp_str/test_modeling_mgp_str.py class MgpstrModelTester (line 42) | class MgpstrModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 79) | def prepare_config_and_inputs(self): method get_config (line 84) | def get_config(self): method create_and_check_model (line 100) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 110) | def prepare_config_and_inputs_for_common(self): class MgpstrModelTest (line 118) | class MgpstrModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 129) | def setUp(self): method test_config (line 133) | def test_config(self): method test_model (line 136) | def test_model(self): method test_batching_equivalence (line 140) | def test_batching_equivalence(self, atol=1e-4, rtol=1e-4): method test_inputs_embeds (line 144) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 147) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 157) | def test_feed_forward_chunking(self): method test_gradient_checkpointing_backward_compatibility (line 160) | def test_gradient_checkpointing_backward_compatibility(self): method test_hidden_states_output (line 171) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 205) | def test_retain_grad_hidden_states_attentions(self): function prepare_img (line 210) | def prepare_img(): class MgpstrModelIntegrationTest (line 218) | class MgpstrModelIntegrationTest(unittest.TestCase): method test_inference (line 220) | def test_inference(self): FILE: tests/models/mgp_str/test_processing_mgp_str.py class MgpstrProcessorTest (line 37) | class MgpstrProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 41) | def _setup_tokenizer(cls): method _setup_image_processor (line 53) | def _setup_image_processor(cls): method test_processor_with_multiple_inputs (line 64) | def test_processor_with_multiple_inputs(self): method test_tokenizer_decode_defaults (line 79) | def test_tokenizer_decode_defaults(self): FILE: tests/models/mgp_str/test_tokenization_mgp_str.py class MgpstrTokenizationTest (line 28) | class MgpstrTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 36) | def setUpClass(cls): method get_tokenizer (line 47) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 51) | def get_input_output_texts(self, tokenizer): method test_added_tokens_do_lower_case (line 57) | def test_added_tokens_do_lower_case(self): method test_add_special_tokens (line 60) | def test_add_special_tokens(self): method test_internal_consistency (line 73) | def test_internal_consistency(self): method test_maximum_encoding_length_pair_input (line 92) | def test_maximum_encoding_length_pair_input(self): method test_pretokenized_inputs (line 96) | def test_pretokenized_inputs(self): FILE: tests/models/mimi/test_modeling_mimi.py function prepare_inputs_dict (line 48) | def prepare_inputs_dict( class MimiModelTester (line 67) | class MimiModelTester: method __init__ (line 68) | def __init__( method prepare_config_and_inputs (line 108) | def prepare_config_and_inputs(self, input_values_length=None): method prepare_config_and_inputs_for_common (line 121) | def prepare_config_and_inputs_for_common(self, input_values_length=None): method prepare_config_and_inputs_for_model_class (line 125) | def prepare_config_and_inputs_for_model_class(self, model_class): method get_config (line 133) | def get_config(self): method create_and_check_model_forward (line 152) | def create_and_check_model_forward(self, config, inputs_dict): class MimiModelTest (line 163) | class MimiModelTest(ModelTesterMixin, unittest.TestCase): method _prepare_for_class (line 170) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 179) | def setUp(self): method test_config (line 185) | def test_config(self): method test_model_forward (line 188) | def test_model_forward(self): method test_forward_signature (line 192) | def test_forward_signature(self): method test_inputs_embeds (line 205) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 209) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 213) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 217) | def test_attention_outputs(self): method test_hidden_states_output (line 221) | def test_hidden_states_output(self): method test_determinism (line 225) | def test_determinism(self): method test_model_outputs_equivalence (line 252) | def test_model_outputs_equivalence(self): method test_identity_shortcut (line 290) | def test_identity_shortcut(self): method test_flash_attn_2_inference_equivalence (line 300) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 330) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_sdpa_can_compile_dynamic (line 335) | def test_sdpa_can_compile_dynamic(self): function normalize (line 340) | def normalize(arr): function compute_rmse (line 347) | def compute_rmse(arr1, arr2): class MimiIntegrationTest (line 355) | class MimiIntegrationTest(unittest.TestCase): method test_integration_using_cache_decode (line 356) | def test_integration_using_cache_decode(self): method test_integration_encode_with_padding_cache (line 404) | def test_integration_encode_with_padding_cache(self): method test_integration (line 452) | def test_integration(self): method test_integration_longform (line 511) | def test_integration_longform(self): FILE: tests/models/minimax/test_modeling_minimax.py class MiniMaxModelTester (line 40) | class MiniMaxModelTester(CausalLMModelTester): method __init__ (line 44) | def __init__(self, parent, layer_types=None, block_size=3): class MiniMaxModelTest (line 51) | class MiniMaxModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 55) | def is_pipeline_test_to_skip( method test_load_balancing_loss (line 68) | def test_load_balancing_loss(self): method _check_attentions_for_generate (line 103) | def _check_attentions_for_generate( method _check_past_key_values_for_generate (line 130) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method _check_caches_are_equal (line 155) | def _check_caches_are_equal(self, cache1: MiniMaxCache, cache2: MiniMa... method test_prompt_lookup_decoding_matches_greedy_search (line 171) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_assisted_decoding_sample (line 175) | def test_assisted_decoding_sample(self): method test_assisted_decoding_matches_greedy_search_0_random (line 179) | def test_assisted_decoding_matches_greedy_search_0_random(self): method test_assisted_decoding_matches_greedy_search_1_same (line 183) | def test_assisted_decoding_matches_greedy_search_1_same(self): method test_attention_outputs (line 187) | def test_attention_outputs(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 191) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 195) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 199) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 203) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): class MiniMaxIntegrationTest (line 210) | class MiniMaxIntegrationTest(unittest.TestCase): method test_small_model_logits (line 211) | def test_small_model_logits(self): method test_small_model_generation (line 236) | def test_small_model_generation(self): FILE: tests/models/minimax_m2/test_modeling_minimax_m2.py class MiniMaxM2ModelTester (line 41) | class MiniMaxM2ModelTester(CausalLMModelTester): class MiniMaxM2ModelTest (line 47) | class MiniMaxM2ModelTest(CausalLMModelTest, unittest.TestCase): method test_load_balancing_loss (line 51) | def test_load_balancing_loss(self): class MiniMaxM2IntegrationTest (line 95) | class MiniMaxM2IntegrationTest(unittest.TestCase): method setup (line 96) | def setup(self): method tearDown (line 99) | def tearDown(self): method test_small_model_logits_batched (line 107) | def test_small_model_logits_batched(self): method test_small_model_generation (line 148) | def test_small_model_generation(self): FILE: tests/models/ministral/test_modeling_ministral.py class MinistralModelTester (line 48) | class MinistralModelTester(CausalLMModelTester): class MinistralModelTest (line 54) | class MinistralModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 58) | def is_pipeline_test_to_skip( method test_flash_attn_2_inference_equivalence_right_padding (line 74) | def test_flash_attn_2_inference_equivalence_right_padding(self): class MinistralIntegrationTest (line 79) | class MinistralIntegrationTest(unittest.TestCase): method tearDown (line 80) | def tearDown(self): method test_model_8b_logits (line 84) | def test_model_8b_logits(self): method test_model_8b_generation (line 106) | def test_model_8b_generation(self): method test_model_8b_long_prompt (line 126) | def test_model_8b_long_prompt(self): method test_export_text_with_hybrid_cache (line 155) | def test_export_text_with_hybrid_cache(self): method test_past_sliding_window_generation (line 213) | def test_past_sliding_window_generation(self): FILE: tests/models/ministral3/test_modeling_ministral3.py class Ministral3ModelTester (line 46) | class Ministral3ModelTester(CausalLMModelTester): class Ministral3ModelTest (line 52) | class Ministral3ModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 58) | def is_pipeline_test_to_skip( method test_flash_attn_2_inference_equivalence_right_padding (line 74) | def test_flash_attn_2_inference_equivalence_right_padding(self): class Ministral3IntegrationTest (line 79) | class Ministral3IntegrationTest(unittest.TestCase): method tearDown (line 80) | def tearDown(self): method test_model_3b_logits (line 84) | def test_model_3b_logits(self): method test_model_3b_generation (line 110) | def test_model_3b_generation(self): FILE: tests/models/mistral/test_modeling_mistral.py class MistralModelTester (line 49) | class MistralModelTester(CausalLMModelTester): class MistralModelTest (line 55) | class MistralModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 59) | def is_pipeline_test_to_skip( class MistralIntegrationTest (line 73) | class MistralIntegrationTest(unittest.TestCase): method setUpClass (line 79) | def setUpClass(cls): method setUp (line 82) | def setUp(self): method tearDown (line 85) | def tearDown(self): method test_model_7b_logits (line 89) | def test_model_7b_logits(self): method test_model_7b_generation (line 116) | def test_model_7b_generation(self): method test_model_7b_long_prompt (line 137) | def test_model_7b_long_prompt(self): method test_model_7b_long_prompt_sdpa (line 159) | def test_model_7b_long_prompt_sdpa(self): method test_speculative_generation (line 194) | def test_speculative_generation(self): method test_compile_static_cache (line 211) | def test_compile_static_cache(self): method test_generation_beyond_sliding_window_dynamic (line 270) | def test_generation_beyond_sliding_window_dynamic(self, attn_implement... class Mask4DTestHard (line 322) | class Mask4DTestHard(unittest.TestCase): method setUpClass (line 328) | def setUpClass(cls): method tearDownClass (line 336) | def tearDownClass(cls): method setUp (line 341) | def setUp(self): method tearDown (line 345) | def tearDown(self): method get_test_data (line 348) | def get_test_data(self): method test_stacked_causal_mask (line 392) | def test_stacked_causal_mask(self): method test_partial_stacked_causal_mask (line 417) | def test_partial_stacked_causal_mask(self): FILE: tests/models/mistral3/test_modeling_mistral3.py class Mistral3VisionText2TextModelTester (line 51) | class Mistral3VisionText2TextModelTester: method __init__ (line 52) | def __init__( method get_config (line 118) | def get_config(self): method prepare_config_and_inputs (line 131) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 137) | def prepare_config_and_inputs_for_common(self): class Mistral3ModelTest (line 160) | class Mistral3ModelTest(ModelTesterMixin, GenerationTesterMixin, Pipelin... method setUp (line 182) | def setUp(self): method test_config (line 186) | def test_config(self): method test_sdpa_can_compile_dynamic (line 198) | def test_sdpa_can_compile_dynamic(self): method test_flash_attn_2_fp32_ln (line 202) | def test_flash_attn_2_fp32_ln(self): method test_eager_matches_fa2_generate (line 206) | def test_eager_matches_fa2_generate(self): method test_eager_matches_sdpa_generate (line 210) | def test_eager_matches_sdpa_generate(self): method test_flash_attn_2_from_config (line 214) | def test_flash_attn_2_from_config(self): method test_flash_attn_2_inference_equivalence (line 218) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 222) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_sdpa_can_dispatch_on_flash (line 226) | def test_sdpa_can_dispatch_on_flash(self): method test_flex_attention_with_grads (line 230) | def test_flex_attention_with_grads(self): class Mistral3IntegrationTest (line 236) | class Mistral3IntegrationTest(unittest.TestCase): method setUp (line 237) | def setUp(self): method tearDown (line 243) | def tearDown(self): method test_mistral3_integration_generate_text_only (line 246) | def test_mistral3_integration_generate_text_only(self): method test_mistral3_integration_generate (line 278) | def test_mistral3_integration_generate(self): method test_mistral3_integration_batched_generate (line 312) | def test_mistral3_integration_batched_generate(self): method test_mistral3_integration_batched_generate_multi_image (line 384) | def test_mistral3_integration_batched_generate_multi_image(self): FILE: tests/models/mistral3/test_processing_mistral3.py class Mistral3ProcessorTest (line 31) | class Mistral3ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 38) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 49) | def prepare_processor_dict(): method test_image_token_filling (line 56) | def test_image_token_filling(self): method test_processor_with_single_image (line 84) | def test_processor_with_single_image(self): method test_processor_with_multiple_images_single_list (line 148) | def test_processor_with_multiple_images_single_list(self): method test_processor_with_multiple_images_multiple_lists (line 201) | def test_processor_with_multiple_images_multiple_lists(self): method test_processor_returns_full_length_batches (line 261) | def test_processor_returns_full_length_batches(self): method test_special_mm_token_truncation (line 279) | def test_special_mm_token_truncation(self): FILE: tests/models/mistral4/test_modeling_mistral4.py class Mistral4ModelTester (line 46) | class Mistral4ModelTester(CausalLMModelTester): class Mistral4ModelTest (line 53) | class Mistral4ModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 59) | def is_pipeline_test_to_skip( method test_flash_attn_2_inference_equivalence_right_padding (line 75) | def test_flash_attn_2_inference_equivalence_right_padding(self): class Mistral4IntegrationTest (line 80) | class Mistral4IntegrationTest(unittest.TestCase): method tearDown (line 81) | def tearDown(self): method test_mistral_small_4_logits (line 85) | def test_mistral_small_4_logits(self): method test_mistral_small_4_generation (line 110) | def test_mistral_small_4_generation(self): FILE: tests/models/mixtral/test_modeling_mixtral.py class MixtralModelTester (line 43) | class MixtralModelTester(CausalLMModelTester): class MixtralModelTest (line 49) | class MixtralModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 53) | def is_pipeline_test_to_skip( method test_flash_attn_2_inference_equivalence_right_padding (line 69) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_load_balancing_loss (line 73) | def test_load_balancing_loss(self): class MixtralIntegrationTest (line 112) | class MixtralIntegrationTest(unittest.TestCase): method test_small_model_logits (line 115) | def test_small_model_logits(self): method test_small_model_logits_batched (line 148) | def test_small_model_logits_batched(self): FILE: tests/models/mlcd/test_modeling_mlcd.py class MLCDVisionModelTester (line 41) | class MLCDVisionModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 78) | def prepare_config_and_inputs(self): method get_config (line 84) | def get_config(self): method create_and_check_model (line 98) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 111) | def prepare_config_and_inputs_for_common(self): class MLCDVisionModelTest (line 119) | class MLCDVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 128) | def setUp(self): method test_model_get_set_embeddings (line 132) | def test_model_get_set_embeddings(self): method test_enable_input_require_grads_with_gradient_checkpointing (line 144) | def test_enable_input_require_grads_with_gradient_checkpointing(self): class MLCDVisionModelIntegrationTest (line 149) | class MLCDVisionModelIntegrationTest(unittest.TestCase): method test_inference (line 151) | def test_inference(self): FILE: tests/models/mllama/test_image_processing_mllama.py class MllamaImageProcessingTester (line 35) | class MllamaImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 75) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 89) | def prepare_image_inputs( method expected_output_image_shape (line 138) | def expected_output_image_shape(self, images): class MllamaImageProcessingTest (line 151) | class MllamaImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 152) | def setUp(self): method image_processor_dict (line 157) | def image_processor_dict(self): method test_image_processor_properties (line 160) | def test_image_processor_properties(self): method test_call_numpy (line 174) | def test_call_numpy(self): method test_call_pil (line 204) | def test_call_pil(self): method test_call_channels_last (line 226) | def test_call_channels_last(self): method test_ambiguous_channel_pil_image (line 239) | def test_ambiguous_channel_pil_image(self): method test_resize_impractical_aspect_ratio (line 249) | def test_resize_impractical_aspect_ratio(self): method test_call_pytorch (line 259) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 283) | def test_call_numpy_4_channels(self): method test_image_correctly_tiled (line 286) | def test_image_correctly_tiled(self): method test_fast_image_processor_explicit_none_preserved (line 394) | def test_fast_image_processor_explicit_none_preserved(self): FILE: tests/models/mllama/test_modeling_mllama.py class MllamaText2TextModelTester (line 56) | class MllamaText2TextModelTester: method __init__ (line 57) | def __init__( method get_config (line 92) | def get_config(self): method prepare_config_and_inputs (line 95) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 101) | def prepare_config_and_inputs_for_common(self): method create_and_check_mllama_model_fp16_forward (line 106) | def create_and_check_mllama_model_fp16_forward(self, config, input_ids... class MllamaForCausalLMModelTest (line 120) | class MllamaForCausalLMModelTest(ModelTesterMixin, GenerationTesterMixin... method setUp (line 127) | def setUp(self): method test_model_base_model_prefix (line 132) | def test_model_base_model_prefix(self): class MllamaVisionText2TextModelTester (line 136) | class MllamaVisionText2TextModelTester: method __init__ (line 137) | def __init__( method get_config (line 198) | def get_config(self): method prepare_config_and_inputs (line 205) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 222) | def prepare_config_and_inputs_for_common(self): method create_and_check_mllama_model_fp16_forward (line 245) | def create_and_check_mllama_model_fp16_forward(self, config, input_ids... method test_eager_padding_matches_padding_free_with_position_ids (line 259) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 263) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): class MllamaForConditionalGenerationModelTest (line 268) | class MllamaForConditionalGenerationModelTest(ModelTesterMixin, Generati... method setUp (line 285) | def setUp(self): method test_config (line 291) | def test_config(self): method test_resize_embeddings_results_in_successful_loss (line 294) | def test_resize_embeddings_results_in_successful_loss(self): method _check_attentions_for_generate (line 311) | def _check_attentions_for_generate( method test_generate_with_quant_cache (line 356) | def test_generate_with_quant_cache(self): method test_sdpa_can_compile_dynamic (line 361) | def test_sdpa_can_compile_dynamic(self): method test_model_parallelism (line 365) | def test_model_parallelism(self): method test_assisted_decoding_with_num_logits_to_keep (line 369) | def test_assisted_decoding_with_num_logits_to_keep(self): method test_cpu_offload (line 373) | def test_cpu_offload(self): method test_disk_offload_bin (line 377) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 381) | def test_disk_offload_safetensors(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 385) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 389) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 393) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 397) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method _check_past_key_values_for_generate (line 401) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_generate_text_only_with_cache (line 416) | def test_generate_text_only_with_cache(self): method test_left_padding_compatibility (line 437) | def test_left_padding_compatibility(self): class MllamaForConditionalGenerationIntegrationTest (line 457) | class MllamaForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 458) | def setUp(self): method tearDown (line 462) | def tearDown(self): method test_11b_model_integration_generate (line 468) | def test_11b_model_integration_generate(self): method test_11b_model_integration_generate_text_only (line 519) | def test_11b_model_integration_generate_text_only(self): method test_11b_model_integration_forward (line 564) | def test_11b_model_integration_forward(self): method test_11b_model_integration_batched_generate (line 604) | def test_11b_model_integration_batched_generate(self): method test_11b_model_integration_multi_image_generate (line 669) | def test_11b_model_integration_multi_image_generate(self): FILE: tests/models/mllama/test_processing_mllama.py class MllamaProcessorTest (line 33) | class MllamaProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 38) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 48) | def prepare_processor_dict(): method test_image_processor_defaults (line 52) | def test_image_processor_defaults(self): method test_tokenizer_defaults (line 56) | def test_tokenizer_defaults(self): method prepare_image_inputs (line 60) | def prepare_image_inputs(self, batch_size: int | None = None): method test_chat_template_is_saved (line 67) | def test_chat_template_is_saved(self): method test_apply_chat_template (line 78) | def test_apply_chat_template(self): method test_process_interleaved_images_prompts_image_splitting (line 230) | def test_process_interleaved_images_prompts_image_splitting(self): method test_process_interleaved_images_prompts_image_error (line 326) | def test_process_interleaved_images_prompts_image_error(self): method test_unstructured_kwargs_batched (line 369) | def test_unstructured_kwargs_batched(self): method test_special_mm_token_truncation (line 397) | def test_special_mm_token_truncation(self): method test_processor_text_has_no_visual (line 423) | def test_processor_text_has_no_visual(self): FILE: tests/models/mluke/test_tokenization_mluke.py class MLukeTokenizerTest (line 31) | class MLukeTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 37) | def setUpClass(cls): method get_tokenizer (line 45) | def get_tokenizer(cls, pretrained_name=None, task=None, **kwargs): method get_input_output_texts (line 56) | def get_input_output_texts(self, tokenizer): method mluke_dict_integration_testing (line 61) | def mluke_dict_integration_testing(self): method test_sequence_builders (line 70) | def test_sequence_builders(self): method get_clean_sequence (line 89) | def get_clean_sequence(self, tokenizer, max_length=20) -> tuple[str, l... method test_pretokenized_inputs (line 95) | def test_pretokenized_inputs(self): method test_padding_entity_inputs (line 98) | def test_padding_entity_inputs(self): method test_conversion_reversible (line 136) | def test_conversion_reversible(self): method test_jinja_loopcontrols (line 140) | def test_jinja_loopcontrols(self): method test_pad_token_initialization (line 144) | def test_pad_token_initialization(self): class MLukeTokenizerIntegrationTests (line 150) | class MLukeTokenizerIntegrationTests(unittest.TestCase): method setUpClass (line 155) | def setUpClass(cls): method test_single_text_no_padding_or_truncation (line 168) | def test_single_text_no_padding_or_truncation(self): method test_single_text_only_entity_spans_no_padding_or_truncation (line 214) | def test_single_text_only_entity_spans_no_padding_or_truncation(self): method test_single_text_padding_pytorch_tensors (line 261) | def test_single_text_padding_pytorch_tensors(self): method test_text_pair_no_padding_or_truncation (line 290) | def test_text_pair_no_padding_or_truncation(self): method test_text_pair_only_entity_spans_no_padding_or_truncation (line 349) | def test_text_pair_only_entity_spans_no_padding_or_truncation(self): method test_text_pair_padding_pytorch_tensors (line 406) | def test_text_pair_padding_pytorch_tensors(self): method test_entity_classification_no_padding_or_truncation (line 441) | def test_entity_classification_no_padding_or_truncation(self): method test_entity_classification_padding_pytorch_tensors (line 475) | def test_entity_classification_padding_pytorch_tensors(self): method test_entity_pair_classification_no_padding_or_truncation (line 498) | def test_entity_pair_classification_no_padding_or_truncation(self): method test_entity_pair_classification_padding_pytorch_tensors (line 535) | def test_entity_pair_classification_padding_pytorch_tensors(self): method test_entity_span_classification_no_padding_or_truncation (line 564) | def test_entity_span_classification_no_padding_or_truncation(self): method test_entity_span_classification_padding_pytorch_tensors (line 593) | def test_entity_span_classification_padding_pytorch_tensors(self): FILE: tests/models/mm_grounding_dino/test_modeling_mm_grounding_dino.py function generate_fake_bounding_boxes (line 61) | def generate_fake_bounding_boxes(n_boxes): class MMGroundingDinoModelTester (line 95) | class MMGroundingDinoModelTester: method __init__ (line 96) | def __init__( method prepare_config_and_inputs (line 152) | def prepare_config_and_inputs(self): method get_config (line 178) | def get_config(self): method prepare_config_and_inputs_for_common (line 217) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 222) | def create_and_check_model(self, config, pixel_values, pixel_mask, inp... method create_and_check_object_detection_head_model (line 231) | def create_and_check_object_detection_head_model(self, config, pixel_v... class MMGroundingDinoModelTest (line 250) | class MMGroundingDinoModelTest(ModelTesterMixin, PipelineTesterMixin, un... method _prepare_for_class (line 265) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 291) | def setUp(self): method test_config (line 300) | def test_config(self): method test_model (line 303) | def test_model(self): method test_object_detection_head_model (line 307) | def test_object_detection_head_model(self): method test_inputs_embeds (line 312) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 316) | def test_model_get_set_embeddings(self): method test_resize_tokens_embeddings (line 320) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 324) | def test_feed_forward_chunking(self): method test_load_save_without_tied_weights (line 328) | def test_load_save_without_tied_weights(self): method test_tie_weights_is_not_modified (line 332) | def test_tie_weights_is_not_modified(self): method test_attention_outputs (line 336) | def test_attention_outputs(self): method test_hidden_states_output (line 431) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 490) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 520) | def test_forward_signature(self): method test_backbone_selection (line 532) | def test_backbone_selection(self): method test_two_stage_training (line 575) | def test_two_stage_training(self): method test_tied_weights_keys (line 590) | def test_tied_weights_keys(self): function prepare_img (line 627) | def prepare_img(): function prepare_text (line 632) | def prepare_text(): class MMGroundingDinoModelIntegrationTests (line 640) | class MMGroundingDinoModelIntegrationTests(unittest.TestCase): method default_processor (line 642) | def default_processor(self): method test_inference_object_detection_head (line 649) | def test_inference_object_detection_head(self): method test_inference_object_detection_head_equivalence_cpu_gpu (line 705) | def test_inference_object_detection_head_equivalence_cpu_gpu(self): method test_cross_attention_mask (line 753) | def test_cross_attention_mask(self): method test_mm_grounding_dino_loss (line 787) | def test_mm_grounding_dino_loss(self): FILE: tests/models/mobilebert/test_modeling_mobilebert.py class MobileBertModelTester (line 43) | class MobileBertModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self): method get_config (line 117) | def get_config(self): method create_and_check_mobilebert_model (line 134) | def create_and_check_mobilebert_model( method create_and_check_mobilebert_for_masked_lm (line 147) | def create_and_check_mobilebert_for_masked_lm( method create_and_check_mobilebert_for_next_sequence_prediction (line 156) | def create_and_check_mobilebert_for_next_sequence_prediction( method create_and_check_mobilebert_for_pretraining (line 170) | def create_and_check_mobilebert_for_pretraining( method create_and_check_mobilebert_for_question_answering (line 186) | def create_and_check_mobilebert_for_question_answering( method create_and_check_mobilebert_for_sequence_classification (line 202) | def create_and_check_mobilebert_for_sequence_classification( method create_and_check_mobilebert_for_token_classification (line 212) | def create_and_check_mobilebert_for_token_classification( method create_and_check_mobilebert_for_multiple_choice (line 222) | def create_and_check_mobilebert_for_multiple_choice( method prepare_config_and_inputs_for_common (line 240) | def prepare_config_and_inputs_for_common(self): class MobileBertModelTest (line 256) | class MobileBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method _prepare_for_class (line 284) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_resize_tokens_embeddings (line 299) | def test_resize_tokens_embeddings(self): method setUp (line 302) | def setUp(self): method test_config (line 306) | def test_config(self): method test_mobilebert_model (line 309) | def test_mobilebert_model(self): method test_for_masked_lm (line 313) | def test_for_masked_lm(self): method test_for_multiple_choice (line 317) | def test_for_multiple_choice(self): method test_for_next_sequence_prediction (line 321) | def test_for_next_sequence_prediction(self): method test_for_pretraining (line 325) | def test_for_pretraining(self): method test_for_question_answering (line 329) | def test_for_question_answering(self): method test_for_sequence_classification (line 333) | def test_for_sequence_classification(self): method test_for_token_classification (line 337) | def test_for_token_classification(self): function _long_tensor (line 342) | def _long_tensor(tok_lst): class MobileBertModelIntegrationTests (line 356) | class MobileBertModelIntegrationTests(unittest.TestCase): method test_inference_no_head (line 358) | def test_inference_no_head(self): FILE: tests/models/mobilenet_v1/test_image_processing_mobilenet_v1.py class MobileNetV1ImageProcessingTester (line 23) | class MobileNetV1ImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 50) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 58) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 61) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class MobileNetV1ImageProcessingTest (line 75) | class MobileNetV1ImageProcessingTest(ImageProcessingTestMixin, unittest.... method setUp (line 76) | def setUp(self): method image_processor_dict (line 81) | def image_processor_dict(self): method test_image_processor_properties (line 84) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 92) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/mobilenet_v1/test_modeling_mobilenet_v1.py class MobileNetV1ConfigTester (line 40) | class MobileNetV1ConfigTester(ConfigTester): method create_and_test_config_common_properties (line 41) | def create_and_test_config_common_properties(self): class MobileNetV1ModelTester (line 47) | class MobileNetV1ModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs(self): method get_config (line 97) | def get_config(self): method create_and_check_model (line 109) | def create_and_check_model(self, config, pixel_values, labels, pixel_l... method create_and_check_for_image_classification (line 124) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 132) | def prepare_config_and_inputs_for_common(self): class MobileNetV1ModelTest (line 140) | class MobileNetV1ModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 156) | def setUp(self): method test_config (line 160) | def test_config(self): method test_inputs_embeds (line 164) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 168) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 172) | def test_attention_outputs(self): method test_model (line 175) | def test_model(self): method test_hidden_states_output (line 179) | def test_hidden_states_output(self): method test_for_image_classification (line 205) | def test_for_image_classification(self): method test_model_from_pretrained (line 210) | def test_model_from_pretrained(self): function prepare_img (line 217) | def prepare_img(): class MobileNetV1ModelIntegrationTest (line 224) | class MobileNetV1ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 226) | def default_image_processor(self): method test_inference_image_classification_head (line 234) | def test_inference_image_classification_head(self): FILE: tests/models/mobilenet_v2/test_image_processing_mobilenet_v2.py class MobileNetV2ImageProcessingTester (line 32) | class MobileNetV2ImageProcessingTester: method __init__ (line 33) | def __init__( method prepare_image_processor_dict (line 61) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 85) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 91) | def prepare_semantic_batch_inputs(): class MobileNetV2ImageProcessingTest (line 98) | class MobileNetV2ImageProcessingTest(ImageProcessingTestMixin, unittest.... method setUp (line 99) | def setUp(self): method image_processor_dict (line 104) | def image_processor_dict(self): method test_image_processor_properties (line 107) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 116) | def test_image_processor_from_dict_with_kwargs(self): method test_call_segmentation_maps (line 130) | def test_call_segmentation_maps(self): method test_reduce_labels (line 237) | def test_reduce_labels(self): method test_backends_equivalence (line 257) | def test_backends_equivalence(self): FILE: tests/models/mobilenet_v2/test_modeling_mobilenet_v2.py class MobileNetV2ConfigTester (line 40) | class MobileNetV2ConfigTester(ConfigTester): method create_and_test_config_common_properties (line 41) | def create_and_test_config_common_properties(self): class MobileNetV2ModelTester (line 47) | class MobileNetV2ModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 105) | def get_config(self): method create_and_check_model (line 122) | def create_and_check_model(self, config, pixel_values, labels, pixel_l... method create_and_check_for_image_classification (line 141) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_for_semantic_segmentation (line 149) | def create_and_check_for_semantic_segmentation(self, config, pixel_val... method prepare_config_and_inputs_for_common (line 175) | def prepare_config_and_inputs_for_common(self): class MobileNetV2ModelTest (line 183) | class MobileNetV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 207) | def setUp(self): method test_config (line 211) | def test_config(self): method test_inputs_embeds (line 215) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 219) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 223) | def test_attention_outputs(self): method test_model (line 226) | def test_model(self): method test_hidden_states_output (line 230) | def test_hidden_states_output(self): method test_for_image_classification (line 256) | def test_for_image_classification(self): method test_for_semantic_segmentation (line 260) | def test_for_semantic_segmentation(self): method test_model_from_pretrained (line 265) | def test_model_from_pretrained(self): function prepare_img (line 272) | def prepare_img(): class MobileNetV2ModelIntegrationTest (line 279) | class MobileNetV2ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 281) | def default_image_processor(self): method test_inference_image_classification_head (line 289) | def test_inference_image_classification_head(self): method test_inference_semantic_segmentation (line 315) | def test_inference_semantic_segmentation(self): FILE: tests/models/mobilevit/test_image_processing_mobilevit.py class MobileViTImageProcessingTester (line 32) | class MobileViTImageProcessingTester: method __init__ (line 33) | def __init__( method prepare_image_processor_dict (line 63) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 73) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 76) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 88) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 94) | def prepare_semantic_batch_inputs(): class MobileViTImageProcessingTest (line 101) | class MobileViTImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 102) | def setUp(self): method image_processor_dict (line 107) | def image_processor_dict(self): method test_image_processor_properties (line 110) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 120) | def test_image_processor_from_dict_with_kwargs(self): method test_call_segmentation_maps (line 134) | def test_call_segmentation_maps(self): method test_reduce_labels (line 241) | def test_reduce_labels(self): method test_backends_equivalence (line 264) | def test_backends_equivalence(self): FILE: tests/models/mobilevit/test_modeling_mobilevit.py class MobileViTConfigTester (line 40) | class MobileViTConfigTester(ConfigTester): method create_and_test_config_common_properties (line 41) | def create_and_test_config_common_properties(self): class MobileViTModelTester (line 48) | class MobileViTModelTester: method __init__ (line 49) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 102) | def get_config(self): method create_and_check_model (line 119) | def create_and_check_model(self, config, pixel_values, labels, pixel_l... method create_and_check_for_image_classification (line 134) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_for_semantic_segmentation (line 142) | def create_and_check_for_semantic_segmentation(self, config, pixel_val... method prepare_config_and_inputs_for_common (line 168) | def prepare_config_and_inputs_for_common(self): class MobileViTModelTest (line 176) | class MobileViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method setUp (line 200) | def setUp(self): method test_config (line 204) | def test_config(self): method test_inputs_embeds (line 208) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 212) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 216) | def test_attention_outputs(self): method test_model (line 219) | def test_model(self): method test_hidden_states_output (line 223) | def test_hidden_states_output(self): method test_for_image_classification (line 261) | def test_for_image_classification(self): method test_for_semantic_segmentation (line 265) | def test_for_semantic_segmentation(self): method test_model_from_pretrained (line 270) | def test_model_from_pretrained(self): function prepare_img (line 277) | def prepare_img(): class MobileViTModelIntegrationTest (line 284) | class MobileViTModelIntegrationTest(unittest.TestCase): method default_image_processor (line 286) | def default_image_processor(self): method test_inference_image_classification_head (line 292) | def test_inference_image_classification_head(self): method test_inference_semantic_segmentation (line 318) | def test_inference_semantic_segmentation(self): method test_post_processing_semantic_segmentation (line 355) | def test_post_processing_semantic_segmentation(self): FILE: tests/models/mobilevitv2/test_modeling_mobilevitv2.py class MobileViTV2ConfigTester (line 50) | class MobileViTV2ConfigTester(ConfigTester): method create_and_test_config_common_properties (line 51) | def create_and_test_config_common_properties(self): class MobileViTV2ModelTester (line 56) | class MobileViTV2ModelTester: method __init__ (line 57) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 109) | def get_config(self): method create_and_check_model (line 127) | def create_and_check_model(self, config, pixel_values, labels, pixel_l... method create_and_check_for_image_classification (line 142) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_for_semantic_segmentation (line 150) | def create_and_check_for_semantic_segmentation(self, config, pixel_val... method prepare_config_and_inputs_for_common (line 176) | def prepare_config_and_inputs_for_common(self): class MobileViTV2ModelTest (line 184) | class MobileViTV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 209) | def setUp(self): method test_config (line 213) | def test_config(self): method test_inputs_embeds (line 217) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 221) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 225) | def test_attention_outputs(self): method test_multi_gpu_data_parallel_forward (line 230) | def test_multi_gpu_data_parallel_forward(self): method test_model (line 233) | def test_model(self): method test_hidden_states_output (line 237) | def test_hidden_states_output(self): method test_for_image_classification (line 275) | def test_for_image_classification(self): method test_for_semantic_segmentation (line 279) | def test_for_semantic_segmentation(self): method test_model_from_pretrained (line 284) | def test_model_from_pretrained(self): function prepare_img (line 291) | def prepare_img(): class MobileViTV2ModelIntegrationTest (line 298) | class MobileViTV2ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 300) | def default_image_processor(self): method test_inference_image_classification_head (line 308) | def test_inference_image_classification_head(self): method test_inference_semantic_segmentation (line 336) | def test_inference_semantic_segmentation(self): method test_post_processing_semantic_segmentation (line 373) | def test_post_processing_semantic_segmentation(self): FILE: tests/models/modernbert/test_modeling_modernbert.py class ModernBertModelTester (line 49) | class ModernBertModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 102) | def prepare_config_and_inputs(self): method get_config (line 121) | def get_config(self): method create_and_check_model (line 155) | def create_and_check_model(self, config, input_ids, input_mask, sequen... method create_and_check_for_masked_lm (line 164) | def create_and_check_for_masked_lm( method create_and_check_for_sequence_classification (line 173) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 183) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 193) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 209) | def prepare_config_and_inputs_for_common(self): class ModernBertModelTest (line 224) | class ModernBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method _prepare_for_class (line 252) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 268) | def setUp(self): method test_config (line 272) | def test_config(self): method test_model (line 275) | def test_model(self): method test_for_masked_lm (line 279) | def test_for_masked_lm(self): method test_for_sequence_classification (line 283) | def test_for_sequence_classification(self): method test_for_token_classification (line 287) | def test_for_token_classification(self): method test_for_multiple_choice (line 291) | def test_for_multiple_choice(self): method test_model_from_pretrained (line 296) | def test_model_from_pretrained(self): class ModernBertModelIntegrationTest (line 303) | class ModernBertModelIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 305) | def test_inference_masked_lm(self): method test_inference_no_head (line 322) | def test_inference_no_head(self): method test_inference_token_classification (line 339) | def test_inference_token_classification(self): method test_inference_sequence_classification (line 358) | def test_inference_sequence_classification(self): method test_inference_multiple_choice (line 377) | def test_inference_multiple_choice(self): method test_inference_masked_lm_flash_attention_2 (line 412) | def test_inference_masked_lm_flash_attention_2(self): FILE: tests/models/modernbert_decoder/test_modeling_modernbert_decoder.py class ModernBertDecoderModelTester (line 36) | class ModernBertDecoderModelTester(CausalLMModelTester): class ModernBertDecoderModelTest (line 42) | class ModernBertDecoderModelTest(CausalLMModelTest, unittest.TestCase): method test_model_rope_scaling_frequencies (line 45) | def test_model_rope_scaling_frequencies(self): class ModernBertDecoderIntegrationTest (line 139) | class ModernBertDecoderIntegrationTest(unittest.TestCase): method test_inference_causal_lm (line 140) | def test_inference_causal_lm(self): method test_inference_no_head (line 156) | def test_inference_no_head(self): method test_generation (line 172) | def test_generation(self): method test_sliding_window_long_context (line 184) | def test_sliding_window_long_context(self): method test_sequence_classification (line 202) | def test_sequence_classification(self): FILE: tests/models/modernvbert/test_modeling_modernvbert.py class ModernVBertModelTester (line 61) | class ModernVBertModelTester: method __init__ (line 62) | def __init__( method get_config (line 129) | def get_config(self): method prepare_config_and_inputs (line 140) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 166) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 177) | def create_and_check_model(self, config, input_ids, input_mask, pixel_... method create_and_check_for_masked_lm (line 191) | def create_and_check_for_masked_lm( method create_and_check_for_sequence_classification (line 207) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 224) | def create_and_check_for_token_classification( class ModernVBertModelTest (line 243) | class ModernVBertModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 276) | def setUp(self): method test_config (line 285) | def test_config(self): method test_model (line 288) | def test_model(self): method test_for_masked_lm (line 292) | def test_for_masked_lm(self): method test_for_sequence_classification (line 296) | def test_for_sequence_classification(self): method test_for_token_classification (line 300) | def test_for_token_classification(self): method test_resize_tokens_embeddings (line 305) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 386) | def test_resize_embeddings_untied(self): method test_multi_gpu_data_parallel_forward (line 433) | def test_multi_gpu_data_parallel_forward(self): method test_training_gradient_checkpointing (line 437) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 441) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 445) | def test_training_gradient_checkpointing_use_reentrant_true(self): class ModernVBertForMaskedLMIntegrationTest (line 450) | class ModernVBertForMaskedLMIntegrationTest(unittest.TestCase): method setUp (line 453) | def setUp(self): method tearDown (line 463) | def tearDown(self): method test_masked_lm_inference (line 467) | def test_masked_lm_inference(self): FILE: tests/models/moonshine/test_modeling_moonshine.py class MoonshineModelTester (line 43) | class MoonshineModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 82) | def prepare_config_and_inputs(self): method get_config (line 93) | def get_config(self): method check_output_attentions (line 111) | def check_output_attentions(self, config, input_values, attention_mask): method prepare_config_and_inputs_for_common (line 120) | def prepare_config_and_inputs_for_common(self): class MoonshineModelTest (line 134) | class MoonshineModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method setUp (line 147) | def setUp(self): method test_config (line 151) | def test_config(self): method test_attention_outputs (line 154) | def test_attention_outputs(self): method test_hidden_states_output (line 251) | def test_hidden_states_output(self): method test_inputs_embeds (line 305) | def test_inputs_embeds(self): method test_resize_tokens_embeddings (line 325) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 374) | def test_resize_embeddings_untied(self): class MoonshineModelIntegrationTests (line 426) | class MoonshineModelIntegrationTests(unittest.TestCase): method setUp (line 427) | def setUp(self): method tearDown (line 431) | def tearDown(self): method _load_datasamples (line 434) | def _load_datasamples(self, num_samples): method test_tiny_logits_single (line 442) | def test_tiny_logits_single(self): method test_base_logits_single (line 462) | def test_base_logits_single(self): method test_tiny_logits_batch (line 480) | def test_tiny_logits_batch(self): method test_base_logits_batch (line 500) | def test_base_logits_batch(self): method test_tiny_generation_single (line 521) | def test_tiny_generation_single(self): method test_base_generation_single (line 535) | def test_base_generation_single(self): method test_tiny_generation_batch (line 549) | def test_tiny_generation_batch(self): method test_base_generation_batch (line 571) | def test_base_generation_batch(self): FILE: tests/models/moonshine_streaming/test_modeling_moonshine_streaming.py class MoonshineStreamingModelTester (line 43) | class MoonshineStreamingModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 80) | def prepare_config_and_inputs(self): method get_config (line 91) | def get_config(self): method check_output_attentions (line 115) | def check_output_attentions(self, config, input_values, attention_mask): method prepare_config_and_inputs_for_common (line 123) | def prepare_config_and_inputs_for_common(self): class MoonshineStreamingModelTest (line 137) | class MoonshineStreamingModelTest(ModelTesterMixin, PipelineTesterMixin,... method setUp (line 152) | def setUp(self): method test_config (line 156) | def test_config(self): method test_can_init_all_missing_weights (line 159) | def test_can_init_all_missing_weights(self): method test_init_weights_can_init_buffers (line 162) | def test_init_weights_can_init_buffers(self): method test_attention_outputs (line 169) | def test_attention_outputs(self): method test_hidden_states_output (line 266) | def test_hidden_states_output(self): method test_inputs_embeds (line 321) | def test_inputs_embeds(self): method test_resize_tokens_embeddings (line 341) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 390) | def test_resize_embeddings_untied(self): class MoonshineStreamingModelIntegrationTests (line 442) | class MoonshineStreamingModelIntegrationTests(unittest.TestCase): method setUp (line 443) | def setUp(self): method tearDown (line 448) | def tearDown(self): method _load_datasamples (line 451) | def _load_datasamples(self, num_samples): method test_tiny_logits_single (line 459) | def test_tiny_logits_single(self): method test_small_logits_single (line 480) | def test_small_logits_single(self): method test_medium_logits_single (line 501) | def test_medium_logits_single(self): method test_tiny_logits_batch (line 522) | def test_tiny_logits_batch(self): method test_small_logits_batch (line 542) | def test_small_logits_batch(self): method test_medium_logits_batch (line 575) | def test_medium_logits_batch(self): method test_tiny_generation_single (line 608) | def test_tiny_generation_single(self): method test_small_generation_single (line 622) | def test_small_generation_single(self): method test_medium_generation_single (line 636) | def test_medium_generation_single(self): method test_tiny_generation_batch (line 650) | def test_tiny_generation_batch(self): method test_small_generation_batch (line 672) | def test_small_generation_batch(self): method test_medium_generation_batch (line 694) | def test_medium_generation_batch(self): FILE: tests/models/moshi/test_modeling_moshi.py function _config_zero_init (line 69) | def _config_zero_init(config): class MoshiDecoderTester (line 80) | class MoshiDecoderTester: method __init__ (line 81) | def __init__( method prepare_config_and_inputs (line 123) | def prepare_config_and_inputs(self, batch_size=None): method get_config (line 133) | def get_config(self): method prepare_config_and_inputs_for_common (line 150) | def prepare_config_and_inputs_for_common(self, batch_size=None): class MoshiDecoderTest (line 156) | class MoshiDecoderTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 169) | def setUp(self): method test_sdpa_can_compile_dynamic (line 180) | def test_sdpa_can_compile_dynamic(self): method _get_input_ids_and_config (line 183) | def _get_input_ids_and_config(self, batch_size=1): method _get_logits_processor_kwargs (line 190) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method test_eager_matches_sdpa_inference (line 195) | def test_eager_matches_sdpa_inference( method test_resize_tokens_embeddings (line 204) | def test_resize_tokens_embeddings(self): method test_cpu_offload (line 353) | def test_cpu_offload(self): method test_disk_offload_bin (line 357) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 361) | def test_disk_offload_safetensors(self): method test_generate_continue_from_inputs_embeds (line 365) | def test_generate_continue_from_inputs_embeds(self): method test_save_load (line 369) | def test_save_load(self): class MoshiTester (line 373) | class MoshiTester: method __init__ (line 374) | def __init__( method prepare_config_and_inputs (line 461) | def prepare_config_and_inputs(self, batch_size=None): method get_config (line 479) | def get_config(self): method prepare_config_and_inputs_for_common (line 526) | def prepare_config_and_inputs_for_common(self, batch_size=None): class MoshiTest (line 532) | class MoshiTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCa... method setUp (line 537) | def setUp(self): method _prepare_for_class (line 541) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method _get_input_ids_and_config (line 552) | def _get_input_ids_and_config(self, batch_size=2): method prepare_config_and_inputs_for_generate (line 566) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method _check_generate_outputs (line 578) | def _check_generate_outputs(self, output, config, use_cache=False, num... method test_generate_continue_from_past_key_values (line 585) | def test_generate_continue_from_past_key_values(self): method test_eager_matches_sdpa_inference (line 590) | def test_eager_matches_sdpa_inference( method test_sdpa_can_compile_dynamic (line 597) | def test_sdpa_can_compile_dynamic(self): method test_left_padding_compatibility (line 601) | def test_left_padding_compatibility(self): method test_eager_matches_sdpa_generate (line 629) | def test_eager_matches_sdpa_generate(self): method test_generate_without_input_ids (line 703) | def test_generate_without_input_ids(self): method test_training_gradient_checkpointing (line 717) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 721) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 725) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_generate_from_input_values (line 728) | def test_generate_from_input_values(self): method test_generate_depth_decoder_kwargs (line 757) | def test_generate_depth_decoder_kwargs(self): method test_generate_from_unconditional (line 770) | def test_generate_from_unconditional(self): method test_sdpa_can_dispatch_on_flash (line 794) | def test_sdpa_can_dispatch_on_flash(self): method test_cpu_offload (line 798) | def test_cpu_offload(self): method test_disk_offload_bin (line 802) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 806) | def test_disk_offload_safetensors(self): method test_generate_continue_from_inputs_embeds (line 810) | def test_generate_continue_from_inputs_embeds(self): method test_save_load (line 814) | def test_save_load(self): method test_prepare_inputs_for_generation_kwargs_forwards (line 819) | def test_prepare_inputs_for_generation_kwargs_forwards(self): method test_model_base_model_prefix (line 826) | def test_model_base_model_prefix(self): function place_dict_on_device (line 830) | def place_dict_on_device(dict_to_place, device): class MoshiIntegrationTests (line 838) | class MoshiIntegrationTests(unittest.TestCase): method feature_extractor (line 840) | def feature_extractor(self): method tokenizer (line 844) | def tokenizer(self): method _load_datasample (line 847) | def _load_datasample(self): method test_moshika_conditional_greedy (line 855) | def test_moshika_conditional_greedy(self): method test_moshiko_greedy_unconditional_fp16_eager (line 900) | def test_moshiko_greedy_unconditional_fp16_eager(self): method test_moshiko_greedy_unconditional_fp32 (line 914) | def test_moshiko_greedy_unconditional_fp32(self): method test_moshiko_greedy_unconditional_fp16 (line 936) | def test_moshiko_greedy_unconditional_fp16(self): method test_moshika_greedy_unconditional_fp16 (line 958) | def test_moshika_greedy_unconditional_fp16(self): FILE: tests/models/moshi/test_tokenization_moshi.py class MoshiTokenizationTest (line 41) | class MoshiTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 50) | def setUpClass(cls): method get_rust_tokenizer (line 63) | def get_rust_tokenizer(cls, pretrained_name=None, **kwargs) -> PreTrai... method test_added_tokens_serialization (line 68) | def test_added_tokens_serialization(self): method test_rust_tokenizer_signature (line 72) | def test_rust_tokenizer_signature(self): method test_encode_decode_with_spaces (line 76) | def test_encode_decode_with_spaces(self): method test_full_tokenizer (line 79) | def test_full_tokenizer(self): method test_special_tokens_initialization (line 156) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 170) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 203) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_alignment_methods (line 298) | def test_alignment_methods(self): method test_added_tokens_do_lower_case (line 302) | def test_added_tokens_do_lower_case(self): class MoshiIntegrationTest (line 310) | class MoshiIntegrationTest(unittest.TestCase): method setUpClass (line 312) | def setUpClass(cls): method integration_tests (line 318) | def integration_tests(self): method test_fast_special_tokens (line 339) | def test_fast_special_tokens(self): method test_simple_encode_decode (line 352) | def test_simple_encode_decode(self): method test_no_differences_decode (line 384) | def test_no_differences_decode(self): class CommonSpmIntegrationTests (line 394) | class CommonSpmIntegrationTests(unittest.TestCase): method test_edge_case_tabulation (line 399) | def test_edge_case_tabulation(self): FILE: tests/models/mpnet/test_modeling_mpnet.py class MPNetModelTester (line 39) | class MPNetModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 106) | def get_config(self): method create_and_check_mpnet_model (line 120) | def create_and_check_mpnet_model( method create_and_check_mpnet_for_question_answering (line 131) | def create_and_check_mpnet_for_question_answering( method create_and_check_mpnet_for_sequence_classification (line 146) | def create_and_check_mpnet_for_sequence_classification( method create_and_check_mpnet_for_multiple_choice (line 156) | def create_and_check_mpnet_for_multiple_choice( method create_and_check_mpnet_for_token_classification (line 172) | def create_and_check_mpnet_for_token_classification( method prepare_config_and_inputs_for_common (line 182) | def prepare_config_and_inputs_for_common(self): class MPNetModelTest (line 190) | class MPNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 217) | def setUp(self): method test_config (line 221) | def test_config(self): method test_mpnet_model (line 224) | def test_mpnet_model(self): method test_for_sequence_classification (line 228) | def test_for_sequence_classification(self): method test_for_multiple_choice (line 232) | def test_for_multiple_choice(self): method test_for_token_classification (line 236) | def test_for_token_classification(self): method test_for_question_answering (line 240) | def test_for_question_answering(self): class MPNetModelIntegrationTest (line 246) | class MPNetModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 248) | def test_inference_no_head(self): FILE: tests/models/mpnet/test_tokenization_mpnet.py class MPNetTokenizerTest (line 25) | class MPNetTokenizerTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/mpt/test_modeling_mpt.py class MptModelTester (line 50) | class MptModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self, gradient_checkpointing=False): method get_config (line 118) | def get_config(self, gradient_checkpointing=False): method create_and_check_mpt_model (line 139) | def create_and_check_mpt_model(self, config, input_ids, input_mask, *a... method create_and_check_mpt_model_past (line 149) | def create_and_check_mpt_model_past(self, config, input_ids, input_mas... method create_and_check_mpt_model_attention_mask_past (line 182) | def create_and_check_mpt_model_attention_mask_past(self, config, input... method create_and_check_mpt_model_past_large_inputs (line 222) | def create_and_check_mpt_model_past_large_inputs(self, config, input_i... method create_and_check_lm_head_model (line 268) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method create_and_check_sequence_classification_model (line 277) | def create_and_check_sequence_classification_model(self, config, input... method create_and_check_token_classification_model (line 286) | def create_and_check_token_classification_model(self, config, input_id... method create_and_check_forward_and_backwards (line 294) | def create_and_check_forward_and_backwards( method create_and_check_mpt_weight_initialization (line 307) | def create_and_check_mpt_weight_initialization(self, config, *args): method prepare_config_and_inputs_for_common (line 315) | def prepare_config_and_inputs_for_common(self): class MptConfigTester (line 325) | class MptConfigTester(ConfigTester): method __init__ (line 326) | def __init__(self, parent, config_class=None, has_text_modality=True, ... method test_attn_config_as_dict (line 329) | def test_attn_config_as_dict(self): method run_common_tests (line 334) | def run_common_tests(self): class MptModelTest (line 340) | class MptModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method setUp (line 367) | def setUp(self): method test_config (line 371) | def test_config(self): method test_mpt_model (line 374) | def test_mpt_model(self): method test_mpt_model_alibi_tensor (line 378) | def test_mpt_model_alibi_tensor(self): method test_mpt_model_past (line 384) | def test_mpt_model_past(self): method test_mpt_model_att_mask_past (line 388) | def test_mpt_model_att_mask_past(self): method test_mpt_model_past_large_inputs (line 392) | def test_mpt_model_past_large_inputs(self): method test_mpt_lm_head_model (line 396) | def test_mpt_lm_head_model(self): method test_mpt_sequence_classification_model (line 400) | def test_mpt_sequence_classification_model(self): method test_mpt_token_classification_model (line 404) | def test_mpt_token_classification_model(self): method test_mpt_gradient_checkpointing (line 408) | def test_mpt_gradient_checkpointing(self): method test_mpt_weight_initialization (line 412) | def test_mpt_weight_initialization(self): method test_model_weights_reload_no_missing_tied_weights (line 417) | def test_model_weights_reload_no_missing_tied_weights(self): method test_model_from_pretrained (line 421) | def test_model_from_pretrained(self): class MptIntegrationTests (line 430) | class MptIntegrationTests(unittest.TestCase): method test_generation_8k (line 431) | def test_generation_8k(self): method test_generation (line 457) | def test_generation(self): method test_generation_batched (line 485) | def test_generation_batched(self): method test_model_logits (line 531) | def test_model_logits(self): FILE: tests/models/mra/test_modeling_mra.py class MraModelTester (line 41) | class MraModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 91) | def prepare_config_and_inputs(self): method get_config (line 114) | def get_config(self): method get_pipeline_config (line 130) | def get_pipeline_config(self): method prepare_config_and_inputs_for_decoder (line 135) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 162) | def create_and_check_model( method create_and_check_for_masked_lm (line 173) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 182) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 198) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 208) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 218) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 236) | def prepare_config_and_inputs_for_common(self): class MraModelTest (line 252) | class MraModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 281) | def setUp(self): method test_config (line 285) | def test_config(self): method test_model (line 288) | def test_model(self): method test_for_masked_lm (line 292) | def test_for_masked_lm(self): method test_for_multiple_choice (line 296) | def test_for_multiple_choice(self): method test_for_question_answering (line 300) | def test_for_question_answering(self): method test_for_sequence_classification (line 304) | def test_for_sequence_classification(self): method test_for_token_classification (line 308) | def test_for_token_classification(self): method test_model_from_pretrained (line 313) | def test_model_from_pretrained(self): method test_attention_outputs (line 319) | def test_attention_outputs(self): method test_training_gradient_checkpointing (line 323) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 327) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 331) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_batching_equivalence (line 337) | def test_batching_equivalence(self): class MraModelIntegrationTest (line 342) | class MraModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 344) | def test_inference_no_head(self): method test_inference_masked_lm (line 361) | def test_inference_masked_lm(self): method test_inference_masked_lm_long_input (line 380) | def test_inference_masked_lm_long_input(self): FILE: tests/models/mt5/test_modeling_mt5.py class MT5ModelTester (line 49) | class MT5ModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_pipeline_config (line 123) | def get_pipeline_config(self): method get_config (line 141) | def get_config(self): method check_prepare_lm_labels_via_shift_left (line 159) | def check_prepare_lm_labels_via_shift_left( method create_and_check_model (line 198) | def create_and_check_model( method create_and_check_with_lm_head (line 226) | def create_and_check_with_lm_head( method create_and_check_with_sequence_classification_head (line 246) | def create_and_check_with_sequence_classification_head( method create_and_check_decoder_model_past (line 266) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 303) | def create_and_check_decoder_model_attention_mask_past( method create_and_check_decoder_model_past_large_inputs (line 354) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_generate_with_past_key_values (line 392) | def create_and_check_generate_with_past_key_values( method create_and_check_model_fp16_forward (line 410) | def create_and_check_model_fp16_forward( method prepare_config_and_inputs_for_common (line 423) | def prepare_config_and_inputs_for_common(self): class MT5ModelTest (line 444) | class MT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method setUp (line 465) | def setUp(self): method is_pipeline_test_to_skip (line 471) | def is_pipeline_test_to_skip( method test_custom_4d_attention_mask (line 489) | def test_custom_4d_attention_mask(self): method test_config (line 523) | def test_config(self): method test_tie_word_embeddings (line 526) | def test_tie_word_embeddings(self): method test_shift_right (line 531) | def test_shift_right(self): method test_model (line 535) | def test_model(self): method test_inputs_embeds (line 542) | def test_inputs_embeds(self): method test_config_and_model_silu_gated (line 571) | def test_config_and_model_silu_gated(self): method test_with_lm_head (line 577) | def test_with_lm_head(self): method test_with_sequence_classification_head (line 581) | def test_with_sequence_classification_head(self): method test_decoder_model_past (line 585) | def test_decoder_model_past(self): method test_decoder_model_past_with_attn_mask (line 589) | def test_decoder_model_past_with_attn_mask(self): method test_decoder_model_past_with_3d_attn_mask (line 593) | def test_decoder_model_past_with_3d_attn_mask(self): method test_decoder_model_past_with_large_inputs (line 621) | def test_decoder_model_past_with_large_inputs(self): method test_generate_with_past_key_values (line 625) | def test_generate_with_past_key_values(self): method test_model_fp16_forward (line 630) | def test_model_fp16_forward(self): method test_model_from_pretrained (line 635) | def test_model_from_pretrained(self): method test_model_base_model_prefix (line 641) | def test_model_base_model_prefix(self): class MT5EncoderOnlyModelTester (line 646) | class MT5EncoderOnlyModelTester: method __init__ (line 647) | def __init__( method prepare_config_and_inputs (line 688) | def prepare_config_and_inputs(self): method create_and_check_model (line 717) | def create_and_check_model( method create_and_check_model_fp16_forward (line 735) | def create_and_check_model_fp16_forward( method create_and_check_with_token_classification_head (line 745) | def create_and_check_with_token_classification_head( method prepare_config_and_inputs_for_common (line 761) | def prepare_config_and_inputs_for_common(self): class MT5EncoderOnlyModelTest (line 777) | class MT5EncoderOnlyModelTest(ModelTesterMixin, PipelineTesterMixin, uni... method setUp (line 789) | def setUp(self): method test_config (line 793) | def test_config(self): method test_model (line 796) | def test_model(self): method test_model_fp16_forward (line 801) | def test_model_fp16_forward(self): method test_with_token_classification_head (line 805) | def test_with_token_classification_head(self): method is_pipeline_test_to_skip (line 809) | def is_pipeline_test_to_skip( class MT5IntegrationTest (line 833) | class MT5IntegrationTest(unittest.TestCase): method test_small_integration_test (line 835) | def test_small_integration_test(self): FILE: tests/models/musicflamingo/test_modeling_musicflamingo.py class MusicFlamingoModelTester (line 47) | class MusicFlamingoModelTester: method __init__ (line 53) | def __init__( method get_config (line 108) | def get_config(self): method prepare_config_and_inputs (line 116) | def prepare_config_and_inputs(self): method _post_pool_tokens_per_window (line 126) | def _post_pool_tokens_per_window(self, T_mel): method prepare_config_and_inputs_for_common (line 132) | def prepare_config_and_inputs_for_common(self): class MusicFlamingoForConditionalGenerationModelTest (line 155) | class MusicFlamingoForConditionalGenerationModelTest(ModelTesterMixin, G... method setUp (line 171) | def setUp(self): method test_rotary_window_axis_resets_per_audio (line 175) | def test_rotary_window_axis_resets_per_audio(self): method test_build_audio_timestamps_reconstructs_windows_from_input_ids (line 197) | def test_build_audio_timestamps_reconstructs_windows_from_input_ids(se... method test_inputs_embeds_matches_input_ids (line 231) | def test_inputs_embeds_matches_input_ids(self): method test_sdpa_can_compile_dynamic (line 236) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 240) | def test_sdpa_can_dispatch_on_flash(self): method test_flash_attn_2_inference_equivalence_right_padding (line 244) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_model_base_model_prefix (line 248) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 251) | def test_sdpa_can_dispatch_composite_models(self): class MusicFlamingoForConditionalGenerationIntegrationTest (line 291) | class MusicFlamingoForConditionalGenerationIntegrationTest(unittest.Test... method setUp (line 297) | def setUp(cls): method tearDown (line 303) | def tearDown(self): method test_fixture_single_matches (line 307) | def test_fixture_single_matches(self): method test_fixture_batched_matches (line 349) | def test_fixture_batched_matches(self): FILE: tests/models/musicflamingo/test_processing_musicflamingo.py class MusicFlamingoProcessorTest (line 33) | class MusicFlamingoProcessorTest(ProcessorTesterMixin, unittest.TestCase): method setUpClass (line 39) | def setUpClass(cls): method get_tokenizer (line 48) | def get_tokenizer(self, **kwargs): method get_audio_processor (line 53) | def get_audio_processor(self, **kwargs): method get_processor (line 58) | def get_processor(self, **kwargs): method tearDownClass (line 62) | def tearDownClass(cls): method test_can_load_various_tokenizers (line 67) | def test_can_load_various_tokenizers(self): method test_save_load_pretrained_default (line 74) | def test_save_load_pretrained_default(self): method test_tokenizer_integration (line 91) | def test_tokenizer_integration(self): method test_chat_template (line 128) | def test_chat_template(self): method test_transcription_helpers_not_supported (line 161) | def test_transcription_helpers_not_supported(self): method test_apply_chat_template_audio (line 169) | def test_apply_chat_template_audio(self, batch_size: int, return_tenso... FILE: tests/models/musicgen/test_modeling_musicgen.py function _config_zero_init (line 64) | def _config_zero_init(config): function prepare_musicgen_decoder_inputs_dict (line 75) | def prepare_musicgen_decoder_inputs_dict( class MusicgenDecoderTester (line 95) | class MusicgenDecoderTester: method __init__ (line 96) | def __init__( method prepare_config_and_inputs (line 134) | def prepare_config_and_inputs(self): method get_config (line 146) | def get_config(self): method prepare_config_and_inputs_for_common (line 162) | def prepare_config_and_inputs_for_common(self): class MusicgenDecoderTest (line 168) | class MusicgenDecoderTest(ModelTesterMixin, GenerationTesterMixin, Pipel... method setUp (line 179) | def setUp(self): method test_config (line 183) | def test_config(self): method _prepare_for_class (line 187) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method check_training_gradient_checkpointing (line 198) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_inputs_embeds (line 226) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 251) | def test_model_get_set_embeddings(self): method test_inputs_embeds_matches_input_ids (line 262) | def test_inputs_embeds_matches_input_ids(self): method test_model_outputs_equivalence (line 266) | def test_model_outputs_equivalence(self): method test_tied_weights_keys (line 270) | def test_tied_weights_keys(self): method _get_logits_processor_kwargs (line 273) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method test_greedy_generate_stereo_outputs (line 277) | def test_greedy_generate_stereo_outputs(self): method test_flash_attn_2_inference_equivalence (line 288) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 368) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_generation_tester_mixin_inheritance (line 448) | def test_generation_tester_mixin_inheritance(self): function prepare_musicgen_inputs_dict (line 452) | def prepare_musicgen_inputs_dict( class MusicgenTester (line 474) | class MusicgenTester: method __init__ (line 475) | def __init__( method prepare_config_and_inputs (line 517) | def prepare_config_and_inputs(self): method get_config (line 525) | def get_config(self): method prepare_config_and_inputs_for_common (line 558) | def prepare_config_and_inputs_for_common(self): class MusicgenTest (line 564) | class MusicgenTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method setUp (line 576) | def setUp(self): method _prepare_for_class (line 580) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method check_training_gradient_checkpointing (line 591) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method _check_output_with_attentions (line 620) | def _check_output_with_attentions(self, outputs, config, input_ids, de... method check_musicgen_model_output_attentions (line 650) | def check_musicgen_model_output_attentions( method check_musicgen_model_output_attentions_from_config (line 675) | def check_musicgen_model_output_attentions_from_config( method test_attention_outputs (line 726) | def test_attention_outputs(self): method test_forward_signature (line 737) | def test_forward_signature(self): method test_gradient_checkpointing_backward_compatibility (line 758) | def test_gradient_checkpointing_backward_compatibility(self): method test_tied_weights_keys (line 772) | def test_tied_weights_keys(self): method test_retain_grad_hidden_states_attentions (line 776) | def test_retain_grad_hidden_states_attentions(self): method test_hidden_states_output (line 826) | def test_hidden_states_output(self): method test_model_get_set_embeddings (line 870) | def test_model_get_set_embeddings(self): method _get_logits_processor_kwargs (line 879) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method test_generate_fp16 (line 885) | def test_generate_fp16(self): method test_greedy_generate_stereo_outputs (line 898) | def test_greedy_generate_stereo_outputs(self): method test_flash_attn_2_conversion (line 908) | def test_flash_attn_2_conversion(self): method test_sdpa_can_dispatch_on_flash (line 913) | def test_sdpa_can_dispatch_on_flash(self): method test_sdpa_can_dispatch_composite_models (line 964) | def test_sdpa_can_dispatch_composite_models(self): method test_requires_grad_with_frozen_encoders (line 998) | def test_requires_grad_with_frozen_encoders(self): method test_generation_tester_mixin_inheritance (line 1025) | def test_generation_tester_mixin_inheritance(self): method test_sdpa_can_compile_dynamic (line 1030) | def test_sdpa_can_compile_dynamic(self): function get_bip_bip (line 1034) | def get_bip_bip(bip_duration=0.125, duration=0.5, sample_rate=32000): function place_dict_on_device (line 1043) | def place_dict_on_device(dict_to_place, device): class MusicgenIntegrationTests (line 1051) | class MusicgenIntegrationTests(unittest.TestCase): method model (line 1053) | def model(self): method processor (line 1057) | def processor(self): method test_logits_text_prompt (line 1061) | def test_logits_text_prompt(self): method test_logits_text_audio_prompt (line 1098) | def test_logits_text_audio_prompt(self): method test_generate_unconditional_greedy (line 1136) | def test_generate_unconditional_greedy(self): method test_generate_unconditional_sampling (line 1158) | def test_generate_unconditional_sampling(self): method test_generate_text_prompt_greedy (line 1182) | def test_generate_text_prompt_greedy(self): method test_generate_text_prompt_greedy_with_classifier_free_guidance (line 1209) | def test_generate_text_prompt_greedy_with_classifier_free_guidance(self): method test_generate_text_prompt_sampling (line 1236) | def test_generate_text_prompt_sampling(self): method test_generate_text_audio_prompt (line 1265) | def test_generate_text_audio_prompt(self): class MusicgenStereoIntegrationTests (line 1293) | class MusicgenStereoIntegrationTests(unittest.TestCase): method model (line 1295) | def model(self): method processor (line 1301) | def processor(self): method test_generate_unconditional_greedy (line 1305) | def test_generate_unconditional_greedy(self): method test_generate_text_audio_prompt (line 1335) | def test_generate_text_audio_prompt(self): FILE: tests/models/musicgen/test_processing_musicgen.py function floats_list (line 36) | def floats_list(shape, scale=1.0, rng=None, name=None): class MusicgenProcessorTest (line 52) | class MusicgenProcessorTest(unittest.TestCase): method setUp (line 53) | def setUp(self): method get_tokenizer (line 57) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 60) | def get_feature_extractor(self, **kwargs): method tearDown (line 63) | def tearDown(self): method test_save_load_pretrained_default (line 66) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 81) | def test_save_load_pretrained_additional_features(self): method test_feature_extractor (line 98) | def test_feature_extractor(self): method test_tokenizer (line 112) | def test_tokenizer(self): method test_tokenizer_decode (line 127) | def test_tokenizer_decode(self): method test_decode_audio (line 140) | def test_decode_audio(self): FILE: tests/models/musicgen_melody/test_feature_extraction_musicgen_melody.py function floats_list (line 45) | def floats_list(shape, scale=1.0, rng=None, name=None): function get_bip_bip (line 60) | def get_bip_bip(bip_duration=0.125, duration=0.5, sample_rate=32000): class MusicgenMelodyFeatureExtractionTester (line 71) | class MusicgenMelodyFeatureExtractionTester: method __init__ (line 72) | def __init__( method prepare_feat_extract_dict (line 94) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 103) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class MusicgenMelodyFeatureExtractionTest (line 122) | class MusicgenMelodyFeatureExtractionTest(SequenceFeatureExtractionTestM... method setUp (line 125) | def setUp(self): method test_feat_extract_from_and_save_pretrained (line 129) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 142) | def test_feat_extract_to_json_file(self): method test_call (line 154) | def test_call(self): method test_call_from_demucs (line 188) | def test_call_from_demucs(self): method test_double_precision_pad (line 206) | def test_double_precision_pad(self): method test_integration (line 219) | def test_integration(self): FILE: tests/models/musicgen_melody/test_modeling_musicgen_melody.py function _config_zero_init (line 69) | def _config_zero_init(config): function prepare_musicgen_melody_decoder_inputs_dict (line 80) | def prepare_musicgen_melody_decoder_inputs_dict( class MusicgenMelodyDecoderTester (line 100) | class MusicgenMelodyDecoderTester: method __init__ (line 101) | def __init__( method prepare_config_and_inputs (line 142) | def prepare_config_and_inputs(self): method get_config (line 154) | def get_config(self): method prepare_config_and_inputs_for_common (line 170) | def prepare_config_and_inputs_for_common(self): class MusicgenMelodyDecoderTest (line 176) | class MusicgenMelodyDecoderTest(ModelTesterMixin, GenerationTesterMixin,... method setUp (line 186) | def setUp(self): method test_config (line 190) | def test_config(self): method _prepare_for_class (line 195) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method check_training_gradient_checkpointing (line 207) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_inputs_embeds (line 235) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 260) | def test_model_get_set_embeddings(self): method test_inputs_embeds_matches_input_ids (line 271) | def test_inputs_embeds_matches_input_ids(self): method test_model_outputs_equivalence (line 275) | def test_model_outputs_equivalence(self): method test_tied_weights_keys (line 279) | def test_tied_weights_keys(self): method _get_logits_processor_kwargs (line 282) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method test_greedy_generate_stereo_outputs (line 286) | def test_greedy_generate_stereo_outputs(self): method test_flash_attn_2_inference_equivalence (line 297) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 379) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_generation_tester_mixin_inheritance (line 461) | def test_generation_tester_mixin_inheritance(self): function prepare_musicgen_melody_inputs_dict (line 465) | def prepare_musicgen_melody_inputs_dict( class MusicgenMelodyTester (line 487) | class MusicgenMelodyTester: method __init__ (line 488) | def __init__( method prepare_config_and_inputs (line 535) | def prepare_config_and_inputs(self): method get_config (line 543) | def get_config(self): method prepare_config_and_inputs_for_common (line 579) | def prepare_config_and_inputs_for_common(self): class MusicgenMelodyTest (line 586) | class MusicgenMelodyTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method setUp (line 598) | def setUp(self): method _prepare_for_class (line 602) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method check_training_gradient_checkpointing (line 613) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method _check_output_with_attentions (line 643) | def _check_output_with_attentions(self, outputs, config, input_ids, de... method check_musicgen_melody_model_output_attentions (line 656) | def check_musicgen_melody_model_output_attentions( method check_musicgen_melody_model_output_attentions_from_config (line 682) | def check_musicgen_melody_model_output_attentions_from_config( method test_attention_outputs (line 729) | def test_attention_outputs(self): method test_forward_signature (line 741) | def test_forward_signature(self): method test_gradient_checkpointing_backward_compatibility (line 761) | def test_gradient_checkpointing_backward_compatibility(self): method test_tied_weights_keys (line 775) | def test_tied_weights_keys(self): method test_retain_grad_hidden_states_attentions (line 780) | def test_retain_grad_hidden_states_attentions(self): method test_hidden_states_output (line 822) | def test_hidden_states_output(self): method test_model_get_set_embeddings (line 872) | def test_model_get_set_embeddings(self): method _get_logits_processor_kwargs (line 881) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method test_generate_fp16 (line 887) | def test_generate_fp16(self): method test_greedy_generate_stereo_outputs (line 900) | def test_greedy_generate_stereo_outputs(self): method test_flash_attn_2_conversion (line 910) | def test_flash_attn_2_conversion(self): method test_sdpa_can_dispatch_on_flash (line 915) | def test_sdpa_can_dispatch_on_flash(self): method test_sdpa_can_dispatch_composite_models (line 966) | def test_sdpa_can_dispatch_composite_models(self): method test_requires_grad_with_frozen_encoders (line 1000) | def test_requires_grad_with_frozen_encoders(self): method test_generation_tester_mixin_inheritance (line 1027) | def test_generation_tester_mixin_inheritance(self): method test_sdpa_can_compile_dynamic (line 1032) | def test_sdpa_can_compile_dynamic(self): function get_bip_bip (line 1037) | def get_bip_bip(bip_duration=0.125, duration=0.5, sample_rate=32000): class MusicgenMelodyIntegrationTests (line 1048) | class MusicgenMelodyIntegrationTests(unittest.TestCase): method model (line 1050) | def model(self): method setUp (line 1053) | def setUp(self): method tearDown (line 1056) | def tearDown(self): method processor (line 1060) | def processor(self): method test_logits_text_prompt (line 1064) | def test_logits_text_prompt(self): method test_logits_text_audio_prompt (line 1106) | def test_logits_text_audio_prompt(self): method test_generate_unconditional_greedy (line 1148) | def test_generate_unconditional_greedy(self): method test_generate_unconditional_sampling (line 1170) | def test_generate_unconditional_sampling(self): method test_generate_text_prompt_greedy (line 1195) | def test_generate_text_prompt_greedy(self): method test_generate_text_prompt_greedy_with_classifier_free_guidance (line 1222) | def test_generate_text_prompt_greedy_with_classifier_free_guidance(self): method test_generate_text_prompt_sampling (line 1250) | def test_generate_text_prompt_sampling(self): method test_generate_text_audio_prompt (line 1285) | def test_generate_text_audio_prompt(self): class MusicgenMelodyStereoIntegrationTests (line 1312) | class MusicgenMelodyStereoIntegrationTests(unittest.TestCase): method model (line 1314) | def model(self): method processor (line 1320) | def processor(self): method test_generate_unconditional_greedy (line 1324) | def test_generate_unconditional_greedy(self): method test_generate_text_audio_prompt (line 1348) | def test_generate_text_audio_prompt(self): FILE: tests/models/musicgen_melody/test_processing_musicgen_melody.py function floats_list (line 36) | def floats_list(shape, scale=1.0, rng=None, name=None): class MusicgenMelodyProcessorTest (line 54) | class MusicgenMelodyProcessorTest(unittest.TestCase): method setUp (line 55) | def setUp(self): method get_tokenizer (line 60) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 63) | def get_feature_extractor(self, **kwargs): method tearDown (line 66) | def tearDown(self): method test_save_load_pretrained_default (line 69) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 84) | def test_save_load_pretrained_additional_features(self): method test_feature_extractor (line 103) | def test_feature_extractor(self): method test_tokenizer (line 117) | def test_tokenizer(self): method test_tokenizer_decode (line 132) | def test_tokenizer_decode(self): method test_decode_audio (line 146) | def test_decode_audio(self): FILE: tests/models/mvp/test_modeling_mvp.py function prepare_mvp_inputs_dict (line 53) | def prepare_mvp_inputs_dict( class MvpModelTester (line 73) | class MvpModelTester: method __init__ (line 74) | def __init__( method prepare_config_and_inputs (line 112) | def prepare_config_and_inputs(self): method get_config (line 125) | def get_config(self): method get_pipeline_config (line 143) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 149) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 153) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 186) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class MvpHeadTests (line 220) | class MvpHeadTests(unittest.TestCase): method _get_config_and_data (line 223) | def _get_config_and_data(self): method test_sequence_classification_forward (line 261) | def test_sequence_classification_forward(self): method test_question_answering_forward (line 272) | def test_question_answering_forward(self): method test_lm_forward (line 288) | def test_lm_forward(self): method test_lm_uneven_forward (line 298) | def test_lm_uneven_forward(self): method test_shift_tokens_right (line 319) | def test_shift_tokens_right(self): method test_tokenization (line 329) | def test_tokenization(self): method test_generate_fp16 (line 341) | def test_generate_fp16(self): method test_dummy_inputs (line 349) | def test_dummy_inputs(self): method test_resize_tokens_embeddings_more (line 354) | def test_resize_tokens_embeddings_more(self): class MvpModelTest (line 372) | class MvpModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method is_pipeline_test_to_skip (line 394) | def is_pipeline_test_to_skip( method setUp (line 416) | def setUp(self): method test_config (line 420) | def test_config(self): method test_save_load_strict (line 423) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 433) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 437) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 442) | def test_inputs_embeds(self): method test_generate_fp16 (line 472) | def test_generate_fp16(self): function assert_tensors_close (line 482) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 501) | def _long_tensor(tok_lst): class MvpModelIntegrationTests (line 508) | class MvpModelIntegrationTests(unittest.TestCase): method default_tokenizer (line 510) | def default_tokenizer(self): method test_inference_no_head (line 514) | def test_inference_no_head(self): method test_summarization_inference (line 528) | def test_summarization_inference(self): class MvpStandaloneDecoderModelTester (line 544) | class MvpStandaloneDecoderModelTester: method __init__ (line 545) | def __init__( method prepare_config_and_inputs (line 600) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_decoder (line 635) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_decoder_model_past (line 655) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 691) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 738) | def prepare_config_and_inputs_for_common(self): class MvpStandaloneDecoderModelTest (line 755) | class MvpStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMi... method setUp (line 759) | def setUp( method test_config (line 765) | def test_config(self): method test_decoder_model_past (line 768) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 772) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 777) | def test_retain_grad_hidden_states_attentions(self): FILE: tests/models/myt5/test_tokenization_myt5.py function bytes_to_hex (line 23) | def bytes_to_hex(bline: bytes, sep: str = " ") -> str: function str_to_hex (line 27) | def str_to_hex(line: str, sep: str = " ") -> str: class TestByteRewriter (line 31) | class TestByteRewriter(unittest.TestCase): method setUpClass (line 33) | def setUpClass(cls) -> None: method test_simple_decompose (line 36) | def test_simple_decompose(self): method test_simple_decompose_reversible (line 48) | def test_simple_decompose_reversible(self): method test_simple_decompose_non_latin (line 61) | def test_simple_decompose_non_latin(self): method test_unrecognized_byte (line 72) | def test_unrecognized_byte(self): class MyT5TokenizationTest (line 83) | class MyT5TokenizationTest(TokenizerTesterMixin, unittest.TestCase): method get_tokenizer (line 88) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> MyT5Tokenizer: method test_pretokenized_inputs (line 92) | def test_pretokenized_inputs(self): method test_convert_tokens_to_string_format (line 95) | def test_convert_tokens_to_string_format(self): method test_simple_tokenize (line 103) | def test_simple_tokenize(self): method test_batch_tokenize (line 121) | def test_batch_tokenize(self): method test_special_bytes (line 136) | def test_special_bytes(self): method test_special_tokens (line 149) | def test_special_tokens(self): method test_token_ids_conversion (line 167) | def test_token_ids_conversion(self): FILE: tests/models/nanochat/test_modeling_nanochat.py class NanoChatModelTester (line 39) | class NanoChatModelTester(CausalLMModelTester): class NanoChatModelTest (line 47) | class NanoChatModelTest(CausalLMModelTest, unittest.TestCase): class NanoChatIntegrationTest (line 52) | class NanoChatIntegrationTest(unittest.TestCase): method setUp (line 55) | def setUp(self): method tearDown (line 58) | def tearDown(self): method test_model_d20_logits (line 62) | def test_model_d20_logits(self): method test_model_d20_generation (line 97) | def test_model_d20_generation(self): method test_model_d32_logits (line 146) | def test_model_d32_logits(self): method test_model_d32_generation (line 184) | def test_model_d32_generation(self): FILE: tests/models/nemotron/test_modeling_nemotron.py class NemotronModelTester (line 41) | class NemotronModelTester(CausalLMModelTester): class NemotronModelTest (line 47) | class NemotronModelTest(CausalLMModelTest, unittest.TestCase): method test_model_outputs_equivalence (line 57) | def test_model_outputs_equivalence(self, **kwargs): class NemotronIntegrationTest (line 62) | class NemotronIntegrationTest(unittest.TestCase): method test_nemotron_8b_generation_sdpa (line 64) | def test_nemotron_8b_generation_sdpa(self): method test_nemotron_8b_generation_eager (line 81) | def test_nemotron_8b_generation_eager(self): method test_nemotron_8b_generation_fa2 (line 106) | def test_nemotron_8b_generation_fa2(self): FILE: tests/models/nemotron_h/test_modeling_nemotron_h.py class NemotronHModelTester (line 45) | class NemotronHModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 122) | def prepare_config_and_inputs(self): method get_config (line 141) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 170) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 191) | def create_and_check_model(self, config, input_ids, input_mask, _seque... method create_and_check_for_causal_lm (line 199) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 217) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_mamba2_slow_vs_fast_forward (line 270) | def create_and_check_mamba2_slow_vs_fast_forward(self, config, input_i... method prepare_config_and_inputs_for_common (line 321) | def prepare_config_and_inputs_for_common(self): class NemotronHModelTest (line 336) | class NemotronHModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method _get_conv_state_shape (line 354) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 363) | def _get_recurrent_state_shape(self, batch_size: int, config): method _check_past_key_values_for_generate (line 366) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method setUp (line 404) | def setUp(self): method tearDown (line 418) | def tearDown(self): method test_num_layers_is_small (line 425) | def test_num_layers_is_small(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 429) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_generate_continue_from_inputs_embeds (line 433) | def test_generate_continue_from_inputs_embeds(self): method test_multi_gpu_data_parallel_forward (line 437) | def test_multi_gpu_data_parallel_forward(self): method test_reverse_loading_mapping (line 440) | def test_reverse_loading_mapping(self): method test_model (line 454) | def test_model(self): method test_for_causal_lm (line 458) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 462) | def test_decoder_model_past_with_large_inputs(self): method test_mamba2_slow_vs_fast_forward (line 466) | def test_mamba2_slow_vs_fast_forward(self): method test_attention_outputs (line 473) | def test_attention_outputs(self): method test_flash_attn_2_fp32_ln (line 547) | def test_flash_attn_2_fp32_ln(self): method test_flex_attention_with_grads (line 583) | def test_flex_attention_with_grads(self): method test_layers_block_type_validation (line 604) | def test_layers_block_type_validation(self): method test_layers_block_type (line 622) | def test_layers_block_type(self): method test_generate_with_and_without_cache (line 650) | def test_generate_with_and_without_cache(self): method test_legacy_hybrid_override_pattern (line 703) | def test_legacy_hybrid_override_pattern(self): method test_num_hidden_layers_deprecated (line 720) | def test_num_hidden_layers_deprecated(self): method test_legacy_config_json_loading (line 734) | def test_legacy_config_json_loading(self): method test_mtp_backward_compatibility (line 762) | def test_mtp_backward_compatibility(self): method test_config_roundtrip_save_load (line 774) | def test_config_roundtrip_save_load(self): method test_pattern_conversion_methods (line 794) | def test_pattern_conversion_methods(self): class NemotronHModelIntegrationTest (line 813) | class NemotronHModelIntegrationTest(unittest.TestCase): method setUpClass (line 819) | def setUpClass(cls): method setUp (line 825) | def setUp(self): method tearDown (line 835) | def tearDown(self): method test_simple_generate (line 842) | def test_simple_generate(self): FILE: tests/models/nllb/test_tokenization_nllb.py class NllbTokenizationTest (line 50) | class NllbTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_prepare_seq2seq_batch (line 72) | def test_prepare_seq2seq_batch(self): method test_save_slow_from_fast_and_reload_fast (line 121) | def test_save_slow_from_fast_and_reload_fast(self): method test_special_tokens_initialization (line 124) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 137) | def test_training_new_tokenizer(self): method test_new_language_codes (line 140) | def test_new_language_codes(self): class NllbDistilledIntegrationTest (line 191) | class NllbDistilledIntegrationTest(unittest.TestCase): method setUpClass (line 222) | def setUpClass(cls): method test_enro_tokenizer_batch_encode_plus (line 229) | def test_enro_tokenizer_batch_encode_plus(self): method test_enro_tokenizer_decode_ignores_language_codes (line 233) | def test_enro_tokenizer_decode_ignores_language_codes(self): method test_enro_tokenizer_truncation (line 242) | def test_enro_tokenizer_truncation(self): method test_mask_token (line 251) | def test_mask_token(self): method test_enro_tokenizer_prepare_batch (line 255) | def test_enro_tokenizer_prepare_batch(self): method test_seq2seq_max_length (line 279) | def test_seq2seq_max_length(self): method test_tokenizer_translation (line 295) | def test_tokenizer_translation(self): method test_legacy_behaviour (line 312) | def test_legacy_behaviour(self): FILE: tests/models/nllb_moe/test_modeling_nllb_moe.py class NllbMoeModelTester (line 44) | class NllbMoeModelTester: method __init__ (line 45) | def __init__( method prepare_nllb_moe_inputs_dict (line 97) | def prepare_nllb_moe_inputs_dict( method prepare_config_and_inputs (line 116) | def prepare_config_and_inputs(self): method get_config (line 135) | def get_config(self): method prepare_config_and_inputs_for_common (line 160) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 165) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 198) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class NllbMoeModelTest (line 232) | class NllbMoeModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method is_pipeline_test_to_skip (line 246) | def is_pipeline_test_to_skip( method setUp (line 259) | def setUp(self): method test_config (line 263) | def test_config(self): method test_save_load_strict (line 266) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 276) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 281) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 285) | def test_inputs_embeds(self): method test_generate_fp16 (line 315) | def test_generate_fp16(self): method test_get_loss (line 324) | def test_get_loss(self): method test_load_save_without_tied_weights (line 337) | def test_load_save_without_tied_weights(self): method test_generate_continue_from_past_key_values (line 341) | def test_generate_continue_from_past_key_values(self): class NllbMoeModelIntegrationTests (line 349) | class NllbMoeModelIntegrationTests(unittest.TestCase): method model_inputs (line 352) | def model_inputs(self): method tokenizer (line 367) | def tokenizer(self): method big_model (line 371) | def big_model(self): method inference_no_head (line 374) | def inference_no_head(self): method test_inference_logits (line 388) | def test_inference_logits(self): method test_large_logits (line 402) | def test_large_logits(self): method test_seq_to_seq_generation (line 420) | def test_seq_to_seq_generation(self): class NllbMoeRouterTest (line 452) | class NllbMoeRouterTest(unittest.TestCase): method test_top_2_routing (line 470) | def test_top_2_routing(self): method test_batch_prioritized_routing (line 506) | def test_batch_prioritized_routing(self): method test_second_expert_policy (line 520) | def test_second_expert_policy(self): FILE: tests/models/nougat/test_image_processing_nougat.py class NougatImageProcessingTester (line 36) | class NougatImageProcessingTester: method __init__ (line 37) | def __init__( method prepare_image_processor_dict (line 74) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 87) | def expected_output_image_shape(self, images): method prepare_dummy_image (line 90) | def prepare_dummy_image(self): method prepare_image_inputs (line 101) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class NougatImageProcessingTest (line 115) | class NougatImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 116) | def setUp(self): method image_processor_dict (line 121) | def image_processor_dict(self): method test_image_processor_properties (line 124) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 133) | def test_image_processor_from_dict_with_kwargs(self): method test_expected_output (line 143) | def test_expected_output(self): method test_crop_margin_all_white (line 150) | def test_crop_margin_all_white(self): method test_crop_margin_centered_black_square (line 163) | def test_crop_margin_centered_black_square(self): method test_align_long_axis_no_rotation (line 179) | def test_align_long_axis_no_rotation(self): method test_align_long_axis_with_rotation (line 192) | def test_align_long_axis_with_rotation(self): method test_align_long_axis_data_format (line 205) | def test_align_long_axis_data_format(self): method prepare_dummy_np_image (line 218) | def prepare_dummy_np_image(self): method test_crop_margin_equality_cv2_python (line 229) | def test_crop_margin_equality_cv2_python(self): method test_call_numpy_4_channels (line 243) | def test_call_numpy_4_channels(self): method test_backends_equivalence (line 280) | def test_backends_equivalence(self): FILE: tests/models/nougat/test_tokenization_nougat.py class NougatTokenizationTest (line 25) | class NougatTokenizationTest(TokenizerTesterMixin, unittest.TestCase): class MarkdownCompatibleTest (line 35) | class MarkdownCompatibleTest(unittest.TestCase): method test_equation_tag (line 36) | def test_equation_tag(self): method test_equation_tag_letters (line 41) | def test_equation_tag_letters(self): method test_bold_formatting (line 46) | def test_bold_formatting(self): method test_url_conversion (line 51) | def test_url_conversion(self): method test_algorithm_code_block (line 56) | def test_algorithm_code_block(self): method test_escape_characters (line 61) | def test_escape_characters(self): method test_nested_tags (line 66) | def test_nested_tags(self): class TestNormalizeListLikeLines (line 72) | class TestNormalizeListLikeLines(unittest.TestCase): method test_two_level_lines (line 73) | def test_two_level_lines(self): method test_three_level_lines (line 78) | def test_three_level_lines(self): method test_nested_lines (line 83) | def test_nested_lines(self): class NougatPostProcessingTest (line 90) | class NougatPostProcessingTest(unittest.TestCase): method setUp (line 91) | def setUp(self): method test_correct_tables_basic (line 95) | def test_correct_tables_basic(self): method test_correct_tables_high_count (line 100) | def test_correct_tables_high_count(self): method test_postprocess_as_nougat_no_markdown (line 107) | def test_postprocess_as_nougat_no_markdown(self): FILE: tests/models/nystromformer/test_modeling_nystromformer.py class NystromformerModelTester (line 39) | class NystromformerModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 111) | def get_config(self): method create_and_check_model (line 127) | def create_and_check_model( method create_and_check_for_masked_lm (line 138) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 147) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 163) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 173) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 183) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 201) | def prepare_config_and_inputs_for_common(self): class NystromformerModelTest (line 217) | class NystromformerModelTest(ModelTesterMixin, PipelineTesterMixin, unit... method setUp (line 242) | def setUp(self): method test_config (line 246) | def test_config(self): method test_model (line 249) | def test_model(self): method test_for_masked_lm (line 253) | def test_for_masked_lm(self): method test_for_multiple_choice (line 257) | def test_for_multiple_choice(self): method test_for_question_answering (line 261) | def test_for_question_answering(self): method test_for_sequence_classification (line 265) | def test_for_sequence_classification(self): method test_for_token_classification (line 269) | def test_for_token_classification(self): method test_model_from_pretrained (line 274) | def test_model_from_pretrained(self): class NystromformerModelIntegrationTest (line 281) | class NystromformerModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 283) | def test_inference_no_head(self): method test_masked_lm_end_to_end (line 300) | def test_masked_lm_end_to_end(self): FILE: tests/models/olmo/test_modeling_olmo.py class OlmoModelTester (line 46) | class OlmoModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 120) | def get_config(self): method create_and_check_model (line 137) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 147) | def prepare_config_and_inputs_for_common(self): class OlmoModelTest (line 163) | class OlmoModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 178) | def setUp(self): method test_config (line 182) | def test_config(self): method test_model (line 185) | def test_model(self): class OlmoIntegrationTest (line 191) | class OlmoIntegrationTest(unittest.TestCase): method test_model_1b_logits (line 193) | def test_model_1b_logits(self): method test_model_7b_logits (line 205) | def test_model_7b_logits(self): method test_model_7b_twin_2t_logits (line 217) | def test_model_7b_twin_2t_logits(self): method test_model_7b_greedy_generation (line 229) | def test_model_7b_greedy_generation(self): method test_fast_special_tokens (line 242) | def test_fast_special_tokens(self): method test_simple_encode_decode (line 258) | def test_simple_encode_decode(self): method test_export_static_cache (line 288) | def test_export_static_cache(self): FILE: tests/models/olmo2/test_modeling_olmo2.py class Olmo2ModelTester (line 47) | class Olmo2ModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 98) | def prepare_config_and_inputs(self): method get_config (line 121) | def get_config(self): method create_and_check_model (line 138) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 148) | def prepare_config_and_inputs_for_common(self): class Olmo2ModelTest (line 164) | class Olmo2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method setUp (line 179) | def setUp(self): method test_config (line 183) | def test_config(self): method test_model (line 186) | def test_model(self): class Olmo2IntegrationTest (line 193) | class Olmo2IntegrationTest(unittest.TestCase): method setUp (line 194) | def setUp(self): method tearDown (line 197) | def tearDown(self): method test_model_1b_logits_bfloat16 (line 200) | def test_model_1b_logits_bfloat16(self): method test_model_7b_logits (line 222) | def test_model_7b_logits(self): method test_model_7b_greedy_generation (line 243) | def test_model_7b_greedy_generation(self): method test_simple_encode_decode (line 256) | def test_simple_encode_decode(self): method test_export_static_cache (line 285) | def test_export_static_cache(self): FILE: tests/models/olmo3/test_modeling_olmo3.py class Olmo3ModelTester (line 46) | class Olmo3ModelTester(CausalLMModelTester): class Olmo3ModelTest (line 52) | class Olmo3ModelTest(CausalLMModelTest, unittest.TestCase): method test_model_rope_scaling_from_config (line 64) | def test_model_rope_scaling_from_config(self, scaling_type): method test_model_rope_scaling_frequencies (line 98) | def test_model_rope_scaling_frequencies(self): class Olmo3IntegrationTest (line 173) | class Olmo3IntegrationTest(unittest.TestCase): method setUp (line 174) | def setUp(self): method tearDown (line 177) | def tearDown(self): method test_model_7b_logits (line 181) | def test_model_7b_logits(self): method test_model_7b_greedy_generation (line 205) | def test_model_7b_greedy_generation(self): method test_export_static_cache (line 219) | def test_export_static_cache(self): FILE: tests/models/olmo_hybrid/test_modeling_olmo_hybrid.py class OlmoHybridModelTester (line 45) | class OlmoHybridModelTester(CausalLMModelTester): method __init__ (line 51) | def __init__(self, parent): class OlmoHybridModelTest (line 63) | class OlmoHybridModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 68) | def test_tp_generation_quantized(self): method _check_past_key_values_for_generate (line 72) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method _check_caches_are_equal (line 90) | def _check_caches_are_equal(self, cache1: Cache, cache2: Cache): method test_attention_outputs (line 102) | def test_attention_outputs(self): method test_multi_gpu_data_parallel_forward (line 150) | def test_multi_gpu_data_parallel_forward(self): class OlmoHybridIntegrationTest (line 155) | class OlmoHybridIntegrationTest(unittest.TestCase): method setUp (line 156) | def setUp(self): method tearDown (line 159) | def tearDown(self): method test_model_logits (line 163) | def test_model_logits(self): method test_model_greedy_generation (line 276) | def test_model_greedy_generation(self): FILE: tests/models/olmoe/test_modeling_olmoe.py class OlmoeModelTester (line 44) | class OlmoeModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 108) | def prepare_config_and_inputs(self): method get_config (line 131) | def get_config(self): method create_and_check_model (line 153) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 163) | def prepare_config_and_inputs_for_common(self): class OlmoeModelTest (line 179) | class OlmoeModelTest( method setUp (line 196) | def setUp(self): method test_config (line 200) | def test_config(self): method test_model (line 203) | def test_model(self): class OlmoeIntegrationTest (line 209) | class OlmoeIntegrationTest(unittest.TestCase): method test_model_7b_logits (line 211) | def test_model_7b_logits(self): method test_model_7b_greedy_generation (line 223) | def test_model_7b_greedy_generation(self): method test_fast_special_tokens (line 236) | def test_fast_special_tokens(self): method test_simple_encode_decode (line 252) | def test_simple_encode_decode(self): FILE: tests/models/omdet_turbo/test_modeling_omdet_turbo.py class OmDetTurboModelTester (line 52) | class OmDetTurboModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs (line 105) | def prepare_config_and_inputs(self): method get_config (line 131) | def get_config(self): method prepare_config_and_inputs_for_common (line 177) | def prepare_config_and_inputs_for_common(self): method create_and_check_object_detection_head_model (line 181) | def create_and_check_object_detection_head_model(self, config, inputs_... class OmDetTurboModelTest (line 195) | class OmDetTurboModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method _prepare_for_class (line 206) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 211) | def setUp(self): method test_config (line 220) | def test_config(self): method test_object_detection_head_model (line 223) | def test_object_detection_head_model(self): method test_multi_gpu_data_parallel_forward (line 230) | def test_multi_gpu_data_parallel_forward(self): method test_inputs_embeds (line 234) | def test_inputs_embeds(self): method test_resize_tokens_embeddings (line 237) | def test_resize_tokens_embeddings(self): method test_batching_equivalence (line 344) | def test_batching_equivalence(self): method test_attention_outputs (line 442) | def test_attention_outputs(self): method test_hidden_states_output (line 530) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 573) | def test_retain_grad_hidden_states_attentions(self): function prepare_img (line 605) | def prepare_img(): function prepare_text (line 611) | def prepare_text(): function prepare_img_batched (line 617) | def prepare_img_batched(): function prepare_text_batched (line 625) | def prepare_text_batched(): class OmDetTurboModelIntegrationTests (line 639) | class OmDetTurboModelIntegrationTests(unittest.TestCase): method default_processor (line 641) | def default_processor(self): method test_inference_object_detection_head (line 644) | def test_inference_object_detection_head(self): method test_inference_object_detection_head_fp16 (line 684) | def test_inference_object_detection_head_fp16(self): method test_inference_object_detection_head_no_task (line 730) | def test_inference_object_detection_head_no_task(self): method test_inference_object_detection_head_batched (line 770) | def test_inference_object_detection_head_batched(self): method test_inference_object_detection_head_equivalence_cpu_accelerator (line 836) | def test_inference_object_detection_head_equivalence_cpu_accelerator(s... FILE: tests/models/omdet_turbo/test_processing_omdet_turbo.py class OmDetTurboProcessorTest (line 36) | class OmDetTurboProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 54) | def _setup_tokenizer(cls): method get_fake_omdet_turbo_output (line 58) | def get_fake_omdet_turbo_output(self): method get_fake_omdet_turbo_classes (line 68) | def get_fake_omdet_turbo_classes(self): method test_post_process_grounded_object_detection (line 71) | def test_post_process_grounded_object_detection(self): FILE: tests/models/oneformer/test_image_processing_oneformer.py class OneFormerImageProcessorTester (line 40) | class OneFormerImageProcessorTester: method __init__ (line 41) | def __init__( method prepare_image_processor_dict (line 84) | def prepare_image_processor_dict(self): method get_expected_values (line 98) | def get_expected_values(self, image_inputs, batched=False): method get_fake_oneformer_outputs (line 131) | def get_fake_oneformer_outputs(self): method expected_output_image_shape (line 138) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 142) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 155) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 162) | def prepare_semantic_batch_inputs(): class OneFormerImageProcessingTest (line 169) | class OneFormerImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 170) | def setUp(self): method image_processor_dict (line 175) | def image_processor_dict(self): method test_image_proc_properties (line 178) | def test_image_proc_properties(self): method comm_get_image_processor_inputs (line 193) | def comm_get_image_processor_inputs( method test_init_without_params (line 224) | def test_init_without_params(self): method test_call_with_segmentation_maps (line 227) | def test_call_with_segmentation_maps(self): method test_binary_mask_to_rle (line 254) | def test_binary_mask_to_rle(self): method test_post_process_semantic_segmentation (line 265) | def test_post_process_semantic_segmentation(self): method test_post_process_instance_segmentation (line 293) | def test_post_process_instance_segmentation(self): method test_post_process_panoptic_segmentation (line 328) | def test_post_process_panoptic_segmentation(self): method test_can_load_with_local_metadata (line 350) | def test_can_load_with_local_metadata(self): method test_backends_equivalence (line 371) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 400) | def test_backends_equivalence_batched(self): FILE: tests/models/oneformer/test_modeling_oneformer.py class OneFormerModelTester (line 55) | class OneFormerModelTester: method __init__ (line 56) | def __init__( method prepare_config_and_inputs (line 86) | def prepare_config_and_inputs(self): method get_config (line 113) | def get_config(self): method prepare_config_and_inputs_for_common (line 144) | def prepare_config_and_inputs_for_common(self): method check_output_hidden_state (line 149) | def check_output_hidden_state(self, output, config): method create_and_check_oneformer_model (line 158) | def create_and_check_oneformer_model( method create_and_check_oneformer_universal_segmentation_head_model (line 181) | def create_and_check_oneformer_universal_segmentation_head_model( class OneFormerModelTest (line 232) | class OneFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method is_pipeline_test_to_skip (line 242) | def is_pipeline_test_to_skip( method setUp (line 257) | def setUp(self): method test_config (line 261) | def test_config(self): method test_batching_equivalence (line 267) | def test_batching_equivalence(self): method test_oneformer_model (line 270) | def test_oneformer_model(self): method test_oneformer_universal_segmentation_head_model (line 274) | def test_oneformer_universal_segmentation_head_model(self): method test_model_main_input_name (line 278) | def test_model_main_input_name(self): method test_inputs_embeds (line 286) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 290) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 294) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 298) | def test_resize_tokens_embeddings(self): method test_multi_gpu_data_parallel_forward (line 305) | def test_multi_gpu_data_parallel_forward(self): method test_forward_signature (line 308) | def test_forward_signature(self): method test_model_from_pretrained (line 321) | def test_model_from_pretrained(self): method test_model_with_labels (line 326) | def test_model_with_labels(self): method test_hidden_states_output (line 345) | def test_hidden_states_output(self): method test_attention_outputs (line 349) | def test_attention_outputs(self): method test_training (line 357) | def test_training(self): method test_retain_grad_hidden_states_attentions (line 382) | def test_retain_grad_hidden_states_attentions(self): method test_backbone_selection (line 430) | def test_backbone_selection(self): function prepare_img (line 472) | def prepare_img(): class OneFormerModelIntegrationTest (line 479) | class OneFormerModelIntegrationTest(unittest.TestCase): method model_checkpoints (line 481) | def model_checkpoints(self): method default_processor (line 485) | def default_processor(self): method test_inference_no_head (line 488) | def test_inference_no_head(self): method test_inference_universal_segmentation_head (line 524) | def test_inference_universal_segmentation_head(self): method test_inference_fp16 (line 568) | def test_inference_fp16(self): method test_with_segmentation_maps_and_loss (line 581) | def test_with_segmentation_maps_and_loss(self): FILE: tests/models/oneformer/test_processing_oneformer.py function prepare_metadata (line 51) | def prepare_metadata(class_info_file, repo_path="shi-labs/oneformer_demo"): class OneFormerProcessorTester (line 69) | class OneFormerProcessorTester: method __init__ (line 70) | def __init__( method prepare_processor_dict (line 118) | def prepare_processor_dict(self): method get_expected_values (line 143) | def get_expected_values(self, image_inputs, batched=False): method get_fake_oneformer_outputs (line 179) | def get_fake_oneformer_outputs(self): method prepare_image_inputs (line 186) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class OneFormerProcessingTest (line 200) | class OneFormerProcessingTest(unittest.TestCase): method setUp (line 205) | def setUp(self): method processor_dict (line 209) | def processor_dict(self): method test_feat_extract_properties (line 212) | def test_feat_extract_properties(self): method test_batch_feature (line 220) | def test_batch_feature(self): method test_call_pil (line 223) | def test_call_pil(self): method test_call_numpy (line 275) | def test_call_numpy(self): method test_call_pytorch (line 327) | def test_call_pytorch(self): method comm_get_processor_inputs (line 379) | def comm_get_processor_inputs(self, with_segmentation_maps=False, is_i... method test_init_without_params (line 408) | def test_init_without_params(self): method test_feat_extract_from_and_save_pretrained (line 412) | def test_feat_extract_from_and_save_pretrained(self): method test_call_with_segmentation_maps (line 424) | def test_call_with_segmentation_maps(self): method test_integration_semantic_segmentation (line 447) | def test_integration_semantic_segmentation(self): method test_integration_instance_segmentation (line 535) | def test_integration_instance_segmentation(self): method test_integration_panoptic_segmentation (line 623) | def test_integration_panoptic_segmentation(self): method test_binary_mask_to_rle (line 711) | def test_binary_mask_to_rle(self): method test_post_process_semantic_segmentation (line 722) | def test_post_process_semantic_segmentation(self): method test_post_process_instance_segmentation (line 756) | def test_post_process_instance_segmentation(self): method test_post_process_panoptic_segmentation (line 782) | def test_post_process_panoptic_segmentation(self): FILE: tests/models/openai/test_modeling_openai.py class OpenAIGPTModelTester (line 39) | class OpenAIGPTModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 87) | def prepare_config_and_inputs(self): method create_and_check_openai_gpt_model (line 126) | def create_and_check_openai_gpt_model(self, config, input_ids, token_t... method create_and_check_lm_head_model (line 137) | def create_and_check_lm_head_model(self, config, input_ids, token_type... method create_and_check_double_lm_head_model (line 146) | def create_and_check_double_lm_head_model(self, config, input_ids, tok... method create_and_check_openai_gpt_for_sequence_classification (line 155) | def create_and_check_openai_gpt_for_sequence_classification(self, conf... method prepare_config_and_inputs_for_common (line 165) | def prepare_config_and_inputs_for_common(self): class OpenAIGPTModelTest (line 184) | class OpenAIGPTModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeli... method is_pipeline_test_to_skip (line 202) | def is_pipeline_test_to_skip( method _greedy_generate (line 220) | def _greedy_generate(self, *args, use_cache=False, **kwargs): method _sample_generate (line 224) | def _sample_generate(self, *args, use_cache=False, **kwargs): method _beam_search_generate (line 228) | def _beam_search_generate(self, *args, use_cache=False, **kwargs): method _beam_sample_generate (line 232) | def _beam_sample_generate(self, *args, use_cache=False, **kwargs): method _prepare_for_class (line 237) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 259) | def setUp(self): method test_config (line 263) | def test_config(self): method test_openai_gpt_model (line 266) | def test_openai_gpt_model(self): method test_openai_gpt_lm_head_model (line 270) | def test_openai_gpt_lm_head_model(self): method test_openai_gpt_double_lm_head_model (line 274) | def test_openai_gpt_double_lm_head_model(self): method test_openai_gpt_classification_model (line 278) | def test_openai_gpt_classification_model(self): method test_model_from_pretrained (line 283) | def test_model_from_pretrained(self): method test_generate_methods_with_logits_to_keep (line 289) | def test_generate_methods_with_logits_to_keep(self): method test_generate_with_and_without_position_ids (line 293) | def test_generate_with_and_without_position_ids(self): class OPENAIGPTModelLanguageGenerationTest (line 298) | class OPENAIGPTModelLanguageGenerationTest(unittest.TestCase): method test_lm_generate_openai_gpt (line 300) | def test_lm_generate_openai_gpt(self): FILE: tests/models/openai/test_tokenization_openai.py class OpenAIGPTTokenizationTest (line 25) | class OpenAIGPTTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/opt/test_modeling_opt.py function prepare_opt_inputs_dict (line 49) | def prepare_opt_inputs_dict( class OPTModelTester (line 64) | class OPTModelTester: method __init__ (line 65) | def __init__( method prepare_config_and_inputs (line 112) | def prepare_config_and_inputs(self): method get_config (line 124) | def get_config(self): method get_pipeline_config (line 142) | def get_pipeline_config(self): method prepare_config_and_inputs_for_common (line 147) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 151) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... class OPTModelTest (line 200) | class OPTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method is_pipeline_test_to_skip (line 221) | def is_pipeline_test_to_skip( method setUp (line 243) | def setUp(self): method test_config (line 247) | def test_config(self): method test_save_load_strict (line 250) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 260) | def test_decoder_model_past_with_large_inputs(self): method test_inputs_embeds (line 264) | def test_inputs_embeds(self): method test_generate_fp16 (line 294) | def test_generate_fp16(self): method test_opt_sequence_classification_model (line 303) | def test_opt_sequence_classification_model(self): method test_opt_sequence_classification_model_for_multi_label (line 315) | def test_opt_sequence_classification_model_for_multi_label(self): method test_model_parallelism (line 331) | def test_model_parallelism(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 335) | def attention_mask_padding_matches_padding_free_with_position_ids( function assert_tensors_close (line 341) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 360) | def _long_tensor(tok_lst): class OPTModelIntegrationTests (line 365) | class OPTModelIntegrationTests(unittest.TestCase): method test_inference_no_head (line 367) | def test_inference_no_head(self): class OPTEmbeddingsTest (line 390) | class OPTEmbeddingsTest(unittest.TestCase): method setUp (line 391) | def setUp(self): method test_load_model (line 395) | def test_load_model(self): method test_logits (line 401) | def test_logits(self): class OPTGenerationTest (line 427) | class OPTGenerationTest(unittest.TestCase): method prompts (line 429) | def prompts(self): method test_generation_pre_attn_layer_norm (line 437) | def test_generation_pre_attn_layer_norm(self): method test_batch_generation (line 461) | def test_batch_generation(self): method test_generation_post_attn_layer_norm (line 502) | def test_generation_post_attn_layer_norm(self): method test_batched_nan_fp16 (line 528) | def test_batched_nan_fp16(self): FILE: tests/models/ovis2/test_image_processing_ovis2.py class Ovis2ImageProcessingTester (line 28) | class Ovis2ImageProcessingTester(unittest.TestCase): method __init__ (line 29) | def __init__( method prepare_image_processor_dict (line 61) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 72) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 75) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Ovis2ProcessingTest (line 89) | class Ovis2ProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 90) | def setUp(self): method image_processor_dict (line 95) | def image_processor_dict(self): method test_image_processor_properties (line 98) | def test_image_processor_properties(self): method test_backends_equivalence_crop_to_patches (line 108) | def test_backends_equivalence_crop_to_patches(self): method test_backends_equivalence_batched_crop_to_patches (line 128) | def test_backends_equivalence_batched_crop_to_patches(self): method test_crop_to_patches (line 152) | def test_crop_to_patches(self): FILE: tests/models/ovis2/test_modeling_ovis2.py class Ovis2VisionText2TextModelTester (line 52) | class Ovis2VisionText2TextModelTester: method __init__ (line 53) | def __init__( method get_config (line 117) | def get_config(self): method prepare_config_and_inputs (line 127) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 140) | def prepare_config_and_inputs_for_common(self): class Ovis2ModelTest (line 163) | class Ovis2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method setUp (line 185) | def setUp(self): method test_config (line 189) | def test_config(self): method test_inputs_embeds (line 192) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 214) | def test_inputs_embeds_matches_input_ids(self): class Ovis2IntegrationTest (line 237) | class Ovis2IntegrationTest(unittest.TestCase): method setUp (line 238) | def setUp(self): method tearDown (line 256) | def tearDown(self): method test_small_model_integration_test (line 259) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 280) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_multi_image (line 300) | def test_small_model_integration_test_multi_image(self): method test_small_model_integration_test_batch_different_resolutions (line 333) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_matches_single (line 360) | def test_small_model_integration_test_batch_matches_single(self): FILE: tests/models/ovis2/test_processor_ovis2.py class Ovis2ProcessorTest (line 32) | class Ovis2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 36) | def _setup_tokenizer(cls): method prepare_processor_dict (line 41) | def prepare_processor_dict(): method test_processor_to_json_string (line 46) | def test_processor_to_json_string(self): method test_chat_template_is_saved (line 55) | def test_chat_template_is_saved(self): method test_chat_template (line 66) | def test_chat_template(self): method test_chat_template_dict (line 84) | def test_chat_template_dict(self): FILE: tests/models/owlv2/test_image_processing_owlv2.py class Owlv2ImageProcessingTester (line 33) | class Owlv2ImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 62) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 71) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 74) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Owlv2ImageProcessingTest (line 88) | class Owlv2ImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 89) | def setUp(self): method image_processor_dict (line 94) | def image_processor_dict(self): method test_image_processor_properties (line 97) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 106) | def test_image_processor_from_dict_with_kwargs(self): method test_image_processor_integration_test (line 117) | def test_image_processor_integration_test(self): method test_image_processor_integration_test_resize (line 128) | def test_image_processor_integration_test_resize(self): method test_call_numpy_4_channels (line 169) | def test_call_numpy_4_channels(self): FILE: tests/models/owlv2/test_modeling_owlv2.py class Owlv2VisionModelTester (line 60) | class Owlv2VisionModelTester: method __init__ (line 61) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 103) | def get_config(self): method create_and_check_model (line 117) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 130) | def prepare_config_and_inputs_for_common(self): class Owlv2VisionModelTest (line 139) | class Owlv2VisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 149) | def setUp(self): method test_config (line 155) | def test_config(self): method test_inputs_embeds (line 159) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 162) | def test_model_get_set_embeddings(self): method test_forward_signature (line 171) | def test_forward_signature(self): method test_model (line 183) | def test_model(self): method test_training (line 188) | def test_training(self): method test_training_gradient_checkpointing (line 192) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 196) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 200) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 204) | def test_model_from_pretrained(self): class Owlv2TextModelTester (line 211) | class Owlv2TextModelTester: method __init__ (line 212) | def __init__( method prepare_config_and_inputs (line 250) | def prepare_config_and_inputs(self): method get_config (line 269) | def get_config(self): method create_and_check_model (line 282) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 293) | def prepare_config_and_inputs_for_common(self): class Owlv2TextModelTest (line 302) | class Owlv2TextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 305) | def setUp(self): method test_config (line 309) | def test_config(self): method test_model (line 312) | def test_model(self): method test_training (line 317) | def test_training(self): method test_training_gradient_checkpointing (line 321) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 325) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 329) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 333) | def test_inputs_embeds(self): method test_model_from_pretrained (line 337) | def test_model_from_pretrained(self): class Owlv2ModelTester (line 343) | class Owlv2ModelTester: method __init__ (line 344) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 358) | def prepare_config_and_inputs(self): method get_config (line 364) | def get_config(self): method create_and_check_model (line 371) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 392) | def prepare_config_and_inputs_for_common(self): class Owlv2ModelTest (line 406) | class Owlv2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 422) | def setUp(self): method test_config (line 429) | def test_config(self): method test_model (line 432) | def test_model(self): method test_hidden_states_output (line 437) | def test_hidden_states_output(self): method test_inputs_embeds (line 441) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 445) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 449) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 452) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 468) | def test_model_from_pretrained(self): class Owlv2ForObjectDetectionTester (line 475) | class Owlv2ForObjectDetectionTester: method __init__ (line 476) | def __init__(self, parent, is_training=True): method prepare_config_and_inputs (line 485) | def prepare_config_and_inputs(self): method get_config (line 491) | def get_config(self): method create_and_check_model (line 498) | def create_and_check_model(self, config, pixel_values, input_ids, atte... method prepare_config_and_inputs_for_common (line 527) | def prepare_config_and_inputs_for_common(self): class Owlv2ForObjectDetectionTest (line 540) | class Owlv2ForObjectDetectionTest(ModelTesterMixin, unittest.TestCase): method setUp (line 548) | def setUp(self): method test_model (line 551) | def test_model(self): method test_hidden_states_output (line 556) | def test_hidden_states_output(self): method test_eager_matches_sdpa_inference (line 560) | def test_eager_matches_sdpa_inference(self, *args): method test_inputs_embeds (line 564) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 568) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 572) | def test_model_get_set_embeddings(self): method test_forward_signature (line 576) | def test_forward_signature(self): method test_training (line 580) | def test_training(self): method test_training_gradient_checkpointing (line 584) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 588) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 592) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 596) | def test_model_from_pretrained(self): function prepare_img (line 603) | def prepare_img(): class Owlv2ModelIntegrationTest (line 611) | class Owlv2ModelIntegrationTest(unittest.TestCase): method test_inference (line 613) | def test_inference(self): method test_inference_interpolate_pos_encoding (line 645) | def test_inference_interpolate_pos_encoding(self): method test_inference_object_detection (line 785) | def test_inference_object_detection(self): method test_inference_one_shot_object_detection (line 835) | def test_inference_one_shot_object_detection(self): method test_inference_one_shot_object_detection_fp16 (line 865) | def test_inference_one_shot_object_detection_fp16(self): FILE: tests/models/owlv2/test_processing_owlv2.py class Owlv2ProcessorTest (line 10) | class Owlv2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): FILE: tests/models/owlvit/test_image_processing_owlvit.py class OwlViTImageProcessingTester (line 23) | class OwlViTImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 56) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 68) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 71) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class OwlViTImageProcessingTest (line 85) | class OwlViTImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 86) | def setUp(self): method image_processor_dict (line 91) | def image_processor_dict(self): method test_image_processor_properties (line 94) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 106) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/owlvit/test_modeling_owlvit.py class OwlViTVisionModelTester (line 59) | class OwlViTVisionModelTester: method __init__ (line 60) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 102) | def get_config(self): method create_and_check_model (line 116) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 129) | def prepare_config_and_inputs_for_common(self): class OwlViTVisionModelTest (line 137) | class OwlViTVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 147) | def setUp(self): method test_config (line 153) | def test_config(self): method test_inputs_embeds (line 157) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 160) | def test_model_get_set_embeddings(self): method test_forward_signature (line 169) | def test_forward_signature(self): method test_model (line 181) | def test_model(self): method test_training (line 186) | def test_training(self): method test_training_gradient_checkpointing (line 190) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 194) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 198) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 202) | def test_model_from_pretrained(self): class OwlViTTextModelTester (line 208) | class OwlViTTextModelTester: method __init__ (line 209) | def __init__( method prepare_config_and_inputs (line 247) | def prepare_config_and_inputs(self): method get_config (line 266) | def get_config(self): method create_and_check_model (line 279) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 290) | def prepare_config_and_inputs_for_common(self): class OwlViTTextModelTest (line 298) | class OwlViTTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 301) | def setUp(self): method test_config (line 305) | def test_config(self): method test_model (line 308) | def test_model(self): method test_training (line 313) | def test_training(self): method test_training_gradient_checkpointing (line 317) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 321) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 325) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 329) | def test_inputs_embeds(self): method test_model_from_pretrained (line 333) | def test_model_from_pretrained(self): class OwlViTModelTester (line 339) | class OwlViTModelTester: method __init__ (line 340) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 354) | def prepare_config_and_inputs(self): method get_config (line 360) | def get_config(self): method create_and_check_model (line 367) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 388) | def prepare_config_and_inputs_for_common(self): class OwlViTModelTest (line 401) | class OwlViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 417) | def setUp(self): method test_config (line 424) | def test_config(self): method test_model (line 427) | def test_model(self): method test_hidden_states_output (line 432) | def test_hidden_states_output(self): method test_inputs_embeds (line 436) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 440) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 444) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 447) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 463) | def test_model_from_pretrained(self): class OwlViTForObjectDetectionTester (line 469) | class OwlViTForObjectDetectionTester: method __init__ (line 470) | def __init__(self, parent, is_training=True): method prepare_config_and_inputs (line 479) | def prepare_config_and_inputs(self): method get_config (line 485) | def get_config(self): method create_and_check_model (line 492) | def create_and_check_model(self, config, pixel_values, input_ids, atte... method prepare_config_and_inputs_for_common (line 521) | def prepare_config_and_inputs_for_common(self): class OwlViTForObjectDetectionTest (line 533) | class OwlViTForObjectDetectionTest(ModelTesterMixin, unittest.TestCase): method setUp (line 541) | def setUp(self): method test_model (line 544) | def test_model(self): method test_hidden_states_output (line 549) | def test_hidden_states_output(self): method test_eager_matches_sdpa_inference (line 553) | def test_eager_matches_sdpa_inference(self, *args): method test_inputs_embeds (line 557) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 561) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 565) | def test_model_get_set_embeddings(self): method test_forward_signature (line 569) | def test_forward_signature(self): method test_training (line 573) | def test_training(self): method test_training_gradient_checkpointing (line 577) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 581) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 585) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 589) | def test_model_from_pretrained(self): function prepare_img (line 596) | def prepare_img(): class OwlViTModelIntegrationTest (line 604) | class OwlViTModelIntegrationTest(unittest.TestCase): method test_inference (line 606) | def test_inference(self): method test_inference_interpolate_pos_encoding (line 637) | def test_inference_interpolate_pos_encoding(self): method test_inference_object_detection (line 775) | def test_inference_object_detection(self): method test_inference_one_shot_object_detection (line 818) | def test_inference_one_shot_object_detection(self): method test_inference_one_shot_object_detection_fp16 (line 848) | def test_inference_one_shot_object_detection_fp16(self): FILE: tests/models/owlvit/test_processing_owlvit.py class OwlViTProcessorTest (line 33) | class OwlViTProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 37) | def _setup_image_processor(cls): method _setup_tokenizer (line 51) | def _setup_tokenizer(cls): method test_processor_with_text_list (line 65) | def test_processor_with_text_list(self): method test_processor_with_nested_text_list (line 80) | def test_processor_with_nested_text_list(self): method test_processor_case (line 98) | def test_processor_case(self): method test_processor_case2 (line 117) | def test_processor_case2(self): FILE: tests/models/paddleocr_vl/test_image_processing_paddleocr_vl.py class PaddleOCRVLImageProcessingTester (line 37) | class PaddleOCRVLImageProcessingTester: method __init__ (line 38) | def __init__( method prepare_image_processor_dict (line 72) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 86) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 120) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PaddleOCRVLImageProcessingTest (line 134) | class PaddleOCRVLImageProcessingTest(ImageProcessingTestMixin, unittest.... method setUp (line 135) | def setUp(self): method image_processor_dict (line 140) | def image_processor_dict(self): method test_image_processor_properties (line 143) | def test_image_processor_properties(self): method test_image_processor_to_json_string (line 155) | def test_image_processor_to_json_string(self): method test_image_processor_from_dict_with_kwargs (line 164) | def test_image_processor_from_dict_with_kwargs(self): method test_select_best_resolution (line 180) | def test_select_best_resolution(self): method test_call_pil (line 184) | def test_call_pil(self): method test_call_numpy (line 203) | def test_call_numpy(self): method test_call_pytorch (line 222) | def test_call_pytorch(self): method test_call_equal_resolution (line 241) | def test_call_equal_resolution(self): method test_call_numpy_4_channels (line 262) | def test_call_numpy_4_channels(self): method test_custom_image_size (line 265) | def test_custom_image_size(self): method test_custom_pixels (line 286) | def test_custom_pixels(self): method test_backends_equivalence (line 302) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 325) | def test_backends_equivalence_batched(self): method test_get_num_patches_without_images (line 345) | def test_get_num_patches_without_images(self): FILE: tests/models/paddleocr_vl/test_modeling_paddleocr_vl.py class PaddleOCRVLVisionText2TextModelTester (line 52) | class PaddleOCRVLVisionText2TextModelTester: method __init__ (line 53) | def __init__( method get_config (line 122) | def get_config(self): method prepare_config_and_inputs (line 130) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 144) | def prepare_config_and_inputs_for_common(self): class PaddleOCRVLModelTest (line 171) | class PaddleOCRVLModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe... method setUp (line 180) | def setUp(self): method test_config (line 184) | def test_config(self): method test_cpu_offload (line 190) | def test_cpu_offload(self): method test_disk_offload_bin (line 196) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 202) | def test_disk_offload_safetensors(self): method test_mismatching_num_image_tokens (line 205) | def test_mismatching_num_image_tokens(self): method prepare_config_and_inputs_for_generate (line 254) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_generate_compile_model_forward_fullgraph (line 295) | def test_generate_compile_model_forward_fullgraph(self): method test_multi_gpu_data_parallel_forward (line 299) | def test_multi_gpu_data_parallel_forward(self): method test_beam_sample_generate (line 304) | def test_beam_sample_generate(self): method test_beam_search_generate (line 309) | def test_beam_search_generate(self): method test_beam_search_generate_dict_output (line 314) | def test_beam_search_generate_dict_output(self): method test_beam_search_generate_dict_outputs_use_cache (line 319) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_beam_sample_generate_dict_output (line 324) | def test_beam_sample_generate_dict_output(self): method test_can_load_from_already_mapped_keys (line 328) | def test_can_load_from_already_mapped_keys(self): method test_generate_from_inputs_embeds_1_beam_search (line 333) | def test_generate_from_inputs_embeds_1_beam_search(self, _, num_beams): method test_assisted_decoding_matches_greedy_search (line 339) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_assisted_decoding_sample (line 344) | def test_assisted_decoding_sample(self): method test_model_is_small (line 348) | def test_model_is_small(self): class PaddleOCRVLIntegrationTest (line 354) | class PaddleOCRVLIntegrationTest(unittest.TestCase): method setUp (line 355) | def setUp(self): method tearDown (line 370) | def tearDown(self): method test_small_model_integration_test (line 374) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 424) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_flashatt2 (line 458) | def test_small_model_integration_test_flashatt2(self): method test_small_model_integration_test_batch_flashatt2 (line 509) | def test_small_model_integration_test_batch_flashatt2(self): FILE: tests/models/paligemma/test_modeling_paligemma.py class PaliGemmaVisionText2TextModelTester (line 51) | class PaliGemmaVisionText2TextModelTester: method __init__ (line 52) | def __init__( method get_config (line 132) | def get_config(self): method prepare_config_and_inputs (line 144) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 157) | def prepare_config_and_inputs_for_common(self): class PaliGemmaForConditionalGenerationModelTest (line 178) | class PaliGemmaForConditionalGenerationModelTest(ModelTesterMixin, Gener... method setUp (line 196) | def setUp(self): method test_mismatching_num_image_tokens (line 201) | def test_mismatching_num_image_tokens(self): method test_training_gradient_checkpointing (line 233) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 237) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 241) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_cpu_offload (line 245) | def test_cpu_offload(self): method test_disk_offload_bin (line 249) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 253) | def test_disk_offload_safetensors(self): method test_model_parallelism (line 257) | def test_model_parallelism(self): method test_model_outputs_equivalence (line 262) | def test_model_outputs_equivalence(self): method test_determinism (line 267) | def test_determinism(self): method test_feed_forward_chunking (line 271) | def test_feed_forward_chunking(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 277) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 281) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 285) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_attention_mask_with_token_types (line 288) | def test_attention_mask_with_token_types(self): class PaliGemmaForConditionalGenerationIntegrationTest (line 333) | class PaliGemmaForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 334) | def setUp(self): method tearDown (line 337) | def tearDown(self): method test_small_model_integration_test (line 340) | def test_small_model_integration_test(self): method test_small_model_integration_test_multiimage (line 361) | def test_small_model_integration_test_multiimage(self): method test_small_model_integration_test_paligemma_VQA (line 398) | def test_small_model_integration_test_paligemma_VQA(self): method test_small_model_integration_test_paligemma_empty_prompt (line 417) | def test_small_model_integration_test_paligemma_empty_prompt(self): method test_small_model_integration_test_paligemma_batched (line 437) | def test_small_model_integration_test_paligemma_batched(self): method test_small_model_integration_test_paligemma_batched_bf16 (line 463) | def test_small_model_integration_test_paligemma_batched_bf16(self): method test_small_model_integration_test_paligemma_batched_f16 (line 492) | def test_small_model_integration_test_paligemma_batched_f16(self): method test_integration_detection_bug (line 522) | def test_integration_detection_bug(self): method test_paligemma_index_error_bug (line 552) | def test_paligemma_index_error_bug(self): method test_paligemma_finetuning_with_suffixes_bf16 (line 575) | def test_paligemma_finetuning_with_suffixes_bf16(self): FILE: tests/models/paligemma/test_processing_paligemma.py class PaliGemmaProcessorTest (line 27) | class PaliGemmaProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 31) | def _setup_image_processor(cls): method _setup_tokenizer (line 38) | def _setup_tokenizer(cls): method _setup_test_attributes (line 45) | def _setup_test_attributes(cls, processor): method test_get_num_vision_tokens (line 48) | def test_get_num_vision_tokens(self): method test_image_seq_length (line 62) | def test_image_seq_length(self): method test_call_with_suffix (line 75) | def test_call_with_suffix(self): method test_text_with_image_tokens (line 88) | def test_text_with_image_tokens(self): FILE: tests/models/paligemma2/test_modeling_paligemma2.py class PaliGemma2VisionText2TextModelTester (line 40) | class PaliGemma2VisionText2TextModelTester: method __init__ (line 41) | def __init__( method get_config (line 121) | def get_config(self): method prepare_config_and_inputs (line 133) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 146) | def prepare_config_and_inputs_for_common(self): class PaliGemma2ForConditionalGenerationModelTest (line 167) | class PaliGemma2ForConditionalGenerationModelTest(ModelTesterMixin, Gene... method setUp (line 178) | def setUp(self): method test_mismatching_num_image_tokens (line 183) | def test_mismatching_num_image_tokens(self): method test_training_gradient_checkpointing (line 215) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 219) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 223) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_cpu_offload (line 227) | def test_cpu_offload(self): method test_disk_offload_bin (line 231) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 235) | def test_disk_offload_safetensors(self): method test_model_parallelism (line 239) | def test_model_parallelism(self): method test_model_outputs_equivalence (line 244) | def test_model_outputs_equivalence(self): method test_determinism (line 249) | def test_determinism(self): method test_feed_forward_chunking (line 253) | def test_feed_forward_chunking(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 259) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 263) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 267) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): FILE: tests/models/parakeet/test_feature_extraction_parakeet.py function floats_list (line 38) | def floats_list(shape, scale=1.0, rng=None, name=None): class ParakeetFeatureExtractionTester (line 52) | class ParakeetFeatureExtractionTester: method __init__ (line 53) | def __init__( method prepare_feat_extract_dict (line 78) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 89) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class ParakeetFeatureExtractionTest (line 106) | class ParakeetFeatureExtractionTest(SequenceFeatureExtractionTestMixin, ... method setUp (line 109) | def setUp(self): method _load_datasamples (line 112) | def _load_datasamples(self, num_samples): method test_torch_integration (line 120) | def test_torch_integration(self): method test_torch_integration_batch (line 148) | def test_torch_integration_batch(self): FILE: tests/models/parakeet/test_modeling_parakeet.py class ParakeetEncoderModelTester (line 43) | class ParakeetEncoderModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 96) | def get_config(self): method create_and_check_model (line 116) | def create_and_check_model(self, config, input_features, attention_mask): method prepare_config_and_inputs_for_common (line 127) | def prepare_config_and_inputs_for_common(self): method check_ctc_loss (line 135) | def check_ctc_loss(self, config, input_values, *args): class ParakeetEncoderModelTest (line 165) | class ParakeetEncoderModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 170) | def setUp(self): method test_config (line 174) | def test_config(self): method test_model (line 177) | def test_model(self): method test_model_get_set_embeddings (line 182) | def test_model_get_set_embeddings(self): class ParakeetForCTCModelTester (line 186) | class ParakeetForCTCModelTester: method __init__ (line 187) | def __init__(self, parent, encoder_kwargs=None, is_training=True, voca... method prepare_config_and_inputs (line 204) | def prepare_config_and_inputs(self): method get_config (line 209) | def get_config(self): method create_and_check_model (line 216) | def create_and_check_model(self, config, input_features, attention_mask): method prepare_config_and_inputs_for_common (line 224) | def prepare_config_and_inputs_for_common(self): method test_ctc_loss_inference (line 232) | def test_ctc_loss_inference(self): class ParakeetForCTCModelTest (line 238) | class ParakeetForCTCModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 255) | def setUp(self): method test_config (line 259) | def test_config(self): method test_model (line 262) | def test_model(self): method test_model_get_set_embeddings (line 267) | def test_model_get_set_embeddings(self): method test_sdpa_can_dispatch_composite_models (line 272) | def test_sdpa_can_dispatch_composite_models(self): class ParakeetForCTCIntegrationTest (line 299) | class ParakeetForCTCIntegrationTest(unittest.TestCase): method setUp (line 303) | def setUp(cls): method tearDown (line 308) | def tearDown(self): method _load_dataset (line 312) | def _load_dataset(cls): method _load_datasamples (line 320) | def _load_datasamples(self, num_samples): method test_1b_model_integration (line 327) | def test_1b_model_integration(self): method test_1b_model_integration_batched (line 352) | def test_1b_model_integration_batched(self): FILE: tests/models/parakeet/test_processing_parakeet.py class ParakeetProcessorTest (line 25) | class ParakeetProcessorTest(ProcessorTesterMixin, unittest.TestCase): FILE: tests/models/parakeet/test_tokenization_parakeet.py class ParakeetTokenizationTest (line 23) | class ParakeetTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 32) | def setUpClass(cls): method test_added_tokens_do_lower_case (line 38) | def test_added_tokens_do_lower_case(self): method test_encode_decode_with_spaces (line 46) | def test_encode_decode_with_spaces(self): method test_rust_tokenizer_signature (line 50) | def test_rust_tokenizer_signature(self): FILE: tests/models/patchtsmixer/test_modeling_patchtsmixer.py class PatchTSMixerModelTester (line 63) | class PatchTSMixerModelTester: method __init__ (line 64) | def __init__( method get_config (line 149) | def get_config(self): method prepare_patchtsmixer_inputs_dict (line 185) | def prepare_patchtsmixer_inputs_dict(self, config): method prepare_config_and_inputs (line 197) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 202) | def prepare_config_and_inputs_for_common(self): class PatchTSMixerModelTest (line 208) | class PatchTSMixerModelTest(ModelTesterMixin, PipelineTesterMixin, unitt... method setUp (line 231) | def setUp(self): method test_config (line 241) | def test_config(self): method _prepare_for_class (line 244) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_save_load_strict (line 270) | def test_save_load_strict(self): method test_hidden_states_output (line 280) | def test_hidden_states_output(self): method test_resize_tokens_embeddings (line 313) | def test_resize_tokens_embeddings(self): method test_model_outputs_equivalence (line 316) | def test_model_outputs_equivalence(self): method test_model_main_input_name (line 389) | def test_model_main_input_name(self): method test_forward_signature (line 395) | def test_forward_signature(self): method test_retain_grad_hidden_states_attentions (line 439) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 443) | def test_model_get_set_embeddings(self): function prepare_batch (line 447) | def prepare_batch(repo_id="ibm/patchtsmixer-etth1-test-data", file="pret... class PatchTSMixerModelIntegrationTests (line 457) | class PatchTSMixerModelIntegrationTests(unittest.TestCase): method test_pretrain_head (line 458) | def test_pretrain_head(self): method test_forecasting_head (line 481) | def test_forecasting_head(self): method test_prediction_generation (line 502) | def test_prediction_generation(self): class PatchTSMixerFunctionalTests (line 526) | class PatchTSMixerFunctionalTests(unittest.TestCase): method setUpClass (line 528) | def setUpClass(cls): method test_patchtsmixer_encoder (line 629) | def test_patchtsmixer_encoder(self): method test_patchmodel (line 635) | def test_patchmodel(self): method test_pretrainhead (line 642) | def test_pretrainhead(self): method test_pretrain_full (line 651) | def test_pretrain_full(self): method test_pretrain_full_with_return_dict (line 662) | def test_pretrain_full_with_return_dict(self): method test_forecast_head (line 670) | def test_forecast_head(self): method check_module (line 680) | def check_module( method test_forecast (line 765) | def test_forecast(self, mode, self_attn, scaling, gated_attn, predicti... method test_classification (line 789) | def test_classification(self, mode, self_attn, scaling, gated_attn, he... method test_regression (line 813) | def test_regression(self, mode, self_attn, scaling, gated_attn, head_a... method test_pretrain (line 839) | def test_pretrain( method forecast_full_module (line 862) | def forecast_full_module(self, params=None, output_hidden_states=False... method test_forecast_full (line 901) | def test_forecast_full(self): method test_forecast_full_2 (line 905) | def test_forecast_full_2(self): method test_forecast_full_2_with_return_dict (line 912) | def test_forecast_full_2_with_return_dict(self): method test_forecast_full_3 (line 919) | def test_forecast_full_3(self): method test_forecast_full_5 (line 926) | def test_forecast_full_5(self): method test_forecast_full_4 (line 935) | def test_forecast_full_4(self): method test_forecast_full_distributional (line 943) | def test_forecast_full_distributional(self): method test_forecast_full_distributional_2 (line 954) | def test_forecast_full_distributional_2(self): method test_forecast_full_distributional_3 (line 964) | def test_forecast_full_distributional_3(self): method test_forecast_full_distributional_4 (line 974) | def test_forecast_full_distributional_4(self): method test_classification_head (line 984) | def test_classification_head(self): method test_classification_full (line 994) | def test_classification_full(self): method test_classification_full_with_return_dict (line 1008) | def test_classification_full_with_return_dict(self): method test_regression_head (line 1025) | def test_regression_head(self): method test_regression_full (line 1033) | def test_regression_full(self): method test_regression_full_with_return_dict (line 1044) | def test_regression_full_with_return_dict(self): method test_regression_full_distribute (line 1061) | def test_regression_full_distribute(self): method test_regression_full_distribute_2 (line 1087) | def test_regression_full_distribute_2(self): FILE: tests/models/patchtst/test_modeling_patchtst.py class PatchTSTModelTester (line 51) | class PatchTSTModelTester: method __init__ (line 52) | def __init__( method get_config (line 102) | def get_config(self): method prepare_patchtst_inputs_dict (line 122) | def prepare_patchtst_inputs_dict(self, config): method prepare_config_and_inputs (line 137) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 142) | def prepare_config_and_inputs_for_common(self): class PatchTSTModelTest (line 148) | class PatchTSTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 172) | def setUp(self): method test_config (line 181) | def test_config(self): method _prepare_for_class (line 184) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_save_load_strict (line 206) | def test_save_load_strict(self): method test_hidden_states_output (line 216) | def test_hidden_states_output(self): method test_resize_tokens_embeddings (line 251) | def test_resize_tokens_embeddings(self): method test_model_main_input_name (line 254) | def test_model_main_input_name(self): method test_forward_signature (line 260) | def test_forward_signature(self): method test_retain_grad_hidden_states_attentions (line 296) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 300) | def test_model_get_set_embeddings(self): function prepare_batch (line 304) | def prepare_batch(repo_id="hf-internal-testing/etth1-hourly-batch", file... class PatchTSTModelIntegrationTests (line 314) | class PatchTSTModelIntegrationTests(unittest.TestCase): method test_pretrain_head (line 316) | def test_pretrain_head(self): method test_prediction_head (line 335) | def test_prediction_head(self): method test_prediction_generation (line 354) | def test_prediction_generation(self): method test_regression_generation (line 372) | def test_regression_generation(self): FILE: tests/models/pe_audio/test_modeling_pe_audio.py class PeAudioEncoderTester (line 46) | class PeAudioEncoderTester: method __init__ (line 47) | def __init__( method seq_length (line 96) | def seq_length(self): method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method get_config (line 113) | def get_config(self): method create_and_check_model (line 118) | def create_and_check_model(self, config, input_values, padding_mask): method prepare_config_and_inputs_for_common (line 126) | def prepare_config_and_inputs_for_common(self): class PeAudioEncoderTest (line 134) | class PeAudioEncoderTest(ModelTesterMixin, unittest.TestCase): method setUp (line 139) | def setUp(self): method test_config (line 145) | def test_config(self): method test_model (line 148) | def test_model(self): method test_model_get_set_embeddings (line 153) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 157) | def test_feed_forward_chunking(self): method test_sdpa_can_dispatch_on_flash (line 161) | def test_sdpa_can_dispatch_on_flash(self): class PeAudioTextModelTester (line 165) | class PeAudioTextModelTester: method __init__ (line 170) | def __init__( method prepare_config_and_inputs (line 208) | def prepare_config_and_inputs(self): method get_config (line 219) | def get_config(self): method prepare_config_and_inputs_for_common (line 222) | def prepare_config_and_inputs_for_common(self): class PeAudioModelTester (line 229) | class PeAudioModelTester: method __init__ (line 230) | def __init__(self, parent, text_kwargs=None, audio_kwargs=None, is_tra... method prepare_config_and_inputs (line 242) | def prepare_config_and_inputs(self): method get_config (line 250) | def get_config(self): method create_and_check_model (line 259) | def create_and_check_model(self, config, input_ids, attention_mask, in... method prepare_config_and_inputs_for_common (line 268) | def prepare_config_and_inputs_for_common(self): class PeAudioModelTest (line 281) | class PeAudioModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 289) | def setUp(self): method test_config (line 295) | def test_config(self): method test_model (line 298) | def test_model(self): method test_model_get_set_embeddings (line 303) | def test_model_get_set_embeddings(self): method test_hidden_states_output (line 307) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 311) | def test_retain_grad_hidden_states_attentions(self): method test_feed_forward_chunking (line 315) | def test_feed_forward_chunking(self): method test_save_load (line 319) | def test_save_load(self): method test_batching_equivalence (line 323) | def test_batching_equivalence(self): method test_can_init_all_missing_weights (line 327) | def test_can_init_all_missing_weights(self): method test_all_tensors_are_parameter_or_buffer (line 331) | def test_all_tensors_are_parameter_or_buffer(self): class PeAudioIntegrationTest (line 336) | class PeAudioIntegrationTest(unittest.TestCase): method setUp (line 337) | def setUp(self): method test_inference (line 343) | def test_inference(self): method test_inference_frame_level (line 362) | def test_inference_frame_level(self): FILE: tests/models/pe_audio_video/test_modeling_pe_audio_video.py class PeAudioVideoEncoderTester (line 44) | class PeAudioVideoEncoderTester: method __init__ (line 45) | def __init__( method seq_length (line 143) | def seq_length(self): method prepare_config_and_inputs (line 150) | def prepare_config_and_inputs(self): method get_config (line 177) | def get_config(self): method create_and_check_model (line 182) | def create_and_check_model(self, config, input_values, padding_mask, p... method prepare_config_and_inputs_for_common (line 195) | def prepare_config_and_inputs_for_common(self): class PeAudioVideoEncoderTest (line 208) | class PeAudioVideoEncoderTest(ModelTesterMixin, unittest.TestCase): method setUp (line 215) | def setUp(self): method test_config (line 221) | def test_config(self): method test_model (line 224) | def test_model(self): method test_reverse_loading_mapping (line 229) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_model_get_set_embeddings (line 233) | def test_model_get_set_embeddings(self): method test_sdpa_can_dispatch_composite_models (line 237) | def test_sdpa_can_dispatch_composite_models(self): method test_can_set_attention_dynamically_composite_model (line 243) | def test_can_set_attention_dynamically_composite_model(self): method test_can_be_initialized_on_meta (line 247) | def test_can_be_initialized_on_meta(self): method test_can_load_with_meta_device_context_manager (line 251) | def test_can_load_with_meta_device_context_manager(self): method test_feed_forward_chunking (line 255) | def test_feed_forward_chunking(self): method test_save_load (line 259) | def test_save_load(self): method test_model_parallelism (line 263) | def test_model_parallelism(self): method test_batching_equivalence (line 267) | def test_batching_equivalence(self): method test_can_init_all_missing_weights (line 271) | def test_can_init_all_missing_weights(self): class PeAudioVideoModelIntegrationTest (line 276) | class PeAudioVideoModelIntegrationTest(unittest.TestCase): method setUp (line 277) | def setUp(self): method tearDown (line 282) | def tearDown(self): method test (line 287) | def test(self): FILE: tests/models/pe_video/test_modeling_pe_video.py class PeVideoEncoderTester (line 44) | class PeVideoEncoderTester: method __init__ (line 45) | def __init__( method seq_length (line 92) | def seq_length(self): method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method create_and_check_model (line 118) | def create_and_check_model(self, config, pixel_values_videos, padding_... method prepare_config_and_inputs_for_common (line 126) | def prepare_config_and_inputs_for_common(self): class PeVideoEncoderTest (line 134) | class PeVideoEncoderTest(ModelTesterMixin, unittest.TestCase): method setUp (line 139) | def setUp(self): method test_config (line 145) | def test_config(self): method test_model (line 148) | def test_model(self): method test_reverse_loading_mapping (line 153) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_can_init_all_missing_weights (line 157) | def test_can_init_all_missing_weights(self): method test_model_get_set_embeddings (line 161) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 165) | def test_attention_outputs(self): method test_can_be_initialized_on_meta (line 169) | def test_can_be_initialized_on_meta(self): method test_can_load_with_meta_device_context_manager (line 173) | def test_can_load_with_meta_device_context_manager(self): method test_retain_grad_hidden_states_attentions (line 177) | def test_retain_grad_hidden_states_attentions(self): method test_feed_forward_chunking (line 181) | def test_feed_forward_chunking(self): method test_save_load (line 185) | def test_save_load(self): method test_model_parallelism (line 189) | def test_model_parallelism(self): method test_batching_equivalence (line 193) | def test_batching_equivalence(self): class PeVideoTextModelTester (line 197) | class PeVideoTextModelTester: method __init__ (line 202) | def __init__( method prepare_config_and_inputs (line 240) | def prepare_config_and_inputs(self): method get_config (line 251) | def get_config(self): method prepare_config_and_inputs_for_common (line 254) | def prepare_config_and_inputs_for_common(self): class PeVideoModelTester (line 261) | class PeVideoModelTester: method __init__ (line 262) | def __init__(self, parent, text_kwargs=None, video_kwargs=None, is_tra... method prepare_config_and_inputs (line 274) | def prepare_config_and_inputs(self): method get_config (line 282) | def get_config(self): method create_and_check_model (line 291) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 300) | def prepare_config_and_inputs_for_common(self): class PeVideoModelTest (line 313) | class PeVideoModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 321) | def setUp(self): method test_config (line 327) | def test_config(self): method test_model (line 330) | def test_model(self): method test_reverse_loading_mapping (line 335) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_model_get_set_embeddings (line 339) | def test_model_get_set_embeddings(self): method test_can_set_attention_dynamically_composite_model (line 345) | def test_can_set_attention_dynamically_composite_model(self): method test_hidden_states_output (line 349) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 353) | def test_retain_grad_hidden_states_attentions(self): method test_feed_forward_chunking (line 357) | def test_feed_forward_chunking(self): method test_save_load (line 361) | def test_save_load(self): method test_batching_equivalence (line 365) | def test_batching_equivalence(self): method test_can_init_all_missing_weights (line 369) | def test_can_init_all_missing_weights(self): method test_model_parallelism (line 373) | def test_model_parallelism(self): method test_all_tensors_are_parameter_or_buffer (line 377) | def test_all_tensors_are_parameter_or_buffer(self): class PeVideoIntegrationTest (line 382) | class PeVideoIntegrationTest(unittest.TestCase): method test_inference (line 384) | def test_inference(self): FILE: tests/models/pegasus/test_modeling_pegasus.py function prepare_pegasus_inputs_dict (line 46) | def prepare_pegasus_inputs_dict( class PegasusModelTester (line 66) | class PegasusModelTester: method __init__ (line 67) | def __init__( method prepare_config_and_inputs (line 105) | def prepare_config_and_inputs(self): method get_pipeline_config (line 118) | def get_pipeline_config(self): method get_config (line 136) | def get_config(self): method prepare_config_and_inputs_for_common (line 154) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 158) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 191) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class PegasusModelTest (line 225) | class PegasusModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 240) | def setUp(self): method test_config (line 244) | def test_config(self): method test_save_load_strict (line 247) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 257) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 261) | def test_encoder_decoder_model_standalone(self): method test_generate_fp16 (line 266) | def test_generate_fp16(self): method test_training_gradient_checkpointing (line 276) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 280) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 284) | def test_training_gradient_checkpointing_use_reentrant_true(self): function assert_tensors_close (line 288) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 307) | def _long_tensor(tok_lst): class PegasusXSUMIntegrationTest (line 314) | class PegasusXSUMIntegrationTest(AbstractSeq2SeqIntegrationTest): method model (line 327) | def model(self): method test_device_map (line 331) | def test_device_map(self): method test_pegasus_xsum_summary (line 345) | def test_pegasus_xsum_summary(self): class PegasusStandaloneDecoderModelTester (line 364) | class PegasusStandaloneDecoderModelTester: method __init__ (line 365) | def __init__( method prepare_config_and_inputs (line 420) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 455) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 491) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 538) | def prepare_config_and_inputs_for_common(self): class PegasusStandaloneDecoderModelTest (line 555) | class PegasusStandaloneDecoderModelTest(ModelTesterMixin, GenerationTest... method setUp (line 561) | def setUp( method test_config (line 567) | def test_config(self): method test_decoder_model_past (line 570) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 574) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 579) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 583) | def test_flex_attention_with_grads(): FILE: tests/models/pegasus/test_tokenization_pegasus.py class PegasusTokenizationTest (line 30) | class PegasusTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method _large_tokenizer (line 41) | def _large_tokenizer(self): method test_large_mask_tokens (line 45) | def test_large_mask_tokens(self): method test_large_tokenizer_settings (line 54) | def test_large_tokenizer_settings(self): method test_large_seq2seq_truncation (line 72) | def test_large_seq2seq_truncation(self): method test_tokenizer_integration (line 86) | def test_tokenizer_integration(self): class BigBirdPegasusTokenizationTest (line 98) | class BigBirdPegasusTokenizationTest(TokenizerTesterMixin, unittest.Test... method setUpClass (line 105) | def setUpClass(cls): method _large_tokenizer (line 115) | def _large_tokenizer(self): method get_tokenizer (line 119) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> PegasusToken... method get_input_output_texts (line 123) | def get_input_output_texts(self, tokenizer): method test_large_seq2seq_truncation (line 127) | def test_large_seq2seq_truncation(self): method test_equivalence_to_orig_tokenizer (line 140) | def test_equivalence_to_orig_tokenizer(self): FILE: tests/models/pegasus_x/test_modeling_pegasus_x.py function prepare_pegasus_x_inputs_dict (line 45) | def prepare_pegasus_x_inputs_dict( class PegasusXModelTester (line 65) | class PegasusXModelTester: method __init__ (line 66) | def __init__( method prepare_config_and_inputs (line 104) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 132) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 136) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 169) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class PegasusXModelTest (line 203) | class PegasusXModelTest(ModelTesterMixin, GenerationTesterMixin, Pipelin... method setUp (line 216) | def setUp(self): method test_config (line 220) | def test_config(self): method test_save_load_strict (line 223) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 233) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 237) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 241) | def test_inputs_embeds(self): method test_generate_fp16 (line 271) | def test_generate_fp16(self): method test_attention_outputs (line 280) | def test_attention_outputs(self): method _check_encoder_attention_for_generate (line 391) | def _check_encoder_attention_for_generate(self, attentions, batch_size... method _check_encoder_hidden_states_for_generate (line 405) | def _check_encoder_hidden_states_for_generate(self, hidden_states, bat... method test_hidden_states_output (line 419) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 472) | def test_retain_grad_hidden_states_attentions(self): method round_up (line 534) | def round_up(cls, n, k): function assert_tensors_close (line 538) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 557) | def _long_tensor(tok_lst): class PegasusXModelIntegrationTests (line 568) | class PegasusXModelIntegrationTests(unittest.TestCase): method default_tokenizer (line 570) | def default_tokenizer(self): method test_inference_no_head (line 573) | def test_inference_no_head(self): method test_inference_head (line 589) | def test_inference_head(self): method test_seq_to_seq_generation (line 607) | def test_seq_to_seq_generation(self): class PegasusXStandaloneDecoderModelTester (line 650) | class PegasusXStandaloneDecoderModelTester: method __init__ (line 651) | def __init__( method prepare_config_and_inputs (line 706) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 740) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 776) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 821) | def prepare_config_and_inputs_for_common(self): class PegasusXStandaloneDecoderModelTest (line 838) | class PegasusXStandaloneDecoderModelTest(ModelTesterMixin, unittest.Test... method setUp (line 843) | def setUp( method test_config (line 849) | def test_config(self): method test_decoder_model_past (line 852) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 856) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 861) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 865) | def test_flex_attention_with_grads(): FILE: tests/models/perceiver/test_image_processing_perceiver.py class PerceiverImageProcessingTester (line 35) | class PerceiverImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 74) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 88) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 91) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PerceiverImageProcessingTest (line 105) | class PerceiverImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 106) | def setUp(self): method image_processor_dict (line 111) | def image_processor_dict(self): method test_image_processor_properties (line 114) | def test_image_processor_properties(self): method test_call_numpy (line 128) | def test_call_numpy(self): method test_call_numpy_4_channels (line 150) | def test_call_numpy_4_channels(self): method test_call_pil (line 175) | def test_call_pil(self): method test_call_pytorch (line 196) | def test_call_pytorch(self): FILE: tests/models/perceiver/test_modeling_perceiver.py class PerceiverModelTester (line 72) | class PerceiverModelTester: method __init__ (line 73) | def __init__( method prepare_config_and_inputs (line 143) | def prepare_config_and_inputs(self, model_class=None): method get_config (line 187) | def get_config(self): method get_pipeline_config (line 215) | def get_pipeline_config(self): method create_and_check_for_masked_lm (line 222) | def create_and_check_for_masked_lm(self, config, inputs, input_mask, s... method create_and_check_for_sequence_classification (line 229) | def create_and_check_for_sequence_classification(self, config, inputs,... method create_and_check_for_image_classification_learned (line 236) | def create_and_check_for_image_classification_learned( method create_and_check_for_learned_image_interpolate_pos (line 245) | def create_and_check_for_learned_image_interpolate_pos( method create_and_check_for_image_classification_fourier (line 257) | def create_and_check_for_image_classification_fourier( method create_and_check_for_image_classification_conv (line 266) | def create_and_check_for_image_classification_conv( method prepare_config_and_inputs_for_common (line 275) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_model_class (line 281) | def prepare_config_and_inputs_for_model_class(self, model_class): class PerceiverModelTest (line 290) | class PerceiverModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method setUp (line 323) | def setUp(self): method _prepare_for_class (line 332) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 358) | def test_config(self): method test_for_masked_lm (line 361) | def test_for_masked_lm(self): method test_for_sequence_classification (line 365) | def test_for_sequence_classification(self): method test_for_image_classification_learned (line 369) | def test_for_image_classification_learned(self): method test_for_learned_image_interpolate_pos (line 375) | def test_for_learned_image_interpolate_pos(self): method test_for_image_classification_fourier (line 381) | def test_for_image_classification_fourier(self): method test_for_image_classification_conv (line 387) | def test_for_image_classification_conv(self): method test_model_get_set_embeddings (line 393) | def test_model_get_set_embeddings(self): method test_training (line 401) | def test_training(self): method test_forward_signature (line 423) | def test_forward_signature(self): method test_determinism (line 435) | def test_determinism(self): method test_attention_outputs (line 464) | def test_attention_outputs(self): method test_hidden_states_output (line 532) | def test_hidden_states_output(self): method test_model_outputs_equivalence (line 565) | def test_model_outputs_equivalence(self): method test_retain_grad_hidden_states_attentions (line 647) | def test_retain_grad_hidden_states_attentions(self): method test_feed_forward_chunking (line 675) | def test_feed_forward_chunking(self): method test_save_load (line 702) | def test_save_load(self): method test_correct_missing_keys (line 747) | def test_correct_missing_keys(self): method test_problem_types (line 775) | def test_problem_types(self): method test_multi_gpu_data_parallel_forward (line 826) | def test_multi_gpu_data_parallel_forward(self): method test_resize_tokens_embeddings (line 830) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 834) | def test_resize_embeddings_untied(self): method test_inputs_embeds (line 838) | def test_inputs_embeds(self): method test_load_with_mismatched_shapes (line 842) | def test_load_with_mismatched_shapes(self): method test_model_from_pretrained (line 846) | def test_model_from_pretrained(self): function prepare_img (line 853) | def prepare_img(): function prepare_optical_flow_images (line 859) | def prepare_optical_flow_images(): function normalize (line 864) | def normalize(img): function extract_image_patches (line 868) | def extract_image_patches(x, kernel, stride=1, dilation=1): class PerceiverModelIntegrationTest (line 886) | class PerceiverModelIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 888) | def test_inference_masked_lm(self): method test_inference_image_classification (line 922) | def test_inference_image_classification(self): method test_inference_image_classification_fourier (line 947) | def test_inference_image_classification_fourier(self): method test_inference_image_classification_conv (line 971) | def test_inference_image_classification_conv(self): method test_inference_optical_flow (line 995) | def test_inference_optical_flow(self): method test_inference_interpolate_pos_encoding (line 1039) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/perceiver/test_tokenization_perceiver.py class PerceiverTokenizationTest (line 26) | class PerceiverTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 32) | def setUpClass(cls): method perceiver_tokenizer (line 38) | def perceiver_tokenizer(self): method get_tokenizer (line 42) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> PerceiverTok... method get_clean_sequence (line 46) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method test_multibytes_char (line 84) | def test_multibytes_char(self): method test_prepare_batch_integration (line 105) | def test_prepare_batch_integration(self): method test_empty_target_text (line 119) | def test_empty_target_text(self): method test_max_length_integration (line 129) | def test_max_length_integration(self): method test_save_and_load_tokenizer (line 141) | def test_save_and_load_tokenizer(self): method test_decode_invalid_byte_id (line 192) | def test_decode_invalid_byte_id(self): method test_get_vocab (line 197) | def test_get_vocab(self): method test_pretokenized_inputs (line 201) | def test_pretokenized_inputs(self): method test_conversion_reversible (line 206) | def test_conversion_reversible(self): method test_convert_tokens_to_string_format (line 209) | def test_convert_tokens_to_string_format(self): FILE: tests/models/perception_lm/test_image_processing_perception_lm.py class PerceptionLMImageProcessingTester (line 33) | class PerceptionLMImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 71) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 85) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 89) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PerceptionLMImageProcessingTest (line 103) | class PerceptionLMImageProcessingTest(ImageProcessingTestMixin, unittest... method setUp (line 104) | def setUp(self): method image_processor_dict (line 110) | def image_processor_dict(self): method test_image_processor_properties (line 113) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 125) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 139) | def test_call_pil(self): method test_call_numpy (line 158) | def test_call_numpy(self): method test_call_pytorch (line 177) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 198) | def test_call_numpy_4_channels(self): method test_nested_input (line 201) | def test_nested_input(self): FILE: tests/models/perception_lm/test_modeling_perception_lm.py class PerceptionLMVisionText2TextModelTester (line 45) | class PerceptionLMVisionText2TextModelTester: method __init__ (line 46) | def __init__( method get_config (line 115) | def get_config(self): method prepare_config_and_inputs (line 125) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 148) | def prepare_config_and_inputs_for_common(self): class PerceptionLMForConditionalGenerationModelTest (line 167) | class PerceptionLMForConditionalGenerationModelTest(ModelTesterMixin, Ge... method setUp (line 183) | def setUp(self): method test_config (line 196) | def test_config(self): method test_inputs_embeds (line 200) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 223) | def test_inputs_embeds_matches_input_ids(self): method test_mismatching_num_image_tokens (line 244) | def test_mismatching_num_image_tokens(self): method test_training (line 276) | def test_training(self): method test_training_gradient_checkpointing (line 280) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 284) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 288) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_reverse_loading_mapping (line 293) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_flash_attn_2_can_dispatch_composite_models (line 299) | def test_flash_attn_2_can_dispatch_composite_models(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 305) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_can_be_initialized_on_meta (line 309) | def test_can_be_initialized_on_meta(self): method test_generate_from_inputs_embeds_0_greedy (line 313) | def test_generate_from_inputs_embeds_0_greedy(self): method test_generate_from_inputs_embeds_1_beam_search (line 317) | def test_generate_from_inputs_embeds_1_beam_search(self): method test_generate_from_inputs_embeds_with_static_cache (line 321) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_eager_matches_fa2_generate (line 328) | def test_eager_matches_fa2_generate(self): method test_flash_attn_2_fp32_ln (line 332) | def test_flash_attn_2_fp32_ln(self): method test_flash_attn_2_from_config (line 336) | def test_flash_attn_2_from_config(self): method test_eager_matches_sdpa_generate_with_dynamic_cache (line 340) | def test_eager_matches_sdpa_generate_with_dynamic_cache(self): method test_flash_attn_2_inference_equivalence_right_padding (line 344) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_eager_matches_sdpa_generate (line 348) | def test_eager_matches_sdpa_generate(self): method test_flash_attn_2_inference_equivalence (line 352) | def test_flash_attn_2_inference_equivalence(self): method test_sdpa_can_dispatch_composite_models (line 358) | def test_sdpa_can_dispatch_composite_models(self): method test_attention_outputs (line 362) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 366) | def test_retain_grad_hidden_states_attentions(self): method test_generate_compilation_all_outputs (line 370) | def test_generate_compilation_all_outputs(self): method test_get_image_features_attentions (line 374) | def test_get_image_features_attentions(self): method _image_features_get_expected_num_hidden_states (line 377) | def _image_features_get_expected_num_hidden_states(self, model_tester=... class PerceptionLMForConditionalGenerationIntegrationTest (line 389) | class PerceptionLMForConditionalGenerationIntegrationTest(unittest.TestC... method setUp (line 390) | def setUp(self): method tearDown (line 424) | def tearDown(self): method test_small_model_integration_test (line 427) | def test_small_model_integration_test(self): method test_small_model_integration_test_batched (line 454) | def test_small_model_integration_test_batched(self): method test_generation_no_images (line 481) | def test_generation_no_images(self): FILE: tests/models/perception_lm/test_processing_perception_lm.py class PerceptionLMProcessorTest (line 35) | class PerceptionLMProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 39) | def _setup_image_processor(cls): method _setup_tokenizer (line 44) | def _setup_tokenizer(cls): method _setup_test_attributes (line 50) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 55) | def prepare_processor_dict(): method test_chat_template_is_saved (line 62) | def test_chat_template_is_saved(self): method test_image_token_filling (line 73) | def test_image_token_filling(self): method test_vanilla_image_with_no_tiles_token_filling (line 100) | def test_vanilla_image_with_no_tiles_token_filling(self): FILE: tests/models/perception_lm/test_video_processing_perception_lm.py class PerceptionLMVideoProcessingTester (line 29) | class PerceptionLMVideoProcessingTester: method __init__ (line 30) | def __init__( method prepare_video_processor_dict (line 64) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 76) | def expected_output_video_shape(self, images): method prepare_video_inputs (line 79) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class PerceptionLMVideoProcessingTest (line 94) | class PerceptionLMVideoProcessingTest(VideoProcessingTestMixin, unittest... method setUp (line 97) | def setUp(self): method video_processor_dict (line 102) | def video_processor_dict(self): method test_video_processor_properties (line 105) | def test_video_processor_properties(self): method test_video_processor_from_dict_with_kwargs (line 116) | def test_video_processor_from_dict_with_kwargs(self): FILE: tests/models/persimmon/test_modeling_persimmon.py class PersimmonModelTester (line 46) | class PersimmonModelTester(CausalLMModelTester): class PersimmonModelTest (line 52) | class PersimmonModelTest(CausalLMModelTest, unittest.TestCase): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 68) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_eager_padding_matches_padding_free_with_position_ids (line 72) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 76) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): class PersimmonIntegrationTest (line 81) | class PersimmonIntegrationTest(unittest.TestCase): method test_model_8b_chat_logits (line 85) | def test_model_8b_chat_logits(self): method test_model_8b_chat_greedy_generation (line 116) | def test_model_8b_chat_greedy_generation(self): FILE: tests/models/phi/test_modeling_phi.py class PhiModelTester (line 39) | class PhiModelTester(CausalLMModelTester): class PhiModelTest (line 45) | class PhiModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 49) | def is_pipeline_test_to_skip( class PhiIntegrationTest (line 64) | class PhiIntegrationTest(unittest.TestCase): method test_model_phi_1_logits (line 65) | def test_model_phi_1_logits(self): method test_model_phi_1_5_logits (line 81) | def test_model_phi_1_5_logits(self): method test_model_phi_2_logits (line 97) | def test_model_phi_2_logits(self): method test_phi_2_generation (line 113) | def test_phi_2_generation(self): FILE: tests/models/phi3/test_modeling_phi3.py class Phi3MiniWithStaticCache (line 44) | class Phi3MiniWithStaticCache(torch.nn.Module): method __init__ (line 45) | def __init__(self, model: Phi3ForCausalLM, batch_size: int, max_seq_le... method forward (line 50) | def forward( method generate (line 62) | def generate(model: Phi3ForCausalLM, prompt_tokens: torch.LongTensor, ... class Phi3ModelTester (line 86) | class Phi3ModelTester(CausalLMModelTester): method __init__ (line 90) | def __init__(self, parent): class Phi3ModelTest (line 99) | class Phi3ModelTest(CausalLMModelTest, unittest.TestCase): class Phi3IntegrationTest (line 105) | class Phi3IntegrationTest(unittest.TestCase): method test_model_phi3_mini_4k_instruct_logits (line 106) | def test_model_phi3_mini_4k_instruct_logits(self): method test_phi3_mini_4k_instruct_generation (line 129) | def test_phi3_mini_4k_instruct_generation(self): method test_phi3_mini_4k_instruct_with_static_cache (line 151) | def test_phi3_mini_4k_instruct_with_static_cache(self): method test_model_phi3_mini_128k_instruct_logits (line 174) | def test_model_phi3_mini_128k_instruct_logits(self): method test_phi3_mini_128k_instruct_generation (line 197) | def test_phi3_mini_128k_instruct_generation(self): method test_phi3_mini_128k_instruct_with_static_cache (line 219) | def test_phi3_mini_128k_instruct_with_static_cache(self): method test_phi3_mini_4k_sliding_window (line 242) | def test_phi3_mini_4k_sliding_window(self): method test_export_static_cache (line 334) | def test_export_static_cache(self): FILE: tests/models/phi4_multimodal/test_feature_extraction_phi4_multimodal.py function floats_list (line 38) | def floats_list(shape, scale=1.0, rng=None, name=None): class Phi4MultimodalFeatureExtractionTester (line 52) | class Phi4MultimodalFeatureExtractionTester: method __init__ (line 53) | def __init__( method prepare_feat_extract_dict (line 80) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 91) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class Phi4MultimodalFeatureExtractionTest (line 108) | class Phi4MultimodalFeatureExtractionTest(SequenceFeatureExtractionTestM... method setUp (line 111) | def setUp(self): method test_feat_extract_from_and_save_pretrained (line 114) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 129) | def test_feat_extract_to_json_file(self): method test_feat_extract_from_pretrained_kwargs (line 144) | def test_feat_extract_from_pretrained_kwargs(self): method test_call (line 158) | def test_call(self): method test_double_precision_pad (line 194) | def test_double_precision_pad(self): method _load_datasamples (line 207) | def _load_datasamples(self, num_samples): method test_torch_integration (line 215) | def test_torch_integration(self): method test_numpy_integration (line 237) | def test_numpy_integration(self): method test_torch_integration_batch (line 257) | def test_torch_integration_batch(self): FILE: tests/models/phi4_multimodal/test_image_processing_phi4_multimodal.py class Phi4MultimodalImageProcessingTester (line 37) | class Phi4MultimodalImageProcessingTester: method __init__ (line 38) | def __init__( method prepare_image_processor_dict (line 72) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 84) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 100) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Phi4MultimodalImageProcessingTest (line 114) | class Phi4MultimodalImageProcessingTest(ImageProcessingTestMixin, unitte... method setUp (line 115) | def setUp(self): method image_processor_dict (line 120) | def image_processor_dict(self): method test_image_processor_properties (line 123) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 135) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 144) | def test_call_numpy_4_channels(self): method test_cast_dtype_device (line 147) | def test_cast_dtype_device(self): method test_call_pil (line 181) | def test_call_pil(self): method test_call_numpy (line 202) | def test_call_numpy(self): method test_call_pytorch (line 223) | def test_call_pytorch(self): method test_image_processor_preprocess_arguments (line 246) | def test_image_processor_preprocess_arguments(self): method test_can_compile_torchvision_backend (line 285) | def test_can_compile_torchvision_backend(self): FILE: tests/models/phi4_multimodal/test_modeling_phi4_multimodal.py class Phi4MultimodalModelTester (line 61) | class Phi4MultimodalModelTester: method __init__ (line 62) | def __init__( method get_config (line 125) | def get_config(self): method prepare_config_and_inputs (line 140) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 174) | def prepare_config_and_inputs_for_common(self): class Phi4MultimodalModelTest (line 198) | class Phi4MultimodalModelTest(ModelTesterMixin, GenerationTesterMixin, u... method setUp (line 208) | def setUp(self): method test_training_gradient_checkpointing (line 213) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 217) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 221) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_multi_gpu_data_parallel_forward (line 225) | def test_multi_gpu_data_parallel_forward(self): method test_sdpa_can_dispatch_composite_models (line 229) | def test_sdpa_can_dispatch_composite_models(self): method test_generate_from_inputs_embeds_with_static_cache (line 233) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_with_static_cache (line 237) | def test_generate_with_static_cache(self): method test_generate_compilation_all_outputs (line 243) | def test_generate_compilation_all_outputs(self): method test_generate_compile_model_forward_fullgraph (line 250) | def test_generate_compile_model_forward_fullgraph(self): method test_assisted_decoding_matches_greedy_search (line 255) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_assisted_decoding_sample (line 259) | def test_assisted_decoding_sample(self): method test_prompt_lookup_decoding_matches_greedy_search (line 263) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 267) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flex_attention_with_grads (line 271) | def test_flex_attention_with_grads(self): class Phi4MultimodalIntegrationTest (line 277) | class Phi4MultimodalIntegrationTest(unittest.TestCase): method setUp (line 283) | def setUp(self): method tearDown (line 298) | def tearDown(self): method test_text_only_generation (line 301) | def test_text_only_generation(self): method test_vision_text_generation (line 320) | def test_vision_text_generation(self): method test_multi_image_vision_text_generation (line 346) | def test_multi_image_vision_text_generation(self): method test_audio_text_generation (line 373) | def test_audio_text_generation(self): FILE: tests/models/phi4_multimodal/test_processing_phi4_multimodal.py class Phi4MultimodalProcessorTest (line 32) | class Phi4MultimodalProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 56) | def _setup_tokenizer(cls): method _setup_test_attributes (line 61) | def _setup_test_attributes(cls, processor): method test_model_input_names (line 68) | def test_model_input_names(self): method test_dynamic_hd_kwarg_passed_to_image_processor (line 87) | def test_dynamic_hd_kwarg_passed_to_image_processor(self): FILE: tests/models/phimoe/test_modeling_phimoe.py class PhimoeMiniWithStaticCache (line 43) | class PhimoeMiniWithStaticCache(torch.nn.Module): method __init__ (line 44) | def __init__(self, model: PhimoeForCausalLM, batch_size: int, max_seq_... method forward (line 49) | def forward( method generate (line 62) | def generate(model: PhimoeForCausalLM, prompt_tokens: torch.LongTensor... class PhimoeModelTester (line 86) | class PhimoeModelTester(CausalLMModelTester): class PhimoeModelTest (line 92) | class PhimoeModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 97) | def is_pipeline_test_to_skip( method test_model_rope_scaling_frequencies (line 103) | def test_model_rope_scaling_frequencies(self): method test_model_rope_scaling_from_config (line 108) | def test_model_rope_scaling_from_config(self, scaling_type): class PhimoeIntegrationTest (line 114) | class PhimoeIntegrationTest(unittest.TestCase): method get_model (line 118) | def get_model(cls): method tearDownClass (line 126) | def tearDownClass(cls): method setUp (line 130) | def setUp(self): method tearDown (line 133) | def tearDown(self): method test_model_phimoe_instruct_logits (line 136) | def test_model_phimoe_instruct_logits(self): method test_phimoe_instruct_generation (line 154) | def test_phimoe_instruct_generation(self): method test_phimoe_instruct_with_static_cache (line 175) | def test_phimoe_instruct_with_static_cache(self): FILE: tests/models/phobert/test_tokenization_phobert.py class PhobertTokenizationTest (line 23) | class PhobertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 29) | def setUpClass(cls): method get_tokenizer (line 47) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_input_output_texts (line 52) | def get_input_output_texts(self, tokenizer): method test_full_tokenizer (line 57) | def test_full_tokenizer(self): FILE: tests/models/pi0/test_modeling_pi0.py class PI0ModelTester (line 47) | class PI0ModelTester: method __init__ (line 48) | def __init__(self, parent): method get_config (line 105) | def get_config(self): method prepare_config_and_inputs_for_common (line 120) | def prepare_config_and_inputs_for_common(self): class PI0ForConditionalGenerationModelTest (line 155) | class PI0ForConditionalGenerationModelTest(ModelTesterMixin, unittest.Te... method setUp (line 167) | def setUp(self): method test_config (line 171) | def test_config(self): method test_model_loss_per_sample (line 174) | def test_model_loss_per_sample(self): method test_eager_matches_sdpa_inference (line 184) | def test_eager_matches_sdpa_inference( method test_reverse_loading_mapping (line 193) | def test_reverse_loading_mapping(self): method test_flex_attention_with_grads (line 197) | def test_flex_attention_with_grads(self): method test_enable_input_require_grads_with_gradient_checkpointing (line 201) | def test_enable_input_require_grads_with_gradient_checkpointing(self): method test_training_gradient_checkpointing (line 205) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 209) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 213) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_full_run_smoke (line 216) | def test_full_run_smoke(self): class PI0ModelIntegrationTest (line 238) | class PI0ModelIntegrationTest(unittest.TestCase): method test_pi0_base_reference_values (line 239) | def test_pi0_base_reference_values(self): method test_pi0_base_libero (line 311) | def test_pi0_base_libero(self): method test_train_pi0_base_libero (line 353) | def test_train_pi0_base_libero(self): FILE: tests/models/pi0/test_processing_pi0.py class PI0ProcessorTest (line 34) | class PI0ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 38) | def _setup_image_processor(cls): method _setup_tokenizer (line 44) | def _setup_tokenizer(cls): method _setup_test_attributes (line 50) | def _setup_test_attributes(cls, processor): method prepare_image_inputs (line 54) | def prepare_image_inputs(self, batch_size: int | None = None, nested: ... method test_image_processor_defaults (line 57) | def test_image_processor_defaults(self): method test_single_camera_output_is_5d (line 70) | def test_single_camera_output_is_5d(self): method test_multi_camera_padding_and_masks (line 80) | def test_multi_camera_padding_and_masks(self): method test_newline_normalization (line 97) | def test_newline_normalization(self): method test_get_num_multimodal_tokens_matches_processor_call (line 106) | def test_get_num_multimodal_tokens_matches_processor_call(self): FILE: tests/models/pix2struct/test_image_processing_pix2struct.py class Pix2StructImageProcessingTester (line 35) | class Pix2StructImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 62) | def prepare_image_processor_dict(self): method prepare_dummy_image (line 65) | def prepare_dummy_image(self): method prepare_image_inputs (line 72) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Pix2StructImageProcessingTest (line 86) | class Pix2StructImageProcessingTest(ImageProcessingTestMixin, unittest.T... method setUp (line 87) | def setUp(self): method image_processor_dict (line 92) | def image_processor_dict(self): method test_backends_equivalence (line 97) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 129) | def test_backends_equivalence_batched(self): method test_image_processor_properties (line 149) | def test_image_processor_properties(self): method test_expected_patches (line 155) | def test_expected_patches(self): method test_call_pil (line 165) | def test_call_pil(self): method test_call_vqa (line 199) | def test_call_vqa(self): method test_call_numpy (line 242) | def test_call_numpy(self): method test_call_numpy_4_channels (line 275) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 310) | def test_call_pytorch(self): method test_can_compile_torchvision_backend (line 347) | def test_can_compile_torchvision_backend(self): class Pix2StructImageProcessingTestFourChannels (line 366) | class Pix2StructImageProcessingTestFourChannels(ImageProcessingTestMixin... method setUp (line 367) | def setUp(self): method image_processor_dict (line 373) | def image_processor_dict(self): method test_image_processor_properties (line 376) | def test_image_processor_properties(self): method test_call_pil (line 382) | def test_call_pil(self): method test_call_numpy (line 417) | def test_call_numpy(self): method test_call_pytorch (line 421) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 427) | def test_call_numpy_4_channels(self): method test_backends_equivalence (line 431) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 435) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 439) | def test_can_compile_torchvision_backend(self): FILE: tests/models/pix2struct/test_modeling_pix2struct.py class Pix2StructVisionModelTester (line 56) | class Pix2StructVisionModelTester: method __init__ (line 57) | def __init__( method prepare_config_and_inputs (line 98) | def prepare_config_and_inputs(self): method get_config (line 104) | def get_config(self): method create_and_check_model (line 120) | def create_and_check_model(self, config, flattened_patches): method prepare_config_and_inputs_for_common (line 128) | def prepare_config_and_inputs_for_common(self): class Pix2StructVisionModelTest (line 139) | class Pix2StructVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 149) | def setUp(self): method test_config (line 155) | def test_config(self): method test_inputs_embeds (line 159) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 162) | def test_model_get_set_embeddings(self): method test_forward_signature (line 171) | def test_forward_signature(self): method test_model (line 183) | def test_model(self): method test_training (line 188) | def test_training(self): method test_training_gradient_checkpointing (line 192) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 196) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 200) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 204) | def test_retain_grad_hidden_states_attentions(self): method test_model_from_pretrained (line 208) | def test_model_from_pretrained(self): class Pix2StructTextModelTester (line 214) | class Pix2StructTextModelTester: method __init__ (line 215) | def __init__( method prepare_config_and_inputs (line 256) | def prepare_config_and_inputs(self): method get_config (line 274) | def get_config(self): method create_and_check_model (line 290) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 299) | def prepare_config_and_inputs_for_common(self): class Pix2StructTextModelTest (line 307) | class Pix2StructTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 310) | def setUp(self): method test_config (line 314) | def test_config(self): method test_model (line 317) | def test_model(self): method test_training (line 322) | def test_training(self): method test_training_gradient_checkpointing (line 326) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 330) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 334) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 338) | def test_inputs_embeds(self): method test_model_from_pretrained (line 342) | def test_model_from_pretrained(self): class Pix2StructModelTester (line 348) | class Pix2StructModelTester: method __init__ (line 349) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 363) | def prepare_config_and_inputs(self): method get_config (line 371) | def get_config(self, text_config, vision_config): method prepare_config_and_inputs_for_common (line 378) | def prepare_config_and_inputs_for_common(self): class Pix2StructModelTest (line 395) | class Pix2StructModelTest(ModelTesterMixin, GenerationTesterMixin, Pipel... method setUp (line 402) | def setUp(self): method test_model (line 405) | def test_model(self): method test_generative_model (line 420) | def test_generative_model(self): method test_hidden_states_output (line 431) | def test_hidden_states_output(self): method test_inputs_embeds (line 435) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 439) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 443) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 448) | def test_generate_without_input_ids(self): method test_forward_signature (line 451) | def test_forward_signature(self): method test_training (line 474) | def test_training(self): method check_training_gradient_checkpointing (line 493) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_resize_tokens_embeddings (line 515) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 562) | def test_resize_embeddings_untied(self): method test_load_vision_text_config (line 610) | def test_load_vision_text_config(self): method _check_encoder_attention_for_generate (line 625) | def _check_encoder_attention_for_generate(self, attentions, batch_size... method _check_encoder_hidden_states_for_generate (line 635) | def _check_encoder_hidden_states_for_generate(self, hidden_states, bat... method test_model_base_model_prefix (line 646) | def test_model_base_model_prefix(self): function prepare_img (line 651) | def prepare_img(): class Pix2StructIntegrationTest (line 660) | class Pix2StructIntegrationTest(unittest.TestCase): method test_inference_image_captioning (line 661) | def test_inference_image_captioning(self): method test_batched_inference_image_captioning (line 675) | def test_batched_inference_image_captioning(self): method test_batched_inference_image_captioning_conditioned (line 697) | def test_batched_inference_image_captioning_conditioned(self): method test_vqa_model (line 723) | def test_vqa_model(self): method test_vqa_model_batched (line 740) | def test_vqa_model_batched(self): FILE: tests/models/pix2struct/test_processing_pix2struct.py class Pix2StructProcessorTest (line 30) | class Pix2StructProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 36) | def _setup_tokenizer(cls): method test_processor_max_patches (line 40) | def test_processor_max_patches(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 64) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 83) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_unstructured_kwargs (line 101) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 127) | def test_unstructured_kwargs_batched(self): method test_structured_kwargs_nested (line 154) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 183) | def test_structured_kwargs_nested_from_dict(self): FILE: tests/models/pixio/test_modeling_pixio.py class PixioModelTester (line 47) | class PixioModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self): method get_config (line 105) | def get_config(self): method create_and_check_model (line 122) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 129) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 176) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 179) | def prepare_config_and_inputs_for_common(self): class PixioModelTest (line 191) | class PixioModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 211) | def setUp(self): method test_config (line 215) | def test_config(self): method test_model_get_set_embeddings (line 218) | def test_model_get_set_embeddings(self): method test_model (line 227) | def test_model(self): method test_backbone (line 231) | def test_backbone(self): method test_for_image_classification (line 235) | def test_for_image_classification(self): method test_batching_equivalence (line 239) | def test_batching_equivalence(self, atol=1e-4, rtol=1e-4): function prepare_img (line 244) | def prepare_img(): class PixioModelIntegrationTest (line 251) | class PixioModelIntegrationTest(unittest.TestCase): method default_image_processor (line 253) | def default_image_processor(self): method test_inference_no_head (line 257) | def test_inference_no_head(self): class PixioBackboneTest (line 281) | class PixioBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 287) | def setUp(self): FILE: tests/models/pixtral/test_image_processing_pixtral.py class PixtralImageProcessingTester (line 39) | class PixtralImageProcessingTester: method __init__ (line 40) | def __init__( method prepare_image_processor_dict (line 75) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 86) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 116) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PixtralImageProcessingTest (line 131) | class PixtralImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 132) | def setUp(self): method image_processor_dict (line 137) | def image_processor_dict(self): method test_image_processor_properties (line 140) | def test_image_processor_properties(self): method test_call_pil (line 156) | def test_call_pil(self): method test_call_numpy (line 175) | def test_call_numpy(self): method test_call_pytorch (line 194) | def test_call_pytorch(self): method test_can_compile_torchvision_backend (line 217) | def test_can_compile_torchvision_backend(self): method test_call_numpy_4_channels (line 234) | def test_call_numpy_4_channels(self): FILE: tests/models/pixtral/test_modeling_pixtral.py class PixtralVisionModelTester (line 36) | class PixtralVisionModelTester: method __init__ (line 37) | def __init__( method prepare_config_and_inputs (line 74) | def prepare_config_and_inputs(self): method get_config (line 83) | def get_config(self): method prepare_config_and_inputs_for_common (line 98) | def prepare_config_and_inputs_for_common(self): class PixtralVisionModelModelTest (line 106) | class PixtralVisionModelModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 117) | def setUp(self): method test_model_get_set_embeddings (line 121) | def test_model_get_set_embeddings(self): FILE: tests/models/pixtral/test_processing_pixtral.py class PixtralProcessorTest (line 31) | class PixtralProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 36) | def _setup_test_attributes(cls, processor): method test_apply_chat_template_image (line 48) | def test_apply_chat_template_image(self, batch_size, return_tensors): method test_image_token_filling (line 51) | def test_image_token_filling(self): method test_from_pretrained_subfolder_tokenizer (line 75) | def test_from_pretrained_subfolder_tokenizer(self): method test_processor_with_single_image (line 80) | def test_processor_with_single_image(self): method test_processor_with_multiple_images_single_list (line 144) | def test_processor_with_multiple_images_single_list(self): method test_processor_with_multiple_images_multiple_lists (line 197) | def test_processor_with_multiple_images_multiple_lists(self): method test_processor_returns_full_length_batches (line 257) | def test_processor_returns_full_length_batches(self): FILE: tests/models/plbart/test_modeling_plbart.py function prepare_plbart_inputs_dict (line 50) | def prepare_plbart_inputs_dict( class PLBartModelTester (line 70) | class PLBartModelTester: method __init__ (line 71) | def __init__( method prepare_config_and_inputs (line 109) | def prepare_config_and_inputs(self): method get_config (line 120) | def get_config(self): method prepare_config_and_inputs_for_common (line 138) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past_large_inputs (line 142) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 176) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class PLBartModelTest (line 210) | class PLBartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method setUp (line 228) | def setUp(self): method test_config (line 232) | def test_config(self): method test_save_load_strict (line 235) | def test_save_load_strict(self): method test_decoder_model_past_with_large_inputs (line 245) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 249) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 254) | def test_inputs_embeds(self): method test_generate_fp16 (line 284) | def test_generate_fp16(self): method test_sample_generate (line 294) | def test_sample_generate(self): method test_load_save_without_tied_weights (line 300) | def test_load_save_without_tied_weights(self): function assert_tensors_close (line 304) | def assert_tensors_close(a, b, atol=1e-12, prefix=""): function _long_tensor (line 323) | def _long_tensor(tok_lst): class AbstractSeq2SeqIntegrationTest (line 330) | class AbstractSeq2SeqIntegrationTest(unittest.TestCase): method setUpClass (line 335) | def setUpClass(cls): method model (line 340) | def model(self): class PLBartJavaCsIntegrationTest (line 351) | class PLBartJavaCsIntegrationTest(AbstractSeq2SeqIntegrationTest): method test_java_cs_generate_one (line 363) | def test_java_cs_generate_one(self): method test_java_cs_generate_batch (line 374) | def test_java_cs_generate_batch(self): method test_plbart_java_cs_config (line 381) | def test_plbart_java_cs_config(self): method test_plbart_fast_forward (line 393) | def test_plbart_fast_forward(self): class PLBartBaseIntegrationTest (line 420) | class PLBartBaseIntegrationTest(AbstractSeq2SeqIntegrationTest): method test_base_generate (line 425) | def test_base_generate(self): method test_fill_mask (line 435) | def test_fill_mask(self): class PLBartStandaloneDecoderModelTester (line 447) | class PLBartStandaloneDecoderModelTester: method __init__ (line 448) | def __init__( method prepare_config_and_inputs (line 503) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 533) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 569) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 616) | def prepare_config_and_inputs_for_common(self): class PLBartStandaloneDecoderModelTest (line 624) | class PLBartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTeste... method setUp (line 629) | def setUp(self): method test_config (line 633) | def test_config(self): method test_decoder_model_past (line 636) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 640) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 645) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 649) | def test_flex_attention_with_grads(): FILE: tests/models/plbart/test_tokenization_plbart.py class PLBartTokenizationTest (line 43) | class PLBartTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 50) | def setUpClass(cls): method test_full_base_tokenizer (line 62) | def test_full_base_tokenizer(self): method test_full_multi_tokenizer (line 149) | def test_full_multi_tokenizer(self): class PLBartPythonEnIntegrationTest (line 240) | class PLBartPythonEnIntegrationTest(unittest.TestCase): method setUpClass (line 280) | def setUpClass(cls): method check_language_codes (line 287) | def check_language_codes(self): method test_python_en_tokenizer_batch_encode_plus (line 293) | def test_python_en_tokenizer_batch_encode_plus(self): method test_python_en_tokenizer_decode_ignores_language_codes (line 298) | def test_python_en_tokenizer_decode_ignores_language_codes(self): method test_python_en_tokenizer_truncation (line 307) | def test_python_en_tokenizer_truncation(self): method test_mask_token (line 317) | def test_mask_token(self): method test_special_tokens_unaffacted_by_save_load (line 321) | def test_special_tokens_unaffacted_by_save_load(self): method test_batch_fairseq_parity (line 330) | def test_batch_fairseq_parity(self): method test_python_en_tokenizer_prepare_batch (line 342) | def test_python_en_tokenizer_prepare_batch(self): method test_seq2seq_max_length (line 365) | def test_seq2seq_max_length(self): method test_tokenizer_translation (line 378) | def test_tokenizer_translation(self): FILE: tests/models/poolformer/test_image_processing_poolformer.py class PoolFormerImageProcessingTester (line 22) | class PoolFormerImageProcessingTester: method __init__ (line 23) | def __init__( method prepare_image_processor_dict (line 53) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 65) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 68) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PoolFormerImageProcessingTest (line 82) | class PoolFormerImageProcessingTest(ImageProcessingTestMixin, unittest.T... method setUp (line 83) | def setUp(self): method image_processor_dict (line 88) | def image_processor_dict(self): method test_image_processor_properties (line 91) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 102) | def test_image_processor_from_dict_with_kwargs(self): class PoolFormerImageProcessingNoCropPctTest (line 115) | class PoolFormerImageProcessingNoCropPctTest(PoolFormerImageProcessingTe... method setUp (line 116) | def setUp(self): FILE: tests/models/poolformer/test_modeling_poolformer.py class PoolFormerConfigTester (line 39) | class PoolFormerConfigTester(ConfigTester): method create_and_test_config_common_properties (line 40) | def create_and_test_config_common_properties(self): class PoolFormerModelTester (line 46) | class PoolFormerModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 83) | def prepare_config_and_inputs(self): method create_and_check_model (line 103) | def create_and_check_model(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 113) | def prepare_config_and_inputs_for_common(self): class PoolFormerModelTest (line 121) | class PoolFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method setUp (line 132) | def setUp(self): method test_config (line 136) | def test_config(self): method test_model (line 139) | def test_model(self): method test_batching_equivalence (line 143) | def test_batching_equivalence(self, atol=2e-4, rtol=2e-4): method test_inputs_embeds (line 147) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 151) | def test_model_get_set_embeddings(self): method test_hidden_states_output (line 154) | def test_hidden_states_output(self): method test_training (line 190) | def test_training(self): method test_model_from_pretrained (line 208) | def test_model_from_pretrained(self): function prepare_img (line 215) | def prepare_img(): class PoolFormerModelIntegrationTest (line 221) | class PoolFormerModelIntegrationTest(unittest.TestCase): method test_inference_image_classification_head (line 223) | def test_inference_image_classification_head(self): FILE: tests/models/pop2piano/test_feature_extraction_pop2piano.py class Pop2PianoFeatureExtractionTester (line 49) | class Pop2PianoFeatureExtractionTester: method __init__ (line 50) | def __init__( method prepare_feat_extract_dict (line 72) | def prepare_feat_extract_dict(self): class Pop2PianoFeatureExtractionTest (line 89) | class Pop2PianoFeatureExtractionTest(SequenceFeatureExtractionTestMixin,... method setUp (line 92) | def setUp(self): method test_feat_extract_from_and_save_pretrained (line 95) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 110) | def test_feat_extract_to_json_file(self): method test_call (line 125) | def test_call(self): method test_integration (line 136) | def test_integration(self): method test_attention_mask (line 151) | def test_attention_mask(self): method test_batch_feature (line 178) | def test_batch_feature(self): method test_batch_feature_np (line 195) | def test_batch_feature_np(self): method test_batch_feature_pt (line 214) | def test_batch_feature_pt(self): method test_padding_accepts_tensors_pt (line 236) | def test_padding_accepts_tensors_pt(self): method test_padding_accepts_tensors_tf (line 242) | def test_padding_accepts_tensors_tf(self): method test_padding_from_list (line 248) | def test_padding_from_list(self): method test_padding_from_array (line 254) | def test_padding_from_array(self): method test_attention_mask_with_truncation (line 258) | def test_attention_mask_with_truncation(self): method test_truncation_from_array (line 262) | def test_truncation_from_array(self): method test_truncation_from_list (line 266) | def test_truncation_from_list(self): FILE: tests/models/pop2piano/test_modeling_pop2piano.py class Pop2PianoModelTester (line 45) | class Pop2PianoModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 93) | def prepare_config_and_inputs(self): method get_pipeline_config (line 109) | def get_pipeline_config(self): method get_config (line 127) | def get_config(self): method check_prepare_lm_labels_via_shift_left (line 145) | def check_prepare_lm_labels_via_shift_left( method create_and_check_model (line 184) | def create_and_check_model( method create_and_check_with_lm_head (line 210) | def create_and_check_with_lm_head( method create_and_check_decoder_model_past (line 230) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 267) | def create_and_check_decoder_model_attention_mask_past( method create_and_check_decoder_model_past_large_inputs (line 318) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_model_fp16_forward (line 356) | def create_and_check_model_fp16_forward( method check_resize_embeddings_pop2piano_v1_1 (line 371) | def check_resize_embeddings_pop2piano_v1_1( method prepare_config_and_inputs_for_common (line 385) | def prepare_config_and_inputs_for_common(self): class Pop2PianoModelTest (line 407) | class Pop2PianoModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method setUp (line 418) | def setUp(self): method test_config (line 422) | def test_config(self): method test_shift_right (line 425) | def test_shift_right(self): method test_model (line 429) | def test_model(self): method test_model_v1_1 (line 433) | def test_model_v1_1(self): method test_config_and_model_silu_gated (line 441) | def test_config_and_model_silu_gated(self): method test_with_lm_head (line 447) | def test_with_lm_head(self): method test_decoder_model_past (line 451) | def test_decoder_model_past(self): method test_decoder_model_past_with_attn_mask (line 455) | def test_decoder_model_past_with_attn_mask(self): method test_decoder_model_past_with_3d_attn_mask (line 459) | def test_decoder_model_past_with_3d_attn_mask(self): method test_decoder_model_past_with_large_inputs (line 487) | def test_decoder_model_past_with_large_inputs(self): method test_model_fp16_forward (line 492) | def test_model_fp16_forward(self): method test_v1_1_resize_embeddings (line 496) | def test_v1_1_resize_embeddings(self): method test_model_from_pretrained (line 501) | def test_model_from_pretrained(self): method test_pass_with_input_features (line 506) | def test_pass_with_input_features(self): method test_pass_with_batched_input_features (line 519) | def test_pass_with_batched_input_features(self): class Pop2PianoModelIntegrationTests (line 551) | class Pop2PianoModelIntegrationTests(unittest.TestCase): method test_mel_conditioner_integration (line 553) | def test_mel_conditioner_integration(self): method test_full_model_integration (line 579) | def test_full_model_integration(self): method test_real_music (line 607) | def test_real_music(self): FILE: tests/models/pop2piano/test_processing_pop2piano.py class Pop2PianoProcessorTest (line 64) | class Pop2PianoProcessorTest(unittest.TestCase): method setUpClass (line 66) | def setUpClass(cls): method get_tokenizer (line 75) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 78) | def get_feature_extractor(self, **kwargs): method tearDownClass (line 82) | def tearDownClass(cls): method test_save_load_pretrained_additional_features (line 85) | def test_save_load_pretrained_additional_features(self): method get_inputs (line 115) | def get_inputs(self): method test_feature_extractor (line 142) | def test_feature_extractor(self): method test_processor_batch_decode (line 161) | def test_processor_batch_decode(self): method test_tokenizer_call (line 204) | def test_tokenizer_call(self): method test_processor (line 221) | def test_processor(self): FILE: tests/models/pop2piano/test_tokenization_pop2piano.py class Pop2PianoTokenizerTest (line 45) | class Pop2PianoTokenizerTest(unittest.TestCase): method setUp (line 46) | def setUp(self): method get_input_notes (line 50) | def get_input_notes(self): method test_call (line 66) | def test_call(self): method test_batch_decode (line 90) | def test_batch_decode(self): method test_batch_decode_outputs (line 135) | def test_batch_decode_outputs(self): method test_get_vocab (line 189) | def test_get_vocab(self): method test_save_and_load_tokenizer (line 201) | def test_save_and_load_tokenizer(self): method test_padding_side_in_kwargs (line 225) | def test_padding_side_in_kwargs(self): method test_truncation_side_in_kwargs (line 239) | def test_truncation_side_in_kwargs(self): method test_right_and_left_padding (line 253) | def test_right_and_left_padding(self): method test_right_and_left_truncation (line 304) | def test_right_and_left_truncation(self): method test_padding_to_multiple_of (line 351) | def test_padding_to_multiple_of(self): method test_padding_with_attention_mask (line 381) | def test_padding_with_attention_mask(self): FILE: tests/models/pp_chart2table/test_image_processing_pp_chart2table.py class PPChart2TableImageProcessingTester (line 23) | class PPChart2TableImageProcessingTester(unittest.TestCase): method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 52) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 61) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 64) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PPChart2TableImageProcessingTest (line 78) | class PPChart2TableImageProcessingTest(ImageProcessingTestMixin, unittes... method setUp (line 79) | def setUp(self): method image_processor_dict (line 84) | def image_processor_dict(self): method test_image_processor_properties (line 87) | def test_image_processor_properties(self): FILE: tests/models/pp_chart2table/test_modeling_pp_chart2table.py class PPChart2TableIntegrationTest (line 25) | class PPChart2TableIntegrationTest(unittest.TestCase): method setUp (line 26) | def setUp(self): method tearDown (line 42) | def tearDown(self): method test_small_model_integration_test_pp_chart2table (line 45) | def test_small_model_integration_test_pp_chart2table(self): method test_small_model_integration_test_pp_chart2table_batched (line 64) | def test_small_model_integration_test_pp_chart2table_batched(self): FILE: tests/models/pp_chart2table/test_processing_pp_chart2table.py class PPChart2TableProcessorTest (line 24) | class PPChart2TableProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_tokenizer (line 28) | def _setup_tokenizer(cls): method test_ocr_queries (line 33) | def test_ocr_queries(self): method test_unstructured_kwargs_batched (line 46) | def test_unstructured_kwargs_batched(self): method test_apply_chat_template_assistant_mask (line 71) | def test_apply_chat_template_assistant_mask(self): method test_apply_chat_template_image_0 (line 77) | def test_apply_chat_template_image_0(self): method test_apply_chat_template_image_1 (line 83) | def test_apply_chat_template_image_1(self): FILE: tests/models/pp_doclayout_v2/test_image_processing_pp_doclayout_v2.py class PPDocLayoutV2ImageProcessingTester (line 22) | class PPDocLayoutV2ImageProcessingTester: method __init__ (line 23) | def __init__( method prepare_image_processor_dict (line 48) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 57) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 60) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PPDocLayoutV2ImageProcessingTest (line 74) | class PPDocLayoutV2ImageProcessingTest(ImageProcessingTestMixin, unittes... method setUp (line 75) | def setUp(self): method image_processor_dict (line 80) | def image_processor_dict(self): method test_call_numpy_4_channels (line 86) | def test_call_numpy_4_channels(self): FILE: tests/models/pp_doclayout_v2/test_modeling_pp_doclayout_v2.py class PPDocLayoutV2ModelTester (line 53) | class PPDocLayoutV2ModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 144) | def prepare_config_and_inputs(self): method get_config (line 150) | def get_config(self): method prepare_config_and_inputs_for_common (line 296) | def prepare_config_and_inputs_for_common(self): method create_and_check_pp_doclayout_v2_object_detection_head_model (line 301) | def create_and_check_pp_doclayout_v2_object_detection_head_model(self,... class PPDocLayoutV2ModelTest (line 313) | class PPDocLayoutV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unit... method setUp (line 322) | def setUp(self): method test_config (line 330) | def test_config(self): method test_pp_doclayout_v2_object_detection_head_model (line 333) | def test_pp_doclayout_v2_object_detection_head_model(self): method test_model_get_set_embeddings (line 338) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 342) | def test_model_common_attributes(self): method test_feed_forward_chunking (line 346) | def test_feed_forward_chunking(self): method test_retain_grad_hidden_states_attentions (line 350) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 353) | def test_forward_signature(self): method test_inference_with_different_dtypes (line 366) | def test_inference_with_different_dtypes(self, dtype_str): method test_inference_equivalence_for_static_and_dynamic_anchors (line 387) | def test_inference_equivalence_for_static_and_dynamic_anchors(self, dt... method test_hidden_states_output (line 423) | def test_hidden_states_output(self): method test_attention_outputs (line 474) | def test_attention_outputs(self): class PPDocLayoutV2ModelIntegrationTest (line 581) | class PPDocLayoutV2ModelIntegrationTest(unittest.TestCase): method setUp (line 582) | def setUp(self): method tearDown (line 589) | def tearDown(self): method test_inference_object_detection_head (line 592) | def test_inference_object_detection_head(self): FILE: tests/models/pp_doclayout_v3/test_image_processing_pp_doclayout_v3.py class PPDocLayoutV3ImageProcessingTester (line 22) | class PPDocLayoutV3ImageProcessingTester: method __init__ (line 23) | def __init__( method prepare_image_processor_dict (line 48) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 57) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 60) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PPDocLayoutV3ImageProcessingTest (line 74) | class PPDocLayoutV3ImageProcessingTest(ImageProcessingTestMixin, unittes... method setUp (line 75) | def setUp(self): method image_processor_dict (line 80) | def image_processor_dict(self): method test_call_numpy_4_channels (line 86) | def test_call_numpy_4_channels(self): FILE: tests/models/pp_doclayout_v3/test_modeling_pp_doclayout_v3.py class PPDocLayoutV3ModelTester (line 51) | class PPDocLayoutV3ModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs (line 146) | def prepare_config_and_inputs(self): method get_config (line 152) | def get_config(self): method prepare_config_and_inputs_for_common (line 206) | def prepare_config_and_inputs_for_common(self): class PPDocLayoutV3ModelTest (line 213) | class PPDocLayoutV3ModelTest(ModelTesterMixin, PipelineTesterMixin, unit... method setUp (line 221) | def setUp(self): method test_config (line 229) | def test_config(self): method test_load_save_without_tied_weights (line 233) | def test_load_save_without_tied_weights(self): method test_inputs_embeds (line 237) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 241) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 245) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 249) | def test_model_common_attributes(self): method test_resize_tokens_embeddings (line 253) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 257) | def test_feed_forward_chunking(self): method test_retain_grad_hidden_states_attentions (line 261) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 264) | def test_forward_signature(self): method test_inference_with_different_dtypes (line 277) | def test_inference_with_different_dtypes(self, dtype_str): method test_hidden_states_output (line 296) | def test_hidden_states_output(self): method test_attention_outputs (line 347) | def test_attention_outputs(self): class PPDocLayoutV3ModelIntegrationTest (line 453) | class PPDocLayoutV3ModelIntegrationTest(unittest.TestCase): method setUp (line 454) | def setUp(self): method test_inference_object_detection_head (line 463) | def test_inference_object_detection_head(self): FILE: tests/models/pp_lcnet/test_image_processing_pp_lcnet.py class PPLCNetImageProcessingTester (line 23) | class PPLCNetImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_inputs (line 63) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_image_processor_dict (line 74) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 88) | def expected_output_image_shape(self, images): class PPLCNetImageProcessingTest (line 94) | class PPLCNetImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 95) | def setUp(self): method image_processor_dict (line 100) | def image_processor_dict(self): method test_call_numpy_4_channels (line 104) | def test_call_numpy_4_channels(self): FILE: tests/models/pp_lcnet/test_modeling_pp_lcnet.py class PPLCNetModelTester (line 52) | class PPLCNetModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs_for_common (line 103) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 108) | def prepare_config_and_inputs(self): method get_config (line 114) | def get_config(self) -> PPLCNetConfig: class PPLCNetBackboneTest (line 133) | class PPLCNetBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 138) | def setUp(self): class PPLCNetModelTest (line 149) | class PPLCNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 157) | def setUp(self): method test_config (line 166) | def test_config(self): method create_and_check_pp_lcnet_image_classification (line 169) | def create_and_check_pp_lcnet_image_classification(self, config, pixel... method test_pp_lcnet_image_classification (line 178) | def test_pp_lcnet_image_classification(self): method test_inputs_embeds_matches_input_ids (line 183) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 187) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 191) | def test_model_common_attributes(self): method test_feed_forward_chunking (line 195) | def test_feed_forward_chunking(self): method test_retain_grad_hidden_states_attentions (line 199) | def test_retain_grad_hidden_states_attentions(self): method test_problem_types (line 203) | def test_problem_types(self): method test_model_parallelism (line 207) | def test_model_parallelism(self): method test_forward_signature (line 210) | def test_forward_signature(self): method test_inference_with_different_dtypes (line 223) | def test_inference_with_different_dtypes(self, dtype_str): method test_hidden_states_output (line 243) | def test_hidden_states_output(self): class PPLCNetModelIntegrationTest (line 280) | class PPLCNetModelIntegrationTest(unittest.TestCase): method setUp (line 281) | def setUp(self): method test_inference_image_classification_head (line 288) | def test_inference_image_classification_head(self): FILE: tests/models/pp_lcnet_v3/test_modeling_pp_lcnet_v3.py class PPLCNetV3ModelTester (line 33) | class PPLCNetV3ModelTester: method __init__ (line 34) | def __init__( method prepare_config_and_inputs_for_common (line 83) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 94) | def get_config(self) -> PPLCNetV3Config: class PPLCNetBackboneTest (line 111) | class PPLCNetBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 116) | def setUp(self): FILE: tests/models/pp_ocrv5_mobile_det/test_modeling_pp_ocrv5_mobile_det.py class PPOCRV5MobileDetModelTester (line 50) | class PPOCRV5MobileDetModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs_for_common (line 79) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs(self): method get_config (line 90) | def get_config(self) -> PPOCRV5MobileDetConfig: method create_and_check_pp_ocrv5_mobile_det_object_detection (line 122) | def create_and_check_pp_ocrv5_mobile_det_object_detection(self, config... class PPOCRV5MobileDetModelTest (line 133) | class PPOCRV5MobileDetModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 141) | def setUp(self): method test_config (line 152) | def test_config(self): method test_model_common_attributes (line 156) | def test_model_common_attributes(self): method test_feed_forward_chunking (line 160) | def test_feed_forward_chunking(self): method test_retain_grad_hidden_states_attentions (line 164) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 168) | def test_model_get_set_embeddings(self): method test_multi_gpu_data_parallel_forward (line 172) | def test_multi_gpu_data_parallel_forward(self): method test_forward_signature (line 175) | def test_forward_signature(self): method test_hidden_states_output (line 186) | def test_hidden_states_output(self): method test_inference_with_different_dtypes (line 214) | def test_inference_with_different_dtypes(self, dtype_str): class PPOCRV5MobileDetModelIntegrationTest (line 238) | class PPOCRV5MobileDetModelIntegrationTest(unittest.TestCase): method setUp (line 239) | def setUp(self): method test_inference_object_detection_head (line 248) | def test_inference_object_detection_head(self): FILE: tests/models/pp_ocrv5_mobile_rec/test_modeling_pp_ocrv5_mobile_rec.py class PPOCRV5MobileRecModelTester (line 51) | class PPOCRV5MobileRecModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs_for_common (line 84) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 95) | def get_config(self) -> PPOCRV5MobileRecConfig: class PPOCRV5MobileRecModelTest (line 134) | class PPOCRV5MobileRecModelTest(ModelTesterMixin, PipelineTesterMixin, u... method setUp (line 144) | def setUp(self): method test_config (line 154) | def test_config(self): method test_model_parallelism (line 158) | def test_model_parallelism(self): method test_model_get_set_embeddings (line 162) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 166) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 169) | def test_forward_signature(self): method test_inference_with_different_dtypes (line 182) | def test_inference_with_different_dtypes(self, dtype_str): method test_hidden_states_output (line 201) | def test_hidden_states_output(self): class PPOCRV5MobileRecModelIntegrationTest (line 240) | class PPOCRV5MobileRecModelIntegrationTest(unittest.TestCase): method setUp (line 241) | def setUp(self): method test_inference_text_recognition_head (line 250) | def test_inference_text_recognition_head(self): FILE: tests/models/pp_ocrv5_server_det/test_image_processing_pp_ocrv5_server_det.py class PPOCRV5ServerDetImageProcessingTester (line 33) | class PPOCRV5ServerDetImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 71) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 82) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method get_expected_value (line 93) | def get_expected_value(self, image_inputs): method expected_output_image_shape (line 127) | def expected_output_image_shape(self, images): class PPOCRV5ServerDetImageProcessingTest (line 134) | class PPOCRV5ServerDetImageProcessingTest(ImageProcessingTestMixin, unit... method setUp (line 135) | def setUp(self): method image_processor_dict (line 140) | def image_processor_dict(self): method test_call_pytorch (line 145) | def test_call_pytorch(self): method test_call_numpy (line 162) | def test_call_numpy(self): method test_call_pil (line 178) | def test_call_pil(self): method test_call_numpy_4_channels (line 193) | def test_call_numpy_4_channels(): FILE: tests/models/pp_ocrv5_server_det/test_modeling_pp_ocrv5_server_det.py class PPOCRV5ServerDetModelTester (line 52) | class PPOCRV5ServerDetModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs_for_common (line 73) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 78) | def prepare_config_and_inputs(self): method get_config (line 84) | def get_config(self) -> PPOCRV5ServerDetConfig: method create_and_check_pp_ocrv5_server_det_object_detection (line 134) | def create_and_check_pp_ocrv5_server_det_object_detection(self, config... class PPOCRV5ServerDetModelTest (line 145) | class PPOCRV5ServerDetModelTest(ModelTesterMixin, PipelineTesterMixin, u... method setUp (line 152) | def setUp(self): method test_config (line 167) | def test_config(self): method test_pp_ocrv5_server_det_object_detection (line 179) | def test_pp_ocrv5_server_det_object_detection(self): method test_model_get_set_embeddings (line 184) | def test_model_get_set_embeddings(self): method test_hidden_states_output (line 187) | def test_hidden_states_output(self): method test_forward_signature (line 222) | def test_forward_signature(self): method test_inference_with_different_dtypes (line 235) | def test_inference_with_different_dtypes(self, dtype_str): class PPOCRV5ServerDetModelIntegrationTest (line 259) | class PPOCRV5ServerDetModelIntegrationTest(unittest.TestCase): method setUp (line 260) | def setUp(self): method test_inference_object_detection_head (line 272) | def test_inference_object_detection_head(self): FILE: tests/models/pp_ocrv5_server_rec/test_image_processing_pp_ocrv5_server_det.py class PPOCRV5ServerRecImageProcessingTester (line 30) | class PPOCRV5ServerRecImageProcessingTester: method __init__ (line 31) | def __init__( method prepare_image_processor_dict (line 66) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 77) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method get_expected_value (line 88) | def get_expected_value(self, images): method expected_output_image_shape (line 122) | def expected_output_image_shape(self, images): class PPOCRV5ServerRecImageProcessingTest (line 129) | class PPOCRV5ServerRecImageProcessingTest(ImageProcessingTestMixin, unit... method setUp (line 130) | def setUp(self): method image_processor_dict (line 135) | def image_processor_dict(self): method test_call_numpy_4_channels (line 139) | def test_call_numpy_4_channels(): FILE: tests/models/pp_ocrv5_server_rec/test_modeling_pp_ocrv5_server_rec.py class PPOCRV5ServerRecModelTester (line 51) | class PPOCRV5ServerRecModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs_for_common (line 82) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 87) | def prepare_config_and_inputs(self): method get_config (line 93) | def get_config(self) -> PPOCRV5ServerRecConfig: class PPOCRV5ServerRecModelTest (line 130) | class PPOCRV5ServerRecModelTest(ModelTesterMixin, PipelineTesterMixin, u... method setUp (line 140) | def setUp(self): method test_config (line 150) | def test_config(self): method test_model_parallelism (line 154) | def test_model_parallelism(self): method test_model_get_set_embeddings (line 158) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 162) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 165) | def test_forward_signature(self): method test_inference_with_different_dtypes (line 178) | def test_inference_with_different_dtypes(self, dtype_str): method test_hidden_states_output (line 197) | def test_hidden_states_output(self): class PPOCRV5ServerRecModelIntegrationTest (line 246) | class PPOCRV5ServerRecModelIntegrationTest(unittest.TestCase): method setUp (line 247) | def setUp(self): method test_inference_text_recognition_head (line 256) | def test_inference_text_recognition_head(self): FILE: tests/models/prompt_depth_anything/test_image_processing_prompt_depth_anything.py class PromptDepthAnythingImageProcessingTester (line 25) | class PromptDepthAnythingImageProcessingTester(unittest.TestCase): method __init__ (line 26) | def __init__( method prepare_image_processor_dict (line 54) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 63) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 66) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PromptDepthAnythingImageProcessingTest (line 80) | class PromptDepthAnythingImageProcessingTest(ImageProcessingTestMixin, u... method setUp (line 81) | def setUp(self): method image_processor_dict (line 86) | def image_processor_dict(self): method test_image_processor_properties (line 89) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 103) | def test_image_processor_from_dict_with_kwargs(self): method test_keep_aspect_ratio (line 111) | def test_keep_aspect_ratio(self): method test_prompt_depth_processing (line 122) | def test_prompt_depth_processing(self): method test_backends_equivalence (line 137) | def test_backends_equivalence(self): method test_slow_fast_equivalence_batched (line 166) | def test_slow_fast_equivalence_batched(self): FILE: tests/models/prompt_depth_anything/test_modeling_prompt_depth_anything.py class PromptDepthAnythingModelTester (line 41) | class PromptDepthAnythingModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method get_config (line 94) | def get_config(self): method get_backbone_config (line 103) | def get_backbone_config(self): method create_and_check_for_depth_estimation (line 117) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method prepare_config_and_inputs_for_common (line 125) | def prepare_config_and_inputs_for_common(self): class PromptDepthAnythingModelTest (line 133) | class PromptDepthAnythingModelTest(ModelTesterMixin, PipelineTesterMixin... method setUp (line 146) | def setUp(self): method test_config (line 156) | def test_config(self): method test_inputs_embeds (line 162) | def test_inputs_embeds(self): method test_for_depth_estimation (line 165) | def test_for_depth_estimation(self): method test_training (line 170) | def test_training(self): method test_training_gradient_checkpointing (line 174) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 178) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 182) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_get_set_embeddings (line 188) | def test_model_get_set_embeddings(self): method test_model_from_pretrained (line 192) | def test_model_from_pretrained(self): method test_backbone_selection (line 197) | def test_backbone_selection(self): function prepare_img (line 218) | def prepare_img(): function prepare_prompt_depth (line 224) | def prepare_prompt_depth(): class PromptDepthAnythingModelIntegrationTest (line 235) | class PromptDepthAnythingModelIntegrationTest(unittest.TestCase): method test_inference_wo_prompt_depth (line 236) | def test_inference_wo_prompt_depth(self): method test_inference (line 258) | def test_inference(self): FILE: tests/models/prophetnet/test_modeling_prophetnet.py class ProphetNetModelTester (line 41) | class ProphetNetModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 109) | def prepare_config_and_inputs(self): method get_config (line 134) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 156) | def prepare_config_and_inputs_for_decoder(self): method check_prepare_lm_labels_via_shift_left (line 178) | def check_prepare_lm_labels_via_shift_left( method create_and_check_model (line 217) | def create_and_check_model( method create_and_check_with_lm_head (line 246) | def create_and_check_with_lm_head( method create_and_check_causal_lm_decoder (line 266) | def create_and_check_causal_lm_decoder( method create_and_check_generate_with_past_key_value_states (line 285) | def create_and_check_generate_with_past_key_value_states( method create_and_check_decoder_generate_with_past_key_value_states (line 303) | def create_and_check_decoder_generate_with_past_key_value_states( method create_and_check_model_fp16_forward (line 321) | def create_and_check_model_fp16_forward( method check_fast_integration (line 334) | def check_fast_integration( method check_model_with_attn_mask (line 364) | def check_model_with_attn_mask(self, config, input_ids, decoder_input_... method check_causal_lm_from_pretrained (line 407) | def check_causal_lm_from_pretrained( method prepare_config_and_inputs_for_common (line 432) | def prepare_config_and_inputs_for_common(self): class ProphetNetStandaloneDecoderModelTester (line 453) | class ProphetNetStandaloneDecoderModelTester: method __init__ (line 454) | def __init__( method prepare_config_and_inputs (line 526) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_decoder (line 567) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_decoder_model_past (line 587) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 623) | def create_and_check_decoder_model_attention_mask_past( method prepare_config_and_inputs_for_common (line 668) | def prepare_config_and_inputs_for_common(self): class ProphetNetStandaloneEncoderModelTester (line 684) | class ProphetNetStandaloneEncoderModelTester: method __init__ (line 685) | def __init__( method prepare_config_and_inputs (line 755) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 790) | def prepare_config_and_inputs_for_common(self): class ProphetNetModelTest (line 806) | class ProphetNetModelTest(ModelTesterMixin, GenerationTesterMixin, Pipel... method is_pipeline_test_to_skip (line 821) | def is_pipeline_test_to_skip( method setUp (line 839) | def setUp(self): method test_config (line 843) | def test_config(self): method test_model (line 846) | def test_model(self): method test_lm_model (line 850) | def test_lm_model(self): method test_only_decoder_causal_model (line 854) | def test_only_decoder_causal_model(self): method test_fast_integration (line 859) | def test_fast_integration(self): method test_shift_labels_via_shift_left (line 863) | def test_shift_labels_via_shift_left(self): method test_decoder_model_generate (line 868) | def test_decoder_model_generate(self): method test_encoder_decoder_model_generate (line 872) | def test_encoder_decoder_model_generate(self): method test_attn_mask_model (line 876) | def test_attn_mask_model(self): method test_config_save (line 880) | def test_config_save(self): method test_causal_lm_from_pretrained (line 889) | def test_causal_lm_from_pretrained(self): method test_fp16_forward (line 894) | def test_fp16_forward(self): method test_attention_outputs (line 899) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 1006) | def test_retain_grad_hidden_states_attentions(self): class ProphetNetStandaloneDecoderModelTest (line 1034) | class ProphetNetStandaloneDecoderModelTest(ModelTesterMixin, GenerationT... method setUp (line 1040) | def setUp(self): method test_config (line 1044) | def test_config(self): method test_decoder_model_past (line 1047) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 1051) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 1056) | def test_retain_grad_hidden_states_attentions(self): class ProphetNetStandaloneEncoderModelTest (line 1061) | class ProphetNetStandaloneEncoderModelTest(ModelTesterMixin, unittest.Te... method setUp (line 1067) | def setUp(self): method test_config (line 1071) | def test_config(self): class ProphetNetModelIntegrationTest (line 1076) | class ProphetNetModelIntegrationTest(unittest.TestCase): method test_pretrained_checkpoint_hidden_states (line 1078) | def test_pretrained_checkpoint_hidden_states(self): method test_cnndm_inference (line 1155) | def test_cnndm_inference(self): method test_question_gen_inference (line 1210) | def test_question_gen_inference(self): FILE: tests/models/prophetnet/test_tokenization_prophetnet.py class ProphetNetTokenizationTest (line 33) | class ProphetNetTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 39) | def setUpClass(cls): method get_input_output_texts (line 63) | def get_input_output_texts(self, tokenizer): method test_full_tokenizer (line 68) | def test_full_tokenizer(self): method test_chinese (line 75) | def test_chinese(self): method test_basic_tokenizer_lower (line 80) | def test_basic_tokenizer_lower(self): method test_basic_tokenizer_lower_strip_accents_false (line 88) | def test_basic_tokenizer_lower_strip_accents_false(self): method test_basic_tokenizer_lower_strip_accents_true (line 96) | def test_basic_tokenizer_lower_strip_accents_true(self): method test_basic_tokenizer_lower_strip_accents_default (line 104) | def test_basic_tokenizer_lower_strip_accents_default(self): method test_basic_tokenizer_no_lower (line 112) | def test_basic_tokenizer_no_lower(self): method test_basic_tokenizer_no_lower_strip_accents_false (line 119) | def test_basic_tokenizer_no_lower_strip_accents_false(self): method test_basic_tokenizer_no_lower_strip_accents_true (line 126) | def test_basic_tokenizer_no_lower_strip_accents_true(self): method test_basic_tokenizer_respects_never_split_tokens (line 133) | def test_basic_tokenizer_respects_never_split_tokens(self): method test_wordpiece_tokenizer (line 140) | def test_wordpiece_tokenizer(self): method test_prepare_batch (line 155) | def test_prepare_batch(self): method test_is_whitespace (line 168) | def test_is_whitespace(self): method test_is_control (line 178) | def test_is_control(self): method test_is_punctuation (line 186) | def test_is_punctuation(self): method test_sequence_builders (line 196) | def test_sequence_builders(self): FILE: tests/models/pvt/test_image_processing_pvt.py class PvtImageProcessingTester (line 23) | class PvtImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 51) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 60) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 63) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class PvtImageProcessingTest (line 77) | class PvtImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 78) | def setUp(self): method image_processor_dict (line 83) | def image_processor_dict(self): method test_image_processor_properties (line 86) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 95) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/pvt/test_modeling_pvt.py class PvtConfigTester (line 45) | class PvtConfigTester(ConfigTester): method run_common_tests (line 46) | def run_common_tests(self): class PvtModelTester (line 52) | class PvtModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs (line 93) | def prepare_config_and_inputs(self): method get_config (line 103) | def get_config(self): method create_and_check_model (line 117) | def create_and_check_model(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 124) | def prepare_config_and_inputs_for_common(self): function prepare_img (line 132) | def prepare_img(): class PvtModelTest (line 138) | class PvtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 149) | def setUp(self): method test_batching_equivalence (line 153) | def test_batching_equivalence(self, atol=1e-4, rtol=1e-4): method test_config (line 156) | def test_config(self): method test_model (line 159) | def test_model(self): method test_inputs_embeds (line 164) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 168) | def test_model_get_set_embeddings(self): method test_hidden_states_output (line 171) | def test_hidden_states_output(self): method test_training (line 207) | def test_training(self): method test_model_from_pretrained (line 225) | def test_model_from_pretrained(self): class PvtModelIntegrationTest (line 232) | class PvtModelIntegrationTest(unittest.TestCase): method test_inference_image_classification (line 234) | def test_inference_image_classification(self): method test_inference_model (line 260) | def test_inference_model(self): method test_inference_fp16 (line 290) | def test_inference_fp16(self): FILE: tests/models/pvt_v2/test_modeling_pvt_v2.py class PvtV2ConfigTester (line 49) | class PvtV2ConfigTester(ConfigTester): method run_common_tests (line 50) | def run_common_tests(self): class PvtV2ModelTester (line 56) | class PvtV2ModelTester(ModelTesterMixin): method __init__ (line 57) | def __init__( method prepare_config_and_inputs (line 99) | def prepare_config_and_inputs(self): method get_config (line 109) | def get_config(self): method create_and_check_model (line 125) | def create_and_check_model(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 132) | def prepare_config_and_inputs_for_common(self): function prepare_img (line 140) | def prepare_img(): class PvtV2ModelTest (line 146) | class PvtV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 157) | def setUp(self): method test_config (line 161) | def test_config(self): method test_model (line 164) | def test_model(self): method test_batching_equivalence (line 168) | def test_batching_equivalence(self, atol=5e-4, rtol=5e-4): method test_inputs_embeds (line 172) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 176) | def test_model_get_set_embeddings(self): method test_hidden_states_output (line 179) | def test_hidden_states_output(self): method test_training (line 215) | def test_training(self): method test_forward_signature (line 232) | def test_forward_signature(self): method test_model_from_pretrained (line 245) | def test_model_from_pretrained(self): method test_training_gradient_checkpointing_use_reentrant_true (line 251) | def test_training_gradient_checkpointing_use_reentrant_true(self): class PvtV2ModelIntegrationTest (line 256) | class PvtV2ModelIntegrationTest(unittest.TestCase): method test_inference_image_classification (line 258) | def test_inference_image_classification(self): method test_inference_model (line 278) | def test_inference_model(self): method test_inference_fp16 (line 304) | def test_inference_fp16(self): class PvtV2BackboneTest (line 322) | class PvtV2BackboneTest(BackboneTesterMixin, unittest.TestCase): method test_config (line 327) | def test_config(self): method test_config_save_pretrained (line 363) | def test_config_save_pretrained(self): method setUp (line 377) | def setUp(self): FILE: tests/models/qwen2/test_modeling_qwen2.py class Qwen2ModelTester (line 48) | class Qwen2ModelTester(CausalLMModelTester): class Qwen2ModelTest (line 54) | class Qwen2ModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 59) | def is_pipeline_test_to_skip( class Qwen2IntegrationTest (line 73) | class Qwen2IntegrationTest(unittest.TestCase): method test_model_450m_logits (line 76) | def test_model_450m_logits(self): method test_model_450m_generation (line 101) | def test_model_450m_generation(self): method test_model_450m_long_prompt (line 123) | def test_model_450m_long_prompt(self): method test_model_450m_long_prompt_sdpa (line 150) | def test_model_450m_long_prompt_sdpa(self): method test_speculative_generation (line 185) | def test_speculative_generation(self): method test_export_static_cache (line 213) | def test_export_static_cache(self): method test_3b_generation (line 290) | def test_3b_generation(self): FILE: tests/models/qwen2/test_tokenization_qwen2.py class Qwen2TokenizationTest (line 26) | class Qwen2TokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/qwen2_5_omni/test_modeling_qwen2_5_omni.py class Qwen2_5OmniThinkerForConditionalGenerationTester (line 61) | class Qwen2_5OmniThinkerForConditionalGenerationTester: method __init__ (line 62) | def __init__( method get_config (line 158) | def get_config(self): method prepare_config_and_inputs (line 176) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 195) | def prepare_config_and_inputs_for_common(self): method create_and_check_qwenomnithinker_model_fp16_forward (line 237) | def create_and_check_qwenomnithinker_model_fp16_forward(self, config, ... class Qwen2_5OmniThinkerForConditionalGenerationModelTest (line 252) | class Qwen2_5OmniThinkerForConditionalGenerationModelTest( method setUp (line 275) | def setUp(self): method test_disk_offload_bin (line 280) | def test_disk_offload_bin(self): method test_cpu_offload (line 284) | def test_cpu_offload(self): method test_disk_offload_safetensors (line 288) | def test_disk_offload_safetensors(self): method test_correct_missing_keys (line 292) | def test_correct_missing_keys(self): method test_sdpa_can_compile_dynamic (line 297) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 301) | def test_sdpa_can_dispatch_on_flash(self): method test_model_outputs_equivalence (line 305) | def test_model_outputs_equivalence(self): method test_model_base_model_prefix (line 309) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 312) | def test_sdpa_can_dispatch_composite_models(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 351) | def attention_mask_padding_matches_padding_free_with_position_ids( method test_generate_from_inputs_embeds_with_static_cache (line 437) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_compile_model_forward_fullgraph (line 444) | def test_generate_compile_model_forward_fullgraph(self): method test_generate_compilation_all_outputs (line 448) | def test_generate_compilation_all_outputs(self): method test_generate_with_static_cache (line 452) | def test_generate_with_static_cache(self): method test_custom_4d_attention_mask (line 456) | def test_custom_4d_attention_mask(self): method test_get_rope_index_video_with_audio (line 459) | def test_get_rope_index_video_with_audio(self): class Qwen2_5OmniModelIntegrationTest (line 598) | class Qwen2_5OmniModelIntegrationTest(unittest.TestCase): method setUp (line 599) | def setUp(self): method tearDown (line 627) | def tearDown(self): method test_small_model_integration_test (line 631) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 695) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_multiturn (line 737) | def test_small_model_integration_test_multiturn(self): method test_small_model_integration_test_w_audio (line 783) | def test_small_model_integration_test_w_audio(self): method test_small_model_integration_test_batch_flashatt2 (line 836) | def test_small_model_integration_test_batch_flashatt2(self): class Qwen2_5OmniToken2WavMaxPositionEmbeddingsTest (line 866) | class Qwen2_5OmniToken2WavMaxPositionEmbeddingsTest(unittest.TestCase): method setUpClass (line 872) | def setUpClass(cls): method setUp (line 902) | def setUp(self): method tearDown (line 909) | def tearDown(self): method test_error_when_exceeding_max_position_embeddings (line 915) | def test_error_when_exceeding_max_position_embeddings(self): method test_no_error_when_within_limits (line 937) | def test_no_error_when_within_limits(self): FILE: tests/models/qwen2_5_omni/test_processing_qwen2_5_omni.py class Qwen2_5OmniProcessorTest (line 45) | class Qwen2_5OmniProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 50) | def _setup_image_processor(cls): method _setup_video_processor (line 57) | def _setup_video_processor(cls): method prepare_audio_inputs (line 63) | def prepare_audio_inputs(self, batch_size: int = 3): method _test_apply_chat_template (line 69) | def _test_apply_chat_template( method test_apply_chat_template_video_frame_sampling (line 169) | def test_apply_chat_template_video_frame_sampling(self): method test_chat_template_audio_from_video (line 297) | def test_chat_template_audio_from_video(self): FILE: tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py class Qwen2_5_VLVisionText2TextModelTester (line 65) | class Qwen2_5_VLVisionText2TextModelTester: method __init__ (line 66) | def __init__( method get_config (line 148) | def get_config(self): method prepare_config_and_inputs (line 157) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 170) | def prepare_config_and_inputs_for_common(self): class Qwen2_5_VLModelTest (line 197) | class Qwen2_5_VLModelTest(ModelTesterMixin, GenerationTesterMixin, unitt... method setUp (line 211) | def setUp(self): method test_config (line 215) | def test_config(self): method test_mismatching_num_image_tokens (line 218) | def test_mismatching_num_image_tokens(self): method test_video_forward (line 264) | def test_video_forward(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 317) | def attention_mask_padding_matches_padding_free_with_position_ids( method test_reverse_loading_mapping (line 400) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_feed_forward_chunking (line 411) | def test_feed_forward_chunking(self): method test_cpu_offload (line 415) | def test_cpu_offload(self): method test_disk_offload_bin (line 419) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 423) | def test_disk_offload_safetensors(self): method test_model_parallelism (line 427) | def test_model_parallelism(self): method test_sdpa_can_dispatch_on_flash (line 431) | def test_sdpa_can_dispatch_on_flash(self): method test_multi_gpu_data_parallel_forward (line 435) | def test_multi_gpu_data_parallel_forward(self): class Qwen2_5_VLIntegrationTest (line 440) | class Qwen2_5_VLIntegrationTest(unittest.TestCase): method setUp (line 441) | def setUp(self): method tearDown (line 458) | def tearDown(self): method test_small_model_integration_test (line 462) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 499) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_expand (line 530) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_batch_wo_image (line 551) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 591) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_flashatt2 (line 641) | def test_small_model_integration_test_batch_flashatt2(self): method test_small_model_integration_test_batch_wo_image_flashatt2 (line 671) | def test_small_model_integration_test_batch_wo_image_flashatt2(self): method test_small_model_integration_test_with_video (line 713) | def test_small_model_integration_test_with_video(self): FILE: tests/models/qwen2_5_vl/test_processing_qwen2_5_vl.py class Qwen2_5_VLProcessorTest (line 36) | class Qwen2_5_VLProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_from_pretrained (line 41) | def _setup_from_pretrained(cls, model_id, **kwargs): method _setup_test_attributes (line 45) | def _setup_test_attributes(cls, processor): method test_get_num_vision_tokens (line 48) | def test_get_num_vision_tokens(self): method _test_apply_chat_template (line 62) | def _test_apply_chat_template( method test_apply_chat_template_video_frame_sampling (line 160) | def test_apply_chat_template_video_frame_sampling(self): method test_kwargs_overrides_custom_image_processor_kwargs (line 280) | def test_kwargs_overrides_custom_image_processor_kwargs(self): FILE: tests/models/qwen2_audio/test_modeling_qwen2_audio.py class Qwen2AudioModelTester (line 47) | class Qwen2AudioModelTester: method __init__ (line 48) | def __init__( method get_config (line 98) | def get_config(self): method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 118) | def prepare_config_and_inputs_for_common(self): class Qwen2AudioForConditionalGenerationModelTest (line 138) | class Qwen2AudioForConditionalGenerationModelTest( method setUp (line 149) | def setUp(self): method test_sdpa_can_compile_dynamic (line 155) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 159) | def test_sdpa_can_dispatch_on_flash(self): method test_model_base_model_prefix (line 163) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 166) | def test_sdpa_can_dispatch_composite_models(self): class Qwen2AudioForConditionalGenerationIntegrationTest (line 205) | class Qwen2AudioForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 206) | def setUp(self): method tearDown (line 210) | def tearDown(self): method test_small_model_integration_test_single (line 214) | def test_small_model_integration_test_single(self): method test_small_model_integration_test_batch (line 259) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_multiurn (line 338) | def test_small_model_integration_test_multiurn(self): FILE: tests/models/qwen2_audio/test_processing_qwen2_audio.py class Qwen2AudioProcessorTest (line 24) | class Qwen2AudioProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 29) | def _setup_test_attributes(cls, processor): method test_can_load_various_tokenizers (line 32) | def test_can_load_various_tokenizers(self): method test_tokenizer_integration (line 37) | def test_tokenizer_integration(self): method test_chat_template (line 74) | def test_chat_template(self): FILE: tests/models/qwen2_moe/test_modeling_qwen2_moe.py class Qwen2MoeModelTester (line 46) | class Qwen2MoeModelTester(CausalLMModelTester): class Qwen2MoeModelTest (line 52) | class Qwen2MoeModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 57) | def is_pipeline_test_to_skip( method test_flash_attn_2_inference_equivalence_right_padding (line 73) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_load_balancing_loss (line 77) | def test_load_balancing_loss(self): class Qwen2MoeIntegrationTest (line 115) | class Qwen2MoeIntegrationTest(unittest.TestCase): method get_model (line 119) | def get_model(cls): method tearDownClass (line 127) | def tearDownClass(cls): method tearDown (line 132) | def tearDown(self): method test_model_a2_7b_logits (line 136) | def test_model_a2_7b_logits(self): method test_model_a2_7b_generation (line 150) | def test_model_a2_7b_generation(self): method test_model_a2_7b_long_prompt_flash_attn (line 169) | def test_model_a2_7b_long_prompt_flash_attn(self): method test_model_a2_7b_long_prompt_sdpa (line 191) | def test_model_a2_7b_long_prompt_sdpa(self): method test_speculative_generation (line 221) | def test_speculative_generation(self): FILE: tests/models/qwen2_vl/test_image_processing_qwen2_vl.py class Qwen2VLImageProcessingTester (line 39) | class Qwen2VLImageProcessingTester: method __init__ (line 40) | def __init__( method prepare_image_processor_dict (line 78) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 90) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_video_inputs (line 102) | def prepare_video_inputs(self, equal_resolution=False, numpify=False, ... class Qwen2VLImageProcessingTest (line 117) | class Qwen2VLImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 118) | def setUp(self): method image_processor_dict (line 123) | def image_processor_dict(self): method test_image_processor_properties (line 126) | def test_image_processor_properties(self): method test_image_processor_to_json_string (line 138) | def test_image_processor_to_json_string(self): method test_select_best_resolution (line 146) | def test_select_best_resolution(self): method test_call_pil (line 151) | def test_call_pil(self): method test_call_numpy (line 178) | def test_call_numpy(self): method test_call_pytorch (line 205) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 234) | def test_call_numpy_4_channels(self): method test_nested_input (line 237) | def test_nested_input(self): method test_custom_image_size (line 265) | def test_custom_image_size(self): method test_custom_pixels (line 279) | def test_custom_pixels(self): method test_backends_equivalence (line 293) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 322) | def test_backends_equivalence_batched(self): method test_get_num_patches_without_images (line 350) | def test_get_num_patches_without_images(self): FILE: tests/models/qwen2_vl/test_modeling_qwen2_vl.py class Qwen2VLVisionText2TextModelTester (line 60) | class Qwen2VLVisionText2TextModelTester: method __init__ (line 61) | def __init__( method get_config (line 123) | def get_config(self): method prepare_config_and_inputs (line 132) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 145) | def prepare_config_and_inputs_for_common(self): class Qwen2VLModelTest (line 173) | class Qwen2VLModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 192) | def setUp(self): method test_config (line 196) | def test_config(self): method test_mismatching_num_image_tokens (line 199) | def test_mismatching_num_image_tokens(self): method test_forward_with_rope_deltas_cached (line 247) | def test_forward_with_rope_deltas_cached(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 278) | def attention_mask_padding_matches_padding_free_with_position_ids( method test_reverse_loading_mapping (line 362) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_feed_forward_chunking (line 371) | def test_feed_forward_chunking(self): method test_cpu_offload (line 375) | def test_cpu_offload(self): method test_disk_offload_bin (line 379) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 383) | def test_disk_offload_safetensors(self): method test_model_parallelism (line 387) | def test_model_parallelism(self): method test_sdpa_can_dispatch_on_flash (line 391) | def test_sdpa_can_dispatch_on_flash(self): method test_multi_gpu_data_parallel_forward (line 395) | def test_multi_gpu_data_parallel_forward(self): method test_enable_input_require_grads_with_gradient_checkpointing (line 398) | def test_enable_input_require_grads_with_gradient_checkpointing(self): class Qwen2VLIntegrationTest (line 456) | class Qwen2VLIntegrationTest(unittest.TestCase): method setUp (line 457) | def setUp(self): method tearDown (line 471) | def tearDown(self): method test_small_model_integration_test (line 476) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 513) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_expand (line 535) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_batch_wo_image (line 555) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 582) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_flashatt2 (line 621) | def test_small_model_integration_test_batch_flashatt2(self): method test_small_model_integration_test_batch_wo_image_flashatt2 (line 649) | def test_small_model_integration_test_batch_wo_image_flashatt2(self): FILE: tests/models/qwen2_vl/test_processing_qwen2_vl.py class Qwen2VLProcessorTest (line 39) | class Qwen2VLProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_from_pretrained (line 44) | def _setup_from_pretrained(cls, model_id, **kwargs): method _setup_test_attributes (line 48) | def _setup_test_attributes(cls, processor): method test_get_num_vision_tokens (line 51) | def test_get_num_vision_tokens(self): method _test_apply_chat_template (line 65) | def _test_apply_chat_template( method test_apply_chat_template_video_frame_sampling (line 162) | def test_apply_chat_template_video_frame_sampling(self): method test_kwargs_overrides_custom_image_processor_kwargs (line 282) | def test_kwargs_overrides_custom_image_processor_kwargs(self): method test_special_mm_token_truncation (line 293) | def test_special_mm_token_truncation(self): FILE: tests/models/qwen2_vl/test_video_processing_qwen2_vl.py class Qwen2VLVideoProcessingTester (line 41) | class Qwen2VLVideoProcessingTester: method __init__ (line 42) | def __init__( method prepare_video_processor_dict (line 81) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 96) | def expected_output_video_shape(self, videos, num_frames=None): method prepare_video_inputs (line 116) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class Qwen2VLVideoProcessingTest (line 131) | class Qwen2VLVideoProcessingTest(VideoProcessingTestMixin, unittest.Test... method setUp (line 134) | def setUp(self): method video_processor_dict (line 139) | def video_processor_dict(self): method test_video_processor_properties (line 142) | def test_video_processor_properties(self): method test_video_processor_from_dict_with_kwargs (line 151) | def test_video_processor_from_dict_with_kwargs(self): method test_video_processor_to_json_string (line 169) | def test_video_processor_to_json_string(self): method test_call_pil (line 177) | def test_call_pil(self): method test_call_numpy (line 199) | def test_call_numpy(self): method test_call_pytorch (line 220) | def test_call_pytorch(self): method test_nested_input (line 245) | def test_nested_input(self): method test_call_numpy_4_channels (line 265) | def test_call_numpy_4_channels(self): method test_call_sample_frames (line 299) | def test_call_sample_frames(self): method test_num_frames_equal_temporal_patch_size_plus_two (line 361) | def test_num_frames_equal_temporal_patch_size_plus_two(self): method test_bc_min_max_pixels (line 380) | def test_bc_min_max_pixels(self): FILE: tests/models/qwen3/test_modeling_qwen3.py class Qwen3ModelTester (line 45) | class Qwen3ModelTester(CausalLMModelTester): method __init__ (line 49) | def __init__(self, parent): class Qwen3ModelTest (line 58) | class Qwen3ModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 62) | def is_pipeline_test_to_skip( class Qwen3IntegrationTest (line 76) | class Qwen3IntegrationTest(unittest.TestCase): method setUp (line 77) | def setUp(self): method tearDown (line 80) | def tearDown(self): method test_model_600m_logits (line 84) | def test_model_600m_logits(self): method test_model_600m_generation (line 99) | def test_model_600m_generation(self): method test_model_600m_long_prompt (line 115) | def test_model_600m_long_prompt(self): method test_model_600m_long_prompt_sdpa (line 137) | def test_model_600m_long_prompt_sdpa(self): method test_speculative_generation (line 172) | def test_speculative_generation(self): method test_export_static_cache (line 202) | def test_export_static_cache(self): method test_600m_generation (line 276) | def test_600m_generation(self): FILE: tests/models/qwen3_5/test_modeling_qwen3_5.py class Qwen3_5TextModelTester (line 51) | class Qwen3_5TextModelTester(CausalLMModelTester): method __init__ (line 57) | def __init__(self, parent): class Qwen3_5TextModelTest (line 68) | class Qwen3_5TextModelTest(CausalLMModelTest, unittest.TestCase): method _get_conv_state_shape (line 73) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 82) | def _get_recurrent_state_shape(self, batch_size: int, config): method test_attention_outputs (line 89) | def test_attention_outputs(self): method test_multi_gpu_data_parallel_forward (line 138) | def test_multi_gpu_data_parallel_forward(self): method test_reverse_loading_mapping (line 142) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): class Qwen3_5VisionText2TextModelTester (line 146) | class Qwen3_5VisionText2TextModelTester: method __init__ (line 147) | def __init__( method get_config (line 234) | def get_config(self): method prepare_config_and_inputs (line 245) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 258) | def prepare_config_and_inputs_for_common(self): class Qwen3_5ModelTest (line 285) | class Qwen3_5ModelTest(ModelTesterMixin, GenerationTesterMixin, unittest... method setUp (line 300) | def setUp(self): method test_config (line 304) | def test_config(self): method _get_conv_state_shape (line 307) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 316) | def _get_recurrent_state_shape(self, batch_size: int, config): method test_attention_outputs (line 323) | def test_attention_outputs(self): method test_mismatching_num_image_tokens (line 381) | def test_mismatching_num_image_tokens(self): method test_image_forward (line 430) | def test_image_forward(self): method test_video_forward (line 481) | def test_video_forward(self): method test_multi_gpu_data_parallel_forward (line 567) | def test_multi_gpu_data_parallel_forward(self): class Qwen3_5IntegrationTest (line 572) | class Qwen3_5IntegrationTest(unittest.TestCase): method setUp (line 575) | def setUp(self): method tearDown (line 578) | def tearDown(self): method test_model_logits (line 582) | def test_model_logits(self): method test_model_generation (line 599) | def test_model_generation(self): method test_model_vision_generation (line 617) | def test_model_vision_generation(self): method test_model_video_generation (line 663) | def test_model_video_generation(self): method test_model_video_generation_batch (line 709) | def test_model_video_generation_batch(self): method test_model_video_generation_batch_mixed (line 750) | def test_model_video_generation_batch_mixed(self): method test_model_video_generation_batch_different_videos (line 790) | def test_model_video_generation_batch_different_videos(self): FILE: tests/models/qwen3_5_moe/test_modeling_qwen3_5_moe.py class Qwen3_5MoeTextModelTester (line 56) | class Qwen3_5MoeTextModelTester(CausalLMModelTester): method __init__ (line 61) | def __init__(self, parent): class Qwen3_5MoeTextModelTest (line 72) | class Qwen3_5MoeTextModelTest(CausalLMModelTest, unittest.TestCase): method _get_conv_state_shape (line 76) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 85) | def _get_recurrent_state_shape(self, batch_size: int, config): method test_attention_outputs (line 92) | def test_attention_outputs(self): method test_reverse_loading_mapping (line 140) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_multi_gpu_data_parallel_forward (line 223) | def test_multi_gpu_data_parallel_forward(self): class Qwen3_5MoeVisionText2TextModelTester (line 227) | class Qwen3_5MoeVisionText2TextModelTester: method __init__ (line 228) | def __init__( method get_config (line 319) | def get_config(self): method prepare_config_and_inputs (line 330) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 343) | def prepare_config_and_inputs_for_common(self): class Qwen3_5MoeModelTest (line 368) | class Qwen3_5MoeModelTest(ModelTesterMixin, GenerationTesterMixin, unitt... method setUp (line 382) | def setUp(self): method test_config (line 386) | def test_config(self): method _get_conv_state_shape (line 389) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 398) | def _get_recurrent_state_shape(self, batch_size: int, config): method test_attention_outputs (line 405) | def test_attention_outputs(self): method test_mismatching_num_image_tokens (line 463) | def test_mismatching_num_image_tokens(self): method test_image_forward (line 514) | def test_image_forward(self): method test_video_forward (line 565) | def test_video_forward(self): method test_multi_gpu_data_parallel_forward (line 651) | def test_multi_gpu_data_parallel_forward(self): FILE: tests/models/qwen3_moe/test_modeling_qwen3_moe.py class Qwen3MoeModelTester (line 44) | class Qwen3MoeModelTester(CausalLMModelTester): class Qwen3MoeModelTest (line 50) | class Qwen3MoeModelTest(CausalLMModelTest, unittest.TestCase): method is_pipeline_test_to_skip (line 55) | def is_pipeline_test_to_skip( method test_load_balancing_loss (line 68) | def test_load_balancing_loss(self): class Qwen3MoeIntegrationTest (line 109) | class Qwen3MoeIntegrationTest(unittest.TestCase): method setUpClass (line 111) | def setUpClass(cls): method tearDownClass (line 115) | def tearDownClass(cls): method tearDown (line 119) | def tearDown(self): method get_model (line 123) | def get_model(cls): method test_model_15b_a2b_logits (line 132) | def test_model_15b_a2b_logits(self): method test_model_15b_a2b_generation (line 148) | def test_model_15b_a2b_generation(self): method test_model_15b_a2b_long_prompt (line 164) | def test_model_15b_a2b_long_prompt(self): method test_model_15b_a2b_long_prompt_sdpa (line 179) | def test_model_15b_a2b_long_prompt_sdpa(self): method test_speculative_generation (line 200) | def test_speculative_generation(self): FILE: tests/models/qwen3_next/test_modeling_qwen3_next.py class Qwen3NextModelTester (line 38) | class Qwen3NextModelTester(CausalLMModelTester): method __init__ (line 42) | def __init__(self, parent): class Qwen3NextModelTest (line 57) | class Qwen3NextModelTest(CausalLMModelTest, unittest.TestCase): method _get_conv_state_shape (line 60) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 69) | def _get_recurrent_state_shape(self, batch_size: int, config): method test_attention_outputs (line 76) | def test_attention_outputs(self): method test_eager_matches_sdpa_inference (line 125) | def test_eager_matches_sdpa_inference( method test_multi_gpu_data_parallel_forward (line 151) | def test_multi_gpu_data_parallel_forward(self): method test_can_use_device_map (line 155) | def test_can_use_device_map(self): class Qwen3NextIntegrationTest (line 191) | class Qwen3NextIntegrationTest(unittest.TestCase): FILE: tests/models/qwen3_omni_moe/test_modeling_qwen3_omni_moe.py class Qwen3OmniMoeThinkerForConditionalGenerationTester (line 62) | class Qwen3OmniMoeThinkerForConditionalGenerationTester: method __init__ (line 63) | def __init__( method get_config (line 166) | def get_config(self): method prepare_config_and_inputs (line 184) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 203) | def prepare_config_and_inputs_for_common(self): method create_and_check_qwenomnithinker_model_fp16_forward (line 245) | def create_and_check_qwenomnithinker_model_fp16_forward(self, config, ... class Qwen3OmniMoeThinkerForConditionalGenerationModelTest (line 260) | class Qwen3OmniMoeThinkerForConditionalGenerationModelTest(ModelTesterMi... method setUp (line 271) | def setUp(self): method test_disk_offload_bin (line 276) | def test_disk_offload_bin(self): method test_cpu_offload (line 280) | def test_cpu_offload(self): method test_disk_offload_safetensors (line 284) | def test_disk_offload_safetensors(self): method test_correct_missing_keys (line 288) | def test_correct_missing_keys(self): method test_sdpa_can_compile_dynamic (line 293) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 297) | def test_sdpa_can_dispatch_on_flash(self): method test_model_outputs_equivalence (line 301) | def test_model_outputs_equivalence(self): method test_eager_padding_matches_padding_free_with_position_ids (line 305) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_can_dispatch_composite_models (line 308) | def test_sdpa_can_dispatch_composite_models(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 347) | def attention_mask_padding_matches_padding_free_with_position_ids( method test_contrastive_generate (line 433) | def test_contrastive_generate(self): method test_contrastive_generate_dict_outputs_use_cache (line 437) | def test_contrastive_generate_dict_outputs_use_cache(self): method test_contrastive_generate_low_memory (line 441) | def test_contrastive_generate_low_memory(self): method test_generate_from_inputs_embeds_with_static_cache (line 445) | def test_generate_from_inputs_embeds_with_static_cache(self): method test_generate_compile_model_forward_fullgraph (line 452) | def test_generate_compile_model_forward_fullgraph(self): method test_save_load (line 458) | def test_save_load(self): method test_generate_compilation_all_outputs (line 462) | def test_generate_compilation_all_outputs(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 466) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_generate_with_static_cache (line 470) | def test_generate_with_static_cache(self): method test_custom_4d_attention_mask (line 474) | def test_custom_4d_attention_mask(self): method test_model_is_small (line 478) | def test_model_is_small(self): method test_model_base_model_prefix (line 482) | def test_model_base_model_prefix(self): method test_get_rope_index_video_with_audio (line 486) | def test_get_rope_index_video_with_audio(self): method _image_features_get_expected_num_attentions (line 623) | def _image_features_get_expected_num_attentions(self, model_tester=None): method _image_features_get_expected_num_hidden_states (line 628) | def _image_features_get_expected_num_hidden_states(self, model_tester=... method _audio_features_get_expected_num_attentions (line 633) | def _audio_features_get_expected_num_attentions(self, model_tester=None): method _audio_features_get_expected_num_hidden_states (line 638) | def _audio_features_get_expected_num_hidden_states(self, model_tester=... method _video_features_get_expected_num_attentions (line 643) | def _video_features_get_expected_num_attentions(self, model_tester=None): method _video_features_get_expected_num_hidden_states (line 648) | def _video_features_get_expected_num_hidden_states(self, model_tester=... method test_code_predictor_config_init (line 653) | def test_code_predictor_config_init(self): class Qwen3OmniModelIntegrationTest (line 680) | class Qwen3OmniModelIntegrationTest(unittest.TestCase): method setUpClass (line 682) | def setUpClass(cls): method get_model (line 686) | def get_model(cls): method tearDownClass (line 694) | def tearDownClass(cls): method setUp (line 699) | def setUp(self): method tearDown (line 729) | def tearDown(self): method test_small_model_integration_test (line 733) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 794) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_multiturn (line 826) | def test_small_model_integration_test_multiturn(self): method test_small_model_integration_test_w_audio (line 870) | def test_small_model_integration_test_w_audio(self): method test_small_model_integration_test_batch_flashatt2 (line 925) | def test_small_model_integration_test_batch_flashatt2(self): FILE: tests/models/qwen3_omni_moe/test_processing_qwen3_omni_moe.py class Qwen3OmniMoeProcessorTest (line 46) | class Qwen3OmniMoeProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 51) | def _setup_image_processor(cls): method _setup_video_processor (line 58) | def _setup_video_processor(cls): method prepare_audio_inputs (line 64) | def prepare_audio_inputs(self, batch_size: int = 3): method _test_apply_chat_template (line 70) | def _test_apply_chat_template( method test_apply_chat_template_image (line 171) | def test_apply_chat_template_image(self, batch_size: int, return_tenso... method test_apply_chat_template_video_frame_sampling (line 175) | def test_apply_chat_template_video_frame_sampling(self): method test_chat_template_audio_from_video (line 293) | def test_chat_template_audio_from_video(self): FILE: tests/models/qwen3_vl/test_modeling_qwen3_vl.py class Qwen3VLVisionText2TextModelTester (line 46) | class Qwen3VLVisionText2TextModelTester(VLMModelTester): method __init__ (line 53) | def __init__(self, parent, **kwargs): method create_pixel_values (line 88) | def create_pixel_values(self): method place_image_tokens (line 97) | def place_image_tokens(self, input_ids, config): method get_additional_inputs (line 110) | def get_additional_inputs(self, config, input_ids, pixel_values): method get_config (line 118) | def get_config(self): class Qwen3VLModelTest (line 133) | class Qwen3VLModelTest(VLMModelTest, unittest.TestCase): method test_training_gradient_checkpointing (line 137) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 141) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 145) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_mismatching_num_image_tokens (line 148) | def test_mismatching_num_image_tokens(self): method test_image_forward (line 196) | def test_image_forward(self): method test_video_forward (line 248) | def test_video_forward(self): class Qwen3VLTextModelPositionIdsTest (line 342) | class Qwen3VLTextModelPositionIdsTest(unittest.TestCase): method get_text_config (line 345) | def get_text_config(self): method _make_vision_position_ids (line 359) | def _make_vision_position_ids(self, batch_size, seq_len): method test_3d_vision_position_ids_no_cache (line 366) | def test_3d_vision_position_ids_no_cache(self): method test_3d_vision_position_ids_produce_finite_output (line 378) | def test_3d_vision_position_ids_produce_finite_output(self): method test_4d_position_ids_forward (line 393) | def test_4d_position_ids_forward(self): method test_use_cache_true_vs_false_with_vision_position_ids (line 410) | def test_use_cache_true_vs_false_with_vision_position_ids(self): method test_2d_position_ids_forward (line 427) | def test_2d_position_ids_forward(self): FILE: tests/models/qwen3_vl/test_processing_qwen3_vl.py class Qwen3VLProcessorTest (line 36) | class Qwen3VLProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_from_pretrained (line 41) | def _setup_from_pretrained(cls, model_id, **kwargs): method _setup_test_attributes (line 45) | def _setup_test_attributes(cls, processor): method test_get_num_vision_tokens (line 48) | def test_get_num_vision_tokens(self): method test_model_input_names (line 60) | def test_model_input_names(self): method _test_apply_chat_template (line 73) | def _test_apply_chat_template( method test_apply_chat_template_video_1 (line 172) | def test_apply_chat_template_video_1(self): method test_apply_chat_template_video_2 (line 177) | def test_apply_chat_template_video_2(self): method test_apply_chat_template_video_frame_sampling (line 181) | def test_apply_chat_template_video_frame_sampling(self): method test_kwargs_overrides_custom_image_processor_kwargs (line 287) | def test_kwargs_overrides_custom_image_processor_kwargs(self): FILE: tests/models/qwen3_vl/test_video_processing_qwen3_vl.py class Qwen3VLVideoProcessingTester (line 34) | class Qwen3VLVideoProcessingTester: method __init__ (line 35) | def __init__( method prepare_video_processor_dict (line 70) | def prepare_video_processor_dict(self): method prepare_video_metadata (line 81) | def prepare_video_metadata(self, videos): method expected_output_video_shape (line 102) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 137) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class Qwen3VLVideoProcessingTest (line 152) | class Qwen3VLVideoProcessingTest(VideoProcessingTestMixin, unittest.Test... method setUp (line 156) | def setUp(self): method video_processor_dict (line 161) | def video_processor_dict(self): method test_video_processor_from_dict_with_kwargs (line 164) | def test_video_processor_from_dict_with_kwargs(self): method test_call_pil (line 173) | def test_call_pil(self): method test_call_numpy (line 195) | def test_call_numpy(self): method test_call_pytorch (line 215) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 234) | def test_call_numpy_4_channels(self): method test_nested_input (line 268) | def test_nested_input(self): method test_call_sample_frames (line 293) | def test_call_sample_frames(self): method test_num_frames_equal_temporal_patch_size_plus_two (line 331) | def test_num_frames_equal_temporal_patch_size_plus_two(self): FILE: tests/models/qwen3_vl_moe/test_modeling_qwen3_vl_moe.py class Qwen3VLMoeVisionText2TextModelTester (line 47) | class Qwen3VLMoeVisionText2TextModelTester(VLMModelTester): method __init__ (line 54) | def __init__(self, parent, **kwargs): method create_pixel_values (line 88) | def create_pixel_values(self): method place_image_tokens (line 97) | def place_image_tokens(self, input_ids, config): method get_additional_inputs (line 109) | def get_additional_inputs(self, config, input_ids, pixel_values): method get_config (line 118) | def get_config(self): class Qwen3VLMoeModelTest (line 133) | class Qwen3VLMoeModelTest(VLMModelTest, unittest.TestCase): method test_training_gradient_checkpointing (line 137) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 141) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 145) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_mismatching_num_image_tokens (line 148) | def test_mismatching_num_image_tokens(self): method test_image_forward (line 196) | def test_image_forward(self): method test_video_forward (line 248) | def test_video_forward(self): method test_reverse_loading_mapping (line 341) | def test_reverse_loading_mapping(self, check_keys_were_modified=False): class Qwen3VLMoeIntegrationTest (line 346) | class Qwen3VLMoeIntegrationTest(unittest.TestCase): method setUp (line 347) | def setUp(self): method tearDown (line 389) | def tearDown(self): method test_small_model_integration_test (line 393) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 430) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_with_video (line 452) | def test_small_model_integration_test_with_video(self): method test_small_model_integration_test_expand (line 489) | def test_small_model_integration_test_expand(self): method test_small_model_integration_test_expand_with_video (line 509) | def test_small_model_integration_test_expand_with_video(self): method test_small_model_integration_test_batch_wo_image (line 530) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 560) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_flashatt2 (line 590) | def test_small_model_integration_test_batch_flashatt2(self): method test_small_model_integration_test_batch_wo_image_flashatt2 (line 634) | def test_small_model_integration_test_batch_wo_image_flashatt2(self): FILE: tests/models/rag/test_modeling_rag.py function _assert_tensors_equal (line 68) | def _assert_tensors_equal(a, b, atol=1e-12, prefix=""): function require_retrieval (line 83) | def require_retrieval(test_case): class RagTestMixin (line 99) | class RagTestMixin: method setUp (line 110) | def setUp(self): method dpr_tokenizer (line 169) | def dpr_tokenizer(self) -> DPRQuestionEncoderTokenizer: method dpr_ctx_encoder_tokenizer (line 173) | def dpr_ctx_encoder_tokenizer(self) -> DPRContextEncoderTokenizer: method bart_tokenizer (line 177) | def bart_tokenizer(self) -> BartTokenizer: method t5_tokenizer (line 181) | def t5_tokenizer(self) -> BartTokenizer: method tearDown (line 184) | def tearDown(self): method get_retriever (line 190) | def get_retriever(self, config): method check_model_with_retriever (line 214) | def check_model_with_retriever( method check_model_with_end2end_retriever (line 246) | def check_model_with_end2end_retriever( method check_model_generate_from_context_input_ids (line 286) | def check_model_generate_from_context_input_ids( method check_model_generate (line 333) | def check_model_generate( method check_model_without_retriever (line 354) | def check_model_without_retriever( method check_model_custom_n_docs (line 413) | def check_model_custom_n_docs( method check_model_with_mismatch_n_docs_value (line 474) | def check_model_with_mismatch_n_docs_value( method check_model_with_encoder_outputs (line 532) | def check_model_with_encoder_outputs( method test_model_with_retriever (line 574) | def test_model_with_retriever(self): method test_model_with_end2end_retriever (line 578) | def test_model_with_end2end_retriever(self): method test_model_without_retriever (line 582) | def test_model_without_retriever(self): method test_model_with_encoder_outputs (line 586) | def test_model_with_encoder_outputs(self): method test_model_generate (line 590) | def test_model_generate(self): method test_model_with_custom_n_docs (line 594) | def test_model_with_custom_n_docs(self): method test_model_with_mismatch_n_docs_value (line 599) | def test_model_with_mismatch_n_docs_value(self): class RagDPRBartTest (line 608) | class RagDPRBartTest(RagTestMixin, unittest.TestCase): method config_and_inputs (line 610) | def config_and_inputs(self): class RagDPRT5Test (line 639) | class RagDPRT5Test(RagTestMixin, unittest.TestCase): method config_and_inputs (line 641) | def config_and_inputs(self): class RagModelIntegrationTests (line 672) | class RagModelIntegrationTests(unittest.TestCase): method setUpClass (line 674) | def setUpClass(cls): method tearDownClass (line 688) | def tearDownClass(cls): method tearDown (line 691) | def tearDown(self): method sequence_model (line 697) | def sequence_model(self): method token_model (line 707) | def token_model(self): method get_rag_config (line 716) | def get_rag_config(self): method test_rag_sequence_inference (line 743) | def test_rag_sequence_inference(self): method test_rag_token_inference (line 781) | def test_rag_token_inference(self): method test_rag_token_generate_beam (line 819) | def test_rag_token_generate_beam(self): method test_rag_sequence_generate_beam (line 857) | def test_rag_sequence_generate_beam(self): method questions_data (line 896) | def questions_data(self): method test_rag_sequence_generate_batch (line 908) | def test_rag_sequence_generate_batch(self): method test_rag_sequence_generate_batch_from_context_input_ids (line 950) | def test_rag_sequence_generate_batch_from_context_input_ids(self): method test_rag_token_generate_batch (line 1002) | def test_rag_token_generate_batch(self): class RagModelSaveLoadTests (line 1046) | class RagModelSaveLoadTests(unittest.TestCase): method setUpClass (line 1048) | def setUpClass(cls): method tearDownClass (line 1062) | def tearDownClass(cls): method tearDown (line 1065) | def tearDown(self): method get_rag_config (line 1070) | def get_rag_config(self): method test_rag_sequence_from_pretrained (line 1098) | def test_rag_sequence_from_pretrained(self): method test_rag_token_from_pretrained (line 1157) | def test_rag_token_from_pretrained(self): FILE: tests/models/rag/test_retrieval_rag.py class RagRetrieverTest (line 39) | class RagRetrieverTest(TestCase): method setUp (line 40) | def setUp(self): method get_dpr_tokenizer (line 95) | def get_dpr_tokenizer(self) -> DPRQuestionEncoderTokenizer: method get_dpr_ctx_encoder_tokenizer (line 98) | def get_dpr_ctx_encoder_tokenizer(self) -> DPRContextEncoderTokenizer: method get_bart_tokenizer (line 101) | def get_bart_tokenizer(self) -> BartTokenizer: method tearDown (line 104) | def tearDown(self): method get_dummy_dataset (line 107) | def get_dummy_dataset(self): method get_dummy_canonical_hf_index_retriever (line 119) | def get_dummy_canonical_hf_index_retriever(self): method get_dummy_custom_hf_index_retriever (line 135) | def get_dummy_custom_hf_index_retriever(self, from_disk: bool): method test_canonical_hf_index_retriever_retrieve (line 164) | def test_canonical_hf_index_retriever_retrieve(self): method test_canonical_hf_index_retriever_save_and_from_pretrained (line 179) | def test_canonical_hf_index_retriever_save_and_from_pretrained(self): method test_custom_hf_index_retriever_retrieve (line 193) | def test_custom_hf_index_retriever_retrieve(self): method test_custom_hf_index_retriever_save_and_from_pretrained (line 208) | def test_custom_hf_index_retriever_save_and_from_pretrained(self): method test_custom_hf_index_retriever_retrieve_from_disk (line 220) | def test_custom_hf_index_retriever_retrieve_from_disk(self): method test_custom_hf_index_retriever_save_and_from_pretrained_from_disk (line 235) | def test_custom_hf_index_retriever_save_and_from_pretrained_from_disk(... method test_hf_index_retriever_call (line 250) | def test_hf_index_retriever_call(self): method test_custom_hf_index_end2end_retriever_call (line 291) | def test_custom_hf_index_end2end_retriever_call(self): FILE: tests/models/rag/test_tokenization_rag.py class RagTokenizerTest (line 37) | class RagTokenizerTest(TestCase): method setUp (line 38) | def setUp(self): method get_dpr_tokenizer (line 102) | def get_dpr_tokenizer(self) -> DPRQuestionEncoderTokenizer: method get_bart_tokenizer (line 105) | def get_bart_tokenizer(self) -> RobertaTokenizer: method tearDown (line 108) | def tearDown(self): method test_save_load_pretrained_with_saved_config (line 112) | def test_save_load_pretrained_with_saved_config(self): method test_pretrained_token_nq_tokenizer (line 125) | def test_pretrained_token_nq_tokenizer(self): method test_pretrained_sequence_nq_tokenizer (line 148) | def test_pretrained_sequence_nq_tokenizer(self): FILE: tests/models/recurrent_gemma/test_modeling_recurrent_gemma.py class RecurrentGemmaModelTester (line 41) | class RecurrentGemmaModelTester(CausalLMModelTester): method __init__ (line 45) | def __init__(self, parent, **kwargs): class RecurrentGemmaModelTest (line 51) | class RecurrentGemmaModelTest(CausalLMModelTest, unittest.TestCase): method test_eager_matches_sdpa_generate (line 56) | def test_eager_matches_sdpa_generate(self): method test_prompt_lookup_decoding_matches_greedy_search (line 60) | def test_prompt_lookup_decoding_matches_greedy_search(self): method test_model_parallelism (line 64) | def test_model_parallelism(self): method test_model_parallel_beam_search (line 68) | def test_model_parallel_beam_search(self): method test_assisted_decoding_matches_greedy_search (line 74) | def test_assisted_decoding_matches_greedy_search(self): method test_left_padding_compatibility (line 78) | def test_left_padding_compatibility(self): method test_assisted_decoding_sample (line 83) | def test_assisted_decoding_sample(self): method test_beam_sample_generate_dict_output (line 88) | def test_beam_sample_generate_dict_output(self): method test_beam_search_generate_dict_output (line 93) | def test_beam_search_generate_dict_output(self): method test_beam_search_generate_dict_outputs_use_cache (line 98) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_generate_without_input_ids (line 103) | def test_generate_without_input_ids(self): method test_greedy_generate_dict_outputs (line 108) | def test_greedy_generate_dict_outputs(self): method test_greedy_generate_dict_outputs_use_cache (line 113) | def test_greedy_generate_dict_outputs_use_cache(self): method test_model_outputs_equivalence (line 117) | def test_model_outputs_equivalence(self): method test_model_rope_scaling_frequencies (line 121) | def test_model_rope_scaling_frequencies(self): method test_model_rope_scaling_from_config (line 126) | def test_model_rope_scaling_from_config(self, scaling_type): class RecurrentGemmaIntegrationTest (line 132) | class RecurrentGemmaIntegrationTest(unittest.TestCase): method setup (line 137) | def setup(self): method tearDown (line 140) | def tearDown(self): method test_2b_generate (line 143) | def test_2b_generate(self): method test_2b_sample (line 175) | def test_2b_sample(self): method test_model_2b_8bit (line 198) | def test_model_2b_8bit(self): method test_long_context (line 224) | def test_long_context(self): method test_longer_than_window (line 234) | def test_longer_than_window(self): FILE: tests/models/reformer/test_modeling_reformer.py class ReformerModelTester (line 49) | class ReformerModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 142) | def prepare_config_and_inputs(self): method get_config (line 162) | def get_config(self): method get_pipeline_config (line 191) | def get_pipeline_config(self): method create_and_check_reformer_model (line 199) | def create_and_check_reformer_model(self, config, input_ids, input_mas... method create_and_check_reformer_model_with_lm_backward (line 211) | def create_and_check_reformer_model_with_lm_backward(self, config, inp... method create_and_check_reformer_with_lm (line 220) | def create_and_check_reformer_with_lm(self, config, input_ids, input_m... method create_and_check_reformer_with_mlm (line 229) | def create_and_check_reformer_with_mlm(self, config, input_ids, input_... method create_and_check_reformer_model_with_attn_mask (line 237) | def create_and_check_reformer_model_with_attn_mask( method create_and_check_reformer_layer_dropout_seed (line 285) | def create_and_check_reformer_layer_dropout_seed( method create_and_check_reformer_feed_backward_chunking (line 328) | def create_and_check_reformer_feed_backward_chunking(self, config, inp... method create_and_check_reformer_random_seed (line 369) | def create_and_check_reformer_random_seed(self, config, input_ids, inp... method create_and_check_reformer_model_fp16_forward (line 400) | def create_and_check_reformer_model_fp16_forward(self, config, input_i... method create_and_check_reformer_model_generate (line 408) | def create_and_check_reformer_model_generate(self, config, input_ids, ... method create_and_check_reformer_model_fp16_generate (line 421) | def create_and_check_reformer_model_fp16_generate(self, config, input_... method create_and_check_reformer_no_chunking (line 432) | def create_and_check_reformer_no_chunking(self, config, input_ids, inp... method create_and_check_reformer_for_question_answering (line 444) | def create_and_check_reformer_for_question_answering(self, config, inp... method create_and_check_past_buckets_states (line 457) | def create_and_check_past_buckets_states(self, config, input_ids, inpu... method prepare_config_and_inputs_for_common (line 484) | def prepare_config_and_inputs_for_common(self): method create_and_check_reformer_for_sequence_classification (line 490) | def create_and_check_reformer_for_sequence_classification( class ReformerTesterMixin (line 502) | class ReformerTesterMixin: method test_config (line 507) | def test_config(self): method test_reformer_model (line 510) | def test_reformer_model(self): method test_reformer_lm_model_backward (line 514) | def test_reformer_lm_model_backward(self): method test_reformer_model_attn_masking (line 520) | def test_reformer_model_attn_masking(self): method test_reformer_with_lm (line 525) | def test_reformer_with_lm(self): method test_reformer_with_mlm (line 529) | def test_reformer_with_mlm(self): method test_reformer_layer_training_dropout (line 533) | def test_reformer_layer_training_dropout(self): method test_reformer_chunking_backward_equality (line 538) | def test_reformer_chunking_backward_equality(self): method test_reformer_no_chunking (line 544) | def test_reformer_no_chunking(self): method test_reformer_qa_answering (line 548) | def test_reformer_qa_answering(self): method test_reformer_cached_inference (line 552) | def test_reformer_cached_inference(self): method test_reformer_cached_generate (line 556) | def test_reformer_cached_generate(self): method test_dropout_random_seed_is_changing (line 561) | def test_dropout_random_seed_is_changing(self): method test_reformer_model_fp16_forward (line 566) | def test_reformer_model_fp16_forward(self): method test_reformer_model_fp16_generate (line 571) | def test_reformer_model_fp16_generate(self): method test_multi_gpu_data_parallel_forward (line 582) | def test_multi_gpu_data_parallel_forward(self): method test_for_sequence_classification (line 585) | def test_for_sequence_classification(self): method test_retain_grad_hidden_states_attentions (line 590) | def test_retain_grad_hidden_states_attentions(self): method test_resize_embeddings_untied (line 594) | def test_resize_embeddings_untied(self): class ReformerLocalAttnModelTest (line 599) | class ReformerLocalAttnModelTest(ReformerTesterMixin, GenerationTesterMi... method setUp (line 609) | def setUp(self): method test_model_from_pretrained (line 614) | def test_model_from_pretrained(self): method _check_attentions_for_generate (line 619) | def _check_attentions_for_generate( method _check_hidden_states_for_generate (line 662) | def _check_hidden_states_for_generate( method _check_past_key_values_for_generate (line 692) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_left_padding_compatibility (line 712) | def test_left_padding_compatibility(self): method test_generate_with_and_without_position_ids (line 718) | def test_generate_with_and_without_position_ids(self): method prepare_config_and_inputs_for_generate (line 721) | def prepare_config_and_inputs_for_generate(self, *args, **kwargs): class ReformerLSHAttnModelTest (line 733) | class ReformerLSHAttnModelTest( method is_pipeline_test_to_skip (line 756) | def is_pipeline_test_to_skip( method setUp (line 778) | def setUp(self): method _check_attentions_for_generate (line 820) | def _check_attentions_for_generate( method _check_hidden_states_for_generate (line 863) | def _check_hidden_states_for_generate( method _check_past_key_values_for_generate (line 893) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_problem_types (line 912) | def test_problem_types(self): method test_past_key_values_format (line 916) | def test_past_key_values_format(self): method test_left_padding_compatibility (line 920) | def test_left_padding_compatibility(self): method test_generate_with_and_without_position_ids (line 926) | def test_generate_with_and_without_position_ids(self): class ReformerIntegrationTests (line 933) | class ReformerIntegrationTests(unittest.TestCase): method _get_basic_config_and_input (line 938) | def _get_basic_config_and_input(self): method _get_hidden_states (line 972) | def _get_hidden_states(self): method _get_attn_mask (line 1054) | def _get_attn_mask(self): method _get_input_ids_and_mask (line 1057) | def _get_input_ids_and_mask(self): method test_lsh_layer_forward (line 1144) | def test_lsh_layer_forward(self): method test_lsh_layer_forward_complex (line 1162) | def test_lsh_layer_forward_complex(self): method test_local_layer_forward (line 1185) | def test_local_layer_forward(self): method test_local_layer_forward_complex (line 1203) | def test_local_layer_forward_complex(self): method test_lsh_model_forward (line 1225) | def test_lsh_model_forward(self): method test_local_model_forward (line 1242) | def test_local_model_forward(self): method test_lm_model_forward (line 1258) | def test_lm_model_forward(self): method test_local_lm_model_grad (line 1277) | def test_local_lm_model_grad(self): method test_lsh_lm_model_grad (line 1317) | def test_lsh_lm_model_grad(self): method test_pretrained_generate_crime_and_punish (line 1359) | def test_pretrained_generate_crime_and_punish(self): method test_pretrained_generate_use_cache_equality (line 1376) | def test_pretrained_generate_use_cache_equality(self): FILE: tests/models/reformer/test_tokenization_reformer.py class ReformerTokenizationTest (line 13) | class ReformerTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/regnet/test_modeling_regnet.py class RegNetModelTester (line 40) | class RegNetModelTester: method __init__ (line 41) | def __init__( method prepare_config_and_inputs (line 70) | def prepare_config_and_inputs(self): method get_config (line 81) | def get_config(self): method create_and_check_model (line 91) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 102) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 110) | def prepare_config_and_inputs_for_common(self): class RegNetModelTest (line 118) | class RegNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 134) | def setUp(self): method test_config (line 143) | def test_config(self): method test_batching_equivalence (line 147) | def test_batching_equivalence(self, atol=3e-5, rtol=3e-5): method test_inputs_embeds (line 151) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 155) | def test_model_get_set_embeddings(self): method test_model (line 158) | def test_model(self): method test_hidden_states_output (line 162) | def test_hidden_states_output(self): method test_for_image_classification (line 196) | def test_for_image_classification(self): method test_model_from_pretrained (line 201) | def test_model_from_pretrained(self): function prepare_img (line 208) | def prepare_img(): class RegNetModelIntegrationTest (line 215) | class RegNetModelIntegrationTest(unittest.TestCase): method default_image_processor (line 217) | def default_image_processor(self): method test_inference_image_classification_head (line 221) | def test_inference_image_classification_head(self): FILE: tests/models/rembert/test_modeling_rembert.py class RemBertModelTester (line 41) | class RemBertModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_decoder (line 132) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 159) | def create_and_check_model( method create_and_check_model_as_decoder (line 170) | def create_and_check_model_as_decoder( method create_and_check_for_masked_lm (line 202) | def create_and_check_for_masked_lm( method create_and_check_decoder_model_past_large_inputs (line 211) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_question_answering (line 273) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 289) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 299) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 309) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 327) | def prepare_config_and_inputs_for_common(self): class RemBertModelTest (line 343) | class RemBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 372) | def setUp(self): method test_config (line 376) | def test_config(self): method test_model (line 379) | def test_model(self): method test_for_masked_lm (line 383) | def test_for_masked_lm(self): method test_for_multiple_choice (line 387) | def test_for_multiple_choice(self): method test_decoder_model_past_with_large_inputs (line 391) | def test_decoder_model_past_with_large_inputs(self): method test_for_question_answering (line 395) | def test_for_question_answering(self): method test_for_sequence_classification (line 399) | def test_for_sequence_classification(self): method test_for_token_classification (line 403) | def test_for_token_classification(self): method test_model_as_decoder (line 407) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 411) | def test_model_as_decoder_with_default_input_mask(self): method test_model_from_pretrained (line 439) | def test_model_from_pretrained(self): class RemBertModelIntegrationTest (line 446) | class RemBertModelIntegrationTest(unittest.TestCase): method test_inference_model (line 448) | def test_inference_model(self): FILE: tests/models/rembert/test_tokenization_rembert.py class RemBertTokenizationTest (line 31) | class RemBertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/resnet/test_modeling_resnet.py class ResNetModelTester (line 41) | class ResNetModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 75) | def prepare_config_and_inputs(self): method get_config (line 86) | def get_config(self): method create_and_check_model (line 98) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 109) | def create_and_check_for_image_classification(self, config, pixel_valu... method create_and_check_backbone (line 117) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 146) | def prepare_config_and_inputs_for_common(self): class ResNetModelTest (line 154) | class ResNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 178) | def setUp(self): method test_config (line 187) | def test_config(self): method test_inputs_embeds (line 191) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 195) | def test_model_get_set_embeddings(self): method test_model (line 198) | def test_model(self): method test_backbone (line 202) | def test_backbone(self): method test_hidden_states_output (line 206) | def test_hidden_states_output(self): method test_feed_forward_chunking (line 241) | def test_feed_forward_chunking(self): method test_for_image_classification (line 244) | def test_for_image_classification(self): method test_model_from_pretrained (line 249) | def test_model_from_pretrained(self): function prepare_img (line 256) | def prepare_img(): class ResNetModelIntegrationTest (line 263) | class ResNetModelIntegrationTest(unittest.TestCase): method default_image_processor (line 265) | def default_image_processor(self): method test_inference_image_classification_head (line 269) | def test_inference_image_classification_head(self): class ResNetBackboneTest (line 295) | class ResNetBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 300) | def setUp(self): FILE: tests/models/roberta/test_modeling_roberta.py class RobertaModelTester (line 43) | class RobertaModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method get_pipeline_config (line 130) | def get_pipeline_config(self): method prepare_config_and_inputs_for_decoder (line 135) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 162) | def create_and_check_model( method create_and_check_model_as_decoder (line 175) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 208) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 226) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_masked_lm (line 294) | def create_and_check_for_masked_lm( method create_and_check_for_token_classification (line 303) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 313) | def create_and_check_for_multiple_choice( method create_and_check_for_question_answering (line 331) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 347) | def prepare_config_and_inputs_for_common(self): class RobertaModelTest (line 363) | class RobertaModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method prepare_config_and_inputs_for_generate (line 392) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method setUp (line 397) | def setUp(self): method test_config (line 401) | def test_config(self): method test_model (line 404) | def test_model(self): method test_model_as_decoder (line 408) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 412) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 439) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 443) | def test_decoder_model_past_with_large_inputs(self): method test_for_masked_lm (line 447) | def test_for_masked_lm(self): method test_for_token_classification (line 451) | def test_for_token_classification(self): method test_for_multiple_choice (line 455) | def test_for_multiple_choice(self): method test_for_question_answering (line 459) | def test_for_question_answering(self): method test_model_from_pretrained (line 464) | def test_model_from_pretrained(self): method test_create_position_ids_respects_padding_index (line 469) | def test_create_position_ids_respects_padding_index(self): method test_create_position_ids_from_inputs_embeds (line 487) | def test_create_position_ids_from_inputs_embeds(self): class RobertaModelIntegrationTest (line 510) | class RobertaModelIntegrationTest(TestCasePlus): method test_inference_masked_lm (line 512) | def test_inference_masked_lm(self): method test_inference_no_head (line 532) | def test_inference_no_head(self): method test_inference_classification_head (line 550) | def test_inference_classification_head(self): FILE: tests/models/roberta/test_tokenization_roberta.py function load_vocab (line 25) | def load_vocab(vocab_file): function load_merges (line 31) | def load_merges(merges_file): class RobertaTokenizationTest (line 43) | class RobertaTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 56) | def setUpClass(cls): method get_input_output_texts (line 102) | def get_input_output_texts(self, tokenizer): method test_full_tokenizer (line 107) | def test_full_tokenizer(self): FILE: tests/models/roberta_prelayernorm/test_modeling_roberta_prelayernorm.py class RobertaPreLayerNormModelTester (line 43) | class RobertaPreLayerNormModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method get_pipeline_config (line 130) | def get_pipeline_config(self): method prepare_config_and_inputs_for_decoder (line 135) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 162) | def create_and_check_model( method create_and_check_model_as_decoder (line 175) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 208) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 226) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_masked_lm (line 294) | def create_and_check_for_masked_lm( method create_and_check_for_token_classification (line 303) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 313) | def create_and_check_for_multiple_choice( method create_and_check_for_question_answering (line 331) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 347) | def prepare_config_and_inputs_for_common(self): class RobertaPreLayerNormModelTest (line 363) | class RobertaPreLayerNormModelTest(ModelTesterMixin, GenerationTesterMix... method prepare_config_and_inputs_for_generate (line 392) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method setUp (line 398) | def setUp(self): method test_config (line 403) | def test_config(self): method test_model (line 407) | def test_model(self): method test_model_as_decoder (line 412) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 417) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 445) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 450) | def test_decoder_model_past_with_large_inputs(self): method test_for_masked_lm (line 455) | def test_for_masked_lm(self): method test_for_token_classification (line 460) | def test_for_token_classification(self): method test_for_multiple_choice (line 465) | def test_for_multiple_choice(self): method test_for_question_answering (line 470) | def test_for_question_answering(self): method test_model_from_pretrained (line 475) | def test_model_from_pretrained(self): method test_create_position_ids_respects_padding_index (line 481) | def test_create_position_ids_respects_padding_index(self): method test_create_position_ids_from_inputs_embeds (line 500) | def test_create_position_ids_from_inputs_embeds(self): class RobertaPreLayerNormModelIntegrationTest (line 523) | class RobertaPreLayerNormModelIntegrationTest(TestCasePlus): method test_inference_masked_lm (line 525) | def test_inference_masked_lm(self): method test_inference_no_head (line 541) | def test_inference_no_head(self): FILE: tests/models/roc_bert/test_modeling_roc_bert.py class RoCBertModelTester (line 43) | class RoCBertModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 135) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 155) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 186) | def create_and_check_model( method create_and_check_model_as_decoder (line 217) | def create_and_check_model_as_decoder( method create_and_check_for_masked_lm (line 261) | def create_and_check_for_masked_lm( method create_and_check_decoder_model_past_large_inputs (line 286) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_question_answering (line 360) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 387) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 413) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 439) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 472) | def prepare_config_and_inputs_for_common(self): method create_and_check_for_pretraining (line 494) | def create_and_check_for_pretraining( class RoCBertModelTest (line 530) | class RoCBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method is_pipeline_test_to_skip (line 561) | def is_pipeline_test_to_skip( method prepare_config_and_inputs_for_generate (line 586) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method _prepare_for_class (line 592) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 617) | def setUp(self): method test_config (line 621) | def test_config(self): method test_model (line 624) | def test_model(self): method test_for_masked_lm (line 628) | def test_for_masked_lm(self): method test_for_multiple_choice (line 632) | def test_for_multiple_choice(self): method test_decoder_model_past_with_large_inputs (line 636) | def test_decoder_model_past_with_large_inputs(self): method test_for_question_answering (line 640) | def test_for_question_answering(self): method test_for_sequence_classification (line 644) | def test_for_sequence_classification(self): method test_for_token_classification (line 648) | def test_for_token_classification(self): method test_for_pretraining (line 652) | def test_for_pretraining(self): method test_model_as_decoder (line 656) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 660) | def test_model_as_decoder_with_default_input_mask(self): method test_model_from_pretrained (line 692) | def test_model_from_pretrained(self): method flash_attn_inference_equivalence (line 697) | def flash_attn_inference_equivalence( class RoCBertModelIntegrationTest (line 710) | class RoCBertModelIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 712) | def test_inference_masked_lm(self): FILE: tests/models/roc_bert/test_tokenization_roc_bert.py class BertTokenizationTest (line 35) | class BertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 44) | def setUpClass(cls): method test_full_tokenizer (line 63) | def test_full_tokenizer(self): method test_chinese (line 72) | def test_chinese(self): method test_basic_tokenizer_lower (line 77) | def test_basic_tokenizer_lower(self): method test_basic_tokenizer_lower_strip_accents_false (line 85) | def test_basic_tokenizer_lower_strip_accents_false(self): method test_basic_tokenizer_lower_strip_accents_true (line 93) | def test_basic_tokenizer_lower_strip_accents_true(self): method test_basic_tokenizer_lower_strip_accents_default (line 101) | def test_basic_tokenizer_lower_strip_accents_default(self): method test_basic_tokenizer_no_lower (line 109) | def test_basic_tokenizer_no_lower(self): method test_basic_tokenizer_no_lower_strip_accents_false (line 116) | def test_basic_tokenizer_no_lower_strip_accents_false(self): method test_basic_tokenizer_no_lower_strip_accents_true (line 123) | def test_basic_tokenizer_no_lower_strip_accents_true(self): method test_basic_tokenizer_respects_never_split_tokens (line 130) | def test_basic_tokenizer_respects_never_split_tokens(self): method test_wordpiece_tokenizer (line 137) | def test_wordpiece_tokenizer(self): method test_is_whitespace (line 151) | def test_is_whitespace(self): method test_is_control (line 161) | def test_is_control(self): method test_is_punctuation (line 169) | def test_is_punctuation(self): method test_clean_text (line 178) | def test_clean_text(self): method test_change_tokenize_chinese_chars (line 190) | def test_change_tokenize_chinese_chars(self): method test_sequence_builders (line 227) | def test_sequence_builders(self): method test_prepare_for_model (line 239) | def test_prepare_for_model(self): FILE: tests/models/roformer/test_modeling_roformer.py class RoFormerModelTester (line 47) | class RoFormerModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 119) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 135) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 162) | def create_and_check_model( method create_and_check_model_as_decoder (line 173) | def create_and_check_model_as_decoder( method create_and_check_for_generate_causal_lm (line 205) | def create_and_check_for_generate_causal_lm( method create_and_check_for_masked_lm (line 226) | def create_and_check_for_masked_lm( method create_and_check_decoder_model_past_large_inputs (line 235) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_question_answering (line 297) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 313) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 323) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 333) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 351) | def prepare_config_and_inputs_for_common(self): class RoFormerModelTest (line 367) | class RoFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 396) | def setUp(self): method test_config (line 400) | def test_config(self): method test_model (line 403) | def test_model(self): method test_for_masked_lm (line 407) | def test_for_masked_lm(self): method test_for_generate_causal_lm (line 411) | def test_for_generate_causal_lm(self): method test_for_multiple_choice (line 415) | def test_for_multiple_choice(self): method test_decoder_model_past_with_large_inputs (line 419) | def test_decoder_model_past_with_large_inputs(self): method test_for_question_answering (line 423) | def test_for_question_answering(self): method test_for_sequence_classification (line 427) | def test_for_sequence_classification(self): method test_for_token_classification (line 431) | def test_for_token_classification(self): method test_model_as_decoder (line 435) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 439) | def test_model_as_decoder_with_default_input_mask(self): method test_model_from_pretrained (line 467) | def test_model_from_pretrained(self): method test_training_gradient_checkpointing (line 473) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 477) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 481) | def test_training_gradient_checkpointing_use_reentrant_true(self): class RoFormerModelIntegrationTest (line 486) | class RoFormerModelIntegrationTest(unittest.TestCase): method test_inference_masked_lm (line 488) | def test_inference_masked_lm(self): class RoFormerSinusoidalPositionalEmbeddingTest (line 509) | class RoFormerSinusoidalPositionalEmbeddingTest(unittest.TestCase): method test_basic (line 512) | def test_basic(self): method test_positional_emb_weights_against_roformer (line 526) | def test_positional_emb_weights_against_roformer(self): class RoFormerSelfAttentionRotaryPositionEmbeddingTest (line 545) | class RoFormerSelfAttentionRotaryPositionEmbeddingTest(unittest.TestCase): method test_apply_rotary_position_embeddings (line 548) | def test_apply_rotary_position_embeddings(self): FILE: tests/models/roformer/test_tokenization_roformer.py class RoFormerTokenizationTest (line 26) | class RoFormerTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 34) | def setUpClass(cls): method get_tokenizer (line 40) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_rust_tokenizer (line 45) | def get_rust_tokenizer(cls, pretrained_name=None, **kwargs): method get_chinese_input_output_texts (line 49) | def get_chinese_input_output_texts(self): method test_tokenizer (line 54) | def test_tokenizer(self): method test_rust_tokenizer (line 65) | def test_rust_tokenizer(self): # noqa: F811 method test_training_new_tokenizer (line 75) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 79) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_save_slow_from_fast_and_reload_fast (line 82) | def test_save_slow_from_fast_and_reload_fast(self): FILE: tests/models/rt_detr/test_image_processing_rt_detr.py class RTDetrImageProcessingTester (line 39) | class RTDetrImageProcessingTester: method __init__ (line 40) | def __init__( method prepare_image_processor_dict (line 64) | def prepare_image_processor_dict(self): method get_expected_values (line 75) | def get_expected_values(self): method expected_output_image_shape (line 78) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 82) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class RtDetrImageProcessingTest (line 96) | class RtDetrImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 97) | def setUp(self): method image_processor_dict (line 102) | def image_processor_dict(self): method test_image_processor_properties (line 105) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 115) | def test_image_processor_from_dict_with_kwargs(self): method test_valid_coco_detection_annotations (line 120) | def test_valid_coco_detection_annotations(self): method test_call_pytorch_with_coco_detection_annotations (line 157) | def test_call_pytorch_with_coco_detection_annotations(self): method test_image_processor_outputs (line 202) | def test_image_processor_outputs(self): method test_multiple_images_processor_outputs (line 217) | def test_multiple_images_processor_outputs(self): method test_batched_coco_detection_annotations (line 262) | def test_batched_coco_detection_annotations(self): method test_torchvision_processor_equivalence_cpu_accelerator_coco_detection_annotations (line 380) | def test_torchvision_processor_equivalence_cpu_accelerator_coco_detect... FILE: tests/models/rt_detr/test_modeling_rt_detr.py class RTDetrModelTester (line 59) | class RTDetrModelTester: method __init__ (line 60) | def __init__( method prepare_config_and_inputs (line 154) | def prepare_config_and_inputs(self): method get_config (line 175) | def get_config(self): method prepare_config_and_inputs_for_common (line 220) | def prepare_config_and_inputs_for_common(self): method create_and_check_rt_detr_model (line 225) | def create_and_check_rt_detr_model(self, config, pixel_values, pixel_m... method create_and_check_rt_detr_object_detection_head_model (line 235) | def create_and_check_rt_detr_object_detection_head_model(self, config,... class RTDetrModelTest (line 254) | class RTDetrModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method _prepare_for_class (line 266) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 285) | def setUp(self): method test_config (line 294) | def test_config(self): method test_rt_detr_model (line 297) | def test_rt_detr_model(self): method test_rt_detr_object_detection_head_model (line 301) | def test_rt_detr_object_detection_head_model(self): method test_inputs_embeds (line 306) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 310) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 314) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 318) | def test_model_common_attributes(self): method test_resize_tokens_embeddings (line 322) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 326) | def test_feed_forward_chunking(self): method test_attention_outputs (line 329) | def test_attention_outputs(self): method test_hidden_states_output (line 432) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 483) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 517) | def test_forward_signature(self): method test_backbone_selection (line 527) | def test_backbone_selection(self): method test_inference_with_different_dtypes (line 577) | def test_inference_with_different_dtypes(self, dtype_str): method test_inference_equivalence_for_static_and_dynamic_anchors (line 599) | def test_inference_equivalence_for_static_and_dynamic_anchors(self, dt... function prepare_img (line 643) | def prepare_img(): class RTDetrModelIntegrationTest (line 651) | class RTDetrModelIntegrationTest(unittest.TestCase): method default_image_processor (line 653) | def default_image_processor(self): method test_inference_object_detection_head (line 656) | def test_inference_object_detection_head(self): FILE: tests/models/rt_detr/test_modeling_rt_detr_resnet.py class RTDetrResNetModelTester (line 29) | class RTDetrResNetModelTester: method __init__ (line 30) | def __init__( method prepare_config_and_inputs (line 63) | def prepare_config_and_inputs(self): method get_config (line 74) | def get_config(self): method prepare_config_and_inputs_for_common (line 86) | def prepare_config_and_inputs_for_common(self): class RTDetrResNetBackboneTest (line 94) | class RTDetrResNetBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 99) | def setUp(self): FILE: tests/models/rt_detr_v2/test_modeling_rt_detr_v2.py class RTDetrV2ModelTester (line 60) | class RTDetrV2ModelTester: method __init__ (line 61) | def __init__( method prepare_config_and_inputs (line 157) | def prepare_config_and_inputs(self): method get_config (line 178) | def get_config(self): method prepare_config_and_inputs_for_common (line 224) | def prepare_config_and_inputs_for_common(self): method create_and_check_rt_detr_model (line 229) | def create_and_check_rt_detr_model(self, config, pixel_values, pixel_m... method create_and_check_rt_detr_object_detection_head_model (line 239) | def create_and_check_rt_detr_object_detection_head_model(self, config,... class RTDetrV2ModelTest (line 258) | class RTDetrV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method _prepare_for_class (line 270) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 289) | def setUp(self): method test_config (line 298) | def test_config(self): method test_rt_detr_model (line 301) | def test_rt_detr_model(self): method test_rt_detr_object_detection_head_model (line 305) | def test_rt_detr_object_detection_head_model(self): method test_inputs_embeds (line 310) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 314) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 318) | def test_model_get_set_embeddings(self): method test_model_common_attributes (line 322) | def test_model_common_attributes(self): method test_resize_tokens_embeddings (line 326) | def test_resize_tokens_embeddings(self): method test_feed_forward_chunking (line 330) | def test_feed_forward_chunking(self): method test_load_save_without_tied_weights (line 334) | def test_load_save_without_tied_weights(self): method test_attention_outputs (line 337) | def test_attention_outputs(self): method test_hidden_states_output (line 440) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 491) | def test_retain_grad_hidden_states_attentions(self): method test_forward_signature (line 525) | def test_forward_signature(self): method test_backbone_selection (line 535) | def test_backbone_selection(self): method test_inference_with_different_dtypes (line 585) | def test_inference_with_different_dtypes(self, dtype_str): method test_inference_equivalence_for_static_and_dynamic_anchors (line 607) | def test_inference_equivalence_for_static_and_dynamic_anchors(self, dt... function prepare_img (line 651) | def prepare_img(): class RTDetrV2ModelIntegrationTest (line 659) | class RTDetrV2ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 661) | def default_image_processor(self): method test_inference_object_detection_head (line 664) | def test_inference_object_detection_head(self): FILE: tests/models/rwkv/test_modeling_rwkv.py class RwkvModelTester (line 37) | class RwkvModelTester: method __init__ (line 38) | def __init__( method prepare_config_and_inputs (line 87) | def prepare_config_and_inputs( method get_config (line 129) | def get_config( method get_pipeline_config (line 151) | def get_pipeline_config(self): method create_and_check_rwkv_model (line 156) | def create_and_check_rwkv_model(self, config, input_ids, input_mask, t... method create_and_check_causl_lm (line 167) | def create_and_check_causl_lm(self, config, input_ids, input_mask, tok... method create_and_check_state_equivalency (line 176) | def create_and_check_state_equivalency(self, config, input_ids, input_... method prepare_config_and_inputs_for_common (line 193) | def prepare_config_and_inputs_for_common(self): class RwkvModelTest (line 213) | class RwkvModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 221) | def setUp(self): method assertInterval (line 227) | def assertInterval(self, member, container, msg=None): method test_config (line 249) | def test_config(self): method test_rwkv_model (line 252) | def test_rwkv_model(self): method test_rwkv_lm_head_model (line 256) | def test_rwkv_lm_head_model(self): method test_state_equivalency (line 260) | def test_state_equivalency(self): method test_attention_outputs (line 264) | def test_attention_outputs(self): method test_model_from_pretrained (line 334) | def test_model_from_pretrained(self): method test_beam_sample_generate_dict_output (line 339) | def test_beam_sample_generate_dict_output(self): method test_beam_search_generate_dict_output (line 346) | def test_beam_search_generate_dict_output(self): method test_greedy_generate_dict_outputs (line 353) | def test_greedy_generate_dict_outputs(self): method test_sample_generate_dict_output (line 360) | def test_sample_generate_dict_output(self): method test_left_padding_compatibility (line 368) | def test_left_padding_compatibility(self): class RWKVIntegrationTests (line 373) | class RWKVIntegrationTests(unittest.TestCase): method setUp (line 374) | def setUp(self): method test_simple_generate (line 378) | def test_simple_generate(self): method test_simple_generate_bf16 (line 388) | def test_simple_generate_bf16(self): FILE: tests/models/sam/test_image_processing_sam.py class SamImageProcessingTester (line 30) | class SamImageProcessingTester: method __init__ (line 31) | def __init__( method prepare_image_processor_dict (line 69) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 82) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 85) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 98) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 105) | def prepare_semantic_batch_inputs(): class SamImageProcessingTest (line 112) | class SamImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 113) | def setUp(self): method image_processor_dict (line 118) | def image_processor_dict(self): method test_image_processor_properties (line 121) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 136) | def test_image_processor_from_dict_with_kwargs(self): method test_call_segmentation_maps (line 145) | def test_call_segmentation_maps(self): method test_backends_equivalence (line 252) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 280) | def test_backends_equivalence_batched(self): FILE: tests/models/sam/test_modeling_sam.py class SamVisionModelTester (line 42) | class SamVisionModelTester: method __init__ (line 43) | def __init__( method get_config (line 105) | def get_config(self): method prepare_config_and_inputs (line 131) | def prepare_config_and_inputs(self): method create_and_check_model (line 137) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 148) | def prepare_config_and_inputs_for_common(self): class SamVisionModelTest (line 156) | class SamVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 166) | def setUp(self): method test_config (line 170) | def test_config(self): method test_inputs_embeds (line 174) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 177) | def test_model_get_set_embeddings(self): method test_model (line 186) | def test_model(self): method test_attention_outputs (line 190) | def test_attention_outputs(self): method test_hidden_states_output (line 231) | def test_hidden_states_output(self): method test_sdpa_can_compile_dynamic (line 235) | def test_sdpa_can_compile_dynamic(self): class SamPromptEncoderTester (line 239) | class SamPromptEncoderTester: method __init__ (line 240) | def __init__( method get_config (line 256) | def get_config(self): method prepare_config_and_inputs (line 266) | def prepare_config_and_inputs(self): class SamMaskDecoderTester (line 273) | class SamMaskDecoderTester: method __init__ (line 274) | def __init__( method get_config (line 298) | def get_config(self): method prepare_config_and_inputs (line 312) | def prepare_config_and_inputs(self): class SamModelTester (line 322) | class SamModelTester: method __init__ (line 323) | def __init__( method prepare_config_and_inputs (line 388) | def prepare_config_and_inputs(self): method get_config (line 394) | def get_config(self): method create_and_check_model (line 430) | def create_and_check_model(self, config, pixel_values): method create_and_check_get_image_features (line 439) | def create_and_check_get_image_features(self, config, pixel_values): method create_and_check_get_image_hidden_states (line 447) | def create_and_check_get_image_hidden_states(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 475) | def prepare_config_and_inputs_for_common(self): class SamModelTest (line 483) | class SamModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method is_pipeline_test_to_skip (line 498) | def is_pipeline_test_to_skip( method setUp (line 510) | def setUp(self): method test_config (line 517) | def test_config(self): method test_inputs_embeds (line 521) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 524) | def test_model_get_set_embeddings(self): method test_model (line 533) | def test_model(self): method test_get_image_features (line 537) | def test_get_image_features(self): method test_image_hidden_states (line 541) | def test_image_hidden_states(self): method test_attention_outputs (line 545) | def test_attention_outputs(self): method test_hidden_states_output (line 600) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 604) | def test_retain_grad_hidden_states_attentions(self): method test_model_from_pretrained (line 608) | def test_model_from_pretrained(self): method test_sdpa_can_compile_dynamic (line 614) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_composite_models (line 617) | def test_sdpa_can_dispatch_composite_models(self): function prepare_image (line 675) | def prepare_image(): function prepare_dog_img (line 681) | def prepare_dog_img(): class SamModelIntegrationTest (line 688) | class SamModelIntegrationTest(unittest.TestCase): method tearDown (line 689) | def tearDown(self): method test_inference_mask_generation_no_point (line 694) | def test_inference_mask_generation_no_point(self): method test_inference_mask_generation_one_point_one_bb (line 711) | def test_inference_mask_generation_one_point_one_bb(self): method test_inference_mask_generation_batched_points_batched_images (line 742) | def test_inference_mask_generation_batched_points_batched_images(self): method test_inference_mask_generation_one_point_one_bb_zero (line 784) | def test_inference_mask_generation_one_point_one_bb_zero(self): method test_inference_mask_generation_one_point (line 810) | def test_inference_mask_generation_one_point(self): method test_inference_mask_generation_two_points (line 841) | def test_inference_mask_generation_two_points(self): method test_inference_mask_generation_two_points_batched (line 871) | def test_inference_mask_generation_two_points_batched(self): method test_inference_mask_generation_one_box (line 893) | def test_inference_mask_generation_one_box(self): method test_inference_mask_generation_batched_image_one_point (line 911) | def test_inference_mask_generation_batched_image_one_point(self): method test_inference_mask_generation_two_points_point_batch (line 940) | def test_inference_mask_generation_two_points_point_batch(self): method test_inference_mask_generation_three_boxes_point_batch (line 964) | def test_inference_mask_generation_three_boxes_point_batch(self): method test_dummy_pipeline_generation (line 986) | def test_dummy_pipeline_generation(self): FILE: tests/models/sam/test_processing_sam.py class SamProcessorTest (line 37) | class SamProcessorTest(ProcessorTesterMixin, unittest.TestCase): method prepare_mask_inputs (line 40) | def prepare_mask_inputs(self): method test_chat_template_save_loading (line 48) | def test_chat_template_save_loading(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 51) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 54) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 57) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_tokenizer_defaults_preserved_by_kwargs (line 60) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_image_processor_no_masks (line 63) | def test_image_processor_no_masks(self): method test_image_processor_with_masks (line 87) | def test_image_processor_with_masks(self): method test_post_process_masks (line 105) | def test_post_process_masks(self): method test_rle_encoding (line 132) | def test_rle_encoding(self): FILE: tests/models/sam2/test_image_processing_sam2.py class Sam2ImageProcessingTester (line 29) | class Sam2ImageProcessingTester: method __init__ (line 30) | def __init__( method prepare_image_processor_dict (line 60) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 70) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 73) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 85) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 91) | def prepare_semantic_batch_inputs(): class Sam2ImageProcessingTest (line 98) | class Sam2ImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 99) | def setUp(self): method image_processor_dict (line 104) | def image_processor_dict(self): method test_image_processor_properties (line 107) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 119) | def test_image_processor_from_dict_with_kwargs(self): method test_call_segmentation_maps (line 127) | def test_call_segmentation_maps(self): FILE: tests/models/sam2/test_modeling_sam2.py class Sam2VisionModelTester (line 56) | class Sam2VisionModelTester: method __init__ (line 57) | def __init__( method get_config (line 91) | def get_config(self): method prepare_config_and_inputs (line 110) | def prepare_config_and_inputs(self): method create_and_check_model (line 116) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 128) | def prepare_config_and_inputs_for_common(self): class Sam2VisionModelTest (line 136) | class Sam2VisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 146) | def setUp(self): method test_config (line 150) | def test_config(self): method test_inputs_embeds (line 159) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 162) | def test_model_get_set_embeddings(self): method test_model (line 171) | def test_model(self): method test_attention_outputs (line 176) | def test_attention_outputs(self): method test_hidden_states_output (line 232) | def test_hidden_states_output(self): method test_batching_equivalence (line 272) | def test_batching_equivalence(self, atol=5e-4, rtol=5e-4): method test_sdpa_can_compile_dynamic (line 275) | def test_sdpa_can_compile_dynamic(self): class Sam2PromptEncoderTester (line 279) | class Sam2PromptEncoderTester: method __init__ (line 280) | def __init__( method get_config (line 296) | def get_config(self): method prepare_config_and_inputs (line 306) | def prepare_config_and_inputs(self): class Sam2MaskDecoderTester (line 313) | class Sam2MaskDecoderTester: method __init__ (line 314) | def __init__( method get_config (line 336) | def get_config(self): method prepare_config_and_inputs (line 349) | def prepare_config_and_inputs(self): class Sam2ModelTester (line 359) | class Sam2ModelTester: method __init__ (line 360) | def __init__( method prepare_config_and_inputs (line 397) | def prepare_config_and_inputs(self): method get_config (line 403) | def get_config(self): method create_and_check_model (line 438) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 447) | def prepare_config_and_inputs_for_common(self): class Sam2ModelTest (line 455) | class Sam2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 469) | def setUp(self): method test_config (line 476) | def test_config(self): method test_inputs_embeds (line 480) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 483) | def test_model_get_set_embeddings(self): method test_model (line 492) | def test_model(self): method test_attention_outputs (line 497) | def test_attention_outputs(self): method test_sdpa_can_dispatch_composite_models (line 556) | def test_sdpa_can_dispatch_composite_models(self): method flash_attn_inference_equivalence (line 605) | def flash_attn_inference_equivalence( method test_batching_equivalence (line 701) | def test_batching_equivalence(self, atol=5e-4, rtol=5e-4): method test_retain_grad_hidden_states_attentions (line 705) | def test_retain_grad_hidden_states_attentions(self): method test_hidden_states_output (line 709) | def test_hidden_states_output(self): method test_model_from_pretrained (line 713) | def test_model_from_pretrained(self): method test_sdpa_can_compile_dynamic (line 718) | def test_sdpa_can_compile_dynamic(self): method _image_features_get_expected_num_attentions (line 721) | def _image_features_get_expected_num_attentions(self, model_tester=None): method _image_features_get_expected_num_hidden_states (line 726) | def _image_features_get_expected_num_hidden_states(self, model_tester=... function prepare_image (line 732) | def prepare_image(): function prepare_groceries_image (line 738) | def prepare_groceries_image(): function prepare_dog_img (line 744) | def prepare_dog_img(): function prepare_video (line 750) | def prepare_video(): class Sam2ModelIntegrationTest (line 757) | class Sam2ModelIntegrationTest(unittest.TestCase): method setUp (line 758) | def setUp(self): method tearDown (line 765) | def tearDown(self): method test_inference_mask_generation_one_point_multimask (line 771) | def test_inference_mask_generation_one_point_multimask(self): method test_inference_mask_generation_one_point_no_multimask (line 799) | def test_inference_mask_generation_one_point_no_multimask(self): method test_inference_mask_generation_batched_images_multi_points (line 824) | def test_inference_mask_generation_batched_images_multi_points(self): method test_inference_mask_generation_batched_images_batched_points_multi_points (line 869) | def test_inference_mask_generation_batched_images_batched_points_multi... method test_inference_batched_images_batched_boxes (line 899) | def test_inference_batched_images_batched_boxes(self): method test_inference_mask_generation_from_existing_points_and_mask (line 943) | def test_inference_mask_generation_from_existing_points_and_mask(self): method test_dummy_pipeline_generation (line 1016) | def test_dummy_pipeline_generation(self): FILE: tests/models/sam2/test_processor_sam2.py class Sam2ProcessorTest (line 37) | class Sam2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method prepare_image_inputs (line 40) | def prepare_image_inputs(self): method prepare_mask_inputs (line 48) | def prepare_mask_inputs(self): method test_image_processor_no_masks (line 56) | def test_image_processor_no_masks(self): method test_image_processor_with_masks (line 80) | def test_image_processor_with_masks(self): method test_post_process_masks (line 98) | def test_post_process_masks(self): FILE: tests/models/sam2_video/test_modeling_sam2_video.py function prepare_image (line 42) | def prepare_image(): function prepare_groceries_image (line 48) | def prepare_groceries_image(): function prepare_dog_img (line 54) | def prepare_dog_img(): function prepare_video (line 60) | def prepare_video(): class Sam2VideoModelIntegrationTest (line 67) | class Sam2VideoModelIntegrationTest(unittest.TestCase): method setUp (line 68) | def setUp(self): method tearDown (line 75) | def tearDown(self): method test_inference_mask_generation_video_one_point (line 81) | def test_inference_mask_generation_video_one_point(self): method test_inference_mask_generation_video_one_point_propagate_in_video_directly (line 135) | def test_inference_mask_generation_video_one_point_propagate_in_video_... method test_inference_mask_generation_video_multi_points (line 174) | def test_inference_mask_generation_video_multi_points(self): method test_inference_mask_generation_video_one_bb (line 230) | def test_inference_mask_generation_video_one_bb(self): method test_inference_mask_generation_video_one_point_one_bb (line 285) | def test_inference_mask_generation_video_one_point_one_bb(self): method test_inference_mask_generation_video_multi_objects_multi_points (line 342) | def test_inference_mask_generation_video_multi_objects_multi_points(se... method test_inference_mask_generation_video_batched_bb (line 397) | def test_inference_mask_generation_video_batched_bb(self): method test_inference_propagate_video_from_mask_input (line 438) | def test_inference_propagate_video_from_mask_input(self): method test_inference_propagate_on_streamed_video (line 505) | def test_inference_propagate_on_streamed_video(self): method test_inference_with_different_dtypes (line 549) | def test_inference_with_different_dtypes(self): FILE: tests/models/sam2_video/test_processor_sam2_video.py class Sam2VideoProcessorTest (line 37) | class Sam2VideoProcessorTest(ProcessorTesterMixin, unittest.TestCase): method test_processor_with_multiple_inputs (line 41) | def test_processor_with_multiple_inputs(self): method prepare_image_inputs (line 44) | def prepare_image_inputs(self): method prepare_mask_inputs (line 52) | def prepare_mask_inputs(self): method test_image_processor_no_masks (line 60) | def test_image_processor_no_masks(self): method test_image_processor_with_masks (line 86) | def test_image_processor_with_masks(self): method test_post_process_masks (line 105) | def test_post_process_masks(self): FILE: tests/models/sam3/test_image_processing_sam3.py class Sam3ImageProcessingTester (line 32) | class Sam3ImageProcessingTester: method __init__ (line 33) | def __init__( method prepare_image_processor_dict (line 61) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 71) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 74) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 86) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 92) | def prepare_semantic_batch_inputs(): class Sam3ImageProcessingTest (line 99) | class Sam3ImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 100) | def setUp(self): method image_processor_dict (line 105) | def image_processor_dict(self): method test_call_segmentation_maps (line 108) | def test_call_segmentation_maps(self): FILE: tests/models/sam3/test_modeling_sam3.py class Sam3VisionModelTester (line 57) | class Sam3VisionModelTester: method __init__ (line 58) | def __init__( method get_config (line 95) | def get_config(self): method prepare_config_and_inputs (line 113) | def prepare_config_and_inputs(self): method create_and_check_model (line 119) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 134) | def prepare_config_and_inputs_for_common(self): class Sam3VisionModelTest (line 142) | class Sam3VisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 151) | def setUp(self): method test_config (line 155) | def test_config(self): method test_inputs_embeds (line 164) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 167) | def test_model_get_set_embeddings(self): method test_model (line 176) | def test_model(self): method test_attention_outputs (line 180) | def test_attention_outputs(self): method test_hidden_states_output (line 216) | def test_hidden_states_output(self): method test_batching_equivalence (line 235) | def test_batching_equivalence(self, atol=5e-4, rtol=5e-4): method test_sdpa_can_compile_dynamic (line 239) | def test_sdpa_can_compile_dynamic(self): method test_flex_attention_with_grads (line 243) | def test_flex_attention_with_grads(self): class Sam3ModelTester (line 247) | class Sam3ModelTester: method __init__ (line 248) | def __init__( method prepare_config_and_inputs (line 307) | def prepare_config_and_inputs(self): method get_config (line 317) | def get_config(self): method create_and_check_model (line 386) | def create_and_check_model(self, config, pixel_values, input_ids, atte... method prepare_config_and_inputs_for_common (line 408) | def prepare_config_and_inputs_for_common(self): class Sam3ModelTest (line 420) | class Sam3ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 431) | def setUp(self): method test_config (line 438) | def test_config(self): method test_inputs_embeds (line 442) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 445) | def test_model_get_set_embeddings(self): method test_model (line 455) | def test_model(self): method test_batching_equivalence (line 459) | def test_batching_equivalence(self, atol=5e-4, rtol=5e-4): method test_attention_outputs (line 463) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 520) | def test_retain_grad_hidden_states_attentions(self): method test_hidden_states_output (line 598) | def test_hidden_states_output(self): method test_flex_attention_with_grads (line 636) | def test_flex_attention_with_grads(self): method test_flash_attn_2_inference_equivalence (line 643) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 650) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_flash_attn_3_inference_equivalence (line 657) | def test_flash_attn_3_inference_equivalence(self): method test_flash_attn_3_inference_equivalence_right_padding (line 664) | def test_flash_attn_3_inference_equivalence_right_padding(self): method test_flash_attn_4_inference_equivalence (line 671) | def test_flash_attn_4_inference_equivalence(self): method test_flash_attn_4_inference_equivalence_right_padding (line 678) | def test_flash_attn_4_inference_equivalence_right_padding(self): method test_flash_attn_kernels_inference_equivalence (line 685) | def test_flash_attn_kernels_inference_equivalence(self): method test_flash_attn_kernels_mps_inference_equivalence (line 692) | def test_flash_attn_kernels_mps_inference_equivalence(self): method test_sdpa_can_dispatch_composite_models (line 695) | def test_sdpa_can_dispatch_composite_models(self): method test_forward_with_text_embeds (line 759) | def test_forward_with_text_embeds(self): method test_forward_with_both_input_ids_and_text_embeds_raises_error (line 791) | def test_forward_with_both_input_ids_and_text_embeds_raises_error(self): method test_forward_with_vision_embeds (line 816) | def test_forward_with_vision_embeds(self): method test_forward_with_both_pixel_values_and_vision_embeds_raises_error (line 849) | def test_forward_with_both_pixel_values_and_vision_embeds_raises_error... method test_custom_image_size (line 873) | def test_custom_image_size(self): method test_sdpa_can_compile_dynamic (line 897) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 903) | def test_sdpa_can_dispatch_on_flash(self): method test_model_outputs_equivalence (line 906) | def test_model_outputs_equivalence(self): method _prepare_for_class (line 975) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... function prepare_coco_cat_image (line 1009) | def prepare_coco_cat_image(): function prepare_coco_kitchen_image (line 1016) | def prepare_coco_kitchen_image(): class Sam3ModelIntegrationTest (line 1024) | class Sam3ModelIntegrationTest(unittest.TestCase): method setUp (line 1027) | def setUp(self): method tearDown (line 1035) | def tearDown(self): method test_inference_text_prompt_only (line 1040) | def test_inference_text_prompt_only(self): method test_inference_single_box_prompt (line 1108) | def test_inference_single_box_prompt(self): method test_inference_multi_box_prompt (line 1178) | def test_inference_multi_box_prompt(self): method test_inference_combined_prompts (line 1249) | def test_inference_combined_prompts(self): method test_inference_batched_images (line 1275) | def test_inference_batched_images(self): method test_inference_batched_mixed_prompts (line 1374) | def test_inference_batched_mixed_prompts(self): method test_semantic_segmentation_output (line 1477) | def test_semantic_segmentation_output(self): method test_efficient_multi_prompt_single_image (line 1491) | def test_efficient_multi_prompt_single_image(self): method test_efficient_single_prompt_multi_images (line 1535) | def test_efficient_single_prompt_multi_images(self): FILE: tests/models/sam3_tracker/test_modeling_sam3_tracker.py class Sam3TrackerPromptEncoderTester (line 53) | class Sam3TrackerPromptEncoderTester: method __init__ (line 54) | def __init__( method get_config (line 72) | def get_config(self): method prepare_config_and_inputs (line 82) | def prepare_config_and_inputs(self): class Sam3TrackerMaskDecoderTester (line 89) | class Sam3TrackerMaskDecoderTester: method __init__ (line 90) | def __init__( method get_config (line 114) | def get_config(self): method prepare_config_and_inputs (line 127) | def prepare_config_and_inputs(self): class Sam3TrackerModelTester (line 137) | class Sam3TrackerModelTester: method __init__ (line 138) | def __init__( method prepare_config_and_inputs (line 181) | def prepare_config_and_inputs(self): method get_config (line 187) | def get_config(self): method create_and_check_model (line 224) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 233) | def prepare_config_and_inputs_for_common(self): class Sam3TrackerModelTest (line 241) | class Sam3TrackerModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 255) | def setUp(self): method test_config (line 262) | def test_config(self): method test_inputs_embeds (line 266) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 269) | def test_model_get_set_embeddings(self): method test_model (line 278) | def test_model(self): method test_attention_outputs (line 283) | def test_attention_outputs(self): method test_sdpa_can_dispatch_composite_models (line 327) | def test_sdpa_can_dispatch_composite_models(self): method flash_attn_inference_equivalence (line 376) | def flash_attn_inference_equivalence( method test_batching_equivalence (line 472) | def test_batching_equivalence(self, atol=5e-4, rtol=5e-4): method test_hidden_states_output (line 476) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 480) | def test_retain_grad_hidden_states_attentions(self): method test_model_from_pretrained (line 484) | def test_model_from_pretrained(self): method test_sdpa_can_compile_dynamic (line 489) | def test_sdpa_can_compile_dynamic(self): function prepare_image (line 493) | def prepare_image(): function prepare_groceries_image (line 499) | def prepare_groceries_image(): function prepare_dog_img (line 505) | def prepare_dog_img(): function prepare_video (line 511) | def prepare_video(): class Sam3TrackerModelIntegrationTest (line 518) | class Sam3TrackerModelIntegrationTest(unittest.TestCase): method setUp (line 519) | def setUp(self): method tearDown (line 527) | def tearDown(self): method test_inference_mask_generation_one_point_multimask (line 532) | def test_inference_mask_generation_one_point_multimask(self): method test_inference_mask_generation_one_point_no_multimask (line 567) | def test_inference_mask_generation_one_point_no_multimask(self): method test_inference_mask_generation_batched_images_multi_points (line 596) | def test_inference_mask_generation_batched_images_multi_points(self): method test_inference_mask_generation_batched_images_batched_points_multi_points (line 655) | def test_inference_mask_generation_batched_images_batched_points_multi... method test_inference_batched_images_batched_boxes (line 691) | def test_inference_batched_images_batched_boxes(self): method test_inference_mask_generation_from_existing_points_and_mask (line 738) | def test_inference_mask_generation_from_existing_points_and_mask(self): method test_dummy_pipeline_generation (line 827) | def test_dummy_pipeline_generation(self): FILE: tests/models/sam3_tracker_video/test_modeling_sam3_tracker_video.py function prepare_image (line 42) | def prepare_image(): function prepare_groceries_image (line 48) | def prepare_groceries_image(): function prepare_dog_img (line 54) | def prepare_dog_img(): function prepare_video (line 60) | def prepare_video(): class Sam3TrackerVideoModelIntegrationTest (line 67) | class Sam3TrackerVideoModelIntegrationTest(unittest.TestCase): method setUp (line 68) | def setUp(self): method tearDown (line 75) | def tearDown(self): method test_inference_mask_generation_video_one_point (line 81) | def test_inference_mask_generation_video_one_point(self): method test_inference_mask_generation_video_one_point_propagate_in_video_directly (line 135) | def test_inference_mask_generation_video_one_point_propagate_in_video_... method test_inference_mask_generation_video_multi_points (line 174) | def test_inference_mask_generation_video_multi_points(self): method test_inference_mask_generation_video_one_bb (line 230) | def test_inference_mask_generation_video_one_bb(self): method test_inference_mask_generation_video_one_point_one_bb (line 285) | def test_inference_mask_generation_video_one_point_one_bb(self): method test_inference_mask_generation_video_multi_objects_multi_points (line 342) | def test_inference_mask_generation_video_multi_objects_multi_points(se... method test_inference_mask_generation_video_batched_bb (line 397) | def test_inference_mask_generation_video_batched_bb(self): method test_inference_propagate_video_from_mask_input (line 435) | def test_inference_propagate_video_from_mask_input(self): method test_inference_propagate_on_streamed_video (line 502) | def test_inference_propagate_on_streamed_video(self): method test_inference_with_different_dtypes (line 546) | def test_inference_with_different_dtypes(self): FILE: tests/models/sam3_video/test_modeling_sam3_video.py function prepare_video (line 36) | def prepare_video(): class Sam3VideoModelIntegrationTest (line 43) | class Sam3VideoModelIntegrationTest(unittest.TestCase): method setUp (line 44) | def setUp(self): method tearDown (line 52) | def tearDown(self): method test_inference_video_propagate_with_text_prompt (line 58) | def test_inference_video_propagate_with_text_prompt(self): method test_inference_video_streaming_with_text_prompt (line 260) | def test_inference_video_streaming_with_text_prompt(self): method test_inference_video_multi_prompt (line 478) | def test_inference_video_multi_prompt(self): method test_custom_image_size (line 537) | def test_custom_image_size(self): method test_inference_with_different_dtypes (line 553) | def test_inference_with_different_dtypes(self): FILE: tests/models/sam_hq/test_modeling_sam_hq.py class SamHQVisionModelTester (line 49) | class SamHQVisionModelTester: method __init__ (line 50) | def __init__( method get_config (line 112) | def get_config(self): method prepare_config_and_inputs (line 138) | def prepare_config_and_inputs(self): method create_and_check_model (line 144) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 155) | def prepare_config_and_inputs_for_common(self): class SamHQVisionModelTest (line 163) | class SamHQVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 173) | def setUp(self): method test_config (line 177) | def test_config(self): method test_inputs_embeds (line 181) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 184) | def test_model_get_set_embeddings(self): method test_model (line 193) | def test_model(self): method test_attention_outputs (line 197) | def test_attention_outputs(self): method test_hidden_states_output (line 238) | def test_hidden_states_output(self): method test_sdpa_can_compile_dynamic (line 242) | def test_sdpa_can_compile_dynamic(self): class SamHQPromptEncoderTester (line 246) | class SamHQPromptEncoderTester: method __init__ (line 247) | def __init__( method get_config (line 265) | def get_config(self): method prepare_config_and_inputs (line 275) | def prepare_config_and_inputs(self): class SamHQMaskDecoderTester (line 282) | class SamHQMaskDecoderTester: method __init__ (line 283) | def __init__( method get_config (line 311) | def get_config(self): method prepare_config_and_inputs (line 326) | def prepare_config_and_inputs(self): class SamHQModelTester (line 335) | class SamHQModelTester: method __init__ (line 336) | def __init__( method prepare_config_and_inputs (line 401) | def prepare_config_and_inputs(self): method get_config (line 407) | def get_config(self): method create_and_check_model (line 443) | def create_and_check_model(self, config, pixel_values): method create_and_check_get_image_features (line 454) | def create_and_check_get_image_features(self, config, pixel_values): method create_and_check_get_image_and_intermediate_embeddings (line 462) | def create_and_check_get_image_and_intermediate_embeddings(self, confi... method create_and_check_get_image_intermediate_embeddings (line 472) | def create_and_check_get_image_intermediate_embeddings(self, config, p... method create_and_check_get_image_hidden_states (line 484) | def create_and_check_get_image_hidden_states(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 510) | def prepare_config_and_inputs_for_common(self): class SamHQModelTest (line 518) | class SamHQModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method is_pipeline_test_to_skip (line 535) | def is_pipeline_test_to_skip( method setUp (line 547) | def setUp(self): method test_config (line 554) | def test_config(self): method test_inputs_embeds (line 558) | def test_inputs_embeds(self): method test_sdpa_can_dispatch_on_flash (line 562) | def test_sdpa_can_dispatch_on_flash(self): method test_model_get_set_embeddings (line 565) | def test_model_get_set_embeddings(self): method test_model (line 574) | def test_model(self): method test_get_image_features (line 578) | def test_get_image_features(self): method test_get_image_and_intermediate_embeddings (line 582) | def test_get_image_and_intermediate_embeddings(self): method test_get_image_intermediate_embeddings (line 586) | def test_get_image_intermediate_embeddings(self): method test_image_hidden_states (line 590) | def test_image_hidden_states(self): method test_attention_outputs (line 594) | def test_attention_outputs(self): method test_hidden_states_output (line 648) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 651) | def test_retain_grad_hidden_states_attentions(self): method check_pt_tf_outputs (line 698) | def check_pt_tf_outputs(self, tf_outputs, pt_outputs, model_class, tol... method test_model_from_pretrained (line 703) | def test_model_from_pretrained(self): method test_sdpa_can_compile_dynamic (line 709) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_composite_models (line 712) | def test_sdpa_can_dispatch_composite_models(self): function prepare_image (line 769) | def prepare_image(): function prepare_dog_img (line 775) | def prepare_dog_img(): class SamHQModelIntegrationTest (line 782) | class SamHQModelIntegrationTest(unittest.TestCase): method tearDown (line 783) | def tearDown(self): method test_inference_mask_generation_no_point (line 788) | def test_inference_mask_generation_no_point(self): method test_inference_mask_generation_one_point_one_bb (line 815) | def test_inference_mask_generation_one_point_one_bb(self): method test_inference_mask_generation_batched_points_batched_images (line 839) | def test_inference_mask_generation_batched_points_batched_images(self): method test_inference_mask_generation_one_point_one_bb_zero (line 907) | def test_inference_mask_generation_one_point_one_bb_zero(self): method test_inference_mask_generation_with_labels (line 933) | def test_inference_mask_generation_with_labels(self): method test_inference_mask_generation_without_labels (line 953) | def test_inference_mask_generation_without_labels(self): method test_inference_mask_generation_two_points_with_labels (line 970) | def test_inference_mask_generation_two_points_with_labels(self): method test_inference_mask_generation_two_points_without_labels (line 990) | def test_inference_mask_generation_two_points_without_labels(self): method test_inference_mask_generation_two_points_batched (line 1007) | def test_inference_mask_generation_two_points_batched(self): method test_inference_mask_generation_one_box (line 1033) | def test_inference_mask_generation_one_box(self): method test_inference_mask_generation_batched_image_one_point (line 1051) | def test_inference_mask_generation_batched_image_one_point(self): method test_inference_mask_generation_two_points_point_batch (line 1080) | def test_inference_mask_generation_two_points_point_batch(self): method test_inference_mask_generation_three_boxes_point_batch (line 1104) | def test_inference_mask_generation_three_boxes_point_batch(self): method test_dummy_pipeline_generation (line 1130) | def test_dummy_pipeline_generation(self): FILE: tests/models/sam_hq/test_processing_sam_hq.py class SamHQProcessorTest (line 35) | class SamHQProcessorTest(ProcessorTesterMixin, unittest.TestCase): method prepare_image_inputs (line 38) | def prepare_image_inputs(self): method prepare_mask_inputs (line 42) | def prepare_mask_inputs(self): method test_tokenizer_defaults_preserved_by_kwargs (line 50) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 53) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_chat_template_save_loading (line 56) | def test_chat_template_save_loading(self): method test_kwargs_overrides_default_image_processor_kwargs (line 59) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 62) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_unstructured_kwargs (line 65) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 68) | def test_unstructured_kwargs_batched(self): method test_doubly_passed_kwargs (line 71) | def test_doubly_passed_kwargs(self): method test_structured_kwargs_nested (line 74) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 77) | def test_structured_kwargs_nested_from_dict(self): method test_image_processor_no_masks (line 80) | def test_image_processor_no_masks(self): method test_image_processor_with_masks (line 104) | def test_image_processor_with_masks(self): method test_post_process_masks (line 122) | def test_post_process_masks(self): FILE: tests/models/seamless_m4t/test_feature_extraction_seamless_m4t.py function floats_list (line 39) | def floats_list(shape, scale=1.0, rng=None, name=None): class SeamlessM4TFeatureExtractionTester (line 54) | class SeamlessM4TFeatureExtractionTester: method __init__ (line 55) | def __init__( method prepare_feat_extract_dict (line 81) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 93) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class SeamlessM4TFeatureExtractionTest (line 111) | class SeamlessM4TFeatureExtractionTest(SequenceFeatureExtractionTestMixi... method setUp (line 114) | def setUp(self): method test_feat_extract_from_and_save_pretrained (line 117) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 129) | def test_feat_extract_to_json_file(self): method test_call_numpy (line 141) | def test_call_numpy(self): method test_call_with_padded_input_not_multiple_of_stride (line 173) | def test_call_with_padded_input_not_multiple_of_stride(self): method test_call_without_attention_mask (line 230) | def test_call_without_attention_mask(self): method test_attention_mask (line 248) | def test_attention_mask(self): method test_call_torch (line 267) | def test_call_torch(self): method test_double_precision_pad (line 303) | def test_double_precision_pad(self): method _load_datasample (line 316) | def _load_datasample(self, id): method test_integration (line 323) | def test_integration(self): method test_zero_mean_unit_variance_normalization_trunc_np_longest (line 343) | def test_zero_mean_unit_variance_normalization_trunc_np_longest(self): FILE: tests/models/seamless_m4t/test_modeling_seamless_m4t.py class SeamlessM4TModelTester (line 52) | class SeamlessM4TModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs (line 148) | def prepare_config_and_inputs(self): method get_config (line 166) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 208) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 232) | def create_and_check_model(self, config, input_ids, decoder_input_ids,... method create_and_check_decoder_model_past_large_inputs (line 260) | def create_and_check_decoder_model_past_large_inputs( method prepare_config_and_inputs_for_common (line 317) | def prepare_config_and_inputs_for_common(self): class SeamlessM4TModelWithSpeechInputTest (line 339) | class SeamlessM4TModelWithSpeechInputTest(ModelTesterMixin, unittest.Tes... method setUp (line 357) | def setUp(self): method test_config (line 361) | def test_config(self): method test_model (line 364) | def test_model(self): method test_model_from_pretrained (line 369) | def test_model_from_pretrained(self): method test_inputs_embeds (line 375) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 379) | def test_inputs_embeds_matches_input_ids(self): method test_model_weights_reload_no_missing_tied_weights (line 385) | def test_model_weights_reload_no_missing_tied_weights(self): method test_forward_signature (line 389) | def test_forward_signature(self): method test_training_gradient_checkpointing (line 393) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 397) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 401) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_load_save_without_tied_weights (line 407) | def test_load_save_without_tied_weights(self): method test_attention_outputs (line 410) | def test_attention_outputs(self): method _prepare_config_and_inputs_for_retain_grad_hidden_states_attentions (line 517) | def _prepare_config_and_inputs_for_retain_grad_hidden_states_attention... class SeamlessM4TModelWithTextInputTest (line 527) | class SeamlessM4TModelWithTextInputTest(ModelTesterMixin, PipelineTester... method setUp (line 554) | def setUp(self): method test_config (line 558) | def test_config(self): method test_model (line 561) | def test_model(self): method test_model_from_pretrained (line 566) | def test_model_from_pretrained(self): method test_model_weights_reload_no_missing_tied_weights (line 574) | def test_model_weights_reload_no_missing_tied_weights(self): method test_forward_signature (line 578) | def test_forward_signature(self): method test_decoder_model_past_with_large_inputs (line 581) | def test_decoder_model_past_with_large_inputs(self): method test_training_gradient_checkpointing (line 586) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 590) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 594) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 600) | def test_retain_grad_hidden_states_attentions(self): method test_load_save_without_tied_weights (line 606) | def test_load_save_without_tied_weights(self): class SeamlessM4TGenerationTest (line 611) | class SeamlessM4TGenerationTest(unittest.TestCase): method setUp (line 615) | def setUp(self): method update_generation (line 620) | def update_generation(self, model): method prepare_text_input (line 636) | def prepare_text_input(self): method prepare_speech_input (line 649) | def prepare_speech_input(self): method prepare_speech_and_text_input (line 662) | def prepare_speech_and_text_input(self): method factory_generation_speech_test (line 684) | def factory_generation_speech_test(self, model, inputs): method test_speech_generation (line 689) | def test_speech_generation(self): method test_text_generation (line 736) | def test_text_generation(self): method test_generation (line 787) | def test_generation(self): class SeamlessM4TModelIntegrationTest (line 823) | class SeamlessM4TModelIntegrationTest(unittest.TestCase): method assertListAlmostEqual (line 826) | def assertListAlmostEqual(self, list1, list2, tol=1e-3): method processor (line 832) | def processor(self): method input_text (line 836) | def input_text(self): method input_audio (line 853) | def input_audio(self): method factory_test_task (line 863) | def factory_test_task(self, class1, class2, inputs, class1_kwargs, cla... method test_to_eng_text (line 880) | def test_to_eng_text(self): method test_to_swh_text (line 908) | def test_to_swh_text(self): method test_to_rus_speech (line 935) | def test_to_rus_speech(self): method test_text_to_text_model (line 962) | def test_text_to_text_model(self): method test_speech_to_text_model (line 974) | def test_speech_to_text_model(self): method test_speech_to_speech_model (line 986) | def test_speech_to_speech_model(self): method test_text_to_speech_model (line 991) | def test_text_to_speech_model(self): FILE: tests/models/seamless_m4t/test_processing_seamless_m4t.py class SeamlessM4TProcessorTest (line 30) | class SeamlessM4TProcessorTest(unittest.TestCase): method setUp (line 31) | def setUp(self): method get_tokenizer (line 35) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 38) | def get_feature_extractor(self, **kwargs): method tearDown (line 41) | def tearDown(self): method test_save_load_pretrained_default (line 44) | def test_save_load_pretrained_default(self): method test_feature_extractor (line 61) | def test_feature_extractor(self): method test_tokenizer (line 76) | def test_tokenizer(self): method test_tokenizer_decode (line 92) | def test_tokenizer_decode(self): FILE: tests/models/seamless_m4t/test_tokenization_seamless_m4t.py class SeamlessM4TTokenizationTest (line 51) | class SeamlessM4TTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method test_batch_encode_plus_batch_sequence_length (line 61) | def test_batch_encode_plus_batch_sequence_length(self): method test_padding_to_multiple_of (line 76) | def test_padding_to_multiple_of(self): method test_prepare_seq2seq_batch (line 112) | def test_prepare_seq2seq_batch(self): method test_special_tokens_initialization (line 172) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 184) | def test_training_new_tokenizer(self): class SeamlessM4TDistilledIntegrationTest (line 226) | class SeamlessM4TDistilledIntegrationTest(unittest.TestCase): method setUpClass (line 242) | def setUpClass(cls): method setUp (line 249) | def setUp(self): method test_int_remove_extra_whitespaces (line 254) | def test_int_remove_extra_whitespaces(self): method test_language_codes (line 281) | def test_language_codes(self): method test_tokenizer_tgt_lang (line 288) | def test_tokenizer_tgt_lang(self): method test_enro_tokenizer_decode_ignores_language_codes (line 301) | def test_enro_tokenizer_decode_ignores_language_codes(self): method test_enro_tokenizer_truncation (line 310) | def test_enro_tokenizer_truncation(self): method test_enro_tokenizer_prepare_batch (line 320) | def test_enro_tokenizer_prepare_batch(self): method test_seq2seq_max_length (line 345) | def test_seq2seq_max_length(self): method test_tokenizer_translation (line 363) | def test_tokenizer_translation(self): class CommonSpmIntegrationTests (line 382) | class CommonSpmIntegrationTests(unittest.TestCase): method setUpClass (line 388) | def setUpClass(cls): method setUp (line 394) | def setUp(self): method test_add_dummy_prefix (line 397) | def test_add_dummy_prefix(self): method test_character_after_special_token (line 414) | def test_character_after_special_token(self): method test_special_tokens_strip (line 428) | def test_special_tokens_strip(self): FILE: tests/models/seamless_m4t_v2/test_modeling_seamless_m4t_v2.py class SeamlessM4Tv2ModelTester (line 51) | class SeamlessM4Tv2ModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs (line 165) | def prepare_config_and_inputs(self): method get_config (line 183) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 234) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 258) | def create_and_check_model(self, config, input_ids, decoder_input_ids,... method create_and_check_decoder_model_past_large_inputs (line 286) | def create_and_check_decoder_model_past_large_inputs( method prepare_config_and_inputs_for_common (line 343) | def prepare_config_and_inputs_for_common(self): class SeamlessM4Tv2ModelWithSpeechInputTest (line 365) | class SeamlessM4Tv2ModelWithSpeechInputTest(ModelTesterMixin, unittest.T... method setUp (line 383) | def setUp(self): method test_config (line 387) | def test_config(self): method test_model (line 390) | def test_model(self): method test_model_from_pretrained (line 395) | def test_model_from_pretrained(self): method test_inputs_embeds (line 401) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 405) | def test_inputs_embeds_matches_input_ids(self): method test_model_weights_reload_no_missing_tied_weights (line 411) | def test_model_weights_reload_no_missing_tied_weights(self): method test_forward_signature (line 415) | def test_forward_signature(self): method test_training_gradient_checkpointing (line 419) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 423) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 427) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_load_save_without_tied_weights (line 433) | def test_load_save_without_tied_weights(self): method test_attention_outputs (line 436) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 545) | def test_retain_grad_hidden_states_attentions(self): class SeamlessM4Tv2ModelWithTextInputTest (line 550) | class SeamlessM4Tv2ModelWithTextInputTest(ModelTesterMixin, unittest.Tes... method setUp (line 568) | def setUp(self): method test_config (line 572) | def test_config(self): method test_model (line 575) | def test_model(self): method test_model_from_pretrained (line 580) | def test_model_from_pretrained(self): method test_model_weights_reload_no_missing_tied_weights (line 588) | def test_model_weights_reload_no_missing_tied_weights(self): method test_forward_signature (line 592) | def test_forward_signature(self): method test_decoder_model_past_with_large_inputs (line 595) | def test_decoder_model_past_with_large_inputs(self): method test_training_gradient_checkpointing (line 600) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 604) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 608) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_load_save_without_tied_weights (line 614) | def test_load_save_without_tied_weights(self): class SeamlessM4Tv2GenerationTest (line 619) | class SeamlessM4Tv2GenerationTest(unittest.TestCase): method setUp (line 623) | def setUp(self): method update_generation (line 628) | def update_generation(self, model): method prepare_text_input (line 661) | def prepare_text_input(self, tgt_lang): method prepare_speech_input (line 674) | def prepare_speech_input(self): method prepare_speech_and_text_input (line 687) | def prepare_speech_and_text_input(self): method factory_generation_speech_test (line 709) | def factory_generation_speech_test(self, model, inputs): method test_generation_languages (line 714) | def test_generation_languages(self): method test_speech_generation (line 734) | def test_speech_generation(self): method test_text_generation (line 797) | def test_text_generation(self): method test_generation (line 848) | def test_generation(self): class SeamlessM4Tv2ModelIntegrationTest (line 886) | class SeamlessM4Tv2ModelIntegrationTest(unittest.TestCase): method assertListAlmostEqual (line 889) | def assertListAlmostEqual(self, list1, list2, tol=1e-4): method processor (line 895) | def processor(self): method input_text (line 899) | def input_text(self): method input_audio (line 916) | def input_audio(self): method factory_test_task (line 926) | def factory_test_task(self, class1, class2, inputs, class1_kwargs, cla... method test_to_eng_text (line 944) | def test_to_eng_text(self): method test_to_swh_text (line 978) | def test_to_swh_text(self): method test_to_rus_speech (line 1013) | def test_to_rus_speech(self): method test_text_to_text_model (line 1046) | def test_text_to_text_model(self): method test_speech_to_text_model (line 1058) | def test_speech_to_text_model(self): method test_speech_to_speech_model (line 1070) | def test_speech_to_speech_model(self): method test_text_to_speech_model (line 1075) | def test_text_to_speech_model(self): FILE: tests/models/seed_oss/test_modeling_seed_oss.py class SeedOssModelTester (line 41) | class SeedOssModelTester(CausalLMModelTester): method __init__ (line 45) | def __init__(self, parent): class SeedOssModelTest (line 56) | class SeedOssModelTest(CausalLMModelTest, unittest.TestCase): class SeedOssIntegrationTest (line 64) | class SeedOssIntegrationTest(unittest.TestCase): method setUp (line 68) | def setUp(self): method tearDown (line 71) | def tearDown(self): method test_model_36b_eager (line 74) | def test_model_36b_eager(self): method test_model_36b_sdpa (line 97) | def test_model_36b_sdpa(self): method test_model_36b_flash_attn (line 119) | def test_model_36b_flash_attn(self): FILE: tests/models/segformer/test_image_processing_segformer.py class SegformerImageProcessingTester (line 30) | class SegformerImageProcessingTester: method __init__ (line 31) | def __init__( method prepare_image_processor_dict (line 58) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 68) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 71) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_semantic_single_inputs (line 83) | def prepare_semantic_single_inputs(): function prepare_semantic_batch_inputs (line 89) | def prepare_semantic_batch_inputs(): class SegformerImageProcessingTest (line 96) | class SegformerImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 97) | def setUp(self): method image_processor_dict (line 102) | def image_processor_dict(self): method test_image_processor_properties (line 105) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 115) | def test_image_processor_from_dict_with_kwargs(self): method test_call_segmentation_maps (line 127) | def test_call_segmentation_maps(self): method test_reduce_labels (line 234) | def test_reduce_labels(self): method test_backends_equivalence (line 255) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 279) | def test_backends_equivalence_batched(self): FILE: tests/models/segformer/test_modeling_segformer.py class SegformerConfigTester (line 43) | class SegformerConfigTester(ConfigTester): method create_and_test_config_common_properties (line 44) | def create_and_test_config_common_properties(self): class SegformerModelTester (line 51) | class SegformerModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 102) | def get_config(self): method create_and_check_model (line 116) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_segmentation (line 126) | def create_and_check_for_image_segmentation(self, config, pixel_values... method create_and_check_for_binary_image_segmentation (line 141) | def create_and_check_for_binary_image_segmentation(self, config, pixel... method prepare_config_and_inputs_for_common (line 150) | def prepare_config_and_inputs_for_common(self): class SegformerModelTest (line 158) | class SegformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest... method setUp (line 180) | def setUp(self): method test_config (line 184) | def test_config(self): method test_model (line 187) | def test_model(self): method test_for_binary_image_segmentation (line 191) | def test_for_binary_image_segmentation(self): method test_for_image_segmentation (line 195) | def test_for_image_segmentation(self): method test_batching_equivalence (line 199) | def test_batching_equivalence(self, atol=2e-4, rtol=2e-4): method test_inputs_embeds (line 203) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 207) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 210) | def test_attention_outputs(self): method test_hidden_states_output (line 280) | def test_hidden_states_output(self): method test_training (line 316) | def test_training(self): method test_model_from_pretrained (line 335) | def test_model_from_pretrained(self): function prepare_img (line 342) | def prepare_img(): class SegformerModelIntegrationTest (line 348) | class SegformerModelIntegrationTest(unittest.TestCase): method test_inference_image_segmentation_ade (line 350) | def test_inference_image_segmentation_ade(self): method test_inference_image_segmentation_city (line 387) | def test_inference_image_segmentation_city(self): method test_post_processing_semantic_segmentation (line 427) | def test_post_processing_semantic_segmentation(self): FILE: tests/models/seggpt/test_image_processing_seggpt.py class SegGptImageProcessingTester (line 35) | class SegGptImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 63) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 72) | def expected_output_image_shape(self, images): method expected_post_processed_shape (line 75) | def expected_post_processed_shape(self): method get_fake_image_segmentation_output (line 78) | def get_fake_image_segmentation_output(self): method prepare_image_inputs (line 84) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... function prepare_mask (line 96) | def prepare_mask(): function prepare_img (line 101) | def prepare_img(): class SegGptImageProcessingTest (line 110) | class SegGptImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 111) | def setUp(self): method image_processor_dict (line 116) | def image_processor_dict(self): method test_image_processor_properties (line 119) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 128) | def test_image_processor_from_dict_with_kwargs(self): method test_image_processor_palette (line 136) | def test_image_processor_palette(self): method test_mask_equivalence (line 144) | def test_mask_equivalence(self): method test_mask_to_rgb (line 156) | def test_mask_to_rgb(self): method test_post_processing_semantic_segmentation (line 182) | def test_post_processing_semantic_segmentation(self): method test_pixel_values (line 194) | def test_pixel_values(self): method test_prompt_mask_equivalence (line 242) | def test_prompt_mask_equivalence(self): method test_backends_equivalence (line 318) | def test_backends_equivalence(self): FILE: tests/models/seggpt/test_modeling_seggpt.py class SegGptModelTester (line 50) | class SegGptModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 112) | def get_config(self): method create_and_check_model (line 130) | def create_and_check_model(self, config, pixel_values, prompt_pixel_va... method prepare_config_and_inputs_for_common (line 145) | def prepare_config_and_inputs_for_common(self): class SegGptModelTest (line 163) | class SegGptModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 177) | def setUp(self): method test_config (line 181) | def test_config(self): method test_inputs_embeds (line 185) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 188) | def test_model_get_set_embeddings(self): method test_forward_signature (line 195) | def test_forward_signature(self): method test_model (line 207) | def test_model(self): method test_hidden_states_output (line 211) | def test_hidden_states_output(self): method test_batching_equivalence (line 246) | def test_batching_equivalence(self): method test_seggpt_loss (line 300) | def test_seggpt_loss(self): method test_model_from_pretrained (line 317) | def test_model_from_pretrained(self): function prepare_img (line 323) | def prepare_img(): function prepare_bool_masked_pos (line 330) | def prepare_bool_masked_pos(config: SegGptConfig): class SegGptModelIntegrationTest (line 346) | class SegGptModelIntegrationTest(unittest.TestCase): method default_image_processor (line 348) | def default_image_processor(self): method test_one_shot_inference (line 352) | def test_one_shot_inference(self): method test_few_shot_inference (line 406) | def test_few_shot_inference(self): method test_one_shot_with_label (line 440) | def test_one_shot_with_label(self): FILE: tests/models/sew/test_modeling_sew.py class SEWModelTester (line 47) | class SEWModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 108) | def prepare_config_and_inputs(self): method get_config (line 116) | def get_config(self): method create_and_check_model (line 139) | def create_and_check_model(self, config, input_values, attention_mask): method check_ctc_loss (line 148) | def check_ctc_loss(self, config, input_values, *args): method check_ctc_training (line 176) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_loss (line 205) | def check_seq_classifier_loss(self, config, input_values, *args): method check_seq_classifier_training (line 230) | def check_seq_classifier_training(self, config, input_values, *args): method check_labels_out_of_vocab (line 253) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 267) | def prepare_config_and_inputs_for_common(self): class SEWModelTest (line 274) | class SEWModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 286) | def setUp(self): method test_config (line 290) | def test_config(self): method test_model (line 293) | def test_model(self): method test_ctc_loss_inference (line 297) | def test_ctc_loss_inference(self): method test_ctc_train (line 301) | def test_ctc_train(self): method test_labels_out_of_vocab (line 305) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 310) | def test_inputs_embeds(self): method test_forward_signature (line 314) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 318) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 322) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 325) | def test_retain_grad_hidden_states_attentions(self): method test_seq_classifier_loss_inference (line 368) | def test_seq_classifier_loss_inference(self): method test_seq_classifier_train (line 372) | def test_seq_classifier_train(self): method _mock_init_weights (line 377) | def _mock_init_weights(self, module): method test_feed_forward_chunking (line 390) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 394) | def test_model_from_pretrained(self): class SEWUtilsTest (line 400) | class SEWUtilsTest(unittest.TestCase): method test_compute_mask_indices (line 401) | def test_compute_mask_indices(self): method test_compute_mask_indices_overlap (line 412) | def test_compute_mask_indices_overlap(self): class SEWModelIntegrationTest (line 429) | class SEWModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 430) | def _load_datasamples(self, num_samples): method test_inference_pretrained_batched (line 441) | def test_inference_pretrained_batched(self): method test_inference_ctc_batched (line 495) | def test_inference_ctc_batched(self): FILE: tests/models/sew_d/test_modeling_sew_d.py class SEWDModelTester (line 47) | class SEWDModelTester: method __init__ (line 48) | def __init__( method prepare_config_and_inputs (line 122) | def prepare_config_and_inputs(self): method get_config (line 130) | def get_config(self): method create_and_check_model (line 160) | def create_and_check_model(self, config, input_values, attention_mask): method check_ctc_loss (line 169) | def check_ctc_loss(self, config, input_values, *args): method check_ctc_training (line 197) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_loss (line 226) | def check_seq_classifier_loss(self, config, input_values, *args): method check_seq_classifier_training (line 251) | def check_seq_classifier_training(self, config, input_values, *args): method check_labels_out_of_vocab (line 274) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 288) | def prepare_config_and_inputs_for_common(self): class SEWDModelTest (line 295) | class SEWDModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 307) | def setUp(self): method test_config (line 311) | def test_config(self): method test_model (line 314) | def test_model(self): method test_ctc_loss_inference (line 318) | def test_ctc_loss_inference(self): method test_ctc_train (line 322) | def test_ctc_train(self): method test_labels_out_of_vocab (line 326) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 331) | def test_inputs_embeds(self): method test_forward_signature (line 335) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 339) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 343) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 346) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 387) | def _mock_init_weights(self, module): method test_feed_forward_chunking (line 400) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 404) | def test_model_from_pretrained(self): class SEWDUtilsTest (line 410) | class SEWDUtilsTest(unittest.TestCase): method test_compute_mask_indices (line 411) | def test_compute_mask_indices(self): method test_compute_mask_indices_overlap (line 422) | def test_compute_mask_indices_overlap(self): class SEWDModelIntegrationTest (line 439) | class SEWDModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 440) | def _load_datasamples(self, num_samples): method test_inference_pretrained_batched (line 451) | def test_inference_pretrained_batched(self): method test_inference_ctc_batched (line 505) | def test_inference_ctc_batched(self): FILE: tests/models/shieldgemma2/test_modeling_shieldgemma2.py class ShieldGemma2IntegrationTest (line 37) | class ShieldGemma2IntegrationTest(unittest.TestCase): method tearDown (line 38) | def tearDown(self): method test_model (line 41) | def test_model(self): FILE: tests/models/shieldgemma2/test_processing_shieldgemma2.py class ShieldGemma2ProcessorTest (line 66) | class ShieldGemma2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 70) | def _setup_image_processor(cls): method _setup_tokenizer (line 75) | def _setup_tokenizer(cls): method prepare_processor_dict (line 87) | def prepare_processor_dict(cls): method test_policy_definitions_saved_in_config (line 93) | def test_policy_definitions_saved_in_config(self): method test_with_default_policies (line 110) | def test_with_default_policies(self, name, policies, expected_batch_si... method test_with_custom_policies (line 131) | def test_with_custom_policies(self, name, policies, expected_batch_size): method test_with_multiple_images (line 149) | def test_with_multiple_images(self): method test_apply_chat_template_image (line 163) | def test_apply_chat_template_image(self, batch_size: int, return_tenso... method test_unstructured_kwargs_batched (line 168) | def test_unstructured_kwargs_batched(self): method test_unstructured_kwargs (line 173) | def test_unstructured_kwargs(self): method test_tokenizer_defaults_preserved_by_kwargs (line 178) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_structured_kwargs_nested_from_dict (line 183) | def test_structured_kwargs_nested_from_dict(self): method test_structured_kwargs_nested (line 188) | def test_structured_kwargs_nested(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 193) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 198) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_apply_chat_template_assistant_mask (line 202) | def test_apply_chat_template_assistant_mask(self): method test_processor_text_has_no_visual (line 205) | def test_processor_text_has_no_visual(self): FILE: tests/models/siglip/test_image_processing_siglip.py class SiglipImageProcessingTester (line 23) | class SiglipImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 55) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 66) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 69) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class SiglipImageProcessingTest (line 84) | class SiglipImageProcessingTest(ImageProcessingTestMixin, unittest.TestC... method setUp (line 85) | def setUp(self): method image_processor_dict (line 90) | def image_processor_dict(self): method test_image_processor_properties (line 94) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 107) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 119) | def test_call_numpy_4_channels(self): FILE: tests/models/siglip/test_modeling_siglip.py class SiglipModelTesterMixin (line 61) | class SiglipModelTesterMixin(ModelTesterMixin): method test_sdpa_can_dispatch_composite_models (line 62) | def test_sdpa_can_dispatch_composite_models(self): class SiglipVisionModelTester (line 91) | class SiglipVisionModelTester: method __init__ (line 92) | def __init__( method prepare_config_and_inputs (line 129) | def prepare_config_and_inputs(self): method get_config (line 135) | def get_config(self): method create_and_check_model (line 149) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 163) | def prepare_config_and_inputs_for_common(self): class SiglipVisionModelTest (line 171) | class SiglipVisionModelTest(SiglipModelTesterMixin, unittest.TestCase): method setUp (line 187) | def setUp(self): method test_config (line 193) | def test_config(self): method test_inputs_embeds (line 197) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 200) | def test_model_get_set_embeddings(self): method test_vision_transformer_get_set_input_embeddings (line 209) | def test_vision_transformer_get_set_input_embeddings(self): method test_forward_signature (line 225) | def test_forward_signature(self): method test_model (line 237) | def test_model(self): method test_training (line 242) | def test_training(self): method test_model_from_pretrained (line 246) | def test_model_from_pretrained(self): method test_eager_matches_sdpa_inference (line 252) | def test_eager_matches_sdpa_inference(self, *args): class SiglipTextModelTester (line 257) | class SiglipTextModelTester: method __init__ (line 258) | def __init__( method prepare_config_and_inputs (line 295) | def prepare_config_and_inputs(self): method get_config (line 313) | def get_config(self): method create_and_check_model (line 326) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 337) | def prepare_config_and_inputs_for_common(self): class SiglipTextModelTest (line 345) | class SiglipTextModelTest(SiglipModelTesterMixin, unittest.TestCase): method setUp (line 351) | def setUp(self): method test_config (line 356) | def test_config(self): method test_model (line 360) | def test_model(self): method test_training (line 365) | def test_training(self): method test_training_gradient_checkpointing (line 369) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 373) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 377) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 382) | def test_inputs_embeds(self): method test_model_from_pretrained (line 386) | def test_model_from_pretrained(self): class SiglipModelTester (line 392) | class SiglipModelTester: method __init__ (line 393) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 406) | def prepare_config_and_inputs(self): method get_config (line 414) | def get_config(self): method create_and_check_model (line 420) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 431) | def prepare_config_and_inputs_for_common(self): class SiglipModelTest (line 444) | class SiglipModelTest(SiglipModelTesterMixin, PipelineTesterMixin, unitt... method setUp (line 459) | def setUp(self): method test_config (line 463) | def test_config(self): method test_model (line 467) | def test_model(self): method test_hidden_states_output (line 473) | def test_hidden_states_output(self): method test_inputs_embeds (line 478) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 483) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 488) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 492) | def test_load_vision_text_config(self): method test_get_text_features_attentions (line 508) | def test_get_text_features_attentions(self): method test_get_text_features_hidden_states (line 513) | def test_get_text_features_hidden_states(self): method test_get_image_features_attentions (line 518) | def test_get_image_features_attentions(self): method test_get_image_features_hidden_states (line 523) | def test_get_image_features_hidden_states(self): method test_model_from_pretrained (line 528) | def test_model_from_pretrained(self): class SiglipForImageClassificationModelTester (line 534) | class SiglipForImageClassificationModelTester(SiglipModelTester): method __init__ (line 535) | def __init__(self, parent): method prepare_config_and_inputs (line 542) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 548) | def prepare_config_and_inputs_for_common(self): class SiglipForImageClassificationModelTest (line 556) | class SiglipForImageClassificationModelTest(SiglipModelTesterMixin, Pipe... method setUp (line 570) | def setUp(self): method test_inputs_embeds (line 574) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 578) | def test_model_get_set_embeddings(self): method test_training_gradient_checkpointing (line 582) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 586) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 590) | def test_training_gradient_checkpointing_use_reentrant_true(self): function prepare_img (line 595) | def prepare_img(): class SiglipModelIntegrationTest (line 603) | class SiglipModelIntegrationTest(unittest.TestCase): method test_inference (line 605) | def test_inference(self): method test_inference_interpolate_pos_encoding (line 641) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/siglip/test_tokenization_siglip.py class SiglipTokenizationTest (line 29) | class SiglipTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 37) | def setUpClass(cls): method test_convert_token_and_id (line 44) | def test_convert_token_and_id(self): method test_get_vocab (line 52) | def test_get_vocab(self): method test_full_tokenizer (line 58) | def test_full_tokenizer(self): method siglip_tokenizer (line 123) | def siglip_tokenizer(self): method get_tokenizer (line 127) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> SiglipTokeni... method test_eos_treatment (line 131) | def test_eos_treatment(self): method test_prepare_batch (line 137) | def test_prepare_batch(self): method test_empty_target_text (line 150) | def test_empty_target_text(self): method test_max_length (line 159) | def test_max_length(self): method test_eos_in_input (line 167) | def test_eos_in_input(self): method test_subword_regularization_tokenizer (line 180) | def test_subword_regularization_tokenizer(self): method test_special_tokens_initialization (line 183) | def test_special_tokens_initialization(self): method test_sentencepiece_tokenize_and_convert_tokens_to_string (line 196) | def test_sentencepiece_tokenize_and_convert_tokens_to_string(self): method test_tokenizer_integration (line 231) | def test_tokenizer_integration(self): method test_some_edge_cases (line 254) | def test_some_edge_cases(self): class CommonSpmIntegrationTests (line 282) | class CommonSpmIntegrationTests(unittest.TestCase): method setUpClass (line 288) | def setUpClass(cls): method test_add_dummy_prefix (line 295) | def test_add_dummy_prefix(self): method test_remove_extra_whitespaces (line 316) | def test_remove_extra_whitespaces(self): FILE: tests/models/siglip2/test_image_processing_siglip2.py class Siglip2ImageProcessingTester (line 28) | class Siglip2ImageProcessingTester: method __init__ (line 29) | def __init__( method prepare_image_processor_dict (line 67) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 80) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 83) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Siglip2ImageProcessingTest (line 98) | class Siglip2ImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 99) | def setUp(self): method image_processor_dict (line 104) | def image_processor_dict(self): method test_image_processor_properties (line 108) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 122) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 136) | def test_call_numpy_4_channels(self): FILE: tests/models/siglip2/test_modeling_siglip2.py class Siglip2ModelTesterMixin (line 64) | class Siglip2ModelTesterMixin(ModelTesterMixin): method test_sdpa_can_dispatch_composite_models (line 65) | def test_sdpa_can_dispatch_composite_models(self): method test_flash_attn_2_inference_equivalence (line 97) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 163) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_sdpa_can_dispatch_on_flash (line 167) | def test_sdpa_can_dispatch_on_flash(self): class Siglip2VisionModelTester (line 171) | class Siglip2VisionModelTester: method __init__ (line 172) | def __init__( method prepare_config_and_inputs (line 206) | def prepare_config_and_inputs(self): method get_config (line 228) | def get_config(self): method create_and_check_model (line 242) | def create_and_check_model(self, config, pixel_values, pixel_attention... method prepare_config_and_inputs_for_common (line 252) | def prepare_config_and_inputs_for_common(self): class Siglip2VisionModelTest (line 263) | class Siglip2VisionModelTest(Siglip2ModelTesterMixin, unittest.TestCase): method setUp (line 280) | def setUp(self): method test_config (line 286) | def test_config(self): method test_inputs_embeds (line 290) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 293) | def test_model_get_set_embeddings(self): method test_forward_signature (line 302) | def test_forward_signature(self): method test_model (line 314) | def test_model(self): method test_model_from_pretrained (line 319) | def test_model_from_pretrained(self): method test_eager_matches_sdpa_inference (line 326) | def test_eager_matches_sdpa_inference(self, *args): class Siglip2TextModelTester (line 331) | class Siglip2TextModelTester: method __init__ (line 332) | def __init__( method prepare_config_and_inputs (line 368) | def prepare_config_and_inputs(self): method get_config (line 386) | def get_config(self): method create_and_check_model (line 399) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 409) | def prepare_config_and_inputs_for_common(self): class Siglip2TextModelTest (line 417) | class Siglip2TextModelTest(Siglip2ModelTesterMixin, unittest.TestCase): method setUp (line 423) | def setUp(self): method test_config (line 427) | def test_config(self): method test_model (line 430) | def test_model(self): method test_training (line 435) | def test_training(self): method test_training_gradient_checkpointing (line 439) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 443) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 447) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 451) | def test_inputs_embeds(self): method test_model_from_pretrained (line 455) | def test_model_from_pretrained(self): class Siglip2ModelTester (line 461) | class Siglip2ModelTester: method __init__ (line 462) | def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_tr... method prepare_config_and_inputs (line 474) | def prepare_config_and_inputs(self): method get_config (line 484) | def get_config(self): method create_and_check_model (line 490) | def create_and_check_model( method prepare_config_and_inputs_for_common (line 503) | def prepare_config_and_inputs_for_common(self): class Siglip2ModelTest (line 519) | class Siglip2ModelTest(Siglip2ModelTesterMixin, PipelineTesterMixin, uni... method setUp (line 538) | def setUp(self): method test_config (line 542) | def test_config(self): method test_model (line 545) | def test_model(self): method test_hidden_states_output (line 550) | def test_hidden_states_output(self): method test_inputs_embeds (line 554) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 558) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 562) | def test_model_get_set_embeddings(self): method test_load_vision_text_config (line 565) | def test_load_vision_text_config(self): method test_get_text_features_attentions (line 581) | def test_get_text_features_attentions(self): method test_get_text_features_hidden_states (line 586) | def test_get_text_features_hidden_states(self): method test_get_image_features_attentions (line 591) | def test_get_image_features_attentions(self): method test_get_image_features_hidden_states (line 596) | def test_get_image_features_hidden_states(self): method test_model_from_pretrained (line 601) | def test_model_from_pretrained(self): method test_flash_attn_2_inference_equivalence_right_padding (line 609) | def test_flash_attn_2_inference_equivalence_right_padding(self): class Siglip2ForImageClassificationModelTester (line 613) | class Siglip2ForImageClassificationModelTester(Siglip2ModelTester): method __init__ (line 614) | def __init__(self, parent): method prepare_config_and_inputs (line 621) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 627) | def prepare_config_and_inputs_for_common(self): class Siglip2ForImageClassificationModelTest (line 639) | class Siglip2ForImageClassificationModelTest(Siglip2ModelTesterMixin, Pi... method setUp (line 654) | def setUp(self): method _set_subconfig_attributes (line 657) | def _set_subconfig_attributes(self, config, attribute_name, value): method test_inputs_embeds (line 665) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 669) | def test_model_get_set_embeddings(self): method test_training_gradient_checkpointing (line 673) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 677) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 681) | def test_training_gradient_checkpointing_use_reentrant_true(self): function prepare_images (line 686) | def prepare_images(): class Siglip2ModelIntegrationTest (line 707) | class Siglip2ModelIntegrationTest(unittest.TestCase): method test_inference (line 709) | def test_inference(self): FILE: tests/models/siglip2/test_tokenization_siglip2.py class Siglip2TokenizerTest (line 23) | class Siglip2TokenizerTest(unittest.TestCase): method test_tokenizer (line 33) | def test_tokenizer(self): FILE: tests/models/slanext/test_image_processing_slanext.py class SLANeXtImageProcessingTester (line 33) | class SLANeXtImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 67) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 77) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method get_expected_value (line 88) | def get_expected_value(self, image_inputs): method expected_output_image_shape (line 110) | def expected_output_image_shape(self, images): class SLANeXtImageProcessingTest (line 117) | class SLANeXtImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 118) | def setUp(self): method image_processor_dict (line 123) | def image_processor_dict(self): method test_call_pytorch (line 128) | def test_call_pytorch(self): method test_call_numpy (line 145) | def test_call_numpy(self): method test_call_pil (line 161) | def test_call_pil(self): method test_call_numpy_4_channels (line 176) | def test_call_numpy_4_channels(self): FILE: tests/models/slanext/test_modeling_slanext.py class SLANeXtModelTester (line 53) | class SLANeXtModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs_for_common (line 77) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 82) | def prepare_config_and_inputs(self): method get_config (line 88) | def get_config(self) -> SLANeXtConfig: class SLANeXtModelTest (line 100) | class SLANeXtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 107) | def setUp(self): method test_config (line 120) | def test_config(self): method test_model_is_small (line 124) | def test_model_is_small(self): method test_enable_input_require_grads (line 128) | def test_enable_input_require_grads(self): method test_inputs_embeds (line 132) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 136) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 140) | def test_model_get_set_embeddings(self): method test_forward_signature (line 143) | def test_forward_signature(self): method test_hidden_states_output (line 153) | def test_hidden_states_output(self): method test_attention_outputs (line 191) | def test_attention_outputs(self): method test_inference_with_different_dtypes (line 262) | def test_inference_with_different_dtypes(self, dtype_str): class SLANeXtModelIntegrationTest (line 291) | class SLANeXtModelIntegrationTest(unittest.TestCase): method setUp (line 292) | def setUp(self): method test_inference_table_recognition_head (line 299) | def test_inference_table_recognition_head(self): FILE: tests/models/smollm3/test_modeling_smollm3.py class SmolLM3ModelTester (line 55) | class SmolLM3ModelTester(CausalLMModelTester): class SmolLM3ModelTest (line 66) | class SmolLM3ModelTest(CausalLMModelTest, unittest.TestCase): method test_eager_matches_sdpa_inference (line 71) | def test_eager_matches_sdpa_inference(self, *args): class SmolLM3IntegrationTest (line 77) | class SmolLM3IntegrationTest(unittest.TestCase): method test_model_3b_logits (line 81) | def test_model_3b_logits(self): method test_model_3b_generation (line 102) | def test_model_3b_generation(self): method test_model_3b_long_prompt (line 122) | def test_model_3b_long_prompt(self): method test_export_static_cache (line 150) | def test_export_static_cache(self): FILE: tests/models/smolvlm/test_image_processing_smolvlm.py class SmolVLMImageProcessingTester (line 36) | class SmolVLMImageProcessingTester: method __init__ (line 37) | def __init__( method prepare_image_processor_dict (line 79) | def prepare_image_processor_dict(self): method get_expected_values (line 94) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 101) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 108) | def prepare_image_inputs( class SmolVLMImageProcessingTest (line 164) | class SmolVLMImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 165) | def setUp(self): method image_processor_dict (line 170) | def image_processor_dict(self): method test_image_processor_properties (line 173) | def test_image_processor_properties(self): method test_call_numpy (line 190) | def test_call_numpy(self): method test_call_numpy_4_channels (line 212) | def test_call_numpy_4_channels(self): method test_call_pil (line 237) | def test_call_pil(self): method test_call_pytorch (line 259) | def test_call_pytorch(self): method test_backends_equivalence (line 285) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 312) | def test_backends_equivalence_batched(self): method test_get_num_patches_without_images (line 348) | def test_get_num_patches_without_images(self): FILE: tests/models/smolvlm/test_modeling_smolvlm.py class SmolVLMVisionText2TextModelTester (line 58) | class SmolVLMVisionText2TextModelTester: method __init__ (line 59) | def __init__( method get_config (line 122) | def get_config(self): method prepare_config_and_inputs (line 133) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 147) | def prepare_config_and_inputs_for_common(self): class SmolVLMModelTest (line 165) | class SmolVLMModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 174) | def setUp(self): method test_config (line 180) | def test_config(self): method test_flash_attn_2_inference_padding_right (line 184) | def test_flash_attn_2_inference_padding_right(self): method test_sdpa_can_compile_dynamic (line 189) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 193) | def test_sdpa_can_dispatch_on_flash(self): method test_resize_tokens_embeddings (line 197) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 277) | def test_resize_embeddings_untied(self): class SmolVLMForConditionalGenerationModelTest (line 325) | class SmolVLMForConditionalGenerationModelTest( method setUp (line 345) | def setUp(self): method test_flash_attn_2_inference_padding_right (line 350) | def test_flash_attn_2_inference_padding_right(self): method test_generate_methods_with_logits_to_keep (line 355) | def test_generate_methods_with_logits_to_keep(self): method test_generate_with_static_cache (line 359) | def test_generate_with_static_cache(self): method test_sdpa_can_compile_dynamic (line 364) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 368) | def test_sdpa_can_dispatch_on_flash(self): method test_eager_matches_sdpa_generate (line 376) | def test_eager_matches_sdpa_generate(self): method test_assisted_decoding_matches_greedy_search (line 382) | def test_assisted_decoding_matches_greedy_search(self, assistant_type): method test_resize_tokens_embeddings (line 386) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 459) | def test_resize_embeddings_untied(self): class SmolVLMForConditionalGenerationIntegrationTest (line 503) | class SmolVLMForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 504) | def setUp(self): method tearDown (line 527) | def tearDown(self): method test_integration_test (line 531) | def test_integration_test(self): method test_integration_test_video (line 551) | def test_integration_test_video(self): method test_export_smolvlm_vision_encoder (line 582) | def test_export_smolvlm_vision_encoder(self): method test_export_smolvlm_connector (line 605) | def test_export_smolvlm_connector(self): method test_export_smolvlm_text_decoder (line 631) | def test_export_smolvlm_text_decoder(self): FILE: tests/models/smolvlm/test_processing_smolvlm.py class SmolVLMProcessorTest (line 28) | class SmolVLMProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_test_attributes (line 34) | def _setup_test_attributes(cls, processor): method prepare_processor_dict (line 63) | def prepare_processor_dict(): method prepare_image_inputs (line 70) | def prepare_image_inputs(self, batch_size: int | None = None): method prepare_video_inputs (line 77) | def prepare_video_inputs(self, batch_size: int | None = None): method get_split_image_expected_tokens (line 84) | def get_split_image_expected_tokens(self, processor, image_rows, image... method test_process_interleaved_images_prompts_no_image_splitting (line 105) | def test_process_interleaved_images_prompts_no_image_splitting(self): method test_process_interleaved_images_prompts_image_splitting (line 169) | def test_process_interleaved_images_prompts_image_splitting(self): method test_add_special_tokens_processor (line 237) | def test_add_special_tokens_processor(self): method test_non_nested_images_with_batched_text (line 257) | def test_non_nested_images_with_batched_text(self): method test_process_interleaved_images_prompts_image_error (line 277) | def test_process_interleaved_images_prompts_image_error(self): method test_apply_chat_template (line 319) | def test_apply_chat_template(self): method test_apply_chat_template_video_frame_sampling (line 355) | def test_apply_chat_template_video_frame_sampling(self): method test_unstructured_kwargs_batched (line 412) | def test_unstructured_kwargs_batched(self): method test_unstructured_kwargs_batched_video (line 443) | def test_unstructured_kwargs_batched_video(self): method test_text_only_inference (line 468) | def test_text_only_inference(self): method test_missing_images_error (line 513) | def test_missing_images_error(self): method test_special_mm_token_truncation (line 541) | def test_special_mm_token_truncation(self): method test_apply_chat_template_decoded_video_0 (line 569) | def test_apply_chat_template_decoded_video_0(self): FILE: tests/models/smolvlm/test_video_processing_smolvlm.py class SmolVLMVideoProcessingTester (line 29) | class SmolVLMVideoProcessingTester: method __init__ (line 30) | def __init__( method prepare_video_processor_dict (line 60) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 71) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 79) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class SmolVLMVideoProcessingTest (line 94) | class SmolVLMVideoProcessingTest(VideoProcessingTestMixin, unittest.Test... method setUp (line 98) | def setUp(self): method video_processor_dict (line 103) | def video_processor_dict(self): method test_video_processor_from_dict_with_kwargs (line 106) | def test_video_processor_from_dict_with_kwargs(self): method test_call_sample_frames (line 114) | def test_call_sample_frames(self): FILE: tests/models/solar_open/test_modeling_solar_open.py class SolarOpenModelTester (line 37) | class SolarOpenModelTester(CausalLMModelTester): method __init__ (line 41) | def __init__( class SolarOpenModelTest (line 66) | class SolarOpenModelTest(CausalLMModelTest, unittest.TestCase): method test_rope_parameters_partially_initialized (line 70) | def test_rope_parameters_partially_initialized(self): class SolarOpenIntegrationTest (line 89) | class SolarOpenIntegrationTest(unittest.TestCase): method setup (line 90) | def setup(self): method tearDown (line 93) | def tearDown(self): method test_batch_generation_dummy_bf16 (line 96) | def test_batch_generation_dummy_bf16(self): FILE: tests/models/speech_encoder_decoder/test_modeling_speech_encoder_decoder.py class EncoderDecoderMixin (line 48) | class EncoderDecoderMixin: method get_encoder_decoder_model (line 49) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 52) | def prepare_config_and_inputs(self): method get_pretrained_model_and_inputs (line 55) | def get_pretrained_model_and_inputs(self): method check_encoder_decoder_model_from_pretrained_configs (line 58) | def check_encoder_decoder_model_from_pretrained_configs( method check_encoder_decoder_model (line 91) | def check_encoder_decoder_model( method check_encoder_decoder_model_with_inputs (line 131) | def check_encoder_decoder_model_with_inputs( method check_encoder_decoder_model_from_pretrained (line 168) | def check_encoder_decoder_model_from_pretrained( method check_save_and_load (line 198) | def check_save_and_load( method check_save_and_load_encoder_decoder_model (line 241) | def check_save_and_load_encoder_decoder_model( method check_encoder_decoder_model_output_attentions (line 290) | def check_encoder_decoder_model_output_attentions( method check_encoder_decoder_model_generate (line 351) | def check_encoder_decoder_model_generate( method test_encoder_decoder_model (line 377) | def test_encoder_decoder_model(self): method test_encoder_decoder_model_with_inputs (line 381) | def test_encoder_decoder_model_with_inputs(self): method test_encoder_decoder_model_from_pretrained_configs (line 385) | def test_encoder_decoder_model_from_pretrained_configs(self): method test_encoder_decoder_model_from_pretrained (line 389) | def test_encoder_decoder_model_from_pretrained(self): method test_encoder_decoder_model_from_pretrained_return_dict (line 393) | def test_encoder_decoder_model_from_pretrained_return_dict(self): method test_save_and_load_from_pretrained (line 397) | def test_save_and_load_from_pretrained(self): method test_save_and_load_from_encoder_decoder_pretrained (line 401) | def test_save_and_load_from_encoder_decoder_pretrained(self): method test_encoder_decoder_model_output_attentions (line 405) | def test_encoder_decoder_model_output_attentions(self): method test_encoder_decoder_model_generate (line 409) | def test_encoder_decoder_model_generate(self): method test_training_gradient_checkpointing (line 413) | def test_training_gradient_checkpointing(self): method test_real_model_save_load_from_pretrained (line 438) | def test_real_model_save_load_from_pretrained(self): method test_sdpa_can_dispatch_composite_models (line 459) | def test_sdpa_can_dispatch_composite_models(self): class Wav2Vec2BertModelTest (line 511) | class Wav2Vec2BertModelTest(EncoderDecoderMixin, unittest.TestCase): method get_pretrained_model_and_inputs (line 512) | def get_pretrained_model_and_inputs(self): method get_encoder_decoder_model (line 530) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 535) | def prepare_config_and_inputs(self): class Speech2TextBertModelTest (line 575) | class Speech2TextBertModelTest(EncoderDecoderMixin, unittest.TestCase): method get_pretrained_model_and_inputs (line 576) | def get_pretrained_model_and_inputs(self): method get_encoder_decoder_model (line 594) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 599) | def prepare_config_and_inputs(self): method test_encoder_decoder_model_from_pretrained_configs (line 638) | def test_encoder_decoder_model_from_pretrained_configs(self): method test_save_and_load_from_pretrained (line 643) | def test_save_and_load_from_pretrained(self): method test_real_model_save_load_from_pretrained (line 648) | def test_real_model_save_load_from_pretrained(self): FILE: tests/models/speech_to_text/test_feature_extraction_speech_to_text.py function floats_list (line 38) | def floats_list(shape, scale=1.0, rng=None, name=None): class Speech2TextFeatureExtractionTester (line 54) | class Speech2TextFeatureExtractionTester: method __init__ (line 55) | def __init__( method prepare_feat_extract_dict (line 80) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 90) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class Speech2TextFeatureExtractionTest (line 109) | class Speech2TextFeatureExtractionTest(SequenceFeatureExtractionTestMixi... method setUp (line 112) | def setUp(self): method _check_zero_mean_unit_variance (line 115) | def _check_zero_mean_unit_variance(self, input_vector): method test_call (line 119) | def test_call(self): method test_dither (line 150) | def test_dither(self): method test_cepstral_mean_and_variance_normalization (line 184) | def test_cepstral_mean_and_variance_normalization(self): method test_cepstral_mean_and_variance_normalization_np (line 202) | def test_cepstral_mean_and_variance_normalization_np(self): method test_cepstral_mean_and_variance_normalization_trunc_max_length (line 222) | def test_cepstral_mean_and_variance_normalization_trunc_max_length(self): method test_cepstral_mean_and_variance_normalization_trunc_longest (line 241) | def test_cepstral_mean_and_variance_normalization_trunc_longest(self): method test_double_precision_pad (line 283) | def test_double_precision_pad(self): method _load_datasamples (line 296) | def _load_datasamples(self, num_samples): method test_integration (line 305) | def test_integration(self): method test_feat_extract_from_and_save_pretrained (line 320) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 332) | def test_feat_extract_to_json_file(self): class Speech2TextFeatureExtractionWithoutTorchaudioTest (line 350) | class Speech2TextFeatureExtractionWithoutTorchaudioTest(Speech2TextFeatu... method test_using_audio_utils (line 351) | def test_using_audio_utils(self): FILE: tests/models/speech_to_text/test_modeling_speech_to_text.py function prepare_speech_to_text_inputs_dict (line 48) | def prepare_speech_to_text_inputs_dict( class Speech2TextModelTester (line 70) | class Speech2TextModelTester: method __init__ (line 71) | def __init__( method prepare_config_and_inputs (line 123) | def prepare_config_and_inputs(self): method get_config (line 139) | def get_config(self): method prepare_config_and_inputs_for_common (line 164) | def prepare_config_and_inputs_for_common(self): method get_subsampled_output_lengths (line 168) | def get_subsampled_output_lengths(self, input_lengths): method create_and_check_model_forward (line 178) | def create_and_check_model_forward(self, config, inputs_dict): method create_and_check_decoder_model_past_large_inputs (line 189) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 222) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class Speech2TextModelTest (line 260) | class Speech2TextModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe... method setUp (line 270) | def setUp(self): method test_config (line 275) | def test_config(self): method test_save_load_strict (line 278) | def test_save_load_strict(self): method test_model_forward (line 288) | def test_model_forward(self): method test_decoder_model_past_with_large_inputs (line 292) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 296) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 301) | def test_inputs_embeds(self): method test_training (line 305) | def test_training(self): method test_training_gradient_checkpointing (line 309) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 313) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 317) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_generate_fp16 (line 321) | def test_generate_fp16(self): method test_forward_signature (line 331) | def test_forward_signature(self): method test_hidden_states_output (line 349) | def test_hidden_states_output(self): method test_attention_outputs (line 402) | def test_attention_outputs(self): method test_resize_tokens_embeddings (line 498) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 546) | def test_resize_embeddings_untied(self): method test_generate_without_input_ids (line 597) | def test_generate_without_input_ids(self): class Speech2TextModelIntegrationTests (line 607) | class Speech2TextModelIntegrationTests(unittest.TestCase): method setUpClass (line 609) | def setUpClass(cls): method test_generation_librispeech (line 618) | def test_generation_librispeech(self): method test_generation_librispeech_batched (line 630) | def test_generation_librispeech_batched(self): FILE: tests/models/speech_to_text/test_processing_speech_to_text.py class Speech2TextProcessorTest (line 34) | class Speech2TextProcessorTest(unittest.TestCase): method setUpClass (line 36) | def setUpClass(cls): method get_tokenizer (line 62) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 65) | def get_feature_extractor(self, **kwargs): method tearDownClass (line 69) | def tearDownClass(cls): method test_save_load_pretrained_default (line 72) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 87) | def test_save_load_pretrained_additional_features(self): method test_feature_extractor (line 109) | def test_feature_extractor(self): method test_tokenizer (line 123) | def test_tokenizer(self): method test_tokenizer_decode (line 138) | def test_tokenizer_decode(self): FILE: tests/models/speech_to_text/test_tokenization_speech_to_text.py class SpeechToTextTokenizerTest (line 40) | class SpeechToTextTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 47) | def setUpClass(cls): method test_convert_token_and_id (line 65) | def test_convert_token_and_id(self): method test_get_vocab (line 73) | def test_get_vocab(self): method test_vocab_size (line 81) | def test_vocab_size(self): method test_full_tokenizer (line 84) | def test_full_tokenizer(self): method test_tokenizer_integration (line 119) | def test_tokenizer_integration(self): class SpeechToTextTokenizerMultilinguialTest (line 130) | class SpeechToTextTokenizerMultilinguialTest(unittest.TestCase): method setUpClass (line 137) | def setUpClass(cls): method check_language_codes (line 141) | def check_language_codes(self): method test_vocab_size (line 147) | def test_vocab_size(self): method test_tokenizer_decode_ignores_language_codes (line 150) | def test_tokenizer_decode_ignores_language_codes(self): method test_tokenizer_adds_special_tokens (line 158) | def test_tokenizer_adds_special_tokens(self): method test_tgt_lang_setter (line 164) | def test_tgt_lang_setter(self): FILE: tests/models/speecht5/test_feature_extraction_speecht5.py function floats_list (line 37) | def floats_list(shape, scale=1.0, rng=None, name=None): class SpeechT5FeatureExtractionTester (line 52) | class SpeechT5FeatureExtractionTester: method __init__ (line 53) | def __init__( method prepare_feat_extract_dict (line 90) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 106) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): method prepare_inputs_for_target (line 124) | def prepare_inputs_for_target(self, equal_length=False, numpify=False): class SpeechT5FeatureExtractionTest (line 141) | class SpeechT5FeatureExtractionTest(SequenceFeatureExtractionTestMixin, ... method setUp (line 144) | def setUp(self): method _check_zero_mean_unit_variance (line 147) | def _check_zero_mean_unit_variance(self, input_vector): method test_call (line 151) | def test_call(self): method test_zero_mean_unit_variance_normalization_np (line 169) | def test_zero_mean_unit_variance_normalization_np(self): method test_zero_mean_unit_variance_normalization (line 185) | def test_zero_mean_unit_variance_normalization(self): method test_zero_mean_unit_variance_normalization_trunc_np_max_length (line 201) | def test_zero_mean_unit_variance_normalization_trunc_np_max_length(self): method test_zero_mean_unit_variance_normalization_trunc_np_longest (line 213) | def test_zero_mean_unit_variance_normalization_trunc_np_longest(self): method test_double_precision_pad (line 241) | def test_double_precision_pad(self): method test_call_target (line 252) | def test_call_target(self): method test_batch_feature_target (line 283) | def test_batch_feature_target(self): method test_batch_feature_target_pt (line 306) | def test_batch_feature_target_pt(self): method test_padding_accepts_tensors_target_pt (line 324) | def test_padding_accepts_tensors_target_pt(self): method test_attention_mask_target (line 338) | def test_attention_mask_target(self): method test_attention_mask_with_truncation_target (line 355) | def test_attention_mask_with_truncation_target(self): method _load_datasamples (line 379) | def _load_datasamples(self, num_samples): method test_integration (line 388) | def test_integration(self): method test_integration_target (line 406) | def test_integration_target(self): FILE: tests/models/speecht5/test_modeling_speecht5.py function prepare_inputs_dict (line 58) | def prepare_inputs_dict( class SpeechT5ModelTester (line 86) | class SpeechT5ModelTester: method __init__ (line 87) | def __init__( method prepare_config_and_inputs (line 109) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 126) | def prepare_config_and_inputs_for_common(self): method get_config (line 130) | def get_config(self): method create_and_check_model_forward (line 142) | def create_and_check_model_forward(self, config, inputs_dict): class SpeechT5ModelTest (line 154) | class SpeechT5ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 165) | def setUp(self): method test_config (line 169) | def test_config(self): method test_model_forward (line 172) | def test_model_forward(self): method test_forward_signature (line 176) | def test_forward_signature(self): method test_inputs_embeds (line 195) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 199) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 203) | def test_retain_grad_hidden_states_attentions(self): class SpeechT5ForSpeechToTextTester (line 208) | class SpeechT5ForSpeechToTextTester: method __init__ (line 209) | def __init__( method prepare_config_and_inputs (line 245) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 262) | def prepare_config_and_inputs_for_common(self): method get_config (line 266) | def get_config(self): method get_subsampled_output_lengths (line 284) | def get_subsampled_output_lengths(self, input_lengths): method create_and_check_model_forward (line 293) | def create_and_check_model_forward(self, config, inputs_dict): method create_and_check_decoder_model_past_large_inputs (line 303) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... class SpeechT5ForSpeechToTextTest (line 338) | class SpeechT5ForSpeechToTextTest(ModelTesterMixin, unittest.TestCase, G... method setUp (line 342) | def setUp(self): method test_config (line 346) | def test_config(self): method test_save_load_strict (line 349) | def test_save_load_strict(self): method test_model_forward (line 359) | def test_model_forward(self): method test_decoder_model_past_with_large_inputs (line 363) | def test_decoder_model_past_with_large_inputs(self): method test_batching_equivalence (line 368) | def test_batching_equivalence(self): method test_attention_outputs (line 371) | def test_attention_outputs(self): method test_forward_signature (line 471) | def test_forward_signature(self): method test_hidden_states_output (line 489) | def test_hidden_states_output(self): method test_inputs_embeds (line 544) | def test_inputs_embeds(self): method test_resize_embeddings_untied (line 547) | def test_resize_embeddings_untied(self): method test_resize_tokens_embeddings (line 594) | def test_resize_tokens_embeddings(self): method test_retain_grad_hidden_states_attentions (line 640) | def test_retain_grad_hidden_states_attentions(self): method test_training (line 645) | def test_training(self): method _mock_init_weights (line 649) | def _mock_init_weights(self, module): method test_generate_without_input_ids (line 662) | def test_generate_without_input_ids(self): method test_generate_continue_from_past_key_values (line 666) | def test_generate_continue_from_past_key_values(self): class SpeechT5ForSpeechToTextIntegrationTests (line 674) | class SpeechT5ForSpeechToTextIntegrationTests(unittest.TestCase): method default_processor (line 676) | def default_processor(self): method _load_datasamples (line 679) | def _load_datasamples(self, num_samples): method test_generation_librispeech (line 688) | def test_generation_librispeech(self): method test_generation_librispeech_batched (line 705) | def test_generation_librispeech_batched(self): class SpeechT5ForTextToSpeechTester (line 732) | class SpeechT5ForTextToSpeechTester: method __init__ (line 733) | def __init__( method prepare_config_and_inputs (line 767) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 784) | def prepare_config_and_inputs_for_common(self): method get_config (line 788) | def get_config(self): method create_and_check_model_forward (line 805) | def create_and_check_model_forward(self, config, inputs_dict): class SpeechT5ForTextToSpeechTest (line 820) | class SpeechT5ForTextToSpeechTest(ModelTesterMixin, unittest.TestCase): method setUp (line 825) | def setUp(self): method test_config (line 829) | def test_config(self): method test_model_can_generate (line 832) | def test_model_can_generate(self): method test_save_load_strict (line 838) | def test_save_load_strict(self): method test_model_forward (line 848) | def test_model_forward(self): method test_model_forward_with_labels (line 852) | def test_model_forward_with_labels(self): method test_decoder_model_past_with_large_inputs (line 870) | def test_decoder_model_past_with_large_inputs(self): method test_determinism (line 874) | def test_determinism(self): method test_batching_equivalence (line 878) | def test_batching_equivalence(self): method test_forward_signature (line 881) | def test_forward_signature(self): method test_inputs_embeds (line 900) | def test_inputs_embeds(self): method test_model_outputs_equivalence (line 904) | def test_model_outputs_equivalence(self): method test_save_load (line 908) | def test_save_load(self): method test_retain_grad_hidden_states_attentions (line 912) | def test_retain_grad_hidden_states_attentions(self): method test_training (line 916) | def test_training(self): method _mock_init_weights (line 920) | def _mock_init_weights(self, module): class SpeechT5ForTextToSpeechIntegrationTests (line 935) | class SpeechT5ForTextToSpeechIntegrationTests(unittest.TestCase): method default_model (line 937) | def default_model(self): method default_processor (line 943) | def default_processor(self): method default_vocoder (line 947) | def default_vocoder(self): method test_generation (line 950) | def test_generation(self): method test_one_to_many_generation (line 979) | def test_one_to_many_generation(self): method test_batch_generation (line 1088) | def test_batch_generation(self): class SpeechT5ForSpeechToSpeechTester (line 1206) | class SpeechT5ForSpeechToSpeechTester: method __init__ (line 1207) | def __init__( method prepare_config_and_inputs (line 1253) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 1270) | def prepare_config_and_inputs_for_common(self): method get_config (line 1274) | def get_config(self): method create_and_check_model_forward (line 1297) | def create_and_check_model_forward(self, config, inputs_dict): class SpeechT5ForSpeechToSpeechTest (line 1312) | class SpeechT5ForSpeechToSpeechTest(ModelTesterMixin, unittest.TestCase): method setUp (line 1318) | def setUp(self): method test_config (line 1322) | def test_config(self): method test_save_load_strict (line 1325) | def test_save_load_strict(self): method test_model_forward (line 1335) | def test_model_forward(self): method test_model_forward_with_labels (line 1339) | def test_model_forward_with_labels(self): method test_decoder_model_past_with_large_inputs (line 1357) | def test_decoder_model_past_with_large_inputs(self): method test_determinism (line 1361) | def test_determinism(self): method test_batching_equivalence (line 1365) | def test_batching_equivalence(self): method test_attention_outputs (line 1368) | def test_attention_outputs(self): method test_forward_signature (line 1468) | def test_forward_signature(self): method test_hidden_states_output (line 1486) | def test_hidden_states_output(self): method test_inputs_embeds (line 1540) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 1544) | def test_model_get_set_embeddings(self): method test_model_outputs_equivalence (line 1548) | def test_model_outputs_equivalence(self): method test_retain_grad_hidden_states_attentions (line 1552) | def test_retain_grad_hidden_states_attentions(self): method test_save_load (line 1556) | def test_save_load(self): method test_training (line 1560) | def test_training(self): method _mock_init_weights (line 1564) | def _mock_init_weights(self, module): class SpeechT5ForSpeechToSpeechIntegrationTests (line 1581) | class SpeechT5ForSpeechToSpeechIntegrationTests(unittest.TestCase): method default_processor (line 1583) | def default_processor(self): method _load_datasamples (line 1586) | def _load_datasamples(self, num_samples): method test_generation_librispeech (line 1595) | def test_generation_librispeech(self): class SpeechT5HifiGanTester (line 1611) | class SpeechT5HifiGanTester: method __init__ (line 1612) | def __init__( method prepare_config_and_inputs (line 1626) | def prepare_config_and_inputs(self): method get_config (line 1631) | def get_config(self): method create_and_check_model (line 1637) | def create_and_check_model(self, config, input_values): method prepare_config_and_inputs_for_common (line 1642) | def prepare_config_and_inputs_for_common(self): class SpeechT5HifiGanTest (line 1649) | class SpeechT5HifiGanTest(ModelTesterMixin, unittest.TestCase): method setUp (line 1659) | def setUp(self): method test_config (line 1663) | def test_config(self): method test_model (line 1672) | def test_model(self): method test_forward_signature (line 1676) | def test_forward_signature(self): method test_hidden_states_output (line 1691) | def test_hidden_states_output(self): method test_inputs_embeds (line 1695) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 1699) | def test_model_get_set_embeddings(self): method test_model_outputs_equivalence (line 1703) | def test_model_outputs_equivalence(self): method test_retain_grad_hidden_states_attentions (line 1707) | def test_retain_grad_hidden_states_attentions(self): method test_batched_inputs_outputs (line 1710) | def test_batched_inputs_outputs(self): method test_unbatched_inputs_outputs (line 1726) | def test_unbatched_inputs_outputs(self): FILE: tests/models/speecht5/test_processing_speecht5.py class SpeechT5ProcessorTest (line 36) | class SpeechT5ProcessorTest(unittest.TestCase): method setUpClass (line 38) | def setUpClass(cls): method get_tokenizer (line 65) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 68) | def get_feature_extractor(self, **kwargs): method tearDownClass (line 72) | def tearDownClass(cls): method test_save_load_pretrained_default (line 75) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 90) | def test_save_load_pretrained_additional_features(self): method test_feature_extractor (line 112) | def test_feature_extractor(self): method test_feature_extractor_target (line 126) | def test_feature_extractor_target(self): method test_tokenizer (line 140) | def test_tokenizer(self): method test_tokenizer_target (line 154) | def test_tokenizer_target(self): method test_tokenizer_decode (line 168) | def test_tokenizer_decode(self): FILE: tests/models/speecht5/test_tokenization_speecht5.py class SpeechT5TokenizerTest (line 31) | class SpeechT5TokenizerTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 38) | def setUpClass(cls): method get_input_output_texts (line 51) | def get_input_output_texts(self, tokenizer): method get_numeric_input_output_texts (line 56) | def get_numeric_input_output_texts(self): method get_clean_sequence (line 61) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method test_tokenizer_normalization (line 67) | def test_tokenizer_normalization(self): method test_convert_token_and_id (line 74) | def test_convert_token_and_id(self): method test_get_vocab (line 82) | def test_get_vocab(self): method test_vocab_size (line 92) | def test_vocab_size(self): method test_add_tokens_tokenizer (line 95) | def test_add_tokens_tokenizer(self): method test_subword_regularization_tokenizer (line 147) | def test_subword_regularization_tokenizer(self): method test_full_tokenizer (line 150) | def test_full_tokenizer(self): method test_tokenizer_integration (line 171) | def test_tokenizer_integration(self): method test_encode_decode (line 205) | def test_encode_decode(self): FILE: tests/models/splinter/test_modeling_splinter.py class SplinterModelTester (line 33) | class SplinterModelTester: method __init__ (line 34) | def __init__( method prepare_config_and_inputs (line 86) | def prepare_config_and_inputs(self): method create_and_check_model (line 124) | def create_and_check_model( method create_and_check_for_question_answering (line 142) | def create_and_check_for_question_answering( method create_and_check_for_pretraining (line 165) | def create_and_check_for_pretraining( method prepare_config_and_inputs_for_common (line 189) | def prepare_config_and_inputs_for_common(self): class SplinterModelTest (line 209) | class SplinterModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method is_pipeline_test_to_skip (line 222) | def is_pipeline_test_to_skip( method _prepare_for_class (line 239) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 271) | def setUp(self): method test_config (line 275) | def test_config(self): method test_model (line 278) | def test_model(self): method test_for_question_answering (line 282) | def test_for_question_answering(self): method test_for_pretraining (line 286) | def test_for_pretraining(self): method test_inputs_embeds (line 290) | def test_inputs_embeds(self): method test_model_from_pretrained (line 325) | def test_model_from_pretrained(self): method test_multi_gpu_data_parallel_forward (line 335) | def test_multi_gpu_data_parallel_forward(self): class SplinterModelIntegrationTest (line 361) | class SplinterModelIntegrationTest(unittest.TestCase): method test_splinter_question_answering (line 363) | def test_splinter_question_answering(self): method test_splinter_pretraining (line 381) | def test_splinter_pretraining(self): method test_splinter_pretraining_loss_requires_question_positions (line 402) | def test_splinter_pretraining_loss_requires_question_positions(self): method test_splinter_pretraining_loss (line 420) | def test_splinter_pretraining_loss(self): method test_splinter_pretraining_loss_with_padding (line 443) | def test_splinter_pretraining_loss_with_padding(self): method test_splinter_pretraining_prepare_question_positions (line 482) | def test_splinter_pretraining_prepare_question_positions(self): FILE: tests/models/splinter/test_tokenization_splinter.py class SplinterTokenizationTest (line 20) | class SplinterTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/squeezebert/test_modeling_squeezebert.py class SqueezeBertModelTester (line 39) | class SqueezeBertModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 119) | def get_config(self): method create_and_check_squeezebert_model (line 140) | def create_and_check_squeezebert_model( method create_and_check_squeezebert_for_masked_lm (line 150) | def create_and_check_squeezebert_for_masked_lm( method create_and_check_squeezebert_for_question_answering (line 159) | def create_and_check_squeezebert_for_question_answering( method create_and_check_squeezebert_for_sequence_classification (line 171) | def create_and_check_squeezebert_for_sequence_classification( method create_and_check_squeezebert_for_token_classification (line 181) | def create_and_check_squeezebert_for_token_classification( method create_and_check_squeezebert_for_multiple_choice (line 192) | def create_and_check_squeezebert_for_multiple_choice( method prepare_config_and_inputs_for_common (line 208) | def prepare_config_and_inputs_for_common(self): class SqueezeBertModelTest (line 216) | class SqueezeBertModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 243) | def setUp(self): method test_config (line 247) | def test_config(self): method test_squeezebert_model (line 250) | def test_squeezebert_model(self): method test_for_masked_lm (line 254) | def test_for_masked_lm(self): method test_for_question_answering (line 258) | def test_for_question_answering(self): method test_for_sequence_classification (line 262) | def test_for_sequence_classification(self): method test_for_token_classification (line 266) | def test_for_token_classification(self): method test_for_multiple_choice (line 270) | def test_for_multiple_choice(self): method test_model_from_pretrained (line 275) | def test_model_from_pretrained(self): class SqueezeBertModelIntegrationTest (line 284) | class SqueezeBertModelIntegrationTest(unittest.TestCase): method test_inference_classification_head (line 286) | def test_inference_classification_head(self): FILE: tests/models/stablelm/test_modeling_stablelm.py class StableLmModelTester (line 42) | class StableLmModelTester(CausalLMModelTester): class StableLmModelTest (line 48) | class StableLmModelTest(CausalLMModelTest, unittest.TestCase): class StableLmModelIntegrationTest (line 53) | class StableLmModelIntegrationTest(unittest.TestCase): method test_model_stablelm_3b_4e1t_logits (line 55) | def test_model_stablelm_3b_4e1t_logits(self): method test_model_stablelm_3b_4e1t_generation (line 72) | def test_model_stablelm_3b_4e1t_generation(self): method test_model_tiny_random_stablelm_2_logits (line 87) | def test_model_tiny_random_stablelm_2_logits(self): method test_model_tiny_random_stablelm_2_generation (line 105) | def test_model_tiny_random_stablelm_2_generation(self): method test_model_3b_long_prompt (line 124) | def test_model_3b_long_prompt(self): FILE: tests/models/starcoder2/test_modeling_starcoder2.py class Starcoder2ModelTester (line 44) | class Starcoder2ModelTester(CausalLMModelTester): class Starcoder2ModelTest (line 50) | class Starcoder2ModelTest(CausalLMModelTest, unittest.TestCase): method test_tp_generation_quantized (line 54) | def test_tp_generation_quantized(self): class Starcoder2IntegrationTest (line 60) | class Starcoder2IntegrationTest(unittest.TestCase): method test_starcoder2_batched_generation_sdpa (line 61) | def test_starcoder2_batched_generation_sdpa(self): method test_starcoder2_batched_generation_eager (line 81) | def test_starcoder2_batched_generation_eager(self): method test_starcoder2_batched_generation_fa2 (line 103) | def test_starcoder2_batched_generation_fa2(self): method test_starcoder2_batched_generation_4bit (line 124) | def test_starcoder2_batched_generation_4bit(self): FILE: tests/models/superglue/test_image_processing_superglue.py function random_array (line 38) | def random_array(size): function random_tensor (line 42) | def random_tensor(size): class SuperGlueImageProcessingTester (line 46) | class SuperGlueImageProcessingTester: method __init__ (line 47) | def __init__( method prepare_image_processor_dict (line 70) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 77) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 80) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_keypoint_matching_output (line 95) | def prepare_keypoint_matching_output(self, pixel_values): class SuperGlueImageProcessingTest (line 121) | class SuperGlueImageProcessingTest(ImageProcessingTestMixin, unittest.Te... method setUp (line 122) | def setUp(self) -> None: method image_processor_dict (line 127) | def image_processor_dict(self): method test_image_processing (line 130) | def test_image_processing(self): method test_image_processor_from_dict_with_kwargs (line 139) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 150) | def test_call_numpy_4_channels(self): method test_number_and_format_of_images_in_input (line 153) | def test_number_and_format_of_images_in_input(self): method test_valid_image_shape_in_input (line 201) | def test_valid_image_shape_in_input(self, image_input, output): method test_invalid_image_shape_in_input (line 218) | def test_invalid_image_shape_in_input(self, image_input): method test_input_images_properly_paired (line 225) | def test_input_images_properly_paired(self): method test_input_not_paired_images_raises_error (line 233) | def test_input_not_paired_images_raises_error(self): method test_input_image_properly_converted_to_grayscale (line 240) | def test_input_image_properly_converted_to_grayscale(self): method test_call_numpy (line 251) | def test_call_numpy(self): method test_call_pil (line 281) | def test_call_pil(self): method test_call_pytorch (line 309) | def test_call_pytorch(self): method test_image_processor_with_list_of_two_images (line 339) | def test_image_processor_with_list_of_two_images(self): method test_post_processing_keypoint_matching (line 356) | def test_post_processing_keypoint_matching(self): method test_post_processing_keypoint_matching_with_padded_match_indices (line 401) | def test_post_processing_keypoint_matching_with_padded_match_indices(s... method test_backends_equivalence (line 461) | def test_backends_equivalence(self): method test_can_compile_torchvision_backend (line 481) | def test_can_compile_torchvision_backend(self): FILE: tests/models/superglue/test_modeling_superglue.py class SuperGlueModelTester (line 37) | class SuperGlueModelTester: method __init__ (line 38) | def __init__( method prepare_config_and_inputs (line 76) | def prepare_config_and_inputs(self): method get_config (line 82) | def get_config(self): method create_and_check_model (line 93) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 112) | def prepare_config_and_inputs_for_common(self): class SuperGlueModelTest (line 120) | class SuperGlueModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 127) | def setUp(self): method test_config (line 131) | def test_config(self): method test_inputs_embeds (line 140) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 144) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 148) | def test_feed_forward_chunking(self): method test_training (line 152) | def test_training(self): method test_training_gradient_checkpointing (line 156) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 160) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 164) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 168) | def test_retain_grad_hidden_states_attentions(self): method test_model (line 171) | def test_model(self): method test_forward_signature (line 175) | def test_forward_signature(self): method test_hidden_states_output (line 187) | def test_hidden_states_output(self): method test_attention_outputs (line 225) | def test_attention_outputs(self): method test_model_from_pretrained (line 262) | def test_model_from_pretrained(self): method test_forward_labels_should_be_none (line 268) | def test_forward_labels_should_be_none(self): method test_batching_equivalence (line 284) | def test_batching_equivalence(self): function prepare_imgs (line 364) | def prepare_imgs(): class SuperGlueModelIntegrationTest (line 374) | class SuperGlueModelIntegrationTest(unittest.TestCase): method default_image_processor (line 376) | def default_image_processor(self): method test_inference (line 384) | def test_inference(self): FILE: tests/models/superpoint/test_image_processing_superpoint.py class SuperPointImageProcessingTester (line 30) | class SuperPointImageProcessingTester: method __init__ (line 31) | def __init__( method prepare_image_processor_dict (line 54) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 61) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 64) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_keypoint_detection_output (line 75) | def prepare_keypoint_detection_output(self, pixel_values): class SuperPointImageProcessingTest (line 95) | class SuperPointImageProcessingTest(ImageProcessingTestMixin, unittest.T... method setUp (line 96) | def setUp(self) -> None: method image_processor_dict (line 101) | def image_processor_dict(self): method test_image_processing (line 104) | def test_image_processing(self): method test_image_processor_from_dict_with_kwargs (line 113) | def test_image_processor_from_dict_with_kwargs(self): method test_call_numpy_4_channels (line 124) | def test_call_numpy_4_channels(self): method test_input_image_properly_converted_to_grayscale (line 127) | def test_input_image_properly_converted_to_grayscale(self): method test_post_processing_keypoint_detection (line 142) | def test_post_processing_keypoint_detection(self): FILE: tests/models/superpoint/test_modeling_superpoint.py class SuperPointModelTester (line 39) | class SuperPointModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 69) | def prepare_config_and_inputs(self): method get_config (line 75) | def get_config(self): method create_and_check_keypoint_detection (line 87) | def create_and_check_keypoint_detection(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 106) | def prepare_config_and_inputs_for_common(self): class SuperPointModelTest (line 114) | class SuperPointModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 122) | def setUp(self): method test_config (line 132) | def test_config(self): method test_batching_equivalence (line 136) | def test_batching_equivalence(self): method test_inputs_embeds (line 140) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 144) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 148) | def test_feed_forward_chunking(self): method test_training (line 152) | def test_training(self): method test_training_gradient_checkpointing (line 156) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 160) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 164) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_retain_grad_hidden_states_attentions (line 168) | def test_retain_grad_hidden_states_attentions(self): method test_keypoint_detection (line 171) | def test_keypoint_detection(self): method test_forward_signature (line 175) | def test_forward_signature(self): method test_hidden_states_output (line 187) | def test_hidden_states_output(self): method test_model_from_pretrained (line 222) | def test_model_from_pretrained(self): method test_forward_labels_should_be_none (line 226) | def test_forward_labels_should_be_none(self): function prepare_imgs (line 243) | def prepare_imgs(): class SuperPointModelIntegrationTest (line 251) | class SuperPointModelIntegrationTest(unittest.TestCase): method default_image_processor (line 253) | def default_image_processor(self): method test_inference (line 257) | def test_inference(self): FILE: tests/models/swiftformer/test_modeling_swiftformer.py class SwiftFormerModelTester (line 46) | class SwiftFormerModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 73) | def prepare_config_and_inputs(self): method get_config (line 84) | def get_config(self): method create_and_check_model (line 101) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 108) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 124) | def prepare_config_and_inputs_for_common(self): class SwiftFormerModelTest (line 131) | class SwiftFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 147) | def setUp(self): method test_config (line 158) | def test_config(self): method test_inputs_embeds (line 162) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 165) | def test_model_get_set_embeddings(self): method test_model (line 173) | def test_model(self): method test_for_image_classification (line 177) | def test_for_image_classification(self): method test_model_from_pretrained (line 182) | def test_model_from_pretrained(self): method test_attention_outputs (line 188) | def test_attention_outputs(self): method test_hidden_states_output (line 191) | def test_hidden_states_output(self): function prepare_img (line 234) | def prepare_img(): class SwiftFormerModelIntegrationTest (line 241) | class SwiftFormerModelIntegrationTest(unittest.TestCase): method default_image_processor (line 243) | def default_image_processor(self): method test_inference_image_classification_head (line 247) | def test_inference_image_classification_head(self): FILE: tests/models/swin/test_modeling_swin.py class SwinModelTester (line 43) | class SwinModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 111) | def get_config(self): method create_and_check_model (line 135) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 146) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_masked_image_modeling (line 173) | def create_and_check_for_masked_image_modeling(self, config, pixel_val... method create_and_check_for_image_classification (line 192) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 210) | def prepare_config_and_inputs_for_common(self): class SwinModelTest (line 222) | class SwinModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 241) | def setUp(self): method test_config (line 251) | def test_config(self): method test_model (line 254) | def test_model(self): method test_multi_gpu_data_parallel_forward (line 260) | def test_multi_gpu_data_parallel_forward(self): method test_backbone (line 263) | def test_backbone(self): method test_for_masked_image_modeling (line 267) | def test_for_masked_image_modeling(self): method test_for_image_classification (line 271) | def test_for_image_classification(self): method test_inputs_embeds (line 276) | def test_inputs_embeds(self): method test_feed_forward_chunking (line 280) | def test_feed_forward_chunking(self): method test_model_get_set_embeddings (line 283) | def test_model_get_set_embeddings(self): method test_attention_outputs (line 292) | def test_attention_outputs(self): method check_hidden_states_output (line 350) | def check_hidden_states_output(self, inputs_dict, config, model_class,... method test_hidden_states_output (line 392) | def test_hidden_states_output(self): method test_hidden_states_output_with_padding (line 411) | def test_hidden_states_output_with_padding(self): method test_model_from_pretrained (line 439) | def test_model_from_pretrained(self): class SwinModelIntegrationTest (line 447) | class SwinModelIntegrationTest(unittest.TestCase): method default_image_processor (line 449) | def default_image_processor(self): method test_inference_image_classification_head (line 457) | def test_inference_image_classification_head(self): method test_inference_interpolate_pos_encoding (line 475) | def test_inference_interpolate_pos_encoding(self): class SwinBackboneTest (line 496) | class SwinBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 500) | def setUp(self): FILE: tests/models/swin2sr/test_image_processing_swin2sr.py class Swin2SRImageProcessingTester (line 35) | class Swin2SRImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 60) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 68) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 83) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class Swin2SRImageProcessingTest (line 97) | class Swin2SRImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 98) | def setUp(self): method image_processor_dict (line 103) | def image_processor_dict(self): method test_image_processor_properties (line 106) | def test_image_processor_properties(self): method calculate_expected_size (line 114) | def calculate_expected_size(self, image): method test_call_pil (line 123) | def test_call_pil(self): method test_call_numpy (line 137) | def test_call_numpy(self): method test_call_numpy_4_channels (line 151) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 169) | def test_call_pytorch(self): method test_backends_equivalence_batched (line 183) | def test_backends_equivalence_batched(self): FILE: tests/models/swin2sr/test_modeling_swin2sr.py class Swin2SRModelTester (line 39) | class Swin2SRModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 108) | def get_config(self): method create_and_check_model (line 131) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_super_resolution (line 141) | def create_and_check_for_image_super_resolution(self, config, pixel_va... method prepare_config_and_inputs_for_common (line 153) | def prepare_config_and_inputs_for_common(self): class Swin2SRModelTest (line 161) | class Swin2SRModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 167) | def setUp(self): method test_config (line 177) | def test_config(self): method test_model (line 180) | def test_model(self): method test_model_for_image_super_resolution (line 184) | def test_model_for_image_super_resolution(self): method test_multi_gpu_data_parallel_forward (line 190) | def test_multi_gpu_data_parallel_forward(self): method test_inputs_embeds (line 194) | def test_inputs_embeds(self): method test_training (line 198) | def test_training(self): method test_training_gradient_checkpointing (line 202) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 206) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 210) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_get_set_embeddings (line 213) | def test_model_get_set_embeddings(self): method test_model_from_pretrained (line 223) | def test_model_from_pretrained(self): method test_attention_outputs (line 228) | def test_attention_outputs(self): class Swin2SRModelIntegrationTest (line 288) | class Swin2SRModelIntegrationTest(unittest.TestCase): method test_inference_image_super_resolution_head (line 289) | def test_inference_image_super_resolution_head(self): method test_inference_fp16 (line 308) | def test_inference_fp16(self): FILE: tests/models/swinv2/test_modeling_swinv2.py class Swinv2ModelTester (line 43) | class Swinv2ModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 111) | def get_config(self): method create_and_check_model (line 135) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 146) | def create_and_check_backbone(self, config, pixel_values, labels): method create_and_check_for_masked_image_modeling (line 173) | def create_and_check_for_masked_image_modeling(self, config, pixel_val... method create_and_check_for_image_classification (line 192) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 200) | def prepare_config_and_inputs_for_common(self): class Swinv2ModelTest (line 208) | class Swinv2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 227) | def setUp(self): method test_config (line 237) | def test_config(self): method test_model (line 240) | def test_model(self): method test_backbone (line 244) | def test_backbone(self): method test_multi_gpu_data_parallel_forward (line 250) | def test_multi_gpu_data_parallel_forward(self): method test_inputs_embeds (line 254) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 257) | def test_model_get_set_embeddings(self): method test_forward_signature (line 266) | def test_forward_signature(self): method test_attention_outputs (line 278) | def test_attention_outputs(self): method check_hidden_states_output (line 336) | def check_hidden_states_output(self, inputs_dict, config, model_class,... method test_hidden_states_output (line 378) | def test_hidden_states_output(self): method test_hidden_states_output_with_padding (line 397) | def test_hidden_states_output_with_padding(self): method test_for_masked_image_modeling (line 424) | def test_for_masked_image_modeling(self): method test_for_image_classification (line 428) | def test_for_image_classification(self): method test_model_from_pretrained (line 433) | def test_model_from_pretrained(self): method test_feed_forward_chunking (line 439) | def test_feed_forward_chunking(self): class Swinv2ModelIntegrationTest (line 445) | class Swinv2ModelIntegrationTest(unittest.TestCase): method default_image_processor (line 447) | def default_image_processor(self): method test_inference_image_classification_head (line 455) | def test_inference_image_classification_head(self): method test_inference_fp16 (line 475) | def test_inference_fp16(self): method test_inference_interpolate_pos_encoding (line 495) | def test_inference_interpolate_pos_encoding(self): class Swinv2BackboneTest (line 516) | class Swinv2BackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 520) | def setUp(self): FILE: tests/models/switch_transformers/test_modeling_switch_transformers.py class SwitchTransformersModelTester (line 53) | class SwitchTransformersModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 110) | def prepare_config_and_inputs(self): method get_pipeline_config (line 135) | def get_pipeline_config(self): method get_config (line 155) | def get_config(self): method check_prepare_lm_labels_via_shift_left (line 176) | def check_prepare_lm_labels_via_shift_left( method create_and_check_model (line 215) | def create_and_check_model( method create_and_check_with_lm_head (line 243) | def create_and_check_with_lm_head( method create_and_check_decoder_model_past (line 266) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 305) | def create_and_check_decoder_model_attention_mask_past( method create_and_check_decoder_model_past_large_inputs (line 360) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_generate_with_past_key_values (line 404) | def create_and_check_generate_with_past_key_values( method create_and_check_model_fp16_forward (line 427) | def create_and_check_model_fp16_forward( method check_resize_embeddings_switch_transformers_v1_1 (line 440) | def check_resize_embeddings_switch_transformers_v1_1( method prepare_config_and_inputs_for_common (line 454) | def prepare_config_and_inputs_for_common(self): class SwitchTransformersModelTest (line 477) | class SwitchTransformersModelTest(ModelTesterMixin, GenerationTesterMixi... method setUp (line 496) | def setUp(self): method test_config (line 500) | def test_config(self): method test_shift_right (line 503) | def test_shift_right(self): method test_model (line 507) | def test_model(self): method test_model_v1_1 (line 511) | def test_model_v1_1(self): method test_config_and_model_silu_gated (line 519) | def test_config_and_model_silu_gated(self): method test_with_lm_head (line 525) | def test_with_lm_head(self): method test_decoder_model_past (line 529) | def test_decoder_model_past(self): method test_decoder_model_past_with_attn_mask (line 533) | def test_decoder_model_past_with_attn_mask(self): method test_decoder_model_past_with_3d_attn_mask (line 537) | def test_decoder_model_past_with_3d_attn_mask(self): method test_custom_4d_attention_mask (line 566) | def test_custom_4d_attention_mask(self): method test_decoder_model_past_with_large_inputs (line 600) | def test_decoder_model_past_with_large_inputs(self): method test_generate_with_past_key_values (line 604) | def test_generate_with_past_key_values(self): method test_model_fp16_forward (line 609) | def test_model_fp16_forward(self): method test_v1_1_resize_embeddings (line 613) | def test_v1_1_resize_embeddings(self): method test_model_from_pretrained (line 618) | def test_model_from_pretrained(self): method test_load_save_without_tied_weights (line 626) | def test_load_save_without_tied_weights(self): method test_retain_grad_hidden_states_attentions (line 630) | def test_retain_grad_hidden_states_attentions(self): method test_model_base_model_prefix (line 634) | def test_model_base_model_prefix(self): class SwitchTransformersEncoderOnlyModelTester (line 638) | class SwitchTransformersEncoderOnlyModelTester: method __init__ (line 639) | def __init__( method prepare_config_and_inputs (line 680) | def prepare_config_and_inputs(self): method create_and_check_model (line 705) | def create_and_check_model(self, config, input_ids, attention_mask): method create_and_check_model_fp16_forward (line 718) | def create_and_check_model_fp16_forward(self, config, input_ids, atten... method prepare_config_and_inputs_for_common (line 723) | def prepare_config_and_inputs_for_common(self): class SwitchTransformersEncoderOnlyModelTest (line 734) | class SwitchTransformersEncoderOnlyModelTest(ModelTesterMixin, unittest.... method setUp (line 739) | def setUp(self): method test_config (line 743) | def test_config(self): method test_model (line 746) | def test_model(self): method test_model_fp16_forward (line 751) | def test_model_fp16_forward(self): method test_load_save_without_tied_weights (line 758) | def test_load_save_without_tied_weights(self): function use_task_specific_params (line 762) | def use_task_specific_params(model, task): class TestAsymmetricSwitchTransformers (line 767) | class TestAsymmetricSwitchTransformers(unittest.TestCase): method build_model_and_check_forward_pass (line 768) | def build_model_and_check_forward_pass(self, **kwargs): method test_small_decoder (line 792) | def test_small_decoder(self): method test_defaulting_to_symmetry (line 798) | def test_defaulting_to_symmetry(self): class SwitchTransformerRouterTest (line 805) | class SwitchTransformerRouterTest(unittest.TestCase): method test_equivalency_balancy_loss (line 823) | def test_equivalency_balancy_loss(self): method test_equivalency_router_z_loss (line 843) | def test_equivalency_router_z_loss(self): method test_equivalency_token_chose_masked_router (line 872) | def test_equivalency_token_chose_masked_router(self): method test_max_routing_capacity (line 917) | def test_max_routing_capacity(self): class SwitchTransformerModelIntegrationTests (line 937) | class SwitchTransformerModelIntegrationTests(unittest.TestCase): method test_small_logits (line 940) | def test_small_logits(self): method test_small_generate (line 982) | def test_small_generate(self): method test_small_batch_generate (line 1011) | def test_small_batch_generate(self): class SwitchTransformersSparseMLPTests (line 1031) | class SwitchTransformersSparseMLPTests(unittest.TestCase): method test_token_dropping (line 1032) | def test_token_dropping(self): FILE: tests/models/t5/test_modeling_t5.py class T5ModelTester (line 58) | class T5ModelTester: method __init__ (line 59) | def __init__( method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method get_pipeline_config (line 132) | def get_pipeline_config(self): method get_config (line 150) | def get_config(self): method get_config_v1_1 (line 168) | def get_config_v1_1(self): method check_prepare_lm_labels_via_shift_left (line 190) | def check_prepare_lm_labels_via_shift_left( method create_and_check_model (line 229) | def create_and_check_model( method create_and_check_with_lm_head (line 257) | def create_and_check_with_lm_head( method create_and_check_with_sequence_classification_head (line 277) | def create_and_check_with_sequence_classification_head( method create_and_check_decoder_model_past (line 297) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 334) | def create_and_check_decoder_model_attention_mask_past( method create_and_check_decoder_model_past_large_inputs (line 385) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_generate_with_past_key_values (line 423) | def create_and_check_generate_with_past_key_values( method create_and_check_model_fp16_forward (line 441) | def create_and_check_model_fp16_forward( method check_resize_embeddings_t5_v1_1 (line 454) | def check_resize_embeddings_t5_v1_1( method prepare_config_and_inputs_for_common (line 470) | def prepare_config_and_inputs_for_common(self): class T5ModelTest (line 491) | class T5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste... method setUp (line 512) | def setUp(self): method is_pipeline_test_to_skip (line 518) | def is_pipeline_test_to_skip( method test_custom_4d_attention_mask (line 536) | def test_custom_4d_attention_mask(self): method test_config (line 570) | def test_config(self): method test_shift_right (line 573) | def test_shift_right(self): method test_model (line 577) | def test_model(self): method test_model_v1_1 (line 582) | def test_model_v1_1(self): method test_inputs_embeds (line 592) | def test_inputs_embeds(self): method test_config_and_model_silu_gated (line 621) | def test_config_and_model_silu_gated(self): method test_with_lm_head (line 627) | def test_with_lm_head(self): method test_with_sequence_classification_head (line 631) | def test_with_sequence_classification_head(self): method test_decoder_model_past (line 635) | def test_decoder_model_past(self): method test_decoder_model_past_with_attn_mask (line 639) | def test_decoder_model_past_with_attn_mask(self): method test_decoder_model_past_with_3d_attn_mask (line 643) | def test_decoder_model_past_with_3d_attn_mask(self): method test_decoder_model_past_with_large_inputs (line 671) | def test_decoder_model_past_with_large_inputs(self): method test_generate_with_past_key_values (line 675) | def test_generate_with_past_key_values(self): method test_model_fp16_forward (line 680) | def test_model_fp16_forward(self): method test_v1_1_resize_embeddings (line 684) | def test_v1_1_resize_embeddings(self): method test_model_from_pretrained (line 689) | def test_model_from_pretrained(self): method test_model_base_model_prefix (line 695) | def test_model_base_model_prefix(self): class T5EncoderOnlyModelTester (line 699) | class T5EncoderOnlyModelTester: method __init__ (line 700) | def __init__( method prepare_config_and_inputs (line 741) | def prepare_config_and_inputs(self): method create_and_check_model (line 770) | def create_and_check_model( method create_and_check_model_fp16_forward (line 788) | def create_and_check_model_fp16_forward( method create_and_check_with_token_classification_head (line 798) | def create_and_check_with_token_classification_head( method prepare_config_and_inputs_for_common (line 814) | def prepare_config_and_inputs_for_common(self): class T5EncoderOnlyModelTest (line 829) | class T5EncoderOnlyModelTest(ModelTesterMixin, PipelineTesterMixin, unit... method setUp (line 841) | def setUp(self): method test_config (line 845) | def test_config(self): method test_model (line 848) | def test_model(self): method test_model_fp16_forward (line 853) | def test_model_fp16_forward(self): method test_with_token_classification_head (line 857) | def test_with_token_classification_head(self): method is_pipeline_test_to_skip (line 861) | def is_pipeline_test_to_skip( function use_task_specific_params (line 882) | def use_task_specific_params(model, task): class T5ModelFp16Tests (line 900) | class T5ModelFp16Tests(unittest.TestCase): method test_fp16_fp32_conversion (line 901) | def test_fp16_fp32_conversion(self): class T5ModelIntegrationTests (line 964) | class T5ModelIntegrationTests(unittest.TestCase): method tearDown (line 965) | def tearDown(self): method model (line 970) | def model(self): method tokenizer (line 974) | def tokenizer(self): method test_torch_quant (line 978) | def test_torch_quant(self): method test_small_generation (line 991) | def test_small_generation(self): method test_small_integration_test (line 1003) | def test_small_integration_test(self): method test_small_v1_1_integration_test (line 1039) | def test_small_v1_1_integration_test(self): method test_small_byt5_integration_test (line 1070) | def test_small_byt5_integration_test(self): method test_summarization (line 1099) | def test_summarization(self): method test_translation_en_to_de (line 1341) | def test_translation_en_to_de(self): method test_translation_en_to_fr (line 1358) | def test_translation_en_to_fr(self): method test_translation_en_to_ro (line 1394) | def test_translation_en_to_ro(self): method test_compile_static_cache (line 1411) | def test_compile_static_cache(self): method test_compile_static_cache_encoder (line 1452) | def test_compile_static_cache_encoder(self): method test_export_encoder (line 1472) | def test_export_encoder(self): method test_export_decoder (line 1507) | def test_export_decoder(self): method test_export_t5_summarization (line 1567) | def test_export_t5_summarization(self): class TestAsymmetricT5 (line 1613) | class TestAsymmetricT5(unittest.TestCase): method build_model_and_check_forward_pass (line 1614) | def build_model_and_check_forward_pass(self, **kwargs): method test_small_decoder (line 1637) | def test_small_decoder(self): method test_defaulting_to_symmetry (line 1643) | def test_defaulting_to_symmetry(self): FILE: tests/models/t5/test_tokenization_t5.py class T5TokenizationTest (line 27) | class T5TokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/t5gemma/test_modeling_t5gemma.py class T5GemmaModelTester (line 51) | class T5GemmaModelTester: method __init__ (line 61) | def __init__( method get_encoder_config (line 141) | def get_encoder_config(self): method get_decoder_config (line 162) | def get_decoder_config(self): method get_config (line 184) | def get_config(self, is_encoder_decoder=True): method prepare_config_and_inputs (line 197) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 235) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 254) | def create_and_check_model( method check_prepare_lm_labels_via_shift_left (line 284) | def check_prepare_lm_labels_via_shift_left( method create_and_check_with_lm_head (line 305) | def create_and_check_with_lm_head( method create_and_check_with_sequence_classification_head (line 326) | def create_and_check_with_sequence_classification_head( method create_and_check_encoderonly_for_sequence_classification_head (line 345) | def create_and_check_encoderonly_for_sequence_classification_head( method create_and_check_encoderonly_for_token_classification_head (line 367) | def create_and_check_encoderonly_for_token_classification_head( method create_and_check_decoder_model_past (line 389) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 432) | def create_and_check_decoder_model_attention_mask_past( method create_and_check_decoder_model_past_large_inputs (line 491) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_generate_with_past_key_values (line 540) | def create_and_check_generate_with_past_key_values( method create_and_check_model_fp16_forward (line 558) | def create_and_check_model_fp16_forward( class T5GemmaModelTest (line 573) | class T5GemmaModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method setUp (line 604) | def setUp(self): method is_pipeline_test_to_skip (line 616) | def is_pipeline_test_to_skip( method test_config (line 633) | def test_config(self): method test_shift_right (line 638) | def test_shift_right(self): method test_model (line 643) | def test_model(self): method test_inputs_embeds (line 648) | def test_inputs_embeds(self): method test_config_and_model_silu_gated (line 678) | def test_config_and_model_silu_gated(self): method test_with_lm_head (line 684) | def test_with_lm_head(self): method test_with_sequence_classification_head (line 688) | def test_with_sequence_classification_head(self): method test_encoderonly_sequence_classification_head (line 693) | def test_encoderonly_sequence_classification_head(self, is_encoder_dec... method test_encoderonly_token_classification_head (line 700) | def test_encoderonly_token_classification_head(self, is_encoder_decoder): method test_decoder_model_past (line 707) | def test_decoder_model_past(self): method test_decoder_model_past_with_attn_mask (line 711) | def test_decoder_model_past_with_attn_mask(self): method test_decoder_model_past_with_3d_attn_mask (line 716) | def test_decoder_model_past_with_3d_attn_mask(self): method test_decoder_model_past_with_large_inputs (line 744) | def test_decoder_model_past_with_large_inputs(self): method test_generate_with_past_key_values (line 748) | def test_generate_with_past_key_values(self): method test_model_fp16_forward (line 753) | def test_model_fp16_forward(self): method test_T5Gemma_sequence_classification_model (line 758) | def test_T5Gemma_sequence_classification_model(self): method test_T5Gemma_sequence_classification_model_for_single_label (line 775) | def test_T5Gemma_sequence_classification_model_for_single_label(self): method test_T5Gemma_sequence_classification_model_for_multi_label (line 793) | def test_T5Gemma_sequence_classification_model_for_multi_label(self): method test_T5Gemma_token_classification_model (line 813) | def test_T5Gemma_token_classification_model(self): method test_sdpa_equivalence (line 837) | def test_sdpa_equivalence(self): method test_flash_attn_2_equivalence (line 863) | def test_flash_attn_2_equivalence(self): method test_attention_outputs (line 869) | def test_attention_outputs(self): method test_load_with_mismatched_shapes (line 994) | def test_load_with_mismatched_shapes(self): method test_generate_continue_from_past_key_values (line 1000) | def test_generate_continue_from_past_key_values(self): method test_inputs_embeds_matches_input_ids (line 1090) | def test_inputs_embeds_matches_input_ids(self): method test_hidden_states_output (line 1126) | def test_hidden_states_output(self): method test_custom_4d_attention_mask (line 1188) | def test_custom_4d_attention_mask(self): method test_flex_attention_with_grads (line 1225) | def test_flex_attention_with_grads(self): method test_generate_beyond_sliding_window_with_flash_attn (line 1274) | def test_generate_beyond_sliding_window_with_flash_attn(self): class T5GemmaEncoderOnlyModelTester (line 1285) | class T5GemmaEncoderOnlyModelTester: method __init__ (line 1292) | def __init__( method get_encoder_config (line 1353) | def get_encoder_config(self): method get_config (line 1374) | def get_config(self): method prepare_config_and_inputs (line 1386) | def prepare_config_and_inputs(self): method create_and_check_model (line 1404) | def create_and_check_model( method create_and_check_model_fp16_forward (line 1422) | def create_and_check_model_fp16_forward( method create_and_check_with_token_classification_head (line 1432) | def create_and_check_with_token_classification_head( method prepare_config_and_inputs_for_common (line 1448) | def prepare_config_and_inputs_for_common(self): class T5GemmaEncoderOnlyModelTest (line 1464) | class T5GemmaEncoderOnlyModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 1473) | def setUp(self): method test_config (line 1485) | def test_config(self): method test_model (line 1491) | def test_model(self): method test_model_fp16_forward (line 1496) | def test_model_fp16_forward(self): method test_with_token_classification_head (line 1500) | def test_with_token_classification_head(self): method test_training (line 1505) | def test_training(self): method test_training_gradient_checkpointing (line 1509) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 1513) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 1517) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_flex_attention_with_grads (line 1523) | def test_flex_attention_with_grads(self): class TestAsymmetricT5Gemma (line 1559) | class TestAsymmetricT5Gemma(unittest.TestCase): method build_model_and_check_forward_pass (line 1560) | def build_model_and_check_forward_pass(self, **kwargs): method test_small_decoder (line 1583) | def test_small_decoder(self): method test_defaulting_to_symmetry (line 1588) | def test_defaulting_to_symmetry(self): FILE: tests/models/t5gemma2/test_modeling_t5gemma2.py class T5Gemma2ModelTester (line 60) | class T5Gemma2ModelTester: method __init__ (line 72) | def __init__( method get_encoder_config (line 177) | def get_encoder_config(self): method get_decoder_config (line 208) | def get_decoder_config(self): method get_config (line 231) | def get_config(self, is_encoder_decoder=True): method prepare_config_and_inputs (line 246) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 293) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 314) | def create_and_check_model( method check_prepare_lm_labels_via_shift_left (line 346) | def check_prepare_lm_labels_via_shift_left( method create_and_check_with_lm_head (line 368) | def create_and_check_with_lm_head( method create_and_check_with_sequence_classification_head (line 391) | def create_and_check_with_sequence_classification_head( method create_and_check_with_token_classification_head (line 412) | def create_and_check_with_token_classification_head( method create_and_check_decoder_model_past (line 435) | def create_and_check_decoder_model_past( method create_and_check_decoder_model_attention_mask_past (line 479) | def create_and_check_decoder_model_attention_mask_past( method create_and_check_decoder_model_past_large_inputs (line 539) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_generate_with_past_key_values (line 592) | def create_and_check_generate_with_past_key_values( method create_and_check_model_fp16_forward (line 613) | def create_and_check_model_fp16_forward( method create_and_create_and_check_forward_full_mask (line 633) | def create_and_create_and_check_forward_full_mask( class T5Gemma2ModelTest (line 675) | class T5Gemma2ModelTest(ModelTesterMixin, GenerationTesterMixin, unittes... method setUp (line 695) | def setUp(self): method test_config (line 707) | def test_config(self): method test_shift_right (line 710) | def test_shift_right(self): method test_model (line 714) | def test_model(self): method test_inputs_embeds (line 719) | def test_inputs_embeds(self): method test_with_lm_head (line 748) | def test_with_lm_head(self): method test_with_sequence_classification_head (line 752) | def test_with_sequence_classification_head(self): method test_with_token_classification_head (line 756) | def test_with_token_classification_head(self): method test_decoder_model_past (line 760) | def test_decoder_model_past(self): method test_decoder_model_past_with_attn_mask (line 764) | def test_decoder_model_past_with_attn_mask(self): method test_decoder_model_past_with_large_inputs (line 768) | def test_decoder_model_past_with_large_inputs(self): method test_generate_with_past_key_values (line 772) | def test_generate_with_past_key_values(self): method test_model_fp16_forward (line 777) | def test_model_fp16_forward(self): method test_forward_full_mask (line 783) | def test_forward_full_mask(self): method test_T5Gemma2_sequence_classification_model (line 788) | def test_T5Gemma2_sequence_classification_model(self): method test_T5Gemma2_sequence_classification_model_for_single_label (line 801) | def test_T5Gemma2_sequence_classification_model_for_single_label(self): method test_T5Gemma2_sequence_classification_model_for_multi_label (line 815) | def test_T5Gemma2_sequence_classification_model_for_multi_label(self): method test_T5Gemma2_token_classification_model (line 831) | def test_T5Gemma2_token_classification_model(self): method test_attention_outputs (line 855) | def test_attention_outputs(self): method test_load_with_mismatched_shapes (line 859) | def test_load_with_mismatched_shapes(self): method test_generate_continue_from_past_key_values (line 865) | def test_generate_continue_from_past_key_values(self): method test_hidden_states_output (line 954) | def test_hidden_states_output(self): method test_custom_4d_attention_mask (line 959) | def test_custom_4d_attention_mask(self): method test_training_gradient_checkpointing (line 1004) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 1008) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 1012) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_torch_compile_for_training (line 1016) | def test_torch_compile_for_training(self): method test_retain_grad_hidden_states_attentions (line 1020) | def test_retain_grad_hidden_states_attentions(self): method test_sdpa_can_dispatch_on_flash (line 1026) | def test_sdpa_can_dispatch_on_flash(self): class T5Gemma2IntegrationTest (line 1032) | class T5Gemma2IntegrationTest(unittest.TestCase): method setUp (line 1033) | def setUp(self): method tearDown (line 1036) | def tearDown(self): method test_model_generation_270m (line 1039) | def test_model_generation_270m(self): method test_model_generation_batch_270m (line 1060) | def test_model_generation_batch_270m(self): FILE: tests/models/table_transformer/test_modeling_table_transformer.py class TableTransformerModelTester (line 43) | class TableTransformerModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 86) | def prepare_config_and_inputs(self): method get_config (line 107) | def get_config(self): method prepare_config_and_inputs_for_common (line 136) | def prepare_config_and_inputs_for_common(self): method create_and_check_table_transformer_model (line 141) | def create_and_check_table_transformer_model(self, config, pixel_value... method create_and_check_table_transformer_object_detection_head_model (line 153) | def create_and_check_table_transformer_object_detection_head_model(sel... method create_and_check_table_transformer_no_timm_backbone (line 170) | def create_and_check_table_transformer_no_timm_backbone(self, config, ... class TableTransformerModelTest (line 191) | class TableTransformerModelTest(ModelTesterMixin, PipelineTesterMixin, u... method _prepare_for_class (line 211) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 237) | def setUp(self): method test_config (line 241) | def test_config(self): method test_table_transformer_model (line 244) | def test_table_transformer_model(self): method test_table_transformer_object_detection_head_model (line 248) | def test_table_transformer_object_detection_head_model(self): method test_table_transformer_no_timm_backbone (line 252) | def test_table_transformer_no_timm_backbone(self): method test_inputs_embeds (line 257) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 261) | def test_inputs_embeds_matches_input_ids(self): method test_model_get_set_embeddings (line 265) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 269) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 273) | def test_resize_tokens_embeddings(self): method test_model_outputs_equivalence (line 278) | def test_model_outputs_equivalence(self): method test_attention_outputs (line 281) | def test_attention_outputs(self): method test_retain_grad_hidden_states_attentions (line 382) | def test_retain_grad_hidden_states_attentions(self): method test_forward_auxiliary_loss (line 418) | def test_forward_auxiliary_loss(self): method test_forward_signature (line 434) | def test_forward_signature(self): method test_backbone_selection (line 450) | def test_backbone_selection(self): method test_greyscale_images (line 497) | def test_greyscale_images(self): function prepare_img (line 523) | def prepare_img(): class TableTransformerModelIntegrationTests (line 531) | class TableTransformerModelIntegrationTests(unittest.TestCase): method test_table_detection (line 532) | def test_table_detection(self): FILE: tests/models/tapas/test_modeling_tapas.py class TapasModelTester (line 64) | class TapasModelTester: method __init__ (line 67) | def __init__( method prepare_config_and_inputs (line 157) | def prepare_config_and_inputs(self): method get_config (line 201) | def get_config(self): method create_and_check_model (line 239) | def create_and_check_model( method create_and_check_for_masked_lm (line 262) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 282) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 370) | def create_and_check_for_sequence_classification( method prepare_config_and_inputs_for_common (line 391) | def prepare_config_and_inputs_for_common(self): class TapasModelTest (line 411) | class TapasModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method _prepare_for_class (line 437) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method is_pipeline_test_to_skip (line 489) | def is_pipeline_test_to_skip( method setUp (line 501) | def setUp(self): method test_config (line 505) | def test_config(self): method test_model (line 508) | def test_model(self): method test_for_masked_lm (line 512) | def test_for_masked_lm(self): method test_for_question_answering (line 516) | def test_for_question_answering(self): method test_for_sequence_classification (line 520) | def test_for_sequence_classification(self): function prepare_tapas_single_inputs_for_inference (line 525) | def prepare_tapas_single_inputs_for_inference(): function prepare_tapas_batch_inputs_for_inference (line 537) | def prepare_tapas_batch_inputs_for_inference(): function prepare_tapas_batch_inputs_for_training (line 550) | def prepare_tapas_batch_inputs_for_training(): class TapasModelIntegrationTest (line 568) | class TapasModelIntegrationTest(unittest.TestCase): method default_tokenizer (line 570) | def default_tokenizer(self): method test_inference_no_head (line 574) | def test_inference_no_head(self): method test_inference_masked_lm (line 603) | def test_inference_masked_lm(self): method test_inference_question_answering_head_conversational (line 612) | def test_inference_question_answering_head_conversational(self): method test_inference_question_answering_head_conversational_absolute_embeddings (line 659) | def test_inference_question_answering_head_conversational_absolute_emb... method test_inference_question_answering_head_weak_supervision (line 709) | def test_inference_question_answering_head_weak_supervision(self): method test_training_question_answering_head_weak_supervision (line 759) | def test_training_question_answering_head_weak_supervision(self): method test_inference_question_answering_head_strong_supervision (line 834) | def test_inference_question_answering_head_strong_supervision(self): method test_inference_classification_head (line 892) | def test_inference_classification_head(self): class TapasUtilitiesTest (line 915) | class TapasUtilitiesTest(unittest.TestCase): method _prepare_tables (line 916) | def _prepare_tables(self): method test_product_index (line 957) | def test_product_index(self): method test_flatten (line 990) | def test_flatten(self): method test_range_index_map (line 1008) | def test_range_index_map(self): method test_reduce_sum (line 1021) | def test_reduce_sum(self): method test_reduce_mean (line 1035) | def test_reduce_mean(self): method test_reduce_max (line 1054) | def test_reduce_max(self): method test_reduce_sum_vectorized (line 1061) | def test_reduce_sum_vectorized(self): method test_gather (line 1071) | def test_gather(self): method test_gather_vectorized (line 1087) | def test_gather_vectorized(self): FILE: tests/models/tapas/test_tokenization_tapas.py class TapasTokenizationTest (line 45) | class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method get_table (line 53) | def get_table( method get_table_and_query (line 69) | def get_table_and_query( method get_clean_sequence (line 80) | def get_clean_sequence( method setUpClass (line 112) | def setUpClass(cls): method get_input_output_texts (line 136) | def get_input_output_texts(self, tokenizer): method convert_batch_encode_plus_format_to_encode_plus (line 141) | def convert_batch_encode_plus_format_to_encode_plus(self, batch_encode... method test_chat_template_batched (line 157) | def test_chat_template_batched(self): method test_chinese (line 160) | def test_chinese(self): method test_basic_tokenizer_lower (line 165) | def test_basic_tokenizer_lower(self): method test_basic_tokenizer_lower_strip_accents_false (line 173) | def test_basic_tokenizer_lower_strip_accents_false(self): method test_basic_tokenizer_lower_strip_accents_true (line 181) | def test_basic_tokenizer_lower_strip_accents_true(self): method test_basic_tokenizer_lower_strip_accents_default (line 189) | def test_basic_tokenizer_lower_strip_accents_default(self): method test_basic_tokenizer_no_lower (line 197) | def test_basic_tokenizer_no_lower(self): method test_basic_tokenizer_no_lower_strip_accents_false (line 204) | def test_basic_tokenizer_no_lower_strip_accents_false(self): method test_basic_tokenizer_no_lower_strip_accents_true (line 211) | def test_basic_tokenizer_no_lower_strip_accents_true(self): method test_basic_tokenizer_respects_never_split_tokens (line 218) | def test_basic_tokenizer_respects_never_split_tokens(self): method test_batch_encode_dynamic_overflowing (line 225) | def test_batch_encode_dynamic_overflowing(self): method test_wordpiece_tokenizer (line 228) | def test_wordpiece_tokenizer(self): method test_is_whitespace (line 242) | def test_is_whitespace(self): method test_is_control (line 252) | def test_is_control(self): method test_is_punctuation (line 260) | def test_is_punctuation(self): method test_clean_text (line 269) | def test_clean_text(self): method test_sequence_builders (line 278) | def test_sequence_builders(self): method test_add_special_tokens (line 291) | def test_add_special_tokens(self): method test_add_tokens_tokenizer (line 306) | def test_add_tokens_tokenizer(self): method test_encode_decode_with_spaces (line 361) | def test_encode_decode_with_spaces(self): method test_encode_plus_with_padding (line 379) | def test_encode_plus_with_padding(self, use_padding_as_call_kwarg: bool): method test_internal_consistency (line 492) | def test_internal_consistency(self): method test_mask_output (line 511) | def test_mask_output(self): method test_maximum_encoding_length_pair_input (line 526) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 530) | def test_maximum_encoding_length_single_input(self): method test_number_of_added_tokens (line 533) | def test_number_of_added_tokens(self): method test_call (line 548) | def test_call(self): method test_batch_encode_plus_batch_sequence_length (line 577) | def test_batch_encode_plus_batch_sequence_length(self): method test_batch_encode_plus_overflowing_tokens (line 636) | def test_batch_encode_plus_overflowing_tokens(self): method test_batch_encode_plus_padding (line 639) | def test_batch_encode_plus_padding(self): method test_padding_to_multiple_of (line 696) | def test_padding_to_multiple_of(self): method test_prepare_for_model (line 723) | def test_prepare_for_model(self): method test_tokenizer_slow_store_full_signature (line 726) | def test_tokenizer_slow_store_full_signature(self): method test_special_tokens_mask_input_pairs (line 736) | def test_special_tokens_mask_input_pairs(self): method test_special_tokens_mask (line 762) | def test_special_tokens_mask(self): method test_save_and_load_tokenizer (line 780) | def test_save_and_load_tokenizer(self): method test_right_and_left_truncation (line 809) | def test_right_and_left_truncation(self): method test_right_and_left_padding (line 812) | def test_right_and_left_padding(self): method test_token_type_ids (line 875) | def test_token_type_ids(self): method test_pretokenized_inputs (line 898) | def test_pretokenized_inputs(self): method test_tapas_truncation_integration_test (line 902) | def test_tapas_truncation_integration_test(self): method test_min_max_question_length (line 940) | def test_min_max_question_length(self): method test_tapas_integration_test (line 971) | def test_tapas_integration_test(self): method test_full_tokenizer (line 994) | def test_full_tokenizer(self): method test_np_encode_plus_sent_to_model (line 1037) | def test_np_encode_plus_sent_to_model(self): method test_chat_template (line 1041) | def test_chat_template(self): method test_chat_template_return_assistant_tokens_mask (line 1045) | def test_chat_template_return_assistant_tokens_mask(self): method test_chat_template_return_assistant_tokens_mask_truncated (line 1049) | def test_chat_template_return_assistant_tokens_mask_truncated(self): method test_empty_input_string (line 1052) | def test_empty_input_string(self): FILE: tests/models/textnet/test_image_processing_textnet.py class TextNetImageProcessingTester (line 23) | class TextNetImageProcessingTester: method __init__ (line 24) | def __init__( method prepare_image_processor_dict (line 60) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 73) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 76) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class TextNetImageProcessingTest (line 90) | class TextNetImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 91) | def setUp(self): method image_processor_dict (line 96) | def image_processor_dict(self): method test_image_processor_properties (line 99) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 112) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/textnet/test_modeling_textnet.py class TextNetConfigTester (line 42) | class TextNetConfigTester(ConfigTester): method create_and_test_config_common_properties (line 43) | def create_and_test_config_common_properties(self): class TextNetModelTester (line 50) | class TextNetModelTester: method __init__ (line 51) | def __init__( method get_config (line 107) | def get_config(self): method create_and_check_model (line 124) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 136) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs (line 144) | def prepare_config_and_inputs(self): method create_and_check_backbone (line 155) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 192) | def prepare_config_and_inputs_for_common(self): class TextNetModelTest (line 200) | class TextNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 216) | def setUp(self): method test_attention_outputs (line 221) | def test_attention_outputs(self): method test_model_get_set_embeddings (line 225) | def test_model_get_set_embeddings(self): method test_inputs_embeds (line 229) | def test_inputs_embeds(self): method test_model_common_attributes (line 233) | def test_model_common_attributes(self): method test_model (line 236) | def test_model(self): method test_backbone (line 240) | def test_backbone(self): method test_hidden_states_output (line 244) | def test_hidden_states_output(self): method test_feed_forward_chunking (line 277) | def test_feed_forward_chunking(self): method test_for_image_classification (line 280) | def test_for_image_classification(self): method test_model_from_pretrained (line 285) | def test_model_from_pretrained(self): class TextNetModelIntegrationTest (line 293) | class TextNetModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 295) | def test_inference_no_head(self): class TextNetBackboneTest (line 325) | class TextNetBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 331) | def setUp(self): FILE: tests/models/time_series_transformer/test_modeling_time_series_transformer.py class TimeSeriesTransformerModelTester (line 50) | class TimeSeriesTransformerModelTester: method __init__ (line 51) | def __init__( method get_config (line 90) | def get_config(self): method prepare_time_series_transformer_inputs_dict (line 111) | def prepare_time_series_transformer_inputs_dict(self, config): method prepare_config_and_inputs (line 136) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 141) | def prepare_config_and_inputs_for_common(self): method check_encoder_decoder_model_standalone (line 145) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class TimeSeriesTransformerModelTest (line 179) | class TimeSeriesTransformerModelTest(ModelTesterMixin, PipelineTesterMix... method setUp (line 189) | def setUp(self): method test_config (line 198) | def test_config(self): method test_save_load_strict (line 201) | def test_save_load_strict(self): method test_encoder_decoder_model_standalone (line 211) | def test_encoder_decoder_model_standalone(self): method test_resize_tokens_embeddings (line 216) | def test_resize_tokens_embeddings(self): method test_model_main_input_name (line 220) | def test_model_main_input_name(self): method test_forward_signature (line 226) | def test_forward_signature(self): method test_attention_outputs (line 266) | def test_attention_outputs(self): method test_training_gradient_checkpointing (line 362) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 366) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 370) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_create_network_inputs (line 384) | def test_create_network_inputs(self, prediction_length, context_length... method test_retain_grad_hidden_states_attentions (line 458) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 462) | def test_model_get_set_embeddings(self): function prepare_batch (line 466) | def prepare_batch(filename="train-batch.pt"): class TimeSeriesTransformerModelIntegrationTests (line 475) | class TimeSeriesTransformerModelIntegrationTests(unittest.TestCase): method test_inference_no_head (line 476) | def test_inference_no_head(self): method test_inference_head (line 501) | def test_inference_head(self): method test_seq_to_seq_generation (line 523) | def test_seq_to_seq_generation(self): FILE: tests/models/timesfm/test_modeling_timesfm.py class TimesFmModelTester (line 35) | class TimesFmModelTester: method __init__ (line 36) | def __init__( method get_config (line 80) | def get_config(self): method get_pipeline_config (line 99) | def get_pipeline_config(self): method prepare_config_and_inputs (line 102) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 112) | def prepare_config_and_inputs_for_common(self): class TimesFmModelTest (line 123) | class TimesFmModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 132) | def setUp(self): method test_create_and_run_model (line 136) | def test_create_and_run_model(self): method test_sdpa_can_dispatch_on_flash (line 145) | def test_sdpa_can_dispatch_on_flash(self): method test_eager_matches_sdpa_inference (line 149) | def test_eager_matches_sdpa_inference( method test_model_get_set_embeddings (line 202) | def test_model_get_set_embeddings(self): method test_model_main_input_name (line 206) | def test_model_main_input_name(self): class TimesFmModelIntegrationTests (line 215) | class TimesFmModelIntegrationTests(unittest.TestCase): method test_inference (line 216) | def test_inference(self): FILE: tests/models/timesfm2_5/test_modeling_timesfm2_5.py class TimesFm2_5ModelTester (line 33) | class TimesFm2_5ModelTester: method __init__ (line 34) | def __init__( method get_config (line 69) | def get_config(self): method get_pipeline_config (line 85) | def get_pipeline_config(self): method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 97) | def prepare_config_and_inputs_for_common(self): class TimesFm2_5ModelTest (line 104) | class TimesFm2_5ModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 111) | def setUp(self): method test_create_and_run_model (line 115) | def test_create_and_run_model(self): method test_sdpa_can_dispatch_on_flash (line 124) | def test_sdpa_can_dispatch_on_flash(self): method test_model_get_set_embeddings (line 128) | def test_model_get_set_embeddings(self): method test_eager_matches_sdpa_inference (line 132) | def test_eager_matches_sdpa_inference( method _test_flash_or_flex_attn_inference_equivalence (line 188) | def _test_flash_or_flex_attn_inference_equivalence(self, attn_implemen... method test_flash_attn_2_inference_equivalence (line 227) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 232) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_retain_grad_hidden_states_attentions (line 235) | def test_retain_grad_hidden_states_attentions(self): method _prepare_for_class (line 277) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... class TimesFm2_5ModelIntegrationTests (line 288) | class TimesFm2_5ModelIntegrationTests(unittest.TestCase): method test_inference (line 289) | def test_inference(self): FILE: tests/models/timesformer/test_modeling_timesformer.py class TimesformerModelTester (line 48) | class TimesformerModelTester: method __init__ (line 49) | def __init__( method prepare_config_and_inputs (line 95) | def prepare_config_and_inputs(self): method get_config (line 108) | def get_config(self): method create_and_check_model (line 127) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_video_classification (line 134) | def create_and_check_for_video_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 145) | def prepare_config_and_inputs_for_common(self): class TimesformerModelTest (line 153) | class TimesformerModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 168) | def setUp(self): method _prepare_for_class (line 174) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 185) | def test_config(self): method test_inputs_embeds (line 189) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 192) | def test_model_get_set_embeddings(self): method test_model (line 201) | def test_model(self): method test_for_video_classification (line 205) | def test_for_video_classification(self): method test_model_from_pretrained (line 210) | def test_model_from_pretrained(self): method test_attention_outputs (line 215) | def test_attention_outputs(self): method test_hidden_states_output (line 277) | def test_hidden_states_output(self): function prepare_video (line 312) | def prepare_video(): class TimesformerModelIntegrationTest (line 322) | class TimesformerModelIntegrationTest(unittest.TestCase): method default_image_processor (line 324) | def default_image_processor(self): method test_inference_for_video_classification (line 333) | def test_inference_for_video_classification(self): FILE: tests/models/timm_backbone/test_modeling_timm_backbone.py class TimmBackboneModelTester (line 34) | class TimmBackboneModelTester: method __init__ (line 35) | def __init__( method prepare_config_and_inputs (line 57) | def prepare_config_and_inputs(self): method get_config (line 63) | def get_config(self): method prepare_config_and_inputs_for_common (line 73) | def prepare_config_and_inputs_for_common(self): class TimmBackboneModelTest (line 82) | class TimmBackboneModelTest(ModelTesterMixin, BackboneTesterMixin, Pipel... method setUp (line 89) | def setUp(self): method test_config (line 97) | def test_config(self): method test_batching_equivalence (line 102) | def test_batching_equivalence(self, atol=1e-4, rtol=1e-4): method test_timm_transformer_backbone_equivalence (line 105) | def test_timm_transformer_backbone_equivalence(self): method test_feed_forward_chunking (line 129) | def test_feed_forward_chunking(self): method test_hidden_states_output (line 133) | def test_hidden_states_output(self): method test_can_init_all_missing_weights (line 137) | def test_can_init_all_missing_weights(self): method test_init_weights_can_init_buffers (line 141) | def test_init_weights_can_init_buffers(self): method test_inputs_embeds (line 145) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 149) | def test_model_get_set_embeddings(self): method test_from_pretrained_no_checkpoint (line 153) | def test_from_pretrained_no_checkpoint(self): method test_save_load (line 157) | def test_save_load(self): method test_load_contiguous_weights (line 161) | def test_load_contiguous_weights(self): method test_can_load_with_device_context_manager (line 165) | def test_can_load_with_device_context_manager(self): method test_can_load_with_global_device_set (line 169) | def test_can_load_with_global_device_set(self): method test_cannot_load_with_meta_device_context_manager (line 173) | def test_cannot_load_with_meta_device_context_manager(self): method test_load_save_without_tied_weights (line 177) | def test_load_save_without_tied_weights(self): method test_model_weights_reload_no_missing_tied_weights (line 181) | def test_model_weights_reload_no_missing_tied_weights(self): method test_channels (line 185) | def test_channels(self): method test_can_use_safetensors (line 189) | def test_can_use_safetensors(self): method test_model_is_small (line 193) | def test_model_is_small(self): method test_forward_signature (line 196) | def test_forward_signature(self): method test_retain_grad_hidden_states_attentions (line 208) | def test_retain_grad_hidden_states_attentions(self): method test_create_from_modified_config (line 238) | def test_create_from_modified_config(self): FILE: tests/models/timm_wrapper/test_image_processing_timm_wrapper.py class TimmWrapperImageProcessingTest (line 36) | class TimmWrapperImageProcessingTest(unittest.TestCase): method setUp (line 39) | def setUp(self): method tearDown (line 45) | def tearDown(self): method test_load_from_hub (line 48) | def test_load_from_hub(self): method test_load_from_local_dir (line 52) | def test_load_from_local_dir(self): method test_image_processor_properties (line 56) | def test_image_processor_properties(self): method test_image_processor_call_numpy (line 62) | def test_image_processor_call_numpy(self): method test_image_processor_call_pil (line 76) | def test_image_processor_call_pil(self): method test_image_processor_call_tensor (line 90) | def test_image_processor_call_tensor(self): FILE: tests/models/timm_wrapper/test_modeling_timm_wrapper.py class TimmWrapperModelTester (line 52) | class TimmWrapperModelTester: method __init__ (line 53) | def __init__( method prepare_config_and_inputs (line 70) | def prepare_config_and_inputs(self): method get_config (line 76) | def get_config(self): method prepare_config_and_inputs_for_common (line 79) | def prepare_config_and_inputs_for_common(self): class TimmWrapperModelTest (line 88) | class TimmWrapperModelTest(ModelTesterMixin, PipelineTesterMixin, unitte... method setUp (line 99) | def setUp(self): method test_config (line 110) | def test_config(self): method test_hidden_states_output (line 113) | def test_hidden_states_output(self): method test_inputs_embeds (line 140) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 144) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 148) | def test_retain_grad_hidden_states_attentions(self): method test_gradient_checkpointing (line 151) | def test_gradient_checkpointing(self): method test_gradient_checkpointing_on_non_supported_model (line 156) | def test_gradient_checkpointing_on_non_supported_model(self): method test_forward_signature (line 161) | def test_forward_signature(self): method test_do_pooling_option (line 173) | def test_do_pooling_option(self): method test_timm_config_labels (line 189) | def test_timm_config_labels(self): method test_model_init_args (line 237) | def test_model_init_args(self): function prepare_img (line 257) | def prepare_img(): class TimmWrapperModelIntegrationTest (line 265) | class TimmWrapperModelIntegrationTest(unittest.TestCase): method test_inference_image_classification_head (line 277) | def test_inference_image_classification_head(self): method test_inference_with_pipeline (line 308) | def test_inference_with_pipeline(self): method test_inference_image_classification_quantized (line 322) | def test_inference_image_classification_quantized(self): method test_transformers_model_for_classification_is_equivalent_to_timm (line 359) | def test_transformers_model_for_classification_is_equivalent_to_timm(s... method test_transformers_model_is_equivalent_to_timm (line 388) | def test_transformers_model_is_equivalent_to_timm(self): method test_save_load_to_timm (line 419) | def test_save_load_to_timm(self): FILE: tests/models/trocr/test_modeling_trocr.py class TrOCRStandaloneDecoderModelTester (line 34) | class TrOCRStandaloneDecoderModelTester: method __init__ (line 35) | def __init__( method prepare_config_and_inputs (line 86) | def prepare_config_and_inputs(self): method create_and_check_decoder_model_past (line 113) | def create_and_check_decoder_model_past( method prepare_config_and_inputs_for_common (line 152) | def prepare_config_and_inputs_for_common(self): class TrOCRStandaloneDecoderModelTest (line 161) | class TrOCRStandaloneDecoderModelTest(ModelTesterMixin, GenerationTester... method setUp (line 165) | def setUp(self): method test_inputs_embeds (line 170) | def test_inputs_embeds(self): method test_config (line 173) | def test_config(self): method test_decoder_model_past (line 176) | def test_decoder_model_past(self): method test_retain_grad_hidden_states_attentions (line 181) | def test_retain_grad_hidden_states_attentions(self): method test_left_padding_compatibility (line 185) | def test_left_padding_compatibility(self): FILE: tests/models/trocr/test_processing_trocr.py class TrOCRProcessorTest (line 22) | class TrOCRProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 27) | def _setup_image_processor(cls): method _setup_tokenizer (line 32) | def _setup_tokenizer(cls): method test_processor_text (line 36) | def test_processor_text(self): FILE: tests/models/tvp/test_image_processing_tvp.py class TvpImageProcessingTester (line 34) | class TvpImageProcessingTester: method __init__ (line 35) | def __init__( method prepare_image_processor_dict (line 76) | def prepare_image_processor_dict(self): method get_expected_values (line 89) | def get_expected_values(self, image_inputs, batched=False): method prepare_video_inputs (line 107) | def prepare_video_inputs(self, equal_resolution=False, numpify=False, ... class TvpImageProcessingTest (line 122) | class TvpImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 123) | def setUp(self): method image_processor_dict (line 128) | def image_processor_dict(self): method test_image_processor_properties (line 131) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 144) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 152) | def test_call_pil(self): method test_call_numpy (line 192) | def test_call_numpy(self): method test_call_numpy_4_channels (line 244) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 309) | def test_call_pytorch(self): method test_backends_equivalence_batched (line 352) | def test_backends_equivalence_batched(self): FILE: tests/models/tvp/test_modeling_tvp.py class TVPModelTester (line 45) | class TVPModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method get_config (line 114) | def get_config(self): method create_and_check_model (line 151) | def create_and_check_model(self, config, input_ids, pixel_values, atte... method prepare_config_and_inputs_for_common (line 158) | def prepare_config_and_inputs_for_common(self): class TVPModelTest (line 166) | class TVPModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 181) | def setUp(self): method test_model (line 184) | def test_model(self): method test_inputs_embeds (line 189) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 193) | def test_model_get_set_embeddings(self): method test_backbone_selection (line 197) | def test_backbone_selection(self): function prepare_img (line 234) | def prepare_img(): class TvpModelIntegrationTests (line 242) | class TvpModelIntegrationTests(unittest.TestCase): method default_image_processor (line 244) | def default_image_processor(self): method test_inference_no_head (line 247) | def test_inference_no_head(self): method test_inference_with_head (line 268) | def test_inference_with_head(self): method test_interpolate_inference_no_head (line 287) | def test_interpolate_inference_no_head(self): method test_interpolate_inference_with_head (line 306) | def test_interpolate_inference_with_head(self): FILE: tests/models/udop/test_modeling_udop.py class UdopModelTester (line 46) | class UdopModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 134) | def get_config(self): method create_and_check_model (line 152) | def create_and_check_model( method create_and_check_with_lm_head (line 182) | def create_and_check_with_lm_head( method create_and_check_generate_with_past_key_values (line 204) | def create_and_check_generate_with_past_key_values( method create_and_check_model_fp16_forward (line 225) | def create_and_check_model_fp16_forward( method prepare_config_and_inputs_for_common (line 239) | def prepare_config_and_inputs_for_common(self): class UdopModelTest (line 263) | class UdopModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 284) | def setUp(self): method _prepare_for_class (line 288) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 298) | def test_config(self): method test_model (line 301) | def test_model(self): method test_with_lm_head (line 305) | def test_with_lm_head(self): method test_generate_with_past_key_values (line 309) | def test_generate_with_past_key_values(self): method test_model_fp16_forward (line 314) | def test_model_fp16_forward(self): method test_training_gradient_checkpointing (line 319) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 323) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 327) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_base_model_prefix (line 331) | def test_model_base_model_prefix(self): method test_forward_signature (line 334) | def test_forward_signature(self): method test_custom_4d_attention_mask (line 362) | def test_custom_4d_attention_mask(self): method test_model_from_pretrained (line 399) | def test_model_from_pretrained(self): method test_generate_without_input_ids (line 405) | def test_generate_without_input_ids(self): class UdopEncoderOnlyModelTester (line 409) | class UdopEncoderOnlyModelTester: method __init__ (line 410) | def __init__( method get_config (line 452) | def get_config(self): method prepare_config_and_inputs (line 470) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 498) | def prepare_config_and_inputs_for_common(self): method create_and_check_model (line 514) | def create_and_check_model( method create_and_check_model_fp16_forward (line 533) | def create_and_check_model_fp16_forward( class UdopEncoderOnlyModelTest (line 545) | class UdopEncoderOnlyModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 550) | def setUp(self): method test_config (line 554) | def test_config(self): method test_model (line 557) | def test_model(self): method test_custom_4d_attention_mask (line 562) | def test_custom_4d_attention_mask(self): class UdopModelIntegrationTests (line 602) | class UdopModelIntegrationTests(unittest.TestCase): method image (line 604) | def image(self): method processor (line 609) | def processor(self): method model (line 613) | def model(self): method test_conditional_generation (line 616) | def test_conditional_generation(self): FILE: tests/models/udop/test_processing_udop.py class UdopProcessorTest (line 46) | class UdopProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_image_processor (line 53) | def _setup_image_processor(cls): method _setup_tokenizer (line 62) | def _setup_tokenizer(cls): method test_image_processor_defaults (line 67) | def test_image_processor_defaults(self): method test_text_target (line 70) | def test_text_target(self): method test_overflowing_tokens (line 88) | def test_overflowing_tokens(self): method test_processor_text_has_no_visual (line 122) | def test_processor_text_has_no_visual(self): class UdopProcessorIntegrationTests (line 130) | class UdopProcessorIntegrationTests(unittest.TestCase): method get_images (line 132) | def get_images(self): method get_tokenizers (line 140) | def get_tokenizers(self): method test_processor_case_1 (line 146) | def test_processor_case_1(self): method test_processor_case_2 (line 201) | def test_processor_case_2(self): method test_processor_case_3 (line 255) | def test_processor_case_3(self): method test_processor_case_4 (line 320) | def test_processor_case_4(self): method test_processor_case_5 (line 371) | def test_processor_case_5(self): FILE: tests/models/udop/test_tokenization_udop.py class UdopTokenizationTest (line 52) | class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method get_words_and_boxes (line 60) | def get_words_and_boxes(self): method get_words_and_boxes_batch (line 66) | def get_words_and_boxes_batch(self): method get_question_words_and_boxes (line 75) | def get_question_words_and_boxes(self): method get_question_words_and_boxes_batch (line 82) | def get_question_words_and_boxes_batch(self): method get_empty_words_and_boxes (line 92) | def get_empty_words_and_boxes(self): method get_empty_words_and_boxes_batch (line 98) | def get_empty_words_and_boxes_batch(self): method get_empty_question_words_and_boxes (line 107) | def get_empty_question_words_and_boxes(self): method get_empty_question_words_and_boxes_batch (line 114) | def get_empty_question_words_and_boxes_batch(self): method get_input_output_texts (line 161) | def get_input_output_texts(self, tokenizer): method convert_batch_encode_plus_format_to_encode_plus (line 166) | def convert_batch_encode_plus_format_to_encode_plus(self, batch_encode... method _check_no_pad_token_padding (line 183) | def _check_no_pad_token_padding(self, tokenizer, sequences): method test_save_sentencepiece_tokenizer (line 206) | def test_save_sentencepiece_tokenizer(self) -> None: method test_sequence_builders (line 243) | def test_sequence_builders(self): method test_pad_token_initialization (line 259) | def test_pad_token_initialization(self): method test_add_special_tokens (line 283) | def test_add_special_tokens(self): method test_encode_decode_with_spaces (line 300) | def test_encode_decode_with_spaces(self): method test_encode_plus_with_padding (line 318) | def test_encode_plus_with_padding(self, use_padding_as_call_kwarg: bool): method test_internal_consistency (line 427) | def test_internal_consistency(self): method test_mask_output (line 448) | def test_mask_output(self): method test_number_of_added_tokens (line 462) | def test_number_of_added_tokens(self): method test_padding (line 490) | def test_padding(self, max_length=50): method test_call (line 675) | def test_call(self): method test_batch_encode_plus_batch_sequence_length (line 698) | def test_batch_encode_plus_batch_sequence_length(self): method test_batch_encode_plus_overflowing_tokens (line 765) | def test_batch_encode_plus_overflowing_tokens(self): method test_batch_encode_plus_padding (line 768) | def test_batch_encode_plus_padding(self): method test_padding_to_multiple_of (line 820) | def test_padding_to_multiple_of(self): method test_tokenizer_slow_store_full_signature (line 855) | def test_tokenizer_slow_store_full_signature(self): method test_special_tokens_mask_input_pairs (line 863) | def test_special_tokens_mask_input_pairs(self): method test_special_tokens_mask (line 886) | def test_special_tokens_mask(self): method test_save_and_load_tokenizer (line 903) | def test_save_and_load_tokenizer(self): method test_right_and_left_truncation (line 931) | def test_right_and_left_truncation(self): method test_right_and_left_padding (line 934) | def test_right_and_left_padding(self): method test_token_type_ids (line 997) | def test_token_type_ids(self): method test_offsets_mapping (line 1029) | def test_offsets_mapping(self): method test_chat_template (line 1076) | def test_chat_template(self): method test_chat_template_return_assistant_tokens_mask (line 1080) | def test_chat_template_return_assistant_tokens_mask(self): method test_chat_template_return_assistant_tokens_mask_truncated (line 1084) | def test_chat_template_return_assistant_tokens_mask_truncated(self): method test_chat_template_batched (line 1088) | def test_chat_template_batched(self): method test_compare_add_special_tokens (line 1091) | def test_compare_add_special_tokens(self): method test_udop_truncation_integration_test (line 1128) | def test_udop_truncation_integration_test(self): method test_sequence_ids (line 1147) | def test_sequence_ids(self): method test_special_tokens_initialization (line 1171) | def test_special_tokens_initialization(self): method test_training_new_tokenizer (line 1187) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 1228) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_prepare_for_model (line 1322) | def test_prepare_for_model(self): method test_batch_encode_dynamic_overflowing (line 1336) | def test_batch_encode_dynamic_overflowing(self): method test_alignment_methods (line 1393) | def test_alignment_methods(self): method test_maximum_encoding_length_pair_input (line 1397) | def test_maximum_encoding_length_pair_input(self): method test_maximum_encoding_length_single_input (line 1401) | def test_maximum_encoding_length_single_input(self): method test_pretokenized_inputs (line 1405) | def test_pretokenized_inputs(self): method test_compare_pretokenized_inputs (line 1409) | def test_compare_pretokenized_inputs(self): method test_compare_prepare_for_model (line 1413) | def test_compare_prepare_for_model(self): method test_bos_token_with_add_bos_token_false (line 1417) | def test_bos_token_with_add_bos_token_false(self): method test_bos_token_with_add_bos_token_true (line 1421) | def test_bos_token_with_add_bos_token_true(self): method test_only_label_first_subword (line 1425) | def test_only_label_first_subword(self): method test_udop_integration_test (line 1439) | def test_udop_integration_test(self): method test_np_encode_plus_sent_to_model (line 1515) | def test_np_encode_plus_sent_to_model(self): method test_sentencepiece_tokenize_and_convert_tokens_to_string (line 1519) | def test_sentencepiece_tokenize_and_convert_tokens_to_string(self): method test_sentencepiece_tokenize_and_decode (line 1523) | def test_sentencepiece_tokenize_and_decode(self): method test_text_target (line 1526) | def test_text_target(self): method test_special_tokens (line 1542) | def test_special_tokens(self): method test_split_special_tokens (line 1559) | def test_split_special_tokens(self): method test_empty_input_string (line 1604) | def test_empty_input_string(self): FILE: tests/models/umt5/test_modeling_umt5.py class UMT5ModelTester (line 49) | class UMT5ModelTester: method __init__ (line 50) | def __init__( method prepare_inputs_dict (line 97) | def prepare_inputs_dict( method prepare_config_and_inputs (line 116) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 136) | def prepare_config_and_inputs_for_common(self): method get_pipeline_config (line 140) | def get_pipeline_config(self): method get_config (line 158) | def get_config(self): method create_and_check_model (line 176) | def create_and_check_model( method create_and_check_model_fp16_forward (line 204) | def create_and_check_model_fp16_forward( method create_and_check_with_sequence_classification_head (line 213) | def create_and_check_with_sequence_classification_head( class UMT5ModelTest (line 227) | class UMT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 248) | def setUp(self): method is_pipeline_test_to_skip (line 253) | def is_pipeline_test_to_skip( method test_inputs_embeds (line 269) | def test_inputs_embeds(self): method test_custom_4d_attention_mask (line 299) | def test_custom_4d_attention_mask(self): method test_with_sequence_classification_head (line 333) | def test_with_sequence_classification_head(self): method test_tie_word_embeddings (line 337) | def test_tie_word_embeddings(self): method test_model_fp16_forward (line 343) | def test_model_fp16_forward(self): method test_model_base_model_prefix (line 348) | def test_model_base_model_prefix(self): class UMT5EncoderOnlyModelTester (line 353) | class UMT5EncoderOnlyModelTester: method __init__ (line 354) | def __init__( method prepare_config_and_inputs (line 395) | def prepare_config_and_inputs(self): method create_and_check_model (line 424) | def create_and_check_model( method create_and_check_model_fp16_forward (line 442) | def create_and_check_model_fp16_forward( method create_and_check_with_token_classification_head (line 452) | def create_and_check_with_token_classification_head( method prepare_config_and_inputs_for_common (line 468) | def prepare_config_and_inputs_for_common(self): class UMT5EncoderOnlyModelTest (line 484) | class UMT5EncoderOnlyModelTest(ModelTesterMixin, PipelineTesterMixin, un... method setUp (line 496) | def setUp(self): method test_config (line 500) | def test_config(self): method test_model (line 503) | def test_model(self): method test_model_fp16_forward (line 508) | def test_model_fp16_forward(self): method test_with_token_classification_head (line 512) | def test_with_token_classification_head(self): method is_pipeline_test_to_skip (line 516) | def is_pipeline_test_to_skip( class Umt5IntegrationTest (line 540) | class Umt5IntegrationTest(unittest.TestCase): method test_small_integration_test (line 545) | def test_small_integration_test(self): FILE: tests/models/unispeech/test_modeling_unispeech.py class UniSpeechModelTester (line 49) | class UniSpeechModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 108) | def prepare_config_and_inputs(self): method get_config (line 116) | def get_config(self): method create_and_check_model (line 138) | def create_and_check_model(self, config, input_values, attention_mask): method create_and_check_batch_inference (line 147) | def create_and_check_batch_inference(self, config, input_values, *args): method check_ctc_loss (line 173) | def check_ctc_loss(self, config, input_values, *args): method check_seq_classifier_loss (line 201) | def check_seq_classifier_loss(self, config, input_values, *args): method check_ctc_training (line 226) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_training (line 255) | def check_seq_classifier_training(self, config, input_values, *args): method check_labels_out_of_vocab (line 278) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 292) | def prepare_config_and_inputs_for_common(self): class UniSpeechRobustModelTest (line 299) | class UniSpeechRobustModelTest(ModelTesterMixin, PipelineTesterMixin, un... method setUp (line 315) | def setUp(self): method test_config (line 321) | def test_config(self): method test_model (line 324) | def test_model(self): method test_batching_equivalence (line 331) | def test_batching_equivalence(self): method test_batched_inference (line 334) | def test_batched_inference(self): method test_ctc_loss_inference (line 338) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 342) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 346) | def test_ctc_train(self): method test_seq_classifier_train (line 350) | def test_seq_classifier_train(self): method test_labels_out_of_vocab (line 354) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 360) | def test_inputs_embeds(self): method test_forward_signature (line 365) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 371) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 375) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 378) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 422) | def _mock_init_weights(self, module): method test_mask_feature_prob_ctc (line 436) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 459) | def test_mask_time_prob_ctc(self): method test_mask_time_feature_prob_ctc_single_batch (line 482) | def test_mask_time_feature_prob_ctc_single_batch(self): method test_feed_forward_chunking (line 510) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 514) | def test_model_from_pretrained(self): class UniSpeechModelIntegrationTest (line 522) | class UniSpeechModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 523) | def _load_datasamples(self, num_samples): method _load_superb (line 532) | def _load_superb(self, task, num_samples): method test_inference_pretraining (line 537) | def test_inference_pretraining(self): FILE: tests/models/unispeech_sat/test_modeling_unispeech_sat.py class UniSpeechSatModelTester (line 51) | class UniSpeechSatModelTester: method __init__ (line 52) | def __init__( method prepare_config_and_inputs (line 122) | def prepare_config_and_inputs(self): method get_config (line 130) | def get_config(self): method create_and_check_model (line 158) | def create_and_check_model(self, config, input_values, attention_mask): method create_and_check_batch_inference (line 167) | def create_and_check_batch_inference(self, config, input_values, *args): method check_ctc_loss (line 193) | def check_ctc_loss(self, config, input_values, *args): method check_seq_classifier_loss (line 221) | def check_seq_classifier_loss(self, config, input_values, *args): method check_ctc_training (line 246) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_training (line 275) | def check_seq_classifier_training(self, config, input_values, *args): method check_xvector_training (line 298) | def check_xvector_training(self, config, *args): method check_labels_out_of_vocab (line 322) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 336) | def prepare_config_and_inputs_for_common(self): class UniSpeechSatModelTest (line 343) | class UniSpeechSatModelTest(ModelTesterMixin, PipelineTesterMixin, unitt... method setUp (line 366) | def setUp(self): method test_config (line 370) | def test_config(self): method test_model (line 373) | def test_model(self): method test_ctc_loss_inference (line 377) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 381) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 385) | def test_ctc_train(self): method test_seq_classifier_train (line 389) | def test_seq_classifier_train(self): method test_xvector_train (line 393) | def test_xvector_train(self): method test_labels_out_of_vocab (line 397) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 402) | def test_inputs_embeds(self): method test_forward_signature (line 406) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 410) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 414) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 417) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 461) | def _mock_init_weights(self, module): method test_mask_feature_prob_ctc (line 475) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 497) | def test_mask_time_prob_ctc(self): method test_feed_forward_chunking (line 521) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 525) | def test_model_from_pretrained(self): class UniSpeechSatRobustModelTest (line 531) | class UniSpeechSatRobustModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 538) | def setUp(self): method test_config (line 544) | def test_config(self): method test_model (line 547) | def test_model(self): method test_batched_inference (line 551) | def test_batched_inference(self): method test_ctc_loss_inference (line 555) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 559) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 563) | def test_ctc_train(self): method test_seq_classifier_train (line 567) | def test_seq_classifier_train(self): method test_labels_out_of_vocab (line 571) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 576) | def test_inputs_embeds(self): method test_forward_signature (line 580) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 584) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 588) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 591) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 635) | def _mock_init_weights(self, module): method test_mask_feature_prob_ctc (line 649) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 672) | def test_mask_time_prob_ctc(self): method test_mask_time_feature_prob_ctc_single_batch (line 695) | def test_mask_time_feature_prob_ctc_single_batch(self): method test_feed_forward_chunking (line 723) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 727) | def test_model_from_pretrained(self): class UniSpeechSatModelIntegrationTest (line 735) | class UniSpeechSatModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 736) | def _load_datasamples(self, num_samples): method _load_superb (line 745) | def _load_superb(self, task, num_samples): method test_inference_encoder_base (line 750) | def test_inference_encoder_base(self): method test_inference_encoder_large (line 780) | def test_inference_encoder_large(self): method test_inference_diarization (line 808) | def test_inference_diarization(self): method test_inference_speaker_verification (line 837) | def test_inference_speaker_verification(self): FILE: tests/models/univnet/test_feature_extraction_univnet.py function floats_list (line 39) | def floats_list(shape, scale=1.0, rng=None, name=None): class UnivNetFeatureExtractionTester (line 53) | class UnivNetFeatureExtractionTester: method __init__ (line 54) | def __init__( method prepare_feat_extract_dict (line 108) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 132) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class UnivNetFeatureExtractionTest (line 151) | class UnivNetFeatureExtractionTest(SequenceFeatureExtractionTestMixin, u... method setUp (line 154) | def setUp(self): method test_feat_extract_from_and_save_pretrained (line 158) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 174) | def test_feat_extract_to_json_file(self): method test_call (line 189) | def test_call(self): method test_batched_unbatched_consistency (line 240) | def test_batched_unbatched_consistency(self): method test_generate_noise (line 265) | def test_generate_noise(self): method test_pad_end (line 276) | def test_pad_end(self): method test_generate_noise_and_pad_end (line 286) | def test_generate_noise_and_pad_end(self): method test_batch_decode (line 298) | def test_batch_decode(self): method test_double_precision_pad (line 316) | def test_double_precision_pad(self): method _load_datasamples (line 329) | def _load_datasamples(self, num_samples): method test_integration (line 339) | def test_integration(self): FILE: tests/models/univnet/test_modeling_univnet.py class UnivNetModelTester (line 44) | class UnivNetModelTester: method __init__ (line 45) | def __init__( method prepare_noise_sequence (line 67) | def prepare_noise_sequence(self): method prepare_config_and_inputs (line 74) | def prepare_config_and_inputs(self): method get_config (line 81) | def get_config(self): method create_and_check_model (line 89) | def create_and_check_model(self, config, spectrogram, noise_sequence): method prepare_config_and_inputs_for_common (line 94) | def prepare_config_and_inputs_for_common(self): class UnivNetModelTest (line 101) | class UnivNetModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 116) | def setUp(self): method test_multi_gpu_data_parallel_forward (line 123) | def test_multi_gpu_data_parallel_forward(self): method test_config (line 126) | def test_config(self): method test_model (line 129) | def test_model(self): method test_forward_signature (line 133) | def test_forward_signature(self): method test_hidden_states_output (line 148) | def test_hidden_states_output(self): method test_inputs_embeds (line 152) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 156) | def test_model_get_set_embeddings(self): method test_model_outputs_equivalence (line 160) | def test_model_outputs_equivalence(self): method test_retain_grad_hidden_states_attentions (line 164) | def test_retain_grad_hidden_states_attentions(self): method test_batched_inputs_outputs (line 167) | def test_batched_inputs_outputs(self): method test_unbatched_inputs_outputs (line 189) | def test_unbatched_inputs_outputs(self): class UnivNetModelIntegrationTests (line 206) | class UnivNetModelIntegrationTests(unittest.TestCase): method tearDown (line 207) | def tearDown(self): method _load_datasamples (line 211) | def _load_datasamples(self, num_samples, sampling_rate=24000): method get_inputs (line 219) | def get_inputs(self, device, num_samples: int = 3, noise_length: int =... method test_model_inference_batched (line 255) | def test_model_inference_batched(self): method test_model_inference_unbatched (line 279) | def test_model_inference_unbatched(self): method test_integration (line 303) | def test_integration(self): FILE: tests/models/upernet/test_modeling_upernet.py class UperNetModelTester (line 46) | class UperNetModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 83) | def prepare_config_and_inputs(self): method get_backbone_config (line 94) | def get_backbone_config(self): method get_config (line 106) | def get_config(self): method create_and_check_for_semantic_segmentation (line 122) | def create_and_check_for_semantic_segmentation(self, config, pixel_val... method prepare_config_and_inputs_for_common (line 131) | def prepare_config_and_inputs_for_common(self): class UperNetModelTest (line 143) | class UperNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.T... method setUp (line 155) | def setUp(self): method test_config (line 165) | def test_config(self): method test_for_semantic_segmentation (line 168) | def test_for_semantic_segmentation(self): method test_inputs_embeds (line 173) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 177) | def test_model_get_set_embeddings(self): method test_multi_gpu_data_parallel_forward (line 182) | def test_multi_gpu_data_parallel_forward(self): method test_hidden_states_output (line 185) | def test_hidden_states_output(self): method test_backbone_selection (line 218) | def test_backbone_selection(self): method test_tied_model_weights_key_ignore (line 252) | def test_tied_model_weights_key_ignore(self): method test_model_from_pretrained (line 256) | def test_model_from_pretrained(self): function prepare_img (line 263) | def prepare_img(): class UperNetModelIntegrationTest (line 271) | class UperNetModelIntegrationTest(unittest.TestCase): method test_inference_swin_backbone (line 272) | def test_inference_swin_backbone(self): method test_inference_convnext_backbone (line 290) | def test_inference_convnext_backbone(self): FILE: tests/models/uvdoc/test_image_processing_uvdoc.py class UVDocImageProcessingTester (line 24) | class UVDocImageProcessingTester: method __init__ (line 25) | def __init__( method prepare_image_processor_dict (line 48) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 55) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 58) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class UVDocImageProcessingTest (line 72) | class UVDocImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 73) | def setUp(self): method image_processor_dict (line 78) | def image_processor_dict(self): method test_call_numpy_4_channels (line 82) | def test_call_numpy_4_channels(self): method test_post_process_document_rectification (line 85) | def test_post_process_document_rectification(self): method test_post_process_document_rectification_different_sizes (line 119) | def test_post_process_document_rectification_different_sizes(self): FILE: tests/models/uvdoc/test_modeling_uvdoc.py class UVDocModelTester (line 53) | class UVDocModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs_for_common (line 84) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 95) | def get_config(self) -> UVDocConfig: method create_and_check_uvdoc_document_rectification (line 141) | def create_and_check_uvdoc_document_rectification(self, config, pixel_... class UVDocBackboneTester (line 151) | class UVDocBackboneTester: method __init__ (line 152) | def __init__( method prepare_config_and_inputs_for_common (line 176) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs (line 181) | def prepare_config_and_inputs(self): method get_config (line 187) | def get_config(self) -> UVDocBackbone: class UVDocBackboneTest (line 226) | class UVDocBackboneTest(BackboneTesterMixin, unittest.TestCase): method setUp (line 231) | def setUp(self): class UVDocModelTest (line 242) | class UVDocModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 248) | def setUp(self): method test_config (line 257) | def test_config(self): method test_uvdoc_document_rectification (line 260) | def test_uvdoc_document_rectification(self): method test_forward_signature (line 264) | def test_forward_signature(self): method test_inference_with_different_dtypes (line 277) | def test_inference_with_different_dtypes(self, dtype_str): method test_model_get_set_embeddings (line 297) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 301) | def test_retain_grad_hidden_states_attentions(self): class UVDocModelIntegrationTest (line 308) | class UVDocModelIntegrationTest(unittest.TestCase): method setUp (line 309) | def setUp(self): method test_inference_document_rectification (line 319) | def test_inference_document_rectification(self): FILE: tests/models/vaultgemma/test_modeling_vaultgemma.py class VaultGemmaModelTester (line 54) | class VaultGemmaModelTester(CausalLMModelTester): class VaultGemmaModelTest (line 60) | class VaultGemmaModelTest(CausalLMModelTest, unittest.TestCase): class VaultGemmaIntegrationTest (line 68) | class VaultGemmaIntegrationTest(unittest.TestCase): method setUp (line 71) | def setUp(self): method tearDown (line 74) | def tearDown(self): method test_model_bf16 (line 77) | def test_model_bf16(self): method test_model_pipeline_bf16 (line 96) | def test_model_pipeline_bf16(self): method test_export_static_cache (line 115) | def test_export_static_cache(self): method test_generation_beyond_sliding_window (line 177) | def test_generation_beyond_sliding_window(self, attn_implementation: s... method test_generation_beyond_sliding_window_dynamic (line 223) | def test_generation_beyond_sliding_window_dynamic(self, attn_implement... FILE: tests/models/vibevoice_acoustic_tokenizer/test_feature_extraction_vibevoice_acoustic_tokenizer.py function floats_list (line 36) | def floats_list(shape, scale=1.0, rng=None, name=None): class VibeVoiceAcousticTokenizerFeatureExtractionTester (line 51) | class VibeVoiceAcousticTokenizerFeatureExtractionTester: method __init__ (line 52) | def __init__( method prepare_feat_extract_dict (line 77) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 88) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class VibeVoiceAcousticTokenizerFeatureExtractionTest (line 108) | class VibeVoiceAcousticTokenizerFeatureExtractionTest(SequenceFeatureExt... method setUp (line 111) | def setUp(self): method test_call (line 114) | def test_call(self): method _load_datasamples (line 134) | def _load_datasamples(self, num_samples): method test_normalize_audio (line 142) | def test_normalize_audio(self): method test_sampling_rate_validation (line 162) | def test_sampling_rate_validation(self): method test_padding_mask_generation (line 173) | def test_padding_mask_generation(self): FILE: tests/models/vibevoice_acoustic_tokenizer/test_modeling_vibevoice_acoustic_tokenizer.py class VibeVoiceAcousticTokenizerModelTester (line 41) | class VibeVoiceAcousticTokenizerModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 64) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 71) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_model_class (line 75) | def prepare_config_and_inputs_for_model_class(self, model_class): method get_config (line 83) | def get_config(self): method create_and_check_model_forward (line 93) | def create_and_check_model_forward(self, config, inputs_dict): class VibeVoiceAcousticTokenizerModelTest (line 106) | class VibeVoiceAcousticTokenizerModelTest(ModelTesterMixin, unittest.Tes... method _prepare_for_class (line 116) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 124) | def setUp(self): method test_config (line 133) | def test_config(self): method test_model_forward (line 136) | def test_model_forward(self): method test_forward_signature (line 140) | def test_forward_signature(self): method test_inputs_embeds (line 152) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 156) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 160) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 164) | def test_attention_outputs(self): method test_hidden_states_output (line 168) | def test_hidden_states_output(self): method test_model_parallelism (line 172) | def test_model_parallelism(self): method test_determinism (line 175) | def test_determinism(self): method test_model_outputs_equivalence (line 200) | def test_model_outputs_equivalence(self): method test_encode_method (line 247) | def test_encode_method(self): method test_decode_method (line 261) | def test_decode_method(self): method test_use_cache (line 276) | def test_use_cache(self): class VibeVoiceAcousticTokenizerIntegrationTest (line 289) | class VibeVoiceAcousticTokenizerIntegrationTest(unittest.TestCase): method setUp (line 290) | def setUp(self): method tearDown (line 294) | def tearDown(self): method test_batch_integration (line 299) | def test_batch_integration(self): FILE: tests/models/vibevoice_asr/test_modeling_vibevoice_asr.py class VibeVoiceAsrModelTester (line 48) | class VibeVoiceAsrModelTester: method __init__ (line 53) | def __init__( method get_config (line 105) | def get_config(self): method prepare_config_and_inputs (line 113) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 121) | def prepare_config_and_inputs_for_common(self): class VibeVoiceAsrForConditionalGenerationModelTest (line 136) | class VibeVoiceAsrForConditionalGenerationModelTest(ModelTesterMixin, Ge... method setUp (line 143) | def setUp(self): method test_inputs_embeds_matches_input_ids (line 150) | def test_inputs_embeds_matches_input_ids(self): method test_sdpa_can_compile_dynamic (line 155) | def test_sdpa_can_compile_dynamic(self): method test_sdpa_can_dispatch_on_flash (line 159) | def test_sdpa_can_dispatch_on_flash(self): method test_flash_attn_2_inference_equivalence_right_padding (line 163) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_model_base_model_prefix (line 167) | def test_model_base_model_prefix(self): method test_get_audio_features_attentions (line 171) | def test_get_audio_features_attentions(self): method test_get_audio_features_hidden_states (line 175) | def test_get_audio_features_hidden_states(self): method test_determinism (line 179) | def test_determinism(self): method test_batching_equivalence (line 183) | def test_batching_equivalence(self): method test_save_load (line 187) | def test_save_load(self): method test_generate_continue_from_past_key_values (line 191) | def test_generate_continue_from_past_key_values(self): method test_model_outputs_equivalence (line 195) | def test_model_outputs_equivalence(self): method test_left_padding_compatibility (line 199) | def test_left_padding_compatibility(self): method test_sdpa_can_dispatch_composite_models (line 202) | def test_sdpa_can_dispatch_composite_models(self): method test_get_audio_features_output (line 231) | def test_get_audio_features_output(self, return_dict: bool | None): class VibeVoiceAsrForConditionalGenerationIntegrationTest (line 265) | class VibeVoiceAsrForConditionalGenerationIntegrationTest(unittest.TestC... method setUp (line 269) | def setUp(cls): method tearDown (line 277) | def tearDown(self): method _load_dataset (line 283) | def _load_dataset(cls): method _load_datasamples (line 291) | def _load_datasamples(self, num_samples): method test_single (line 298) | def test_single(self): method test_batch (line 327) | def test_batch(self): method test_single_with_context (line 359) | def test_single_with_context(self): FILE: tests/models/vibevoice_asr/test_processing_vibevoice_asr.py class VibeVoiceAsrProcessorTest (line 32) | class VibeVoiceAsrProcessorTest(ProcessorTesterMixin, unittest.TestCase): method setUpClass (line 37) | def setUpClass(cls): method get_tokenizer (line 45) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 49) | def get_feature_extractor(self, **kwargs): method get_processor (line 53) | def get_processor(self, **kwargs): method tearDownClass (line 57) | def tearDownClass(cls): method test_can_load_various_tokenizers (line 61) | def test_can_load_various_tokenizers(self): method test_save_load_pretrained_default (line 67) | def test_save_load_pretrained_default(self): method test_apply_transcription_request_single (line 83) | def test_apply_transcription_request_single(self): method test_apply_chat_template_audio (line 112) | def test_apply_chat_template_audio(self, batch_size: int, return_tenso... method test_apply_chat_template_assistant_mask (line 115) | def test_apply_chat_template_assistant_mask(self): method test_decode_output_formats (line 119) | def test_decode_output_formats(self): FILE: tests/models/video_llama_3/test_image_processing_video_llama_3.py class VideoLlama3ImageProcessingTester (line 38) | class VideoLlama3ImageProcessingTester: method __init__ (line 39) | def __init__( method prepare_image_processor_dict (line 75) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 86) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_video_inputs (line 98) | def prepare_video_inputs(self, equal_resolution=False, numpify=False, ... class VideoLlama3ImageProcessingTest (line 113) | class VideoLlama3ImageProcessingTest(ImageProcessingTestMixin, unittest.... method setUp (line 114) | def setUp(self): method image_processor_dict (line 119) | def image_processor_dict(self): method test_image_processor_properties (line 122) | def test_image_processor_properties(self): method test_image_processor_to_json_string (line 133) | def test_image_processor_to_json_string(self): method test_select_best_resolution (line 141) | def test_select_best_resolution(self): method test_call_pil (line 146) | def test_call_pil(self): method test_call_numpy (line 173) | def test_call_numpy(self): method test_call_pytorch (line 200) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 229) | def test_call_numpy_4_channels(self): method test_nested_input (line 232) | def test_nested_input(self): method test_video_inputs (line 263) | def test_video_inputs(self): method test_custom_image_size (line 266) | def test_custom_image_size(self): method test_custom_pixels (line 280) | def test_custom_pixels(self): method test_backends_equivalence (line 294) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 319) | def test_backends_equivalence_batched(self): method test_get_num_patches_without_images (line 345) | def test_get_num_patches_without_images(self): FILE: tests/models/video_llama_3/test_modeling_video_llama_3.py function _test_encoder_eager_matches_sdpa_inference (line 69) | def _test_encoder_eager_matches_sdpa_inference( class VideoLlama3VisionModelTester (line 277) | class VideoLlama3VisionModelTester: method __init__ (line 278) | def __init__( method get_config (line 309) | def get_config(self): method prepare_config_and_inputs (line 321) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 332) | def prepare_config_and_inputs_for_common(self): class VideoLlama3VisionModelTest (line 345) | class VideoLlama3VisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 358) | def setUp(self): method test_config (line 362) | def test_config(self): method test_model_get_set_embeddings (line 365) | def test_model_get_set_embeddings(self): method test_eager_matches_sdpa_inference (line 375) | def test_eager_matches_sdpa_inference( method test_attention_outputs (line 382) | def test_attention_outputs(self): method test_hidden_states_output (line 444) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 480) | def test_retain_grad_hidden_states_attentions(self): method test_flash_attn_2_inference_equivalence (line 521) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 525) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_flash_attn_kernels_inference_equivalence (line 529) | def test_flash_attn_kernels_inference_equivalence(self): class VideoLlama3VisionText2TextModelTester (line 533) | class VideoLlama3VisionText2TextModelTester: method __init__ (line 534) | def __init__( method get_config (line 597) | def get_config(self): method prepare_config_and_inputs (line 606) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 618) | def prepare_config_and_inputs_for_common(self): class VideoLlama3ModelTest (line 641) | class VideoLlama3ModelTest(ModelTesterMixin, GenerationTesterMixin, unit... method setUp (line 657) | def setUp(self): method test_config (line 661) | def test_config(self): method test_mismatching_num_image_tokens (line 664) | def test_mismatching_num_image_tokens(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 712) | def attention_mask_padding_matches_padding_free_with_position_ids( class VideoLlama3IntegrationTest (line 787) | class VideoLlama3IntegrationTest(unittest.TestCase): method setUp (line 788) | def setUp(self): method tearDown (line 802) | def tearDown(self): method test_small_model_integration_test (line 806) | def test_small_model_integration_test(self): method test_small_model_integration_test_batch (line 846) | def test_small_model_integration_test_batch(self): method test_small_model_integration_test_batch_wo_image (line 867) | def test_small_model_integration_test_batch_wo_image(self): method test_small_model_integration_test_batch_different_resolutions (line 902) | def test_small_model_integration_test_batch_different_resolutions(self): method test_small_model_integration_test_batch_flashatt2 (line 927) | def test_small_model_integration_test_batch_flashatt2(self): method test_small_model_integration_test_batch_wo_image_flashatt2 (line 963) | def test_small_model_integration_test_batch_wo_image_flashatt2(self): FILE: tests/models/video_llama_3/test_processing_video_llama_3.py function prepare_image_inputs (line 33) | def prepare_image_inputs(): class VideoLlama3ProcessorTest (line 43) | class VideoLlama3ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_from_pretrained (line 48) | def _setup_from_pretrained(cls, model_id, **kwargs): method _setup_test_attributes (line 52) | def _setup_test_attributes(cls, processor): method prepare_image_inputs (line 55) | def prepare_image_inputs(self, batch_size: int | None = None): method test_get_num_vision_tokens (line 64) | def test_get_num_vision_tokens(self): method _test_apply_chat_template (line 78) | def _test_apply_chat_template( method test_apply_chat_template_video_frame_sampling (line 175) | def test_apply_chat_template_video_frame_sampling(self): method test_kwargs_overrides_custom_image_processor_kwargs (line 289) | def test_kwargs_overrides_custom_image_processor_kwargs(self): method test_special_mm_token_truncation (line 300) | def test_special_mm_token_truncation(self): FILE: tests/models/video_llama_3/test_video_processing_video_llama_3.py class VideoLlama3VideoProcessingTester (line 40) | class VideoLlama3VideoProcessingTester: method __init__ (line 41) | def __init__( method prepare_video_processor_dict (line 85) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 102) | def expected_output_video_shape(self, videos, num_frames=None): method prepare_video_inputs (line 122) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class VideoLlama3VideoProcessingTest (line 137) | class VideoLlama3VideoProcessingTest(VideoProcessingTestMixin, unittest.... method setUp (line 140) | def setUp(self): method video_processor_dict (line 145) | def video_processor_dict(self): method test_video_processor_properties (line 148) | def test_video_processor_properties(self): method test_video_processor_from_dict_with_kwargs (line 159) | def test_video_processor_from_dict_with_kwargs(self): method test_video_processor_to_json_string (line 178) | def test_video_processor_to_json_string(self): method test_call_pil (line 186) | def test_call_pil(self): method test_call_numpy (line 208) | def test_call_numpy(self): method test_call_pytorch (line 229) | def test_call_pytorch(self): method test_nested_input (line 254) | def test_nested_input(self): method test_call_numpy_4_channels (line 274) | def test_call_numpy_4_channels(self): method test_call_sample_frames (line 308) | def test_call_sample_frames(self): FILE: tests/models/video_llava/test_modeling_video_llava.py class VideoLlavaVisionText2TextModelTester (line 55) | class VideoLlavaVisionText2TextModelTester: method __init__ (line 56) | def __init__( method get_config (line 134) | def get_config(self): method prepare_config_and_inputs (line 148) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 171) | def prepare_config_and_inputs_for_common(self): class VideoLlavaForConditionalGenerationModelTest (line 192) | class VideoLlavaForConditionalGenerationModelTest(ModelTesterMixin, Gene... method setUp (line 210) | def setUp(self): method test_config (line 217) | def test_config(self): method test_training_gradient_checkpointing (line 221) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 225) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 229) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 235) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_mixed_input (line 239) | def test_mixed_input(self): method test_video_only_input (line 254) | def test_video_only_input(self): method test_image_only_input (line 268) | def test_image_only_input(self): method test_batching_equivalence (line 286) | def test_batching_equivalence(self): method test_mismatching_num_image_tokens (line 342) | def test_mismatching_num_image_tokens(self): method test_vision_feature_layers (line 380) | def test_vision_feature_layers(self, vision_feature_layer): class VideoLlavaForConditionalGenerationIntegrationTest (line 402) | class VideoLlavaForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 403) | def setUp(self): method tearDown (line 406) | def tearDown(self): method test_small_model_integration_test (line 411) | def test_small_model_integration_test(self): method test_small_model_integration_test_mixed_inputs (line 438) | def test_small_model_integration_test_mixed_inputs(self): method test_small_model_integration_test_llama (line 471) | def test_small_model_integration_test_llama(self): method test_small_model_integration_test_llama_batched (line 498) | def test_small_model_integration_test_llama_batched(self): FILE: tests/models/video_llava/test_video_processing_video_llava.py class VideoLlavaVideoProcessingTester (line 29) | class VideoLlavaVideoProcessingTester: method __init__ (line 30) | def __init__( method prepare_video_processor_dict (line 67) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 79) | def expected_output_video_shape(self, images): method prepare_video_inputs (line 82) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class VideoLlavaVideoProcessingTest (line 98) | class VideoLlavaVideoProcessingTest(VideoProcessingTestMixin, unittest.T... method setUp (line 101) | def setUp(self): method video_processor_dict (line 106) | def video_processor_dict(self): method test_video_processor_properties (line 109) | def test_video_processor_properties(self): FILE: tests/models/videomae/test_image_processing_videomae.py class VideoMAEImageProcessingTester (line 33) | class VideoMAEImageProcessingTester: method __init__ (line 34) | def __init__( method prepare_image_processor_dict (line 67) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 77) | def expected_output_image_shape(self, images): method prepare_video_inputs (line 80) | def prepare_video_inputs(self, equal_resolution=False, numpify=False, ... class VideoMAEImageProcessingTest (line 95) | class VideoMAEImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 96) | def setUp(self): method image_processor_dict (line 101) | def image_processor_dict(self): method test_image_processor_properties (line 104) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 114) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 124) | def test_call_pil(self): method test_call_numpy (line 146) | def test_call_numpy(self): method test_call_numpy_4_channels (line 168) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 204) | def test_call_pytorch(self): method test_backends_equivalence_batched (line 226) | def test_backends_equivalence_batched(self): FILE: tests/models/videomae/test_modeling_videomae.py class VideoMAEModelTester (line 60) | class VideoMAEModelTester: method __init__ (line 61) | def __init__( method prepare_config_and_inputs (line 114) | def prepare_config_and_inputs(self): method get_config (line 127) | def get_config(self): method create_and_check_model (line 150) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_pretraining (line 157) | def create_and_check_for_pretraining(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 173) | def prepare_config_and_inputs_for_common(self): class VideoMAEModelTest (line 181) | class VideoMAEModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 200) | def setUp(self): method _prepare_for_class (line 204) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 226) | def test_config(self): method test_inputs_embeds (line 230) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 233) | def test_model_get_set_embeddings(self): method test_model (line 242) | def test_model(self): method test_for_pretraining (line 246) | def test_for_pretraining(self): method test_model_from_pretrained (line 251) | def test_model_from_pretrained(self): method test_attention_outputs (line 256) | def test_attention_outputs(self): method test_hidden_states_output (line 317) | def test_hidden_states_output(self): method test_flash_attn_2_inference_equivalence (line 355) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 402) | def test_flash_attn_2_inference_equivalence_right_padding(self): function prepare_video (line 408) | def prepare_video(): class VideoMAEModelIntegrationTest (line 418) | class VideoMAEModelIntegrationTest(unittest.TestCase): method default_image_processor (line 420) | def default_image_processor(self): method test_inference_for_video_classification (line 429) | def test_inference_for_video_classification(self): method test_inference_for_pretraining (line 456) | def test_inference_for_pretraining(self): FILE: tests/models/videomae/test_video_processing_videomae.py class VideoMAEVideoProcessingTester (line 32) | class VideoMAEVideoProcessingTester: method __init__ (line 33) | def __init__( method prepare_video_processor_dict (line 74) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 88) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 91) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... class VideoMAEVideoProcessingTest (line 108) | class VideoMAEVideoProcessingTest(VideoProcessingTestMixin, unittest.Tes... method setUp (line 112) | def setUp(self): method video_processor_dict (line 117) | def video_processor_dict(self): method test_video_processor_properties (line 120) | def test_video_processor_properties(self): method test_pixel_value_identity (line 133) | def test_pixel_value_identity(self): FILE: tests/models/videomt/test_modeling_videomt.py class VideomtForUniversalSegmentationTester (line 47) | class VideomtForUniversalSegmentationTester: method __init__ (line 48) | def __init__( method get_config (line 78) | def get_config(self): method prepare_config_and_inputs (line 93) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 101) | def prepare_config_and_inputs_for_common(self): class VideomtForUniversalSegmentationTest (line 108) | class VideomtForUniversalSegmentationTest(ModelTesterMixin, PipelineTest... method setUp (line 115) | def setUp(self): method test_config (line 119) | def test_config(self): method test_inputs_embeds (line 123) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 126) | def test_model_get_set_embeddings(self): method test_generate_without_input_ids (line 136) | def test_generate_without_input_ids(self): method test_resize_tokens_embeddings (line 140) | def test_resize_tokens_embeddings(self): method test_image_inputs_raise (line 143) | def test_image_inputs_raise(self): method test_pixel_values_name_raises (line 151) | def test_pixel_values_name_raises(self): class VideomtForUniversalSegmentationIntegrationTest (line 163) | class VideomtForUniversalSegmentationIntegrationTest(unittest.TestCase): method prepare_video (line 181) | def prepare_video(self, num_frames=2): method prepare_model_and_inputs (line 185) | def prepare_model_and_inputs(self, model_id, num_frames=2, dtype=None): method run_inference (line 196) | def run_inference(self, model_id, num_frames=2, dtype=None): method assert_common_video_outputs (line 207) | def assert_common_video_outputs(self, outputs, model, num_frames): method assert_segments_info_close (line 222) | def assert_segments_info_close(self, actual_segments_info, expected_se... method test_instance_segmentation_inference (line 229) | def test_instance_segmentation_inference(self): method test_semantic_segmentation_inference (line 305) | def test_semantic_segmentation_inference(self): method test_panoptic_segmentation_inference (line 378) | def test_panoptic_segmentation_inference(self): method test_instance_segmentation_inference_bf16 (line 456) | def test_instance_segmentation_inference_bf16(self): FILE: tests/models/videomt/test_video_processing_videomt.py class VideomtVideoProcessingTester (line 35) | class VideomtVideoProcessingTester: method __init__ (line 36) | def __init__( method prepare_video_processor_dict (line 78) | def prepare_video_processor_dict(self): method expected_output_video_shape (line 91) | def expected_output_video_shape(self, videos): method prepare_video_inputs (line 94) | def prepare_video_inputs(self, equal_resolution=False, return_tensors=... method prepare_fake_videomt_outputs (line 105) | def prepare_fake_videomt_outputs(self, num_frames): class VideomtVideoProcessingTest (line 116) | class VideomtVideoProcessingTest(VideoProcessingTestMixin, unittest.Test... method setUp (line 120) | def setUp(self): method video_processor_dict (line 125) | def video_processor_dict(self): method test_video_processor_properties (line 128) | def test_video_processor_properties(self): method test_video_processor_from_dict_with_kwargs (line 140) | def test_video_processor_from_dict_with_kwargs(self): method test_post_process_semantic_segmentation (line 147) | def test_post_process_semantic_segmentation(self): method test_post_process_instance_segmentation (line 161) | def test_post_process_instance_segmentation(self): method test_post_process_panoptic_segmentation (line 177) | def test_post_process_panoptic_segmentation(self): FILE: tests/models/vilt/test_image_processing_vilt.py class ViltImageProcessingTester (line 30) | class ViltImageProcessingTester: method __init__ (line 31) | def __init__( method prepare_image_processor_dict (line 60) | def prepare_image_processor_dict(self): method get_expected_values (line 70) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 112) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 116) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class ViltImageProcessingTest (line 130) | class ViltImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 131) | def setUp(self): method image_processor_dict (line 136) | def image_processor_dict(self): method test_image_processor_properties (line 139) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 153) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/vilt/test_modeling_vilt.py class ViltModelTester (line 50) | class ViltModelTester: method __init__ (line 51) | def __init__( method prepare_config_and_inputs (line 112) | def prepare_config_and_inputs(self): method get_config (line 134) | def get_config(self): method create_and_check_model (line 156) | def create_and_check_model( method create_and_check_for_token_classification (line 175) | def create_and_check_for_token_classification( method prepare_config_and_inputs_for_common (line 192) | def prepare_config_and_inputs_for_common(self): method prepare_pixel_values (line 210) | def prepare_pixel_values(self): class ViltModelTest (line 215) | class ViltModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method _prepare_for_class (line 233) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 252) | def setUp(self): method test_config (line 256) | def test_config(self): method test_model (line 259) | def test_model(self): method test_for_token_classification (line 263) | def test_for_token_classification(self): method test_training (line 267) | def test_training(self): method check_training_gradient_checkpointing (line 291) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_save_load (line 319) | def test_save_load(self): method test_determinism (line 326) | def test_determinism(self): method test_batching_equivalence (line 332) | def test_batching_equivalence(self): method test_model_outputs_equivalence (line 339) | def test_model_outputs_equivalence(self): method test_inputs_embeds_matches_input_ids (line 346) | def test_inputs_embeds_matches_input_ids(self): method test_attention_outputs (line 349) | def test_attention_outputs(self): method test_hidden_states_output (line 430) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 478) | def test_retain_grad_hidden_states_attentions(self): method test_model_from_pretrained (line 519) | def test_model_from_pretrained(self): class ViltForImagesAndTextClassificationModelTest (line 526) | class ViltForImagesAndTextClassificationModelTest(ViltModelTest, unittes... method setUp (line 531) | def setUp(self): method test_model (line 536) | def test_model(self): method test_for_token_classification (line 540) | def test_for_token_classification(self): function prepare_img (line 545) | def prepare_img(): class ViltModelIntegrationTest (line 552) | class ViltModelIntegrationTest(unittest.TestCase): method default_processor (line 554) | def default_processor(self): method test_inference_masked_lm (line 558) | def test_inference_masked_lm(self): method test_inference_visual_question_answering (line 582) | def test_inference_visual_question_answering(self): method test_inference_natural_language_visual_reasoning (line 618) | def test_inference_natural_language_visual_reasoning(self): FILE: tests/models/vipllava/test_modeling_vipllava.py class VipLlavaVisionText2TextModelTester (line 53) | class VipLlavaVisionText2TextModelTester: method __init__ (line 55) | def __init__( method get_config (line 125) | def get_config(self): method prepare_config_and_inputs (line 136) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 149) | def prepare_config_and_inputs_for_common(self): class VipLlavaForConditionalGenerationModelTest (line 167) | class VipLlavaForConditionalGenerationModelTest(ModelTesterMixin, Genera... method setUp (line 185) | def setUp(self): method test_config (line 192) | def test_config(self): method test_mismatching_num_image_tokens (line 196) | def test_mismatching_num_image_tokens(self): method test_vision_feature_layers (line 234) | def test_vision_feature_layers(self, vision_feature_layers): method test_training_gradient_checkpointing (line 260) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 264) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 268) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 274) | def test_flash_attention_2_padding_matches_padding_free_with_position_... class VipLlavaForConditionalGenerationIntegrationTest (line 279) | class VipLlavaForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 280) | def setUp(self): method tearDown (line 283) | def tearDown(self): method test_small_model_integration_test (line 288) | def test_small_model_integration_test(self): FILE: tests/models/vision_encoder_decoder/test_modeling_vision_encoder_decoder.py class EncoderDecoderMixin (line 81) | class EncoderDecoderMixin: method get_encoder_decoder_model (line 84) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 87) | def prepare_config_and_inputs(self): method get_pretrained_model_and_inputs (line 90) | def get_pretrained_model_and_inputs(self): method check_encoder_decoder_model_from_pretrained_configs (line 93) | def check_encoder_decoder_model_from_pretrained_configs( method check_encoder_decoder_model (line 115) | def check_encoder_decoder_model( method check_encoder_decoder_model_from_pretrained (line 144) | def check_encoder_decoder_model_from_pretrained( method check_save_and_load (line 170) | def check_save_and_load( method check_save_and_load_encoder_decoder_model (line 201) | def check_save_and_load_encoder_decoder_model( method check_encoder_decoder_model_output_attentions (line 238) | def check_encoder_decoder_model_output_attentions( method check_encoder_decoder_model_generate (line 297) | def check_encoder_decoder_model_generate(self, config, decoder_config,... method test_encoder_decoder_model (line 321) | def test_encoder_decoder_model(self): method test_encoder_decoder_model_from_pretrained_configs (line 325) | def test_encoder_decoder_model_from_pretrained_configs(self): method test_encoder_decoder_model_from_pretrained (line 329) | def test_encoder_decoder_model_from_pretrained(self): method test_encoder_decoder_model_from_pretrained_return_dict (line 333) | def test_encoder_decoder_model_from_pretrained_return_dict(self): method test_save_and_load_from_pretrained (line 337) | def test_save_and_load_from_pretrained(self): method test_save_and_load_from_encoder_decoder_pretrained (line 341) | def test_save_and_load_from_encoder_decoder_pretrained(self): method test_encoder_decoder_model_output_attentions (line 345) | def test_encoder_decoder_model_output_attentions(self): method test_encoder_decoder_model_generate (line 349) | def test_encoder_decoder_model_generate(self): method test_training_gradient_checkpointing (line 353) | def test_training_gradient_checkpointing(self): method test_real_model_save_load_from_pretrained (line 376) | def test_real_model_save_load_from_pretrained(self): method test_sdpa_can_dispatch_composite_models (line 397) | def test_sdpa_can_dispatch_composite_models(self): class DeiT2RobertaModelTest (line 452) | class DeiT2RobertaModelTest(EncoderDecoderMixin, unittest.TestCase): method get_pretrained_model_and_inputs (line 453) | def get_pretrained_model_and_inputs(self): method check_encoder_decoder_model_output_attentions (line 477) | def check_encoder_decoder_model_output_attentions( method get_encoder_decoder_model (line 536) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 541) | def prepare_config_and_inputs(self): class ViT2BertModelTest (line 576) | class ViT2BertModelTest(EncoderDecoderMixin, unittest.TestCase): method get_pretrained_model_and_inputs (line 579) | def get_pretrained_model_and_inputs(self): method get_encoder_decoder_model (line 603) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 608) | def prepare_config_and_inputs(self): class Swin2BartModelTest (line 645) | class Swin2BartModelTest(EncoderDecoderMixin, unittest.TestCase): method get_encoder_decoder_model (line 646) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 651) | def prepare_config_and_inputs(self): method check_encoder_decoder_model_output_attentions (line 671) | def check_encoder_decoder_model_output_attentions( method test_real_model_save_load_from_pretrained (line 729) | def test_real_model_save_load_from_pretrained(self): class ViT2TrOCR (line 734) | class ViT2TrOCR(EncoderDecoderMixin, unittest.TestCase): method get_encoder_decoder_model (line 737) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 742) | def prepare_config_and_inputs(self): method test_real_model_save_load_from_pretrained (line 766) | def test_real_model_save_load_from_pretrained(self): class LayoutLMv32TrOCR (line 771) | class LayoutLMv32TrOCR(EncoderDecoderMixin, unittest.TestCase): method get_encoder_decoder_model (line 772) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 777) | def prepare_config_and_inputs(self): method check_encoder_decoder_model_output_attentions (line 811) | def check_encoder_decoder_model_output_attentions( method check_encoder_decoder_model_generate (line 871) | def check_encoder_decoder_model_generate(self, config, decoder_config,... method test_real_model_save_load_from_pretrained (line 896) | def test_real_model_save_load_from_pretrained(self): class VIT2GPT2Test (line 901) | class VIT2GPT2Test(EncoderDecoderMixin, unittest.TestCase): method get_encoder_decoder_model (line 904) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 909) | def prepare_config_and_inputs(self): method check_encoder_decoder_model_output_attentions (line 930) | def check_encoder_decoder_model_output_attentions( method check_encoder_decoder_model_generate (line 985) | def check_encoder_decoder_model_generate(self, config, decoder_config,... method test_real_model_save_load_from_pretrained (line 1010) | def test_real_model_save_load_from_pretrained(self): class Donut2GPT2Test (line 1015) | class Donut2GPT2Test(EncoderDecoderMixin, unittest.TestCase): method get_encoder_decoder_model (line 1018) | def get_encoder_decoder_model(self, config, decoder_config): method prepare_config_and_inputs (line 1023) | def prepare_config_and_inputs(self): method check_encoder_decoder_model_output_attentions (line 1044) | def check_encoder_decoder_model_output_attentions( method check_encoder_decoder_model_generate (line 1099) | def check_encoder_decoder_model_generate(self, config, decoder_config,... method test_real_model_save_load_from_pretrained (line 1124) | def test_real_model_save_load_from_pretrained(self): class TrOCRModelIntegrationTest (line 1130) | class TrOCRModelIntegrationTest(unittest.TestCase): method default_processor (line 1132) | def default_processor(self): method test_inference_handwritten (line 1136) | def test_inference_handwritten(self): method test_inference_printed (line 1161) | def test_inference_printed(self): class ViT2GPT2ModelIntegrationTest (line 1197) | class ViT2GPT2ModelIntegrationTest(unittest.TestCase): method test_inference_coco_en (line 1199) | def test_inference_coco_en(self): class DonutModelIntegrationTest (line 1262) | class DonutModelIntegrationTest(unittest.TestCase): method test_inference_docvqa (line 1264) | def test_inference_docvqa(self): method test_inference_cordv2 (line 1328) | def test_inference_cordv2(self): method test_inference_rvlcdip (line 1390) | def test_inference_rvlcdip(self): class NougatModelIntegrationTest (line 1456) | class NougatModelIntegrationTest(unittest.TestCase): method default_processor (line 1458) | def default_processor(self): method default_model (line 1462) | def default_model(self): method default_image (line 1466) | def default_image(self): method test_forward_pass (line 1473) | def test_forward_pass(self): method test_generation (line 1493) | def test_generation(self): FILE: tests/models/vision_text_dual_encoder/test_modeling_vision_text_dual_encoder.py function to_2tuple (line 56) | def to_2tuple(x): class VisionTextDualEncoderMixin (line 63) | class VisionTextDualEncoderMixin: method get_vision_text_model (line 64) | def get_vision_text_model(self, config, text_config): method prepare_config_and_inputs (line 67) | def prepare_config_and_inputs(self): method get_pretrained_model_and_inputs (line 70) | def get_pretrained_model_and_inputs(self): method check_model_from_pretrained_configs (line 73) | def check_model_from_pretrained_configs( method check_vision_text_dual_encoder_model (line 87) | def check_vision_text_dual_encoder_model( method check_vision_text_dual_encoder_from_pretrained (line 100) | def check_vision_text_dual_encoder_from_pretrained( method check_save_load (line 114) | def check_save_load(self, text_config, input_ids, attention_mask, visi... method check_vision_text_output_attention (line 134) | def check_vision_text_output_attention( method test_vision_text_dual_encoder_model (line 167) | def test_vision_text_dual_encoder_model(self): method test_model_from_pretrained_configs (line 171) | def test_model_from_pretrained_configs(self): method test_vision_text_dual_encoder_from_pretrained (line 175) | def test_vision_text_dual_encoder_from_pretrained(self): method test_save_load (line 179) | def test_save_load(self): method test_vision_text_output_attention (line 183) | def test_vision_text_output_attention(self): method test_real_model_save_load_from_pretrained (line 188) | def test_real_model_save_load_from_pretrained(self): class ViTBertModelTest (line 208) | class ViTBertModelTest(VisionTextDualEncoderMixin, unittest.TestCase): method get_pretrained_model_and_inputs (line 209) | def get_pretrained_model_and_inputs(self): method get_vision_text_model (line 228) | def get_vision_text_model(self, vision_config, text_config): method prepare_config_and_inputs (line 233) | def prepare_config_and_inputs(self): class DeiTRobertaModelTest (line 265) | class DeiTRobertaModelTest(VisionTextDualEncoderMixin, unittest.TestCase): method get_pretrained_model_and_inputs (line 266) | def get_pretrained_model_and_inputs(self): method check_vision_text_output_attention (line 285) | def check_vision_text_output_attention( method get_vision_text_model (line 318) | def get_vision_text_model(self, vision_config, text_config): method prepare_config_and_inputs (line 323) | def prepare_config_and_inputs(self): class CLIPVisionBertModelTest (line 355) | class CLIPVisionBertModelTest(VisionTextDualEncoderMixin, unittest.TestC... method get_pretrained_model_and_inputs (line 356) | def get_pretrained_model_and_inputs(self): method get_vision_text_model (line 375) | def get_vision_text_model(self, vision_config, text_config): method prepare_config_and_inputs (line 380) | def prepare_config_and_inputs(self): class VisionTextDualEncoderIntegrationTest (line 413) | class VisionTextDualEncoderIntegrationTest(unittest.TestCase): method test_inference (line 415) | def test_inference(self): FILE: tests/models/vision_text_dual_encoder/test_processing_vision_text_dual_encoder.py class VisionTextDualEncoderProcessorTest (line 31) | class VisionTextDualEncoderProcessorTest(ProcessorTesterMixin, unittest.... method _setup_image_processor (line 35) | def _setup_image_processor(cls): method _setup_tokenizer (line 46) | def _setup_tokenizer(cls): FILE: tests/models/visual_bert/test_modeling_visual_bert.py class VisualBertModelTester (line 42) | class VisualBertModelTester: method __init__ (line 43) | def __init__( method get_config (line 99) | def get_config(self): method prepare_config_and_inputs_for_common (line 117) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_pretraining (line 149) | def prepare_config_and_inputs_for_pretraining(self): method prepare_config_and_inputs_for_multiple_choice (line 166) | def prepare_config_and_inputs_for_multiple_choice(self): method prepare_config_and_inputs_for_vqa (line 210) | def prepare_config_and_inputs_for_vqa(self): method prepare_config_and_inputs_for_nlvr (line 221) | def prepare_config_and_inputs_for_nlvr(self): method prepare_config_and_inputs_for_flickr (line 232) | def prepare_config_and_inputs_for_flickr(self): method create_and_check_model (line 251) | def create_and_check_model(self, config, input_dict): method create_and_check_for_pretraining (line 261) | def create_and_check_for_pretraining(self, config, input_dict): method create_and_check_for_vqa (line 271) | def create_and_check_for_vqa(self, config, input_dict): method create_and_check_for_multiple_choice (line 278) | def create_and_check_for_multiple_choice(self, config, input_dict): method create_and_check_for_nlvr (line 285) | def create_and_check_for_nlvr(self, config, input_dict): method create_and_check_for_flickr (line 292) | def create_and_check_for_flickr(self, config, input_dict): class VisualBertModelTest (line 303) | class VisualBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittes... method _prepare_for_class (line 318) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 392) | def setUp(self): method test_attention_outputs (line 396) | def test_attention_outputs(self): method test_hidden_states_output (line 478) | def test_hidden_states_output(self): method test_config (line 518) | def test_config(self): method test_model (line 521) | def test_model(self): method test_model_for_pretraining (line 525) | def test_model_for_pretraining(self): method test_model_for_vqa (line 529) | def test_model_for_vqa(self): method test_model_for_nlvr (line 533) | def test_model_for_nlvr(self): method test_model_for_multiple_choice (line 537) | def test_model_for_multiple_choice(self): method test_model_for_flickr (line 541) | def test_model_for_flickr(self): method test_model_from_pretrained (line 546) | def test_model_from_pretrained(self): method test_training_gradient_checkpointing (line 552) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 556) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 560) | def test_training_gradient_checkpointing_use_reentrant_true(self): class VisualBertModelIntegrationTest (line 565) | class VisualBertModelIntegrationTest(unittest.TestCase): method test_inference_vqa_coco_pre (line 567) | def test_inference_vqa_coco_pre(self): method test_inference_vqa (line 606) | def test_inference_vqa(self): method test_inference_nlvr (line 638) | def test_inference_nlvr(self): method test_inference_vcr (line 668) | def test_inference_vcr(self): FILE: tests/models/vit/test_image_processing_vit.py class ViTImageProcessingTester (line 29) | class ViTImageProcessingTester: method __init__ (line 30) | def __init__( method prepare_image_processor_dict (line 57) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 66) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 69) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class ViTImageProcessingTest (line 83) | class ViTImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase): method setUp (line 84) | def setUp(self): method image_processor_dict (line 89) | def image_processor_dict(self): method test_image_processor_properties (line 92) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 101) | def test_image_processor_from_dict_with_kwargs(self): FILE: tests/models/vit/test_modeling_vit.py class ViTModelTester (line 49) | class ViTModelTester: method __init__ (line 50) | def __init__( method prepare_config_and_inputs (line 100) | def prepare_config_and_inputs(self): method get_config (line 111) | def get_config(self): method create_and_check_model (line 129) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_masked_image_modeling (line 136) | def create_and_check_for_masked_image_modeling(self, config, pixel_val... method create_and_check_for_image_classification (line 155) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 173) | def prepare_config_and_inputs_for_common(self): class ViTModelTest (line 185) | class ViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC... method setUp (line 208) | def setUp(self): method test_multi_gpu_data_parallel_forward (line 216) | def test_multi_gpu_data_parallel_forward(self): method test_config (line 219) | def test_config(self): method test_inputs_embeds (line 223) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 226) | def test_model_get_set_embeddings(self): method test_model (line 235) | def test_model(self): method test_for_masked_image_modeling (line 239) | def test_for_masked_image_modeling(self): method test_for_image_classification (line 243) | def test_for_image_classification(self): method test_model_from_pretrained (line 248) | def test_model_from_pretrained(self): function prepare_img (line 255) | def prepare_img(): class ViTModelIntegrationTest (line 262) | class ViTModelIntegrationTest(unittest.TestCase): method default_image_processor (line 264) | def default_image_processor(self): method test_inference_image_classification_head (line 268) | def test_inference_image_classification_head(self): method test_inference_interpolate_pos_encoding (line 288) | def test_inference_interpolate_pos_encoding(self): method test_inference_fp16 (line 318) | def test_inference_fp16(self): FILE: tests/models/vit_mae/test_modeling_vit_mae.py class ViTMAEModelTester (line 54) | class ViTMAEModelTester: method __init__ (line 55) | def __init__( method prepare_config_and_inputs (line 106) | def prepare_config_and_inputs(self): method get_config (line 117) | def get_config(self): method create_and_check_model (line 139) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_pretraining (line 146) | def create_and_check_for_pretraining(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 165) | def prepare_config_and_inputs_for_common(self): class ViTMAEModelTest (line 173) | class ViTMAEModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 184) | def setUp(self): method test_config (line 188) | def test_config(self): method test_inputs_embeds (line 192) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 195) | def test_model_get_set_embeddings(self): method test_model (line 204) | def test_model(self): method test_for_pretraining (line 208) | def test_for_pretraining(self): method test_save_load (line 212) | def test_save_load(self): method test_determinism (line 246) | def test_determinism(self): method test_model_outputs_equivalence (line 250) | def test_model_outputs_equivalence(self): method test_batching_equivalence (line 254) | def test_batching_equivalence(self): method test_model_from_pretrained (line 258) | def test_model_from_pretrained(self): method test_flash_attn_2_inference_equivalence (line 268) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 317) | def test_flash_attn_2_inference_equivalence_right_padding(self): function prepare_img (line 322) | def prepare_img(): class ViTMAEModelIntegrationTest (line 329) | class ViTMAEModelIntegrationTest(unittest.TestCase): method default_image_processor (line 331) | def default_image_processor(self): method default_model (line 335) | def default_model(self): method test_inference_for_pretraining (line 339) | def test_inference_for_pretraining(self): method test_inference_interpolate_pos_encoding (line 367) | def test_inference_interpolate_pos_encoding(self): method test_inference_interpolate_pos_encoding_custom_sizes (line 394) | def test_inference_interpolate_pos_encoding_custom_sizes(self): FILE: tests/models/vit_msn/test_modeling_vit_msn.py class ViTMSNModelTester (line 41) | class ViTMSNModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 89) | def prepare_config_and_inputs(self): method get_config (line 100) | def get_config(self): method create_and_check_model (line 116) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_image_classification (line 123) | def create_and_check_for_image_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 143) | def prepare_config_and_inputs_for_common(self): class ViTMSNModelTest (line 151) | class ViTMSNModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 166) | def setUp(self): method test_config (line 170) | def test_config(self): method test_inputs_embeds (line 174) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 177) | def test_model_get_set_embeddings(self): method test_model (line 186) | def test_model(self): method test_for_image_classification (line 190) | def test_for_image_classification(self): method test_model_from_pretrained (line 195) | def test_model_from_pretrained(self): function prepare_img (line 202) | def prepare_img(): class ViTMSNModelIntegrationTest (line 209) | class ViTMSNModelIntegrationTest(unittest.TestCase): method default_image_processor (line 211) | def default_image_processor(self): method test_inference_image_classification_head (line 215) | def test_inference_image_classification_head(self): FILE: tests/models/vitdet/test_modeling_vitdet.py class VitDetModelTester (line 35) | class VitDetModelTester: method __init__ (line 36) | def __init__( method prepare_config_and_inputs (line 77) | def prepare_config_and_inputs(self): method get_config (line 88) | def get_config(self): method create_and_check_model (line 105) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_backbone (line 115) | def create_and_check_backbone(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 150) | def prepare_config_and_inputs_for_common(self): class VitDetModelTest (line 158) | class VitDetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 169) | def setUp(self): method test_cpu_offload (line 175) | def test_cpu_offload(self): method test_disk_offload_bin (line 180) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 184) | def test_disk_offload_safetensors(self): method test_model_parallelism (line 189) | def test_model_parallelism(self): method test_config (line 192) | def test_config(self): method test_inputs_embeds (line 196) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 199) | def test_model_get_set_embeddings(self): method test_model (line 208) | def test_model(self): method test_backbone (line 212) | def test_backbone(self): method test_hidden_states_output (line 216) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 252) | def test_retain_grad_hidden_states_attentions(self): method test_feed_forward_chunking (line 277) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 281) | def test_model_from_pretrained(self): method test_non_square_image (line 284) | def test_non_square_image(self): class VitDetBackboneTest (line 311) | class VitDetBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 317) | def setUp(self): FILE: tests/models/vitmatte/test_image_processing_vitmatte.py class VitMatteImageProcessingTester (line 44) | class VitMatteImageProcessingTester: method __init__ (line 45) | def __init__( method prepare_image_processor_dict (line 75) | def prepare_image_processor_dict(self): method prepare_image_inputs (line 86) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class VitMatteImageProcessingTest (line 100) | class VitMatteImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 101) | def setUp(self): method image_processor_dict (line 106) | def image_processor_dict(self): method test_image_processor_properties (line 109) | def test_image_processor_properties(self): method test_call_numpy (line 120) | def test_call_numpy(self): method test_call_pytorch (line 138) | def test_call_pytorch(self): method test_call_pil (line 177) | def test_call_pil(self): method test_call_numpy_4_channels (line 195) | def test_call_numpy_4_channels(self): method test_padding (line 221) | def test_padding(self): method test_image_processor_preprocess_arguments (line 241) | def test_image_processor_preprocess_arguments(self): method test_backends_equivalence (line 286) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 306) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 331) | def test_can_compile_torchvision_backend(self): FILE: tests/models/vitmatte/test_modeling_vitmatte.py class VitMatteModelTester (line 46) | class VitMatteModelTester: method __init__ (line 47) | def __init__( method prepare_config_and_inputs (line 85) | def prepare_config_and_inputs(self): method get_backbone_config (line 96) | def get_backbone_config(self): method get_config (line 109) | def get_config(self): method create_and_check_model (line 117) | def create_and_check_model(self, config, pixel_values, labels): method prepare_config_and_inputs_for_common (line 124) | def prepare_config_and_inputs_for_common(self): class VitMatteModelTest (line 132) | class VitMatteModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 143) | def setUp(self): method test_config (line 153) | def test_config(self): method test_inputs_embeds (line 157) | def test_inputs_embeds(self): method test_training (line 161) | def test_training(self): method test_training_gradient_checkpointing (line 165) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 169) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 173) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_get_set_embeddings (line 177) | def test_model_get_set_embeddings(self): method test_model (line 180) | def test_model(self): method test_model_from_pretrained (line 185) | def test_model_from_pretrained(self): method test_retain_grad_hidden_states_attentions (line 191) | def test_retain_grad_hidden_states_attentions(self): method test_hidden_states_output (line 194) | def test_hidden_states_output(self): method test_backbone_selection (line 230) | def test_backbone_selection(self): class VitMatteModelIntegrationTest (line 267) | class VitMatteModelIntegrationTest(unittest.TestCase): method test_inference (line 269) | def test_inference(self): FILE: tests/models/vitpose/test_image_processing_vitpose.py class VitPoseImageProcessingTester (line 35) | class VitPoseImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 67) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 78) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 81) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class VitPoseImageProcessingTest (line 95) | class VitPoseImageProcessingTest(ImageProcessingTestMixin, unittest.Test... method setUp (line 96) | def setUp(self): method image_processor_dict (line 101) | def image_processor_dict(self): method test_image_processor_properties (line 104) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 115) | def test_image_processor_from_dict_with_kwargs(self): method test_call_pil (line 125) | def test_call_pil(self): method test_call_numpy (line 147) | def test_call_numpy(self): method test_call_pytorch (line 169) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 192) | def test_call_numpy_4_channels(self): method test_backends_equivalence (line 231) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 255) | def test_backends_equivalence_batched(self): method test_can_compile_torchvision_backend (line 276) | def test_can_compile_torchvision_backend(self): FILE: tests/models/vitpose/test_modeling_vitpose.py class VitPoseModelTester (line 44) | class VitPoseModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 93) | def prepare_config_and_inputs(self): method get_config (line 104) | def get_config(self): method get_backbone_config (line 109) | def get_backbone_config(self): method create_and_check_for_pose_estimation (line 122) | def create_and_check_for_pose_estimation(self, config, pixel_values, l... method prepare_config_and_inputs_for_common (line 135) | def prepare_config_and_inputs_for_common(self): class VitPoseModelTest (line 147) | class VitPoseModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 157) | def setUp(self): method test_config (line 161) | def test_config(self): method test_batching_equivalence (line 169) | def test_batching_equivalence(self, atol=3e-4, rtol=3e-4): method test_model_common_attributes (line 173) | def test_model_common_attributes(self): method test_inputs_embeds (line 177) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 181) | def test_model_get_set_embeddings(self): method test_training (line 185) | def test_training(self): method test_training_gradient_checkpointing (line 189) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 193) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 197) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_forward_signature (line 200) | def test_forward_signature(self): method test_for_pose_estimation (line 212) | def test_for_pose_estimation(self): method test_model_from_pretrained (line 217) | def test_model_from_pretrained(self): function prepare_img (line 224) | def prepare_img(): class VitPoseModelIntegrationTest (line 232) | class VitPoseModelIntegrationTest(unittest.TestCase): method default_image_processor (line 234) | def default_image_processor(self): method test_inference_pose_estimation (line 242) | def test_inference_pose_estimation(self): method test_batched_inference (line 285) | def test_batched_inference(self): FILE: tests/models/vitpose_backbone/test_modeling_vitpose_backbone.py class VitPoseBackboneModelTester (line 32) | class VitPoseBackboneModelTester: method __init__ (line 33) | def __init__( method prepare_config_and_inputs (line 77) | def prepare_config_and_inputs(self): method get_config (line 88) | def get_config(self): method prepare_config_and_inputs_for_common (line 104) | def prepare_config_and_inputs_for_common(self): class VitPoseBackboneModelTest (line 116) | class VitPoseBackboneModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 126) | def setUp(self): method test_config (line 132) | def test_config(self): method test_batching_equivalence (line 135) | def test_batching_equivalence(self, atol=3e-4, rtol=3e-4): method test_model_common_attributes (line 139) | def test_model_common_attributes(self): method test_inputs_embeds (line 143) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 147) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 151) | def test_feed_forward_chunking(self): method test_retain_grad_hidden_states_attentions (line 155) | def test_retain_grad_hidden_states_attentions(self): method test_training (line 159) | def test_training(self): method test_forward_signature (line 162) | def test_forward_signature(self): class VitPoseBackboneTest (line 176) | class VitPoseBackboneTest(unittest.TestCase, BackboneTesterMixin): method setUp (line 182) | def setUp(self): FILE: tests/models/vits/test_modeling_vits.py function _config_zero_init (line 56) | def _config_zero_init(config): class VitsModelTester (line 68) | class VitsModelTester: method __init__ (line 69) | def __init__( method prepare_config_and_inputs (line 111) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 122) | def prepare_config_and_inputs_for_common(self): method get_config (line 126) | def get_config(self): method create_and_check_model_forward (line 146) | def create_and_check_model_forward(self, config, inputs_dict): class VitsModelTest (line 157) | class VitsModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 168) | def setUp(self): method test_config (line 172) | def test_config(self): method test_pipeline_feature_extraction (line 177) | def test_pipeline_feature_extraction(self): method test_pipeline_feature_extraction_fp16 (line 181) | def test_pipeline_feature_extraction_fp16(self): method test_model_forward (line 185) | def test_model_forward(self): method test_multi_gpu_data_parallel_forward (line 193) | def test_multi_gpu_data_parallel_forward(self): method test_determinism (line 216) | def test_determinism(self): method test_batching_equivalence (line 220) | def test_batching_equivalence(self): method test_inputs_embeds (line 224) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 228) | def test_model_get_set_embeddings(self): method test_model_outputs_equivalence (line 232) | def test_model_outputs_equivalence(self): method test_save_load (line 309) | def test_save_load(self): method _mock_init_weights (line 352) | def _mock_init_weights(self, module): class VitsModelIntegrationTests (line 365) | class VitsModelIntegrationTests(unittest.TestCase): method test_forward (line 366) | def test_forward(self): method test_forward_fp16 (line 397) | def test_forward_fp16(self): FILE: tests/models/vits/test_tokenization_vits.py class VitsTokenizerTest (line 29) | class VitsTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 35) | def setUpClass(cls): method get_tokenizer (line 55) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method get_clean_sequence (line 65) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method test_add_tokens_tokenizer (line 71) | def test_add_tokens_tokenizer(self): method test_encode_decode_with_spaces (line 75) | def test_encode_decode_with_spaces(self): method test_pretokenized_inputs (line 79) | def test_pretokenized_inputs(self): method test_save_and_load_tokenizer (line 82) | def test_save_and_load_tokenizer(self): method test_ron_normalization (line 109) | def test_ron_normalization(self): method test_normalization (line 120) | def test_normalization(self): method test_tokenizer_integration (line 143) | def test_tokenizer_integration(self): FILE: tests/models/vivit/test_image_processing_vivit.py class VivitImageProcessingTester (line 35) | class VivitImageProcessingTester: method __init__ (line 36) | def __init__( method prepare_image_processor_dict (line 69) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 79) | def expected_output_image_shape(self, images): method prepare_video_inputs (line 82) | def prepare_video_inputs(self, equal_resolution=False, numpify=False, ... class VivitImageProcessingTest (line 97) | class VivitImageProcessingTest(ImageProcessingTestMixin, unittest.TestCa... method setUp (line 100) | def setUp(self): method image_processor_dict (line 105) | def image_processor_dict(self): method test_image_processor_properties (line 108) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 117) | def test_image_processor_from_dict_with_kwargs(self): method test_rescale (line 126) | def test_rescale(self): method test_call_pil (line 140) | def test_call_pil(self): method test_call_numpy (line 161) | def test_call_numpy(self): method test_call_numpy_4_channels (line 182) | def test_call_numpy_4_channels(self): method test_call_pytorch (line 217) | def test_call_pytorch(self): method test_override_instance_attributes_does_not_affect_other_instances (line 239) | def test_override_instance_attributes_does_not_affect_other_instances(... FILE: tests/models/vivit/test_modeling_vivit.py class VivitModelTester (line 45) | class VivitModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 101) | def prepare_config_and_inputs(self): method get_config (line 114) | def get_config(self): method create_and_check_model (line 135) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_video_classification (line 142) | def create_and_check_for_video_classification(self, config, pixel_valu... method prepare_config_and_inputs_for_common (line 153) | def prepare_config_and_inputs_for_common(self): class VivitModelTest (line 161) | class VivitModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 176) | def setUp(self): method _prepare_for_class (line 180) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_config (line 191) | def test_config(self): method test_inputs_embeds (line 195) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 198) | def test_model_get_set_embeddings(self): method test_forward_signature (line 207) | def test_forward_signature(self): method test_model (line 218) | def test_model(self): method test_for_video_classification (line 222) | def test_for_video_classification(self): method test_model_from_pretrained (line 227) | def test_model_from_pretrained(self): method test_attention_outputs (line 232) | def test_attention_outputs(self): method test_hidden_states_output (line 288) | def test_hidden_states_output(self): function prepare_video (line 323) | def prepare_video(): class VivitModelIntegrationTest (line 333) | class VivitModelIntegrationTest(unittest.TestCase): method default_image_processor (line 335) | def default_image_processor(self): method test_inference_for_video_classification (line 339) | def test_inference_for_video_classification(self): method test_inference_interpolate_pos_encoding (line 364) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/vjepa2/test_modeling_vjepa2.py class VJEPA2ModelTester (line 53) | class VJEPA2ModelTester: method __init__ (line 54) | def __init__( method prepare_config_and_inputs (line 97) | def prepare_config_and_inputs(self): method get_config (line 112) | def get_config(self): method create_and_check_model (line 126) | def create_and_check_model(self, config, pixel_values_videos): method prepare_config_and_inputs_for_common (line 136) | def prepare_config_and_inputs_for_common(self): class VJEPA2ModelTest (line 147) | class VJEPA2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te... method setUp (line 159) | def setUp(self): method test_config (line 163) | def test_config(self): method test_inputs_embeds (line 167) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 170) | def test_model_get_set_embeddings(self): method test_model (line 179) | def test_model(self): method test_feed_forward_chunking (line 184) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 188) | def test_model_from_pretrained(self): function prepare_img (line 194) | def prepare_img(): function prepare_random_video (line 199) | def prepare_random_video(image_size=256): class VJEPA2ModelIntegrationTest (line 214) | class VJEPA2ModelIntegrationTest(unittest.TestCase): method default_video_processor (line 216) | def default_video_processor(self): method test_inference_image (line 220) | def test_inference_image(self): method test_inference_video (line 244) | def test_inference_video(self): method test_predictor_outputs (line 261) | def test_predictor_outputs(self): method test_predictor_full_mask (line 278) | def test_predictor_full_mask(self): method test_predictor_partial_mask (line 297) | def test_predictor_partial_mask(self): method test_video_classification (line 319) | def test_video_classification(self): FILE: tests/models/voxtral/test_modeling_voxtral.py class VoxtralModelTester (line 43) | class VoxtralModelTester: method __init__ (line 44) | def __init__( method get_config (line 95) | def get_config(self): method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 114) | def prepare_config_and_inputs_for_common(self): class VoxtralForConditionalGenerationModelTest (line 133) | class VoxtralForConditionalGenerationModelTest( method setUp (line 149) | def setUp(self): method test_inputs_embeds_matches_input_ids (line 156) | def test_inputs_embeds_matches_input_ids(self): method test_eager_padding_matches_padding_free_with_position_ids (line 162) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 168) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 174) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_2_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 180) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_flash_attention_3_padding_matches_padding_free_with_position_ids (line 186) | def test_flash_attention_3_padding_matches_padding_free_with_position_... method test_flash_attention_3_padding_matches_padding_free_with_position_ids_and_fa_kwargs (line 192) | def test_flash_attention_3_padding_matches_padding_free_with_position_... method test_model_base_model_prefix (line 196) | def test_model_base_model_prefix(self): method test_sdpa_can_dispatch_composite_models (line 199) | def test_sdpa_can_dispatch_composite_models(self): class VoxtralForConditionalGenerationIntegrationTest (line 238) | class VoxtralForConditionalGenerationIntegrationTest(unittest.TestCase): method setUp (line 239) | def setUp(self): method tearDown (line 244) | def tearDown(self): method test_mini_single_turn_audio_only (line 248) | def test_mini_single_turn_audio_only(self): method test_mini_single_turn_text_and_audio (line 280) | def test_mini_single_turn_text_and_audio(self): method test_mini_single_turn_text_and_multiple_audios (line 320) | def test_mini_single_turn_text_and_multiple_audios(self): method test_mini_single_turn_text_only (line 358) | def test_mini_single_turn_text_only(self): method test_mini_single_turn_text_and_multiple_audios_batched (line 388) | def test_mini_single_turn_text_and_multiple_audios_batched(self): method test_mini_multi_turn_text_and_audio (line 444) | def test_mini_multi_turn_text_and_audio(self): method test_transcribe_mode_audio_input (line 498) | def test_transcribe_mode_audio_input(self): FILE: tests/models/voxtral_realtime/test_modeling_voxtral_realtime.py class VoxtralRealtimeModelTester (line 47) | class VoxtralRealtimeModelTester: method __init__ (line 48) | def __init__( method get_config (line 116) | def get_config(self): method prepare_config_and_inputs (line 124) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 140) | def prepare_config_and_inputs_for_common(self): class VoxtralRealtimeForConditionalGenerationModelTest (line 159) | class VoxtralRealtimeForConditionalGenerationModelTest( method setUp (line 173) | def setUp(self): method _with_max_new_tokens (line 177) | def _with_max_new_tokens(max_new_tokens): method prepare_config_and_inputs_for_generate (line 191) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_generate_methods_with_logits_to_keep (line 201) | def test_generate_methods_with_logits_to_keep(self): method test_generate_compile_model_forward_fullgraph (line 205) | def test_generate_compile_model_forward_fullgraph(self): method test_generate_with_and_without_position_ids (line 209) | def test_generate_with_and_without_position_ids(self): method test_model_base_model_prefix (line 213) | def test_model_base_model_prefix(self): method test_flash_attention_2_continue_generate_with_position_ids (line 219) | def test_flash_attention_2_continue_generate_with_position_ids(self): method test_custom_4d_attention_mask (line 225) | def test_custom_4d_attention_mask(self): method test_flash_attn_2_from_config (line 231) | def test_flash_attn_2_from_config(self): method test_flash_attn_2_fp32_ln (line 237) | def test_flash_attn_2_fp32_ln(self): method attention_mask_padding_matches_padding_free_with_position_ids (line 243) | def attention_mask_padding_matches_padding_free_with_position_ids(self): method flash_attn_inference_equivalence (line 249) | def flash_attn_inference_equivalence(self): method test_generate_continue_from_past_key_values (line 255) | def test_generate_continue_from_past_key_values(self): method test_prepare_inputs_for_generation_kwargs_forwards (line 261) | def test_prepare_inputs_for_generation_kwargs_forwards(self): method test_generate_without_input_ids (line 267) | def test_generate_without_input_ids(self): method test_assisted_decoding_sample (line 273) | def test_assisted_decoding_sample(self): method test_assisted_decoding_matches_greedy_search_0_random (line 279) | def test_assisted_decoding_matches_greedy_search_0_random(self): method test_assisted_decoding_matches_greedy_search_1_same (line 285) | def test_assisted_decoding_matches_greedy_search_1_same(self): method test_left_padding_compatibility (line 291) | def test_left_padding_compatibility(self): method test_multi_gpu_data_parallel_forward (line 297) | def test_multi_gpu_data_parallel_forward(self): method test_generate_with_quant_cache (line 303) | def test_generate_with_quant_cache(self): class VoxtralRealtimeForConditionalGenerationIntegrationTest (line 308) | class VoxtralRealtimeForConditionalGenerationIntegrationTest(unittest.Te... method setUp (line 309) | def setUp(self): method tearDown (line 313) | def tearDown(self): method test_single_longform (line 317) | def test_single_longform(self): method test_batched (line 340) | def test_batched(self): method test_batched_longform (line 368) | def test_batched_longform(self): FILE: tests/models/wav2vec2/test_feature_extraction_wav2vec2.py function floats_list (line 32) | def floats_list(shape, scale=1.0, rng=None, name=None): class Wav2Vec2FeatureExtractionTester (line 46) | class Wav2Vec2FeatureExtractionTester: method __init__ (line 47) | def __init__( method prepare_feat_extract_dict (line 70) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 79) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class Wav2Vec2FeatureExtractionTest (line 98) | class Wav2Vec2FeatureExtractionTest(SequenceFeatureExtractionTestMixin, ... method setUp (line 101) | def setUp(self): method _check_zero_mean_unit_variance (line 104) | def _check_zero_mean_unit_variance(self, input_vector): method test_call (line 108) | def test_call(self): method test_zero_mean_unit_variance_normalization_np (line 134) | def test_zero_mean_unit_variance_normalization_np(self): method test_zero_mean_unit_variance_normalization (line 150) | def test_zero_mean_unit_variance_normalization(self): method test_zero_mean_unit_variance_normalization_trunc_np_max_length (line 166) | def test_zero_mean_unit_variance_normalization_trunc_np_max_length(self): method test_zero_mean_unit_variance_normalization_trunc_np_longest (line 178) | def test_zero_mean_unit_variance_normalization_trunc_np_longest(self): method test_double_precision_pad (line 207) | def test_double_precision_pad(self): method test_pretrained_checkpoints_are_set_correctly (line 222) | def test_pretrained_checkpoints_are_set_correctly(self): FILE: tests/models/wav2vec2/test_modeling_wav2vec2.py function _test_wav2vec2_with_lm_invalid_pool (line 89) | def _test_wav2vec2_with_lm_invalid_pool(in_queue, out_queue, timeout): class Wav2Vec2ModelTester (line 134) | class Wav2Vec2ModelTester: method __init__ (line 135) | def __init__( method prepare_config_and_inputs (line 211) | def prepare_config_and_inputs(self): method get_config (line 219) | def get_config(self): method create_and_check_model (line 250) | def create_and_check_model(self, config, input_values, attention_mask): method create_and_check_model_with_adapter (line 259) | def create_and_check_model_with_adapter(self, config, input_values, at... method create_and_check_model_with_adapter_for_ctc (line 269) | def create_and_check_model_with_adapter_for_ctc(self, config, input_va... method create_and_check_model_with_adapter_proj_dim (line 280) | def create_and_check_model_with_adapter_proj_dim(self, config, input_v... method create_and_check_model_with_attn_adapter (line 292) | def create_and_check_model_with_attn_adapter(self, config, input_value... method create_and_check_batch_inference (line 303) | def create_and_check_batch_inference(self, config, input_values, *args): method check_ctc_loss (line 329) | def check_ctc_loss(self, config, input_values, *args): method check_seq_classifier_loss (line 357) | def check_seq_classifier_loss(self, config, input_values, *args): method check_ctc_training (line 382) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_training (line 411) | def check_seq_classifier_training(self, config, input_values, *args): method check_xvector_training (line 434) | def check_xvector_training(self, config, input_values, *args): method check_labels_out_of_vocab (line 457) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 471) | def prepare_config_and_inputs_for_common(self): class Wav2Vec2ModelTest (line 478) | class Wav2Vec2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 494) | def setUp(self): method test_config (line 498) | def test_config(self): method test_model (line 501) | def test_model(self): method test_model_with_adapter (line 505) | def test_model_with_adapter(self): method test_model_with_adapter_for_ctc (line 509) | def test_model_with_adapter_for_ctc(self): method test_model_with_adapter_proj_dim (line 513) | def test_model_with_adapter_proj_dim(self): method test_ctc_loss_inference (line 517) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 521) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 525) | def test_ctc_train(self): method test_seq_classifier_train (line 529) | def test_seq_classifier_train(self): method test_xvector_train (line 533) | def test_xvector_train(self): method test_labels_out_of_vocab (line 537) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 542) | def test_inputs_embeds(self): method test_forward_signature (line 546) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 550) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 554) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 557) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 601) | def _mock_init_weights(self, module): method test_mask_feature_prob_ctc (line 615) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 638) | def test_mask_time_prob_ctc(self): method test_feed_forward_chunking (line 662) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 666) | def test_model_from_pretrained(self): class Wav2Vec2RobustModelTest (line 672) | class Wav2Vec2RobustModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 686) | def setUp(self): method test_config (line 692) | def test_config(self): method test_model (line 695) | def test_model(self): method test_batching_equivalence (line 702) | def test_batching_equivalence(self): method test_model_with_adapter (line 705) | def test_model_with_adapter(self): method test_model_with_adapter_proj_dim (line 709) | def test_model_with_adapter_proj_dim(self): method test_model_with_attn_adapter (line 713) | def test_model_with_attn_adapter(self): method test_batched_inference (line 717) | def test_batched_inference(self): method test_ctc_loss_inference (line 721) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 725) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 729) | def test_ctc_train(self): method test_seq_classifier_train (line 733) | def test_seq_classifier_train(self): method test_xvector_train (line 737) | def test_xvector_train(self): method test_labels_out_of_vocab (line 741) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 746) | def test_inputs_embeds(self): method test_forward_signature (line 750) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 754) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 758) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 761) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 805) | def _mock_init_weights(self, module): method test_model_for_pretraining (line 819) | def test_model_for_pretraining(self): method test_mask_feature_prob_ctc (line 861) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 884) | def test_mask_time_prob_ctc(self): method test_mask_time_feature_prob_ctc_single_batch (line 907) | def test_mask_time_feature_prob_ctc_single_batch(self): method test_feed_forward_chunking (line 935) | def test_feed_forward_chunking(self): method test_load_and_set_attn_adapter (line 938) | def test_load_and_set_attn_adapter(self): method test_load_target_lang_with_mismatched_size (line 973) | def test_load_target_lang_with_mismatched_size(self): method test_load_attn_adapter (line 1009) | def test_load_attn_adapter(self): method test_model_from_pretrained (line 1089) | def test_model_from_pretrained(self): class Wav2Vec2UtilsTest (line 1095) | class Wav2Vec2UtilsTest(unittest.TestCase): method test_compute_mask_indices (line 1096) | def test_compute_mask_indices(self): method test_compute_mask_indices_low_prob (line 1107) | def test_compute_mask_indices_low_prob(self): method test_compute_mask_indices_overlap (line 1137) | def test_compute_mask_indices_overlap(self): method test_compute_mask_indices_attn_mask_overlap (line 1150) | def test_compute_mask_indices_attn_mask_overlap(self): method test_compute_mask_indices_short_audio (line 1169) | def test_compute_mask_indices_short_audio(self): method test_compute_perplexity (line 1186) | def test_compute_perplexity(self): method test_sample_negatives (line 1199) | def test_sample_negatives(self): method test_sample_negatives_with_mask (line 1224) | def test_sample_negatives_with_mask(self): class Wav2Vec2ModelIntegrationTest (line 1266) | class Wav2Vec2ModelIntegrationTest(unittest.TestCase): method tearDown (line 1267) | def tearDown(self): method _load_datasamples (line 1272) | def _load_datasamples(self, num_samples): method _load_superb (line 1281) | def _load_superb(self, task, num_samples): method test_inference_ctc_normal (line 1286) | def test_inference_ctc_normal(self): method test_inference_ctc_normal_batched (line 1303) | def test_inference_ctc_normal_batched(self): method test_inference_ctc_robust_batched (line 1326) | def test_inference_ctc_robust_batched(self): method test_inference_integration (line 1353) | def test_inference_integration(self): method test_inference_pretrained (line 1401) | def test_inference_pretrained(self): method test_loss_pretraining (line 1465) | def test_loss_pretraining(self): method test_inference_keyword_spotting (line 1521) | def test_inference_keyword_spotting(self): method test_inference_intent_classification (line 1540) | def test_inference_intent_classification(self): method test_inference_speaker_identification (line 1570) | def test_inference_speaker_identification(self): method test_inference_emotion_recognition (line 1591) | def test_inference_emotion_recognition(self): method test_phoneme_recognition (line 1610) | def test_phoneme_recognition(self): method test_wav2vec2_with_lm (line 1647) | def test_wav2vec2_with_lm(self): method test_wav2vec2_with_lm_pool (line 1672) | def test_wav2vec2_with_lm_pool(self): method test_wav2vec2_with_lm_invalid_pool (line 1711) | def test_wav2vec2_with_lm_invalid_pool(self): method test_inference_diarization (line 1714) | def test_inference_diarization(self): method test_inference_speaker_verification (line 1741) | def test_inference_speaker_verification(self): method test_inference_mms_1b_all (line 1766) | def test_inference_mms_1b_all(self): method test_inference_ctc_fa2 (line 1810) | def test_inference_ctc_fa2(self): method test_inference_ctc_fa2_batched (line 1832) | def test_inference_ctc_fa2_batched(self): FILE: tests/models/wav2vec2/test_processing_wav2vec2.py class Wav2Vec2ProcessorTest (line 26) | class Wav2Vec2ProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_feature_extractor (line 32) | def _setup_feature_extractor(cls): method _setup_tokenizer (line 45) | def _setup_tokenizer(cls): method test_overlapping_text_audio_kwargs_handling (line 62) | def test_overlapping_text_audio_kwargs_handling(self): method test_processor_with_multiple_inputs (line 66) | def test_processor_with_multiple_inputs(self): method test_feature_extractor (line 69) | def test_feature_extractor(self): method test_model_input_names (line 80) | def test_model_input_names(self): FILE: tests/models/wav2vec2/test_tokenization_wav2vec2.py function floats_list (line 33) | def floats_list(shape, scale=1.0, rng=None, name=None): class Wav2Vec2CTCTokenizerTest (line 47) | class Wav2Vec2CTCTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method test_pretokenized_inputs (line 52) | def test_pretokenized_inputs(self): method setUpClass (line 58) | def setUpClass(cls): method get_tokenizer (line 72) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method test_word_delimiter_round_trip_without_config (line 79) | def test_word_delimiter_round_trip_without_config(self): method test_tokenizer_add_token_chars (line 98) | def test_tokenizer_add_token_chars(self): method test_tokenizer_add_token_words (line 114) | def test_tokenizer_add_token_words(self): method test_tokenizer_decode (line 130) | def test_tokenizer_decode(self): method test_tokenizer_decode_special (line 142) | def test_tokenizer_decode_special(self): method test_tokenizer_decode_added_tokens (line 161) | def test_tokenizer_decode_added_tokens(self): method test_special_characters_in_vocab (line 178) | def test_special_characters_in_vocab(self): method get_from_offsets (line 199) | def get_from_offsets(offsets, key): method test_offsets (line 203) | def test_offsets(self): method test_word_offsets_from_char_offsets (line 265) | def test_word_offsets_from_char_offsets(self): method test_offsets_batch (line 301) | def test_offsets_batch(self): method test_offsets_integration (line 349) | def test_offsets_integration(self): method test_add_tokens_tokenizer (line 416) | def test_add_tokens_tokenizer(self): method test_tf_encode_plus_sent_to_model (line 471) | def test_tf_encode_plus_sent_to_model(self): method test_torch_encode_plus_sent_to_model (line 475) | def test_torch_encode_plus_sent_to_model(self): method test_convert_tokens_to_string_format (line 478) | def test_convert_tokens_to_string_format(self): method test_nested_vocab (line 489) | def test_nested_vocab(self): FILE: tests/models/wav2vec2_bert/test_modeling_wav2vec2_bert.py class Wav2Vec2BertModelTester (line 59) | class Wav2Vec2BertModelTester: method __init__ (line 61) | def __init__( method prepare_config_and_inputs (line 128) | def prepare_config_and_inputs(self, position_embeddings_type="relative"): method get_config (line 139) | def get_config(self, position_embeddings_type="relative"): method create_and_check_model (line 165) | def create_and_check_model(self, config, input_features, attention_mask): method create_and_check_model_with_adapter (line 174) | def create_and_check_model_with_adapter(self, config, input_features, ... method create_and_check_model_with_adapter_for_ctc (line 184) | def create_and_check_model_with_adapter_for_ctc(self, config, input_fe... method create_and_check_model_with_intermediate_ffn_before_adapter (line 196) | def create_and_check_model_with_intermediate_ffn_before_adapter(self, ... method create_and_check_model_with_adapter_proj_dim (line 219) | def create_and_check_model_with_adapter_proj_dim(self, config, input_f... method create_and_check_model_float16 (line 231) | def create_and_check_model_float16(self, config, input_features, atten... method check_ctc_loss (line 248) | def check_ctc_loss(self, config, input_features, *args): method check_seq_classifier_loss (line 277) | def check_seq_classifier_loss(self, config, input_features, *args): method check_ctc_training (line 303) | def check_ctc_training(self, config, input_features, *args): method check_seq_classifier_training (line 330) | def check_seq_classifier_training(self, config, input_features, *args): method check_xvector_training (line 354) | def check_xvector_training(self, config, input_features, *args): method check_labels_out_of_vocab (line 377) | def check_labels_out_of_vocab(self, config, input_features, *args): method prepare_config_and_inputs_for_common (line 391) | def prepare_config_and_inputs_for_common(self): class Wav2Vec2BertModelTest (line 398) | class Wav2Vec2BertModelTest(ModelTesterMixin, PipelineTesterMixin, unitt... method setUp (line 422) | def setUp(self): method test_config (line 426) | def test_config(self): method test_model (line 429) | def test_model(self): method test_batching_equivalence (line 434) | def test_batching_equivalence(self, atol=5e-4, rtol=5e-4): method test_model_with_relative (line 437) | def test_model_with_relative(self): method test_model_with_relative_key (line 442) | def test_model_with_relative_key(self): method test_model_with_rotary (line 446) | def test_model_with_rotary(self): method test_model_with_no_rel_pos (line 450) | def test_model_with_no_rel_pos(self): method test_model_with_adapter (line 454) | def test_model_with_adapter(self): method test_model_with_adapter_for_ctc (line 458) | def test_model_with_adapter_for_ctc(self): method test_model_with_intermediate_ffn_before_adapter (line 463) | def test_model_with_intermediate_ffn_before_adapter(self): method test_model_with_adapter_proj_dim (line 467) | def test_model_with_adapter_proj_dim(self): method test_model_float16_with_relative (line 473) | def test_model_float16_with_relative(self): method test_model_float16_with_relative_key (line 480) | def test_model_float16_with_relative_key(self): method test_model_float16_with_rotary (line 486) | def test_model_float16_with_rotary(self): method test_ctc_loss_inference (line 490) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 494) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 498) | def test_ctc_train(self): method test_seq_classifier_train (line 502) | def test_seq_classifier_train(self): method test_xvector_train (line 506) | def test_xvector_train(self): method test_labels_out_of_vocab (line 510) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 516) | def test_inputs_embeds(self): method test_forward_signature (line 521) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 526) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 531) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 534) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 575) | def _mock_init_weights(self, module): method test_mask_feature_prob_ctc (line 595) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 600) | def test_mask_time_prob_ctc(self): method test_feed_forward_chunking (line 604) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 608) | def test_model_from_pretrained(self): class Wav2Vec2BertUtilsTest (line 616) | class Wav2Vec2BertUtilsTest(unittest.TestCase): method test_compute_mask_indices (line 617) | def test_compute_mask_indices(self): method test_compute_mask_indices_low_prob (line 628) | def test_compute_mask_indices_low_prob(self): method test_compute_mask_indices_overlap (line 658) | def test_compute_mask_indices_overlap(self): method test_compute_mask_indices_attn_mask_overlap (line 671) | def test_compute_mask_indices_attn_mask_overlap(self): method test_compute_mask_indices_short_audio (line 690) | def test_compute_mask_indices_short_audio(self): method test_compute_perplexity (line 709) | def test_compute_perplexity(self): method test_sample_negatives (line 712) | def test_sample_negatives(self): method test_sample_negatives_with_mask (line 737) | def test_sample_negatives_with_mask(self): class Wav2Vec2BertModelIntegrationTest (line 777) | class Wav2Vec2BertModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 778) | def _load_datasamples(self, num_samples): method test_inference_w2v2_bert (line 786) | def test_inference_w2v2_bert(self): FILE: tests/models/wav2vec2_bert/test_processing_wav2vec2_bert.py class Wav2Vec2BertProcessorTest (line 26) | class Wav2Vec2BertProcessorTest(ProcessorTesterMixin, unittest.TestCase): method _setup_feature_extractor (line 31) | def _setup_feature_extractor(cls): method _setup_tokenizer (line 44) | def _setup_tokenizer(cls): method test_processor_with_multiple_inputs (line 60) | def test_processor_with_multiple_inputs(self): method test_overlapping_text_audio_kwargs_handling (line 64) | def test_overlapping_text_audio_kwargs_handling(self): method test_feature_extractor (line 67) | def test_feature_extractor(self): method test_model_input_names (line 78) | def test_model_input_names(self): FILE: tests/models/wav2vec2_conformer/test_modeling_wav2vec2_conformer.py class Wav2Vec2ConformerModelTester (line 63) | class Wav2Vec2ConformerModelTester: method __init__ (line 64) | def __init__( method prepare_config_and_inputs (line 142) | def prepare_config_and_inputs(self, position_embeddings_type="relative"): method get_config (line 150) | def get_config(self, position_embeddings_type="relative"): method create_and_check_model (line 182) | def create_and_check_model(self, config, input_values, attention_mask): method create_and_check_model_with_adapter (line 191) | def create_and_check_model_with_adapter(self, config, input_values, at... method create_and_check_model_with_adapter_for_ctc (line 201) | def create_and_check_model_with_adapter_for_ctc(self, config, input_va... method create_and_check_model_with_adapter_proj_dim (line 212) | def create_and_check_model_with_adapter_proj_dim(self, config, input_v... method create_and_check_model_float16 (line 224) | def create_and_check_model_float16(self, config, input_values, attenti... method check_ctc_loss (line 241) | def check_ctc_loss(self, config, input_values, *args): method check_seq_classifier_loss (line 269) | def check_seq_classifier_loss(self, config, input_values, *args): method check_ctc_training (line 294) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_training (line 323) | def check_seq_classifier_training(self, config, input_values, *args): method check_xvector_training (line 346) | def check_xvector_training(self, config, input_values, *args): method check_labels_out_of_vocab (line 369) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 383) | def prepare_config_and_inputs_for_common(self): class Wav2Vec2ConformerModelTest (line 390) | class Wav2Vec2ConformerModelTest(ModelTesterMixin, PipelineTesterMixin, ... method setUp (line 413) | def setUp(self): method test_config (line 417) | def test_config(self): method test_model (line 420) | def test_model(self): method test_batching_equivalence (line 427) | def test_batching_equivalence(self, atol=1e-4, rtol=1e-4): method test_model_with_relative (line 430) | def test_model_with_relative(self): method test_model_with_rotary (line 434) | def test_model_with_rotary(self): method test_model_with_no_rel_pos (line 438) | def test_model_with_no_rel_pos(self): method test_model_with_adapter (line 442) | def test_model_with_adapter(self): method test_model_with_adapter_for_ctc (line 446) | def test_model_with_adapter_for_ctc(self): method test_model_with_adapter_proj_dim (line 450) | def test_model_with_adapter_proj_dim(self): method test_model_float16_with_relative (line 456) | def test_model_float16_with_relative(self): method test_model_float16_with_rotary (line 462) | def test_model_float16_with_rotary(self): method test_ctc_loss_inference (line 466) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 470) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 474) | def test_ctc_train(self): method test_seq_classifier_train (line 478) | def test_seq_classifier_train(self): method test_xvector_train (line 482) | def test_xvector_train(self): method test_labels_out_of_vocab (line 486) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 491) | def test_inputs_embeds(self): method test_forward_signature (line 495) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 499) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 503) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 506) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 547) | def _mock_init_weights(self, module): method test_mask_feature_prob_ctc (line 565) | def test_mask_feature_prob_ctc(self): method test_mask_time_prob_ctc (line 588) | def test_mask_time_prob_ctc(self): method test_feed_forward_chunking (line 612) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 616) | def test_model_from_pretrained(self): class Wav2Vec2ConformerUtilsTest (line 622) | class Wav2Vec2ConformerUtilsTest(unittest.TestCase): method test_compute_mask_indices (line 623) | def test_compute_mask_indices(self): method test_compute_mask_indices_low_prob (line 634) | def test_compute_mask_indices_low_prob(self): method test_compute_mask_indices_overlap (line 664) | def test_compute_mask_indices_overlap(self): method test_compute_mask_indices_attn_mask_overlap (line 677) | def test_compute_mask_indices_attn_mask_overlap(self): method test_compute_mask_indices_short_audio (line 696) | def test_compute_mask_indices_short_audio(self): method test_compute_perplexity (line 713) | def test_compute_perplexity(self): method test_sample_negatives (line 726) | def test_sample_negatives(self): method test_sample_negatives_with_mask (line 751) | def test_sample_negatives_with_mask(self): class Wav2Vec2ConformerModelIntegrationTest (line 791) | class Wav2Vec2ConformerModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 792) | def _load_datasamples(self, num_samples): method test_inference_ctc_normal_batched_rel_pos (line 800) | def test_inference_ctc_normal_batched_rel_pos(self): method test_inference_ctc_normal_batched_rope (line 825) | def test_inference_ctc_normal_batched_rope(self): method test_inference_pretrained (line 850) | def test_inference_pretrained(self): FILE: tests/models/wav2vec2_phoneme/test_tokenization_wav2vec2_phoneme.py class Wav2Vec2PhonemeCTCTokenizerTest (line 29) | class Wav2Vec2PhonemeCTCTokenizerTest(TokenizerTesterMixin, unittest.Tes... method setUpClass (line 35) | def setUpClass(cls): method get_clean_sequence (line 62) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method get_tokenizer (line 87) | def get_tokenizer(cls, pretrained_name=None, **kwargs): method test_tokenizer_add_new_tokens (line 92) | def test_tokenizer_add_new_tokens(self): method test_phonemize (line 107) | def test_phonemize(self): method test_encode (line 114) | def test_encode(self): method test_encode_decode (line 121) | def test_encode_decode(self): method test_decode (line 130) | def test_decode(self): method test_phonemize_with_word_del (line 142) | def test_phonemize_with_word_del(self): method test_encode_with_del (line 152) | def test_encode_with_del(self): method test_decode_with_del (line 162) | def test_decode_with_del(self): method test_encode_decode_with_del (line 187) | def test_encode_decode_with_del(self): method test_encode_decode_with_del_filter (line 200) | def test_encode_decode_with_del_filter(self): method test_change_phonemizer_lang (line 213) | def test_change_phonemizer_lang(self): method test_case_insensitive (line 230) | def test_case_insensitive(self): method test_tokenizer_decode_added_tokens (line 240) | def test_tokenizer_decode_added_tokens(self): method get_from_offsets (line 256) | def get_from_offsets(offsets, key): method test_offsets (line 260) | def test_offsets(self): method test_offsets_batch (line 292) | def test_offsets_batch(self): method test_added_tokens_do_lower_case (line 330) | def test_added_tokens_do_lower_case(self): method test_encode_decode_with_spaces (line 334) | def test_encode_decode_with_spaces(self): method test_internal_consistency (line 340) | def test_internal_consistency(self): method test_add_tokens_tokenizer (line 344) | def test_add_tokens_tokenizer(self): method test_tf_encode_plus_sent_to_model (line 396) | def test_tf_encode_plus_sent_to_model(self): method test_torch_encode_plus_sent_to_model (line 400) | def test_torch_encode_plus_sent_to_model(self): method test_convert_tokens_to_string_format (line 403) | def test_convert_tokens_to_string_format(self): FILE: tests/models/wav2vec2_with_lm/test_processing_wav2vec2_with_lm.py class Wav2Vec2ProcessorWithLMTest (line 49) | class Wav2Vec2ProcessorWithLMTest(unittest.TestCase): method setUp (line 50) | def setUp(self): method get_tokenizer (line 80) | def get_tokenizer(self, **kwargs_init): method get_feature_extractor (line 85) | def get_feature_extractor(self, **kwargs): method get_decoder (line 88) | def get_decoder(self, **kwargs): method tearDown (line 91) | def tearDown(self): method test_save_load_pretrained_default (line 94) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 120) | def test_save_load_pretrained_additional_features(self): method test_load_decoder_tokenizer_mismatch_content (line 137) | def test_load_decoder_tokenizer_mismatch_content(self): method test_feature_extractor (line 146) | def test_feature_extractor(self): method test_another_feature_extractor (line 161) | def test_another_feature_extractor(self): method test_wrong_feature_extractor_raises_error (line 182) | def test_wrong_feature_extractor_raises_error(self): method test_tokenizer (line 190) | def test_tokenizer(self): method _get_dummy_logits (line 206) | def _get_dummy_logits(self, shape=(2, 10, 16), seed=77): method test_decoder (line 210) | def test_decoder(self): method test_decoder_batch (line 229) | def test_decoder_batch(self, pool_context): method test_decoder_with_params (line 263) | def test_decoder_with_params(self): method test_decoder_with_params_of_lm (line 308) | def test_decoder_with_params_of_lm(self): method test_decoder_download_ignores_files (line 355) | def test_decoder_download_ignores_files(self): method test_decoder_local_files (line 372) | def test_decoder_local_files(self): method test_processor_from_auto_processor (line 389) | def test_processor_from_auto_processor(self): method get_from_offsets (line 409) | def get_from_offsets(offsets, key): method test_offsets_integration_fast (line 413) | def test_offsets_integration_fast(self): method test_offsets_integration_fast_batch (line 429) | def test_offsets_integration_fast_batch(self): method test_word_time_stamp_integration (line 451) | def test_word_time_stamp_integration(self): FILE: tests/models/wavlm/test_modeling_wavlm.py class WavLMModelTester (line 48) | class WavLMModelTester: method __init__ (line 49) | def __init__( method prepare_config_and_inputs (line 115) | def prepare_config_and_inputs(self): method get_config (line 123) | def get_config(self): method create_and_check_model (line 149) | def create_and_check_model(self, config, input_values, attention_mask): method check_ctc_loss (line 158) | def check_ctc_loss(self, config, input_values, *args): method check_seq_classifier_loss (line 186) | def check_seq_classifier_loss(self, config, input_values, *args): method check_ctc_training (line 211) | def check_ctc_training(self, config, input_values, *args): method check_seq_classifier_training (line 240) | def check_seq_classifier_training(self, config, input_values, *args): method check_output_attentions (line 263) | def check_output_attentions(self, config, input_values, attention_mask): method check_labels_out_of_vocab (line 272) | def check_labels_out_of_vocab(self, config, input_values, *args): method prepare_config_and_inputs_for_common (line 286) | def prepare_config_and_inputs_for_common(self): class WavLMModelTest (line 293) | class WavLMModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 309) | def setUp(self): method test_config (line 313) | def test_config(self): method test_model (line 316) | def test_model(self): method test_ctc_loss_inference (line 320) | def test_ctc_loss_inference(self): method test_seq_classifier_loss_inference (line 324) | def test_seq_classifier_loss_inference(self): method test_ctc_train (line 328) | def test_ctc_train(self): method test_seq_classifier_train (line 332) | def test_seq_classifier_train(self): method test_output_attentions (line 336) | def test_output_attentions(self): method test_labels_out_of_vocab (line 340) | def test_labels_out_of_vocab(self): method test_inputs_embeds (line 345) | def test_inputs_embeds(self): method test_forward_signature (line 350) | def test_forward_signature(self): method test_resize_tokens_embeddings (line 354) | def test_resize_tokens_embeddings(self): method test_model_get_set_embeddings (line 357) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 362) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 399) | def _mock_init_weights(self, module): method test_feed_forward_chunking (line 414) | def test_feed_forward_chunking(self): method test_model_from_pretrained (line 418) | def test_model_from_pretrained(self): class WavLMModelIntegrationTest (line 426) | class WavLMModelIntegrationTest(unittest.TestCase): method _load_datasamples (line 427) | def _load_datasamples(self, num_samples): method _load_superb (line 436) | def _load_superb(self, task, num_samples): method test_inference_base (line 441) | def test_inference_base(self): method test_inference_large (line 464) | def test_inference_large(self): method test_inference_diarization (line 488) | def test_inference_diarization(self): method test_inference_speaker_verification (line 515) | def test_inference_speaker_verification(self): FILE: tests/models/whisper/test_feature_extraction_whisper.py function floats_list (line 42) | def floats_list(shape, scale=1.0, rng=None, name=None): class WhisperFeatureExtractionTester (line 56) | class WhisperFeatureExtractionTester: method __init__ (line 57) | def __init__( method prepare_feat_extract_dict (line 84) | def prepare_feat_extract_dict(self): method prepare_inputs_for_common (line 95) | def prepare_inputs_for_common(self, equal_length=False, numpify=False): class WhisperFeatureExtractionTest (line 112) | class WhisperFeatureExtractionTest(SequenceFeatureExtractionTestMixin, u... method setUp (line 115) | def setUp(self): method test_feat_extract_from_and_save_pretrained (line 118) | def test_feat_extract_from_and_save_pretrained(self): method test_feat_extract_to_json_file (line 133) | def test_feat_extract_to_json_file(self): method test_feat_extract_from_pretrained_kwargs (line 148) | def test_feat_extract_from_pretrained_kwargs(self): method test_call (line 162) | def test_call(self): method test_dither (line 206) | def test_dither(self): method test_feature_shape (line 240) | def test_feature_shape(self): method test_double_precision_pad (line 274) | def test_double_precision_pad(self): method _load_datasamples (line 287) | def _load_datasamples(self, num_samples): method test_torch_integration (line 296) | def test_torch_integration(self): method test_numpy_integration (line 316) | def test_numpy_integration(self): method test_zero_mean_unit_variance_normalization_trunc_np_longest (line 334) | def test_zero_mean_unit_variance_normalization_trunc_np_longest(self): method test_torch_integration_batch (line 345) | def test_torch_integration_batch(self): FILE: tests/models/whisper/test_modeling_whisper.py class DummyTimestampLogitProcessor (line 72) | class DummyTimestampLogitProcessor(LogitsProcessor): method __init__ (line 75) | def __init__( method set_begin_index (line 99) | def set_begin_index(self, begin_index: int): method __call__ (line 102) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... function prepare_whisper_inputs_dict (line 152) | def prepare_whisper_inputs_dict( class WhisperModelTester (line 170) | class WhisperModelTester: method __init__ (line 171) | def __init__( method prepare_config_and_inputs (line 221) | def prepare_config_and_inputs(self): method get_config (line 235) | def get_config(self): method prepare_config_and_inputs_for_common (line 258) | def prepare_config_and_inputs_for_common(self): method get_subsampled_output_lengths (line 262) | def get_subsampled_output_lengths(self, input_lengths): method create_and_check_model_forward (line 272) | def create_and_check_model_forward(self, config, inputs_dict, freeze_e... method create_and_check_decoder_model_past_large_inputs (line 286) | def create_and_check_decoder_model_past_large_inputs(self, config, inp... method check_encoder_decoder_model_standalone (line 319) | def check_encoder_decoder_model_standalone(self, config, inputs_dict): class WhisperModelTest (line 350) | class WhisperModelTest(ModelTesterMixin, GenerationTesterMixin, Pipeline... method is_pipeline_test_to_skip (line 370) | def is_pipeline_test_to_skip( method _get_logits_processor_kwargs (line 390) | def _get_logits_processor_kwargs(self, do_sample=False, config=None): method _get_beam_kwargs (line 396) | def _get_beam_kwargs(self, num_return_sequences=1): method setUp (line 402) | def setUp(self): method prepare_config_and_inputs_for_generate (line 407) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method test_config (line 412) | def test_config(self): method test_save_load_strict (line 415) | def test_save_load_strict(self): method test_model_forward (line 425) | def test_model_forward(self): method test_model_forward_with_frozen_encoder (line 429) | def test_model_forward_with_frozen_encoder(self): method test_requires_grad_with_frozen_encoder (line 433) | def test_requires_grad_with_frozen_encoder(self): method test_requires_grad_encoder_embed_positions (line 449) | def test_requires_grad_encoder_embed_positions(self): method test_encoder_sinusoidal_embed_positions (line 456) | def test_encoder_sinusoidal_embed_positions(self): method test_decoder_model_past_with_large_inputs (line 463) | def test_decoder_model_past_with_large_inputs(self): method test_encoder_decoder_model_standalone (line 467) | def test_encoder_decoder_model_standalone(self): method test_inputs_embeds (line 471) | def test_inputs_embeds(self): method test_beam_search_output (line 490) | def test_beam_search_output(self): method test_training (line 510) | def test_training(self): method test_training_gradient_checkpointing (line 514) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 518) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 522) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_offloaded_cache_implementation (line 528) | def test_offloaded_cache_implementation(self, cache_implementation): method test_generate_fp16 (line 532) | def test_generate_fp16(self): method test_generate_language (line 542) | def test_generate_language(self): method test_forward_signature (line 566) | def test_forward_signature(self): method test_hidden_states_output (line 584) | def test_hidden_states_output(self): method test_attention_outputs (line 637) | def test_attention_outputs(self): method test_resize_tokens_embeddings (line 736) | def test_resize_tokens_embeddings(self): method test_resize_embeddings_untied (line 784) | def test_resize_embeddings_untied(self): method test_generate_without_input_ids (line 835) | def test_generate_without_input_ids(self): method test_mask_feature_prob (line 838) | def test_mask_feature_prob(self): method test_mask_time_prob (line 852) | def test_mask_time_prob(self): method test_generate_with_prompt_ids_max_length (line 866) | def test_generate_with_prompt_ids_max_length(self): method test_generate_longform_with_prompt_ids (line 889) | def test_generate_longform_with_prompt_ids(self): method _check_longform_generate_single_batch (line 929) | def _check_longform_generate_single_batch(self, condition_on_prev_toke... method test_longform_generate_single_batch (line 1002) | def test_longform_generate_single_batch(self): method test_longform_generate_single_batch_cond_prev (line 1005) | def test_longform_generate_single_batch_cond_prev(self): method _check_longform_generate_multi_batch (line 1008) | def _check_longform_generate_multi_batch(self, condition_on_prev_tokens): method test_longform_generate_multi_batch (line 1090) | def test_longform_generate_multi_batch(self): method test_longform_generate_multi_batch_cond_prev (line 1094) | def test_longform_generate_multi_batch_cond_prev(self): method test_custom_4d_attention_mask (line 1098) | def test_custom_4d_attention_mask(self): method test_generate_output_type (line 1136) | def test_generate_output_type(self, return_dict_in_generate): method test_labels_sequence_max_length_correct (line 1155) | def test_labels_sequence_max_length_correct(self): method test_labels_sequence_max_length_correct_after_changing_config (line 1167) | def test_labels_sequence_max_length_correct_after_changing_config(self): method test_labels_sequence_max_length_error (line 1181) | def test_labels_sequence_max_length_error(self): method test_labels_sequence_max_length_error_after_changing_config (line 1194) | def test_labels_sequence_max_length_error_after_changing_config(self): method test_generate_compile_model_forward_fullgraph (line 1215) | def test_generate_compile_model_forward_fullgraph(self): method test_generate_compilation_all_outputs (line 1220) | def test_generate_compilation_all_outputs(self): class WhisperModelIntegrationTests (line 1226) | class WhisperModelIntegrationTests(unittest.TestCase): method _load_dataset (line 1230) | def _load_dataset(cls): method _load_datasamples (line 1237) | def _load_datasamples(self, num_samples): method test_tiny_logits_librispeech (line 1244) | def test_tiny_logits_librispeech(self): method test_small_en_logits_librispeech (line 1290) | def test_small_en_logits_librispeech(self): method test_large_logits_librispeech (line 1325) | def test_large_logits_librispeech(self): method test_tiny_en_generation (line 1369) | def test_tiny_en_generation(self): method test_tiny_generation (line 1386) | def test_tiny_generation(self): method test_large_generation (line 1402) | def test_large_generation(self): method test_large_generation_multilingual (line 1420) | def test_large_generation_multilingual(self): method test_large_batched_generation (line 1447) | def test_large_batched_generation(self): method test_large_batched_generation_multilingual (line 1484) | def test_large_batched_generation_multilingual(self): method test_tiny_en_batched_generation (line 1518) | def test_tiny_en_batched_generation(self): method test_tiny_timestamp_generation (line 1556) | def test_tiny_timestamp_generation(self): method test_distil_token_timestamp_generation (line 1627) | def test_distil_token_timestamp_generation(self): method test_tiny_longform_timestamps_generation (line 1642) | def test_tiny_longform_timestamps_generation(self): method test_small_longform_timestamps_generation (line 1701) | def test_small_longform_timestamps_generation(self): method test_large_timestamp_generation (line 1894) | def test_large_timestamp_generation(self): method test_tiny_token_timestamp_generation (line 1967) | def test_tiny_token_timestamp_generation(self): method test_small_token_timestamp_generation (line 1996) | def test_small_token_timestamp_generation(self): method test_tiny_token_timestamp_batch_generation (line 2026) | def test_tiny_token_timestamp_batch_generation(self): method test_tiny_token_timestamp_generation_longform (line 2053) | def test_tiny_token_timestamp_generation_longform(self): method test_tiny_specaugment_librispeech (line 2105) | def test_tiny_specaugment_librispeech(self): method test_generate_with_prompt_ids (line 2140) | def test_generate_with_prompt_ids(self): method test_generate_with_forced_decoder_ids (line 2162) | def test_generate_with_forced_decoder_ids(self): method test_generate_with_prompt_ids_task_language (line 2185) | def test_generate_with_prompt_ids_task_language(self): method test_language_detection (line 2218) | def test_language_detection(self): method test_default_multilingual_transcription_short_form (line 2245) | def test_default_multilingual_transcription_short_form(self): method test_default_multilingual_transcription_long_form (line 2272) | def test_default_multilingual_transcription_long_form(self): method test_speculative_decoding_distil (line 2305) | def test_speculative_decoding_distil(self): method test_speculative_decoding_non_distil (line 2351) | def test_speculative_decoding_non_distil(self): method test_whisper_longform_single_batch (line 2398) | def test_whisper_longform_single_batch(self): method test_whisper_longform_prompt_ids (line 2435) | def test_whisper_longform_prompt_ids(self): method test_whisper_longform_single_batch_prev_cond (line 2485) | def test_whisper_longform_single_batch_prev_cond(self): method test_whisper_shortform_single_batch_prev_cond (line 2518) | def test_whisper_shortform_single_batch_prev_cond(self): method test_whisper_longform_single_batch_beam (line 2573) | def test_whisper_longform_single_batch_beam(self): method test_whisper_longform_multi_batch (line 2608) | def test_whisper_longform_multi_batch(self): method test_whisper_longform_multi_batch_prev_cond (line 2662) | def test_whisper_longform_multi_batch_prev_cond(self): method test_whisper_longform_multi_batch_hard (line 2706) | def test_whisper_longform_multi_batch_hard(self): method test_whisper_longform_multi_batch_hard_prev_cond (line 2790) | def test_whisper_longform_multi_batch_hard_prev_cond(self): method test_whisper_shortform_multi_batch_hard_prev_cond (line 2844) | def test_whisper_shortform_multi_batch_hard_prev_cond(self): method test_whisper_longform_no_speech_detection (line 2893) | def test_whisper_longform_no_speech_detection(self): method test_whisper_empty_longform (line 2951) | def test_whisper_empty_longform(self): method test_whisper_empty_longform_multi_gpu (line 2990) | def test_whisper_empty_longform_multi_gpu(self): method test_tiny_static_generation (line 3027) | def test_tiny_static_generation(self): method test_tiny_static_generation_long_form (line 3055) | def test_tiny_static_generation_long_form(self): class WhisperEncoderModelTester (line 3116) | class WhisperEncoderModelTester: method __init__ (line 3117) | def __init__( method get_config (line 3163) | def get_config(self): method prepare_config_and_inputs (line 3184) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 3191) | def prepare_config_and_inputs_for_common(self): method get_subsampled_output_lengths (line 3195) | def get_subsampled_output_lengths(self, input_lengths): method encoder_seq_length (line 3206) | def encoder_seq_length(self): method create_and_check_model_forward (line 3209) | def create_and_check_model_forward(self, config, inputs_dict, use_weig... class WhisperEncoderModelTest (line 3223) | class WhisperEncoderModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 3229) | def setUp(self): method test_config (line 3234) | def test_config(self): method test_forward_signature (line 3237) | def test_forward_signature(self): method test_forward_pass (line 3249) | def test_forward_pass(self): method test_forward_pass_weighted_layer_sum (line 3253) | def test_forward_pass_weighted_layer_sum(self): method test_inputs_embeds (line 3258) | def test_inputs_embeds(self): method test_encoder_outputs (line 3263) | def test_encoder_outputs(self): method test_model_get_set_embeddings (line 3293) | def test_model_get_set_embeddings(self): method test_resize_tokens_embeddings (line 3305) | def test_resize_tokens_embeddings(self): class WhisperStandaloneDecoderModelTester (line 3309) | class WhisperStandaloneDecoderModelTester: method __init__ (line 3310) | def __init__( method prepare_config_and_inputs (line 3358) | def prepare_config_and_inputs(self): method encoder_seq_length (line 3381) | def encoder_seq_length(self): method seq_length (line 3385) | def seq_length(self): method get_config (line 3388) | def get_config(self): method prepare_config_and_inputs_for_common (line 3411) | def prepare_config_and_inputs_for_common(self): method create_and_check_decoder_model_past (line 3418) | def create_and_check_decoder_model_past(self, config, input_ids): method create_and_check_decoder_model_attention_mask_past (line 3448) | def create_and_check_decoder_model_attention_mask_past(self, config, i... class WhisperStandaloneDecoderModelTest (line 3491) | class WhisperStandaloneDecoderModelTest(ModelTesterMixin, GenerationTest... method setUp (line 3496) | def setUp(self): method test_config (line 3500) | def test_config(self): method test_decoder_model_past (line 3503) | def test_decoder_model_past(self): method test_decoder_model_attn_mask_past (line 3509) | def test_decoder_model_attn_mask_past(self): method test_retain_grad_hidden_states_attentions (line 3518) | def test_retain_grad_hidden_states_attentions(self): method test_flex_attention_with_grads (line 3522) | def test_flex_attention_with_grads(): FILE: tests/models/whisper/test_processing_whisper.py class WhisperProcessorTest (line 39) | class WhisperProcessorTest(unittest.TestCase): method setUp (line 40) | def setUp(self): method get_tokenizer (line 44) | def get_tokenizer(self, **kwargs): method get_feature_extractor (line 47) | def get_feature_extractor(self, **kwargs): method tearDown (line 50) | def tearDown(self): method test_save_load_pretrained_default (line 53) | def test_save_load_pretrained_default(self): method test_save_load_pretrained_additional_features (line 68) | def test_save_load_pretrained_additional_features(self): method test_feature_extractor (line 85) | def test_feature_extractor(self): method test_tokenizer (line 99) | def test_tokenizer(self): method test_tokenizer_decode (line 114) | def test_tokenizer_decode(self): method test_get_decoder_prompt_ids (line 127) | def test_get_decoder_prompt_ids(self): method test_get_prompt_ids (line 141) | def test_get_prompt_ids(self): method test_empty_get_prompt_ids (line 149) | def test_empty_get_prompt_ids(self): method test_get_prompt_ids_with_special_tokens (line 157) | def test_get_prompt_ids_with_special_tokens(self): method test_find_longest_common_subsequence_old (line 170) | def test_find_longest_common_subsequence_old(self): function _fast_find_longest_common_sequence (line 335) | def _fast_find_longest_common_sequence(sequence_left, sequence_right): function _find_timestamp_sequence (line 356) | def _find_timestamp_sequence(sequences, tokenizer, feature_extractor, ma... FILE: tests/models/whisper/test_tokenization_whisper.py class WhisperTokenizerTest (line 35) | class WhisperTokenizerTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 45) | def setUpClass(cls): method test_convert_token_and_id (line 53) | def test_convert_token_and_id(self): method test_full_tokenizer (line 63) | def test_full_tokenizer(self): method test_tokenizer_slow_store_full_signature (line 89) | def test_tokenizer_slow_store_full_signature(self): method test_tokenizer_fast_store_full_signature (line 93) | def test_tokenizer_fast_store_full_signature(self): method test_special_tokens_initialization (line 97) | def test_special_tokens_initialization(self): method test_tokenizer_integration (line 106) | def test_tokenizer_integration(self): method test_output_offsets (line 113) | def test_output_offsets(self): method test_find_longest_common_subsequence (line 143) | def test_find_longest_common_subsequence(self): method test_skip_special_tokens_skips_prompt_ids (line 189) | def test_skip_special_tokens_skips_prompt_ids(self): method test_skip_special_tokens_with_timestamps (line 203) | def test_skip_special_tokens_with_timestamps(self): method test_fast_tokenizer_get_prompt_ids (line 226) | def test_fast_tokenizer_get_prompt_ids(self): method test_tokenizer_decode_prompt (line 235) | def test_tokenizer_decode_prompt(self): method test_combine_tokens_into_words (line 259) | def test_combine_tokens_into_words(self): method test_basic_normalizer (line 272) | def test_basic_normalizer(self): method test_decode_asr_with_word_level_timestamps (line 292) | def test_decode_asr_with_word_level_timestamps(self): class SpeechToTextTokenizerMultilinguialTest (line 321) | class SpeechToTextTokenizerMultilinguialTest(unittest.TestCase): method setUpClass (line 325) | def setUpClass(cls): method test_tokenizer_equivalence (line 329) | def test_tokenizer_equivalence(self): method test_tokenizer_special (line 357) | def test_tokenizer_special(self): method test_vocab_size (line 386) | def test_vocab_size(self): method test_tokenizer_decode_ignores_language_codes (line 390) | def test_tokenizer_decode_ignores_language_codes(self): method test_batch_encoding (line 398) | def test_batch_encoding(self): method test_set_prefix_tokens (line 416) | def test_set_prefix_tokens(self): method test_batch_encoding_decoding (line 438) | def test_batch_encoding_decoding(self): method test_offset_decoding (line 445) | def test_offset_decoding(self): method test_convert_to_list_np (line 521) | def test_convert_to_list_np(self): method test_convert_to_list_pt (line 534) | def test_convert_to_list_pt(self): FILE: tests/models/x_clip/test_modeling_x_clip.py class XCLIPVisionModelTester (line 55) | class XCLIPVisionModelTester: method __init__ (line 56) | def __init__( method prepare_config_and_inputs (line 96) | def prepare_config_and_inputs(self): method get_config (line 104) | def get_config(self): method create_and_check_model (line 120) | def create_and_check_model(self, config, pixel_values): method prepare_config_and_inputs_for_common (line 135) | def prepare_config_and_inputs_for_common(self): class XCLIPVisionModelTest (line 143) | class XCLIPVisionModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 153) | def setUp(self): method test_config (line 159) | def test_config(self): method test_inputs_embeds (line 163) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 166) | def test_model_get_set_embeddings(self): method test_forward_signature (line 175) | def test_forward_signature(self): method test_model (line 187) | def test_model(self): method test_training (line 192) | def test_training(self): method test_training_gradient_checkpointing (line 196) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 200) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 204) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 208) | def test_model_from_pretrained(self): method test_gradient_checkpointing_backward_compatibility (line 213) | def test_gradient_checkpointing_backward_compatibility(self): method test_attention_outputs (line 226) | def test_attention_outputs(self): method test_multi_gpu_data_parallel_forward (line 282) | def test_multi_gpu_data_parallel_forward(self): class XCLIPTextModelTester (line 307) | class XCLIPTextModelTester: method __init__ (line 308) | def __init__( method prepare_config_and_inputs (line 344) | def prepare_config_and_inputs(self): method get_config (line 362) | def get_config(self): method create_and_check_model (line 375) | def create_and_check_model(self, config, input_ids, input_mask): method prepare_config_and_inputs_for_common (line 385) | def prepare_config_and_inputs_for_common(self): class XCLIPTextModelTest (line 393) | class XCLIPTextModelTest(ModelTesterMixin, unittest.TestCase): method setUp (line 396) | def setUp(self): method test_config (line 400) | def test_config(self): method test_model (line 403) | def test_model(self): method test_training (line 408) | def test_training(self): method test_training_gradient_checkpointing (line 412) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 416) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 420) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_inputs_embeds (line 424) | def test_inputs_embeds(self): method test_model_from_pretrained (line 428) | def test_model_from_pretrained(self): class XCLIPModelTester (line 434) | class XCLIPModelTester: method __init__ (line 435) | def __init__( method prepare_config_and_inputs (line 457) | def prepare_config_and_inputs(self): method get_config (line 474) | def get_config(self): method create_and_check_model (line 481) | def create_and_check_model(self, config, input_ids, attention_mask, pi... method prepare_config_and_inputs_for_common (line 494) | def prepare_config_and_inputs_for_common(self): class XCLIPModelTest (line 507) | class XCLIPModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method setUp (line 516) | def setUp(self): method test_config (line 523) | def test_config(self): method test_model (line 526) | def test_model(self): method test_hidden_states_output (line 531) | def test_hidden_states_output(self): method test_inputs_embeds (line 535) | def test_inputs_embeds(self): method test_retain_grad_hidden_states_attentions (line 539) | def test_retain_grad_hidden_states_attentions(self): method test_model_get_set_embeddings (line 543) | def test_model_get_set_embeddings(self): method test_feed_forward_chunking (line 547) | def test_feed_forward_chunking(self): method test_load_vision_text_config (line 550) | def test_load_vision_text_config(self): method test_model_from_pretrained (line 566) | def test_model_from_pretrained(self): method _video_features_prepare_config_and_inputs (line 571) | def _video_features_prepare_config_and_inputs(self): function prepare_video (line 587) | def prepare_video(): class XCLIPModelIntegrationTest (line 597) | class XCLIPModelIntegrationTest(unittest.TestCase): method test_inference (line 599) | def test_inference(self): method test_inference_interpolate_pos_encoding (line 628) | def test_inference_interpolate_pos_encoding(self): FILE: tests/models/xcodec/test_modeling_xcodec.py class XcodecModelTester (line 45) | class XcodecModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 74) | def prepare_config_and_inputs(self): method prepare_config_and_inputs_for_common (line 81) | def prepare_config_and_inputs_for_common(self): method prepare_config_and_inputs_for_model_class (line 85) | def prepare_config_and_inputs_for_model_class(self, model_class): method get_config (line 93) | def get_config(self): method create_and_check_model_forward (line 102) | def create_and_check_model_forward(self, config, inputs_dict): class XcodecModelTest (line 109) | class XcodecModelTest(ModelTesterMixin, unittest.TestCase): method _prepare_for_class (line 115) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 124) | def setUp(self): method test_config (line 130) | def test_config(self): method test_model_forward (line 133) | def test_model_forward(self): method test_forward_signature (line 137) | def test_forward_signature(self): method test_gradient_checkpointing_backward_compatibility (line 149) | def test_gradient_checkpointing_backward_compatibility(self): method test_inputs_embeds (line 163) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 167) | def test_model_get_set_embeddings(self): method test_retain_grad_hidden_states_attentions (line 171) | def test_retain_grad_hidden_states_attentions(self): method test_attention_outputs (line 175) | def test_attention_outputs(self): method test_hidden_states_output (line 179) | def test_hidden_states_output(self): method test_determinism (line 183) | def test_determinism(self): method test_model_outputs_equivalence (line 210) | def test_model_outputs_equivalence(self): method test_sdpa_can_compile_dynamic (line 248) | def test_sdpa_can_compile_dynamic(self): function normalize (line 253) | def normalize(arr): function compute_rmse (line 260) | def compute_rmse(arr1, arr2): class XcodecIntegrationTest (line 305) | class XcodecIntegrationTest(unittest.TestCase): method test_integration (line 308) | def test_integration( FILE: tests/models/xglm/test_modeling_xglm.py class XGLMModelTester (line 42) | class XGLMModelTester: method __init__ (line 43) | def __init__( method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs( method get_config (line 101) | def get_config( method create_and_check_xglm_model (line 122) | def create_and_check_xglm_model(self, config, input_ids, input_mask, *... method create_and_check_xglm_model_past (line 133) | def create_and_check_xglm_model_past(self, config, input_ids, input_ma... method create_and_check_xglm_model_attention_mask_past (line 163) | def create_and_check_xglm_model_attention_mask_past(self, config, inpu... method create_and_check_xglm_model_past_large_inputs (line 198) | def create_and_check_xglm_model_past_large_inputs(self, config, input_... method create_and_check_lm_head_model (line 230) | def create_and_check_lm_head_model(self, config, input_ids, input_mask... method create_and_check_forward_and_backwards (line 239) | def create_and_check_forward_and_backwards( method create_and_check_xglm_weight_initialization (line 252) | def create_and_check_xglm_weight_initialization(self, config, *args): method prepare_config_and_inputs_for_common (line 260) | def prepare_config_and_inputs_for_common(self): class XGLMModelTest (line 277) | class XGLMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method setUp (line 284) | def setUp(self): method test_config (line 288) | def test_config(self): method test_xglm_model (line 291) | def test_xglm_model(self): method test_xglm_model_past (line 295) | def test_xglm_model_past(self): method test_xglm_model_att_mask_past (line 299) | def test_xglm_model_att_mask_past(self): method test_xglm_model_past_large_inputs (line 303) | def test_xglm_model_past_large_inputs(self): method test_xglm_lm_head_model (line 307) | def test_xglm_lm_head_model(self): method test_xglm_gradient_checkpointing (line 311) | def test_xglm_gradient_checkpointing(self): method test_xglm_weight_initialization (line 315) | def test_xglm_weight_initialization(self): method test_model_from_pretrained (line 320) | def test_model_from_pretrained(self): method test_model_parallelism (line 326) | def test_model_parallelism(self): class XGLMModelLanguageGenerationTest (line 331) | class XGLMModelLanguageGenerationTest(unittest.TestCase): method tearDown (line 332) | def tearDown(self): method _test_lm_generate_xglm_helper (line 337) | def _test_lm_generate_xglm_helper( method test_batch_generation (line 356) | def test_batch_generation(self): method test_lm_generate_xglm (line 408) | def test_lm_generate_xglm(self): method test_lm_generate_xglm_with_gradient_checkpointing (line 412) | def test_lm_generate_xglm_with_gradient_checkpointing(self): method test_xglm_sample (line 416) | def test_xglm_sample(self): method test_batched_nan_fp16 (line 445) | def test_batched_nan_fp16(self): method test_loss_with_padding (line 464) | def test_loss_with_padding(self): FILE: tests/models/xglm/test_tokenization_xglm.py class XGLMTokenizationTest (line 23) | class XGLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 32) | def setUpClass(cls): FILE: tests/models/xlm/test_modeling_xlm.py class XLMModelTester (line 41) | class XLMModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 102) | def prepare_config_and_inputs(self): method get_config (line 139) | def get_config(self): method create_and_check_xlm_model (line 161) | def create_and_check_xlm_model( method create_and_check_xlm_lm_head (line 181) | def create_and_check_xlm_lm_head( method create_and_check_xlm_simple_qa (line 201) | def create_and_check_xlm_simple_qa( method create_and_check_xlm_qa (line 224) | def create_and_check_xlm_qa( method create_and_check_xlm_sequence_classif (line 276) | def create_and_check_xlm_sequence_classif( method create_and_check_xlm_token_classif (line 297) | def create_and_check_xlm_token_classif( method create_and_check_xlm_for_multiple_choice (line 317) | def create_and_check_xlm_for_multiple_choice( method prepare_config_and_inputs_for_common (line 344) | def prepare_config_and_inputs_for_common(self): class XLMModelTest (line 362) | class XLMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method _greedy_generate (line 389) | def _greedy_generate(self, *args, use_cache=False, **kwargs): method _sample_generate (line 393) | def _sample_generate(self, *args, use_cache=False, **kwargs): method _beam_search_generate (line 397) | def _beam_search_generate(self, *args, use_cache=False, **kwargs): method _beam_sample_generate (line 401) | def _beam_sample_generate(self, *args, use_cache=False, **kwargs): method is_pipeline_test_to_skip (line 406) | def is_pipeline_test_to_skip( method _prepare_for_class (line 429) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 443) | def setUp(self): method test_config (line 447) | def test_config(self): method test_xlm_model (line 450) | def test_xlm_model(self): method test_xlm_model_with_sinusoidal_encodings (line 455) | def test_xlm_model_with_sinusoidal_encodings(self): method test_xlm_lm_head (line 462) | def test_xlm_lm_head(self): method test_xlm_simple_qa (line 466) | def test_xlm_simple_qa(self): method test_xlm_qa (line 470) | def test_xlm_qa(self): method test_xlm_sequence_classif (line 474) | def test_xlm_sequence_classif(self): method test_xlm_token_classif (line 478) | def test_xlm_token_classif(self): method test_xlm_for_multiple_choice (line 482) | def test_xlm_for_multiple_choice(self): method _check_attentions_for_generate (line 486) | def _check_attentions_for_generate( method _check_hidden_states_for_generate (line 496) | def _check_hidden_states_for_generate( method test_model_from_pretrained (line 507) | def test_model_from_pretrained(self): method test_generate_methods_with_logits_to_keep (line 513) | def test_generate_methods_with_logits_to_keep(self): method test_generate_with_and_without_position_ids (line 517) | def test_generate_with_and_without_position_ids(self): class XLMModelLanguageGenerationTest (line 522) | class XLMModelLanguageGenerationTest(unittest.TestCase): method test_lm_generate_xlm_mlm_en_2048 (line 524) | def test_lm_generate_xlm_mlm_en_2048(self): FILE: tests/models/xlm/test_tokenization_xlm.py class XLMTokenizationTest (line 27) | class XLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase): method setUpClass (line 33) | def setUpClass(cls): method test_full_tokenizer (line 61) | def test_full_tokenizer(self): method test_sequence_builders (line 109) | def test_sequence_builders(self): FILE: tests/models/xlm_roberta/test_modeling_xlm_roberta.py class XLMRobertaModelIntegrationTest (line 37) | class XLMRobertaModelIntegrationTest(unittest.TestCase): method test_xlm_roberta_base (line 38) | def test_xlm_roberta_base(self): method test_xlm_roberta_base_sdpa (line 56) | def test_xlm_roberta_base_sdpa(self): method test_xlm_roberta_large (line 72) | def test_xlm_roberta_large(self): FILE: tests/models/xlm_roberta/test_tokenization_xlm_roberta.py class XLMRobertaTokenizationTest (line 26) | class XLMRobertaTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/xlm_roberta_xl/test_modeling_xlm_roberta_xl.py class XLMRobertaXLModelTester (line 43) | class XLMRobertaXLModelTester: method __init__ (line 44) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 115) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 130) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 157) | def create_and_check_model( method create_and_check_model_as_decoder (line 170) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 203) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 221) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_masked_lm (line 289) | def create_and_check_for_masked_lm( method create_and_check_for_token_classification (line 298) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 308) | def create_and_check_for_multiple_choice( method create_and_check_for_question_answering (line 326) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 342) | def prepare_config_and_inputs_for_common(self): class XLMRobertaXLModelTest (line 358) | class XLMRobertaXLModelTest(ModelTesterMixin, GenerationTesterMixin, Pip... method is_pipeline_test_to_skip (line 388) | def is_pipeline_test_to_skip( method prepare_config_and_inputs_for_generate (line 404) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method setUp (line 409) | def setUp(self): method test_config (line 413) | def test_config(self): method test_model (line 416) | def test_model(self): method test_model_as_decoder (line 420) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 424) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 451) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 455) | def test_decoder_model_past_with_large_inputs(self): method test_for_masked_lm (line 459) | def test_for_masked_lm(self): method test_for_token_classification (line 463) | def test_for_token_classification(self): method test_for_multiple_choice (line 467) | def test_for_multiple_choice(self): method test_for_question_answering (line 471) | def test_for_question_answering(self): method test_create_position_ids_respects_padding_index (line 475) | def test_create_position_ids_respects_padding_index(self): method test_create_position_ids_from_inputs_embeds (line 493) | def test_create_position_ids_from_inputs_embeds(self): method flash_attn_inference_equivalence (line 514) | def flash_attn_inference_equivalence( method test_flash_attn_2_inference_equivalence_right_padding (line 619) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_eager_padding_matches_padding_free_with_position_ids (line 623) | def test_eager_padding_matches_padding_free_with_position_ids(self): method test_sdpa_padding_matches_padding_free_with_position_ids (line 627) | def test_sdpa_padding_matches_padding_free_with_position_ids(self): class XLMRobertaModelXLIntegrationTest (line 632) | class XLMRobertaModelXLIntegrationTest(unittest.TestCase): method test_xlm_roberta_xl (line 634) | def test_xlm_roberta_xl(self): method test_xlm_roberta_xxl (line 653) | def test_xlm_roberta_xxl(self): FILE: tests/models/xlnet/test_modeling_xlnet.py class XLNetModelTester (line 41) | class XLNetModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 95) | def prepare_config_and_inputs(self): method get_config (line 146) | def get_config(self): method set_seed (line 165) | def set_seed(self): method create_and_check_xlnet_base_model (line 169) | def create_and_check_xlnet_base_model( method create_and_check_use_mems_train (line 206) | def create_and_check_use_mems_train( method create_and_check_xlnet_model_use_mems (line 235) | def create_and_check_xlnet_model_use_mems( method create_and_check_xlnet_base_model_with_att_output (line 301) | def create_and_check_xlnet_base_model_with_att_output( method create_and_check_xlnet_lm_head (line 327) | def create_and_check_xlnet_lm_head( method create_and_check_xlnet_qa (line 366) | def create_and_check_xlnet_qa( method create_and_check_xlnet_token_classif (line 429) | def create_and_check_xlnet_token_classif( method create_and_check_xlnet_sequence_classif (line 458) | def create_and_check_xlnet_sequence_classif( method prepare_config_and_inputs_for_common (line 487) | def prepare_config_and_inputs_for_common(self): class XLNetModelTest (line 508) | class XLNetModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method is_pipeline_test_to_skip (line 535) | def is_pipeline_test_to_skip( method _prepare_for_class (line 551) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 565) | def setUp(self): method test_config (line 569) | def test_config(self): method test_xlnet_base_model (line 572) | def test_xlnet_base_model(self): method test_xlnet_base_model_use_mems (line 577) | def test_xlnet_base_model_use_mems(self): method test_seq_classification_use_mems_train (line 583) | def test_seq_classification_use_mems_train(self): method test_xlnet_base_model_with_att_output (line 587) | def test_xlnet_base_model_with_att_output(self): method test_xlnet_lm_head (line 592) | def test_xlnet_lm_head(self): method test_xlnet_sequence_classif (line 597) | def test_xlnet_sequence_classif(self): method test_xlnet_token_classif (line 602) | def test_xlnet_token_classif(self): method test_xlnet_qa (line 607) | def test_xlnet_qa(self): method test_retain_grad_hidden_states_attentions (line 613) | def test_retain_grad_hidden_states_attentions(self): method _mock_init_weights (line 617) | def _mock_init_weights(self, module): method _check_hidden_states_for_generate (line 628) | def _check_hidden_states_for_generate( method _check_attentions_for_generate (line 652) | def _check_attentions_for_generate( method test_model_from_pretrained (line 682) | def test_model_from_pretrained(self): class XLNetModelLanguageGenerationTest (line 689) | class XLNetModelLanguageGenerationTest(unittest.TestCase): method test_lm_generate_xlnet_base_cased (line 691) | def test_lm_generate_xlnet_base_cased(self): FILE: tests/models/xlnet/test_tokenization_xlnet.py class XLNetTokenizationTest (line 28) | class XLNetTokenizationTest(TokenizerTesterMixin, unittest.TestCase): FILE: tests/models/xlstm/test_modeling_xlstm.py class xLSTMModelTester (line 44) | class xLSTMModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 94) | def prepare_config_and_inputs(self, scale_attn_by_inverse_layer_idx=Fa... method get_config (line 116) | def get_config(self): method prepare_config_and_inputs_for_common (line 140) | def prepare_config_and_inputs_for_common(self): class xLSTMModelTest (line 154) | class xLSTMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method setUp (line 163) | def setUp(self): method test_generate_without_input_ids (line 170) | def test_generate_without_input_ids(self): method test_generate_from_inputs_embeds (line 175) | def test_generate_from_inputs_embeds(self, _, num_beams): method test_greedy_generate_dict_outputs_use_cache (line 179) | def test_greedy_generate_dict_outputs_use_cache(self): method test_beam_search_generate_dict_outputs_use_cache (line 183) | def test_beam_search_generate_dict_outputs_use_cache(self): method test_multi_gpu_data_parallel_forward (line 187) | def test_multi_gpu_data_parallel_forward(self): method test_model_outputs_equivalence (line 190) | def test_model_outputs_equivalence(self): method test_chunkwise_shape_calculation (line 245) | def test_chunkwise_shape_calculation(self): class xLSTMIntegrationTest (line 267) | class xLSTMIntegrationTest(unittest.TestCase): method setUp (line 268) | def setUp(self): method test_simple_generate (line 273) | def test_simple_generate(self): method test_batched_equivalence_with_cache (line 293) | def test_batched_equivalence_with_cache(self): method test_batched_equivalence_without_cache (line 321) | def test_batched_equivalence_without_cache(self): method test_xlstm_block_train_vs_eval_equivalence (line 350) | def test_xlstm_block_train_vs_eval_equivalence(self): FILE: tests/models/xmod/test_modeling_xmod.py class XmodModelTester (line 41) | class XmodModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 90) | def prepare_config_and_inputs(self): method get_config (line 113) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 129) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 156) | def create_and_check_model( method create_and_check_model_as_decoder (line 169) | def create_and_check_model_as_decoder( method create_and_check_for_causal_lm (line 202) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 220) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_masked_lm (line 288) | def create_and_check_for_masked_lm( method create_and_check_for_token_classification (line 297) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 307) | def create_and_check_for_multiple_choice( method create_and_check_for_question_answering (line 325) | def create_and_check_for_question_answering( method prepare_config_and_inputs_for_common (line 341) | def prepare_config_and_inputs_for_common(self): class XmodModelTest (line 357) | class XmodModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes... method is_pipeline_test_to_skip (line 385) | def is_pipeline_test_to_skip( method prepare_config_and_inputs_for_generate (line 401) | def prepare_config_and_inputs_for_generate(self, batch_size=2): method setUp (line 406) | def setUp(self): method test_config (line 410) | def test_config(self): method test_model (line 413) | def test_model(self): method test_model_as_decoder (line 417) | def test_model_as_decoder(self): method test_model_as_decoder_with_default_input_mask (line 421) | def test_model_as_decoder_with_default_input_mask(self): method test_for_causal_lm (line 448) | def test_for_causal_lm(self): method test_decoder_model_past_with_large_inputs (line 452) | def test_decoder_model_past_with_large_inputs(self): method test_for_masked_lm (line 456) | def test_for_masked_lm(self): method test_for_token_classification (line 460) | def test_for_token_classification(self): method test_for_multiple_choice (line 464) | def test_for_multiple_choice(self): method test_for_question_answering (line 468) | def test_for_question_answering(self): method test_create_position_ids_respects_padding_index (line 472) | def test_create_position_ids_respects_padding_index(self): method test_create_position_ids_from_inputs_embeds (line 490) | def test_create_position_ids_from_inputs_embeds(self): method test_set_default_language (line 511) | def test_set_default_language(self): method test_freeze_embeddings_and_language_adapters (line 519) | def test_freeze_embeddings_and_language_adapters(self): class XmodModelIntegrationTest (line 531) | class XmodModelIntegrationTest(unittest.TestCase): method test_xmod_base (line 533) | def test_xmod_base(self): method test_xmod_large_prenorm (line 566) | def test_xmod_large_prenorm(self): method test_multilingual_batch (line 602) | def test_multilingual_batch(self): method test_end_to_end_mask_fill (line 628) | def test_end_to_end_mask_fill(self): FILE: tests/models/yolos/test_image_processing_yolos.py class YolosImageProcessingTester (line 36) | class YolosImageProcessingTester: method __init__ (line 37) | def __init__( method prepare_image_processor_dict (line 69) | def prepare_image_processor_dict(self): method get_expected_values (line 81) | def get_expected_values(self, image_inputs, batched=False): method expected_output_image_shape (line 124) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 128) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... class YolosImageProcessingTest (line 142) | class YolosImageProcessingTest(AnnotationFormatTestMixin, ImageProcessin... method setUp (line 143) | def setUp(self): method image_processor_dict (line 148) | def image_processor_dict(self): method test_image_processor_properties (line 151) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 160) | def test_image_processor_from_dict_with_kwargs(self): method test_resize_max_size_respected (line 179) | def test_resize_max_size_respected(self, image_size, longest_edge, sho... method test_call_pytorch_with_coco_detection_annotations (line 198) | def test_call_pytorch_with_coco_detection_annotations(self): method test_call_pytorch_with_coco_panoptic_annotations (line 243) | def test_call_pytorch_with_coco_panoptic_annotations(self): method test_batched_coco_detection_annotations (line 295) | def test_batched_coco_detection_annotations(self): method test_batched_coco_panoptic_annotations (line 414) | def test_batched_coco_panoptic_annotations(self): method test_max_width_max_height_resizing_and_pad_strategy (line 538) | def test_max_width_max_height_resizing_and_pad_strategy(self): FILE: tests/models/yolos/test_modeling_yolos.py class YolosModelTester (line 41) | class YolosModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 92) | def prepare_config_and_inputs(self): method get_config (line 111) | def get_config(self): method create_and_check_model (line 130) | def create_and_check_model(self, config, pixel_values, labels): method create_and_check_for_object_detection (line 139) | def create_and_check_for_object_detection(self, config, pixel_values, ... method prepare_config_and_inputs_for_common (line 156) | def prepare_config_and_inputs_for_common(self): class YolosModelTest (line 164) | class YolosModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes... method _prepare_for_class (line 180) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method setUp (line 199) | def setUp(self): method test_config (line 203) | def test_config(self): method test_inputs_embeds (line 207) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 210) | def test_model_get_set_embeddings(self): method test_model (line 219) | def test_model(self): method test_attention_outputs (line 223) | def test_attention_outputs(self): method test_hidden_states_output (line 279) | def test_hidden_states_output(self): method test_for_object_detection (line 315) | def test_for_object_detection(self): method test_model_from_pretrained (line 320) | def test_model_from_pretrained(self): function prepare_img (line 327) | def prepare_img(): class YolosModelIntegrationTest (line 334) | class YolosModelIntegrationTest(unittest.TestCase): method default_image_processor (line 336) | def default_image_processor(self): method test_inference_object_detection_head (line 340) | def test_inference_object_detection_head(self): FILE: tests/models/yoso/test_modeling_yoso.py class YosoModelTester (line 39) | class YosoModelTester: method __init__ (line 40) | def __init__( method prepare_config_and_inputs (line 88) | def prepare_config_and_inputs(self): method get_config (line 111) | def get_config(self): method get_pipeline_config (line 127) | def get_pipeline_config(self): method prepare_config_and_inputs_for_decoder (line 132) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 159) | def create_and_check_model( method create_and_check_for_masked_lm (line 170) | def create_and_check_for_masked_lm( method create_and_check_for_question_answering (line 179) | def create_and_check_for_question_answering( method create_and_check_for_sequence_classification (line 195) | def create_and_check_for_sequence_classification( method create_and_check_for_token_classification (line 205) | def create_and_check_for_token_classification( method create_and_check_for_multiple_choice (line 215) | def create_and_check_for_multiple_choice( method prepare_config_and_inputs_for_common (line 233) | def prepare_config_and_inputs_for_common(self): class YosoModelTest (line 249) | class YosoModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test... method setUp (line 275) | def setUp(self): method test_config (line 279) | def test_config(self): method test_model (line 282) | def test_model(self): method test_for_masked_lm (line 286) | def test_for_masked_lm(self): method test_for_multiple_choice (line 290) | def test_for_multiple_choice(self): method test_for_question_answering (line 294) | def test_for_question_answering(self): method test_for_sequence_classification (line 298) | def test_for_sequence_classification(self): method test_for_token_classification (line 302) | def test_for_token_classification(self): method test_model_from_pretrained (line 307) | def test_model_from_pretrained(self): method test_attention_outputs (line 313) | def test_attention_outputs(self): class YosoModelIntegrationTest (line 318) | class YosoModelIntegrationTest(unittest.TestCase): method test_inference_no_head (line 320) | def test_inference_no_head(self): method test_inference_masked_lm (line 337) | def test_inference_masked_lm(self): method test_inference_masked_lm_long_input (line 356) | def test_inference_masked_lm_long_input(self): FILE: tests/models/youtu/test_modeling_youtu.py class YoutuModelTester (line 45) | class YoutuModelTester(CausalLMModelTester): method __init__ (line 49) | def __init__( class YoutuModelTest (line 67) | class YoutuModelTest(CausalLMModelTest, unittest.TestCase): method _check_past_key_values_for_generate (line 70) | def _check_past_key_values_for_generate(self, batch_size, past_key_val... method test_sdpa_can_dispatch_on_flash (line 88) | def test_sdpa_can_dispatch_on_flash(self): class YoutuIntegrationTest (line 93) | class YoutuIntegrationTest(unittest.TestCase): method tearDown (line 94) | def tearDown(self): method test_dynamic_cache (line 99) | def test_dynamic_cache(self): method test_static_cache (line 123) | def test_static_cache(self): method test_compile_static_cache (line 151) | def test_compile_static_cache(self): FILE: tests/models/zamba/test_modeling_zamba.py class ZambaModelTester (line 44) | class ZambaModelTester: method __init__ (line 45) | def __init__( method prepare_config_and_inputs (line 103) | def prepare_config_and_inputs(self): method get_config (line 122) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 145) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 166) | def create_and_check_model(self, config, input_ids, input_mask, sequen... method create_and_check_for_causal_lm (line 174) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 192) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_sequence_classification (line 245) | def create_and_check_for_sequence_classification( method prepare_config_and_inputs_for_common (line 255) | def prepare_config_and_inputs_for_common(self): class ZambaModelTest (line 270) | class ZambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTe... method _get_conv_state_shape (line 292) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 296) | def _get_recurrent_state_shape(self, batch_size: int, config): method setUp (line 300) | def setUp(self): method test_disk_offload_bin (line 307) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 313) | def test_disk_offload_safetensors(self): method test_cpu_offload (line 319) | def test_cpu_offload(self): method test_config (line 322) | def test_config(self): method test_model (line 325) | def test_model(self): method test_for_causal_lm (line 329) | def test_for_causal_lm(self): method test_for_sequence_classification (line 333) | def test_for_sequence_classification(self): method test_decoder_model_past_with_large_inputs (line 337) | def test_decoder_model_past_with_large_inputs(self): method test_attention_outputs (line 341) | def test_attention_outputs(self): method _get_input_ids_and_config (line 411) | def _get_input_ids_and_config(self): method test_flash_attn_2_fp32_ln (line 428) | def test_flash_attn_2_fp32_ln(self): class ZambaModelIntegrationTest (line 463) | class ZambaModelIntegrationTest(unittest.TestCase): method setUpClass (line 469) | def setUpClass(cls): method test_simple_generate (line 475) | def test_simple_generate(self): method test_simple_batched_generate_with_padding (line 504) | def test_simple_batched_generate_with_padding(self): FILE: tests/models/zamba2/test_modeling_zamba2.py class Zamba2ModelTester (line 45) | class Zamba2ModelTester: method __init__ (line 46) | def __init__( method prepare_config_and_inputs (line 110) | def prepare_config_and_inputs(self): method get_config (line 129) | def get_config(self): method prepare_config_and_inputs_for_decoder (line 155) | def prepare_config_and_inputs_for_decoder(self): method create_and_check_model (line 176) | def create_and_check_model(self, config, input_ids, input_mask, sequen... method create_and_check_for_causal_lm (line 184) | def create_and_check_for_causal_lm( method create_and_check_decoder_model_past_large_inputs (line 202) | def create_and_check_decoder_model_past_large_inputs( method create_and_check_for_sequence_classification (line 255) | def create_and_check_for_sequence_classification( method prepare_config_and_inputs_for_common (line 265) | def prepare_config_and_inputs_for_common(self): class Zamba2ModelTest (line 280) | class Zamba2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT... method _get_conv_state_shape (line 302) | def _get_conv_state_shape(self, batch_size: int, config): method _get_recurrent_state_shape (line 311) | def _get_recurrent_state_shape(self, batch_size: int, config): method setUp (line 314) | def setUp(self): method test_num_layers_is_small (line 319) | def test_num_layers_is_small(self): method test_disk_offload_bin (line 325) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 331) | def test_disk_offload_safetensors(self): method test_cpu_offload (line 337) | def test_cpu_offload(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 341) | def test_flash_attention_2_padding_matches_padding_free_with_position_... method test_generate_continue_from_inputs_embeds (line 345) | def test_generate_continue_from_inputs_embeds(self): method test_multi_gpu_data_parallel_forward (line 349) | def test_multi_gpu_data_parallel_forward(self): method test_config (line 352) | def test_config(self): method test_model (line 355) | def test_model(self): method test_for_causal_lm (line 359) | def test_for_causal_lm(self): method test_for_sequence_classification (line 363) | def test_for_sequence_classification(self): method test_decoder_model_past_with_large_inputs (line 367) | def test_decoder_model_past_with_large_inputs(self): method test_attention_outputs (line 371) | def test_attention_outputs(self): method _get_input_ids_and_config (line 430) | def _get_input_ids_and_config(self): method test_flash_attn_2_fp32_ln (line 447) | def test_flash_attn_2_fp32_ln(self): method test_flex_attention_with_grads (line 481) | def test_flex_attention_with_grads(self): class Zamba2ModelIntegrationTest (line 504) | class Zamba2ModelIntegrationTest(unittest.TestCase): method setUpClass (line 510) | def setUpClass(cls): method test_simple_generate (line 517) | def test_simple_generate(self, torch_device): method test_simple_batched_generate_with_padding (line 546) | def test_simple_batched_generate_with_padding(self, torch_device): FILE: tests/models/zoedepth/test_image_processing_zoedepth.py class ZoeDepthDepthOutputProxy (line 32) | class ZoeDepthDepthOutputProxy: class ZoeDepthImageProcessingTester (line 36) | class ZoeDepthImageProcessingTester: method __init__ (line 37) | def __init__( method prepare_image_processor_dict (line 70) | def prepare_image_processor_dict(self): method expected_output_image_shape (line 82) | def expected_output_image_shape(self, images): method prepare_image_inputs (line 85) | def prepare_image_inputs(self, equal_resolution=False, numpify=False, ... method prepare_depth_outputs (line 96) | def prepare_depth_outputs(self): class ZoeDepthImageProcessingTest (line 112) | class ZoeDepthImageProcessingTest(ImageProcessingTestMixin, unittest.Tes... method setUp (line 113) | def setUp(self): method image_processor_dict (line 119) | def image_processor_dict(self): method test_image_processor_properties (line 122) | def test_image_processor_properties(self): method test_image_processor_from_dict_with_kwargs (line 135) | def test_image_processor_from_dict_with_kwargs(self): method test_ensure_multiple_of (line 146) | def test_ensure_multiple_of(self): method test_keep_aspect_ratio (line 178) | def test_keep_aspect_ratio(self): method test_post_processing_equivalence (line 218) | def test_post_processing_equivalence(self): FILE: tests/models/zoedepth/test_modeling_zoedepth.py class ZoeDepthModelTester (line 41) | class ZoeDepthModelTester: method __init__ (line 42) | def __init__( method prepare_config_and_inputs (line 86) | def prepare_config_and_inputs(self): method get_config (line 97) | def get_config(self): method get_backbone_config (line 107) | def get_backbone_config(self): method create_and_check_for_depth_estimation (line 121) | def create_and_check_for_depth_estimation(self, config, pixel_values, ... method prepare_config_and_inputs_for_common (line 129) | def prepare_config_and_inputs_for_common(self): class ZoeDepthModelTest (line 137) | class ZoeDepthModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.... method setUp (line 148) | def setUp(self): method test_config (line 154) | def test_config(self): method test_inputs_embeds (line 158) | def test_inputs_embeds(self): method test_model_get_set_embeddings (line 162) | def test_model_get_set_embeddings(self): method test_for_depth_estimation (line 165) | def test_for_depth_estimation(self): method test_model_common_attributes (line 170) | def test_model_common_attributes(self): method test_training (line 174) | def test_training(self): method test_training_gradient_checkpointing (line 178) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 182) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 186) | def test_training_gradient_checkpointing_use_reentrant_true(self): method test_model_from_pretrained (line 190) | def test_model_from_pretrained(self): function prepare_img (line 197) | def prepare_img(): class ZoeDepthModelIntegrationTest (line 205) | class ZoeDepthModelIntegrationTest(unittest.TestCase): method test_inference_depth_estimation (line 225) | def test_inference_depth_estimation(self): method test_inference_depth_estimation_multiple_heads (line 247) | def test_inference_depth_estimation_multiple_heads(self): method check_target_size (line 269) | def check_target_size( method check_post_processing_test (line 295) | def check_post_processing_test(self, image_processor, images, model, p... method test_post_processing_depth_estimation_post_processing_nopad_noflip (line 319) | def test_post_processing_depth_estimation_post_processing_nopad_noflip... method test_inference_depth_estimation_post_processing_nopad_flip (line 328) | def test_inference_depth_estimation_post_processing_nopad_flip(self): method test_inference_depth_estimation_post_processing_pad_noflip (line 337) | def test_inference_depth_estimation_post_processing_pad_noflip(self): method test_inference_depth_estimation_post_processing_pad_flip (line 346) | def test_inference_depth_estimation_post_processing_pad_flip(self): FILE: tests/optimization/test_greedy_lr.py class GreedyLRTest (line 29) | class GreedyLRTest(unittest.TestCase): method _get_scheduler (line 30) | def _get_scheduler(self, **kwargs): method test_initialization_valid_params (line 49) | def test_initialization_valid_params(self): method test_initialization_max_mode (line 58) | def test_initialization_max_mode(self): method test_initialization_invalid_factor (line 63) | def test_initialization_invalid_factor(self): method test_initialization_invalid_mode (line 69) | def test_initialization_invalid_mode(self): method test_initialization_invalid_threshold_mode (line 73) | def test_initialization_invalid_threshold_mode(self): method test_initialization_not_optimizer (line 77) | def test_initialization_not_optimizer(self): method test_lr_decrease_on_plateau (line 81) | def test_lr_decrease_on_plateau(self): method test_lr_increase_on_improvement (line 95) | def test_lr_increase_on_improvement(self): method test_lr_never_below_min_lr (line 109) | def test_lr_never_below_min_lr(self): method test_lr_never_above_max_lr (line 119) | def test_lr_never_above_max_lr(self): method test_cooldown_prevents_further_reduction (line 130) | def test_cooldown_prevents_further_reduction(self): method test_warmup_prevents_further_increase (line 145) | def test_warmup_prevents_further_increase(self): method test_smoothing_uses_streaming_average (line 162) | def test_smoothing_uses_streaming_average(self): method test_no_smoothing_by_default (line 179) | def test_no_smoothing_by_default(self): method test_state_dict_round_trip (line 183) | def test_state_dict_round_trip(self): method test_state_dict_contains_all_keys (line 211) | def test_state_dict_contains_all_keys(self): method test_load_state_dict_backward_compatibility (line 245) | def test_load_state_dict_backward_compatibility(self): method test_factory_function (line 263) | def test_factory_function(self): method test_factory_function_with_kwargs (line 272) | def test_factory_function_with_kwargs(self): method test_get_scheduler_integration (line 282) | def test_get_scheduler_integration(self): method test_get_last_lr (line 295) | def test_get_last_lr(self): method test_reset_at_min_lr (line 302) | def test_reset_at_min_lr(self): method test_max_mode_lr_decrease (line 314) | def test_max_mode_lr_decrease(self): method test_max_mode_lr_increase (line 325) | def test_max_mode_lr_increase(self): method test_relative_threshold_mode (line 337) | def test_relative_threshold_mode(self): method test_multiple_param_groups (line 346) | def test_multiple_param_groups(self): class StreamingAverageTest (line 364) | class StreamingAverageTest(unittest.TestCase): method test_basic_average (line 365) | def test_basic_average(self): method test_state_dict_round_trip (line 373) | def test_state_dict_round_trip(self): class BackwardCompatibilityTest (line 389) | class BackwardCompatibilityTest(unittest.TestCase): method test_default_lr_scheduler_type_unchanged (line 390) | def test_default_lr_scheduler_type_unchanged(self): method test_existing_schedulers_still_work (line 396) | def test_existing_schedulers_still_work(self): FILE: tests/optimization/test_optimization.py function unwrap_schedule (line 42) | def unwrap_schedule(scheduler, num_steps=10): function unwrap_and_save_reload_schedule (line 50) | def unwrap_and_save_reload_schedule(scheduler, num_steps=10): class OptimizationTest (line 66) | class OptimizationTest(unittest.TestCase): method assertListAlmostEqual (line 67) | def assertListAlmostEqual(self, list1, list2, tol): method test_adam_w (line 72) | def test_adam_w(self): method test_adafactor (line 86) | def test_adafactor(self): class ScheduleInitTest (line 113) | class ScheduleInitTest(unittest.TestCase): method assertListAlmostEqual (line 118) | def assertListAlmostEqual(self, list1, list2, tol, msg=None): method test_schedulers (line 123) | def test_schedulers(self): method test_get_scheduler (line 178) | def test_get_scheduler(self): class LambdaScheduleWrapper (line 220) | class LambdaScheduleWrapper: method __init__ (line 223) | def __init__(self, fn): method __call__ (line 226) | def __call__(self, *args, **kwargs): method wrap_scheduler (line 230) | def wrap_scheduler(cls, scheduler): FILE: tests/peft_integration/test_peft_integration.py class PeftTesterMixin (line 58) | class PeftTesterMixin: class PeftIntegrationTester (line 66) | class PeftIntegrationTester(unittest.TestCase, PeftTesterMixin): method _check_lora_correctly_converted (line 71) | def _check_lora_correctly_converted(self, model): method _get_bnb_4bit_config (line 86) | def _get_bnb_4bit_config(self): method _get_bnb_8bit_config (line 89) | def _get_bnb_8bit_config(self): method test_peft_from_pretrained (line 92) | def test_peft_from_pretrained(self): method test_peft_state_dict (line 113) | def test_peft_state_dict(self): method test_peft_save_pretrained (line 127) | def test_peft_save_pretrained(self): method test_peft_enable_disable_adapters (line 149) | def test_peft_enable_disable_adapters(self): method test_peft_add_adapter (line 178) | def test_peft_add_adapter(self): method test_peft_add_adapter_from_pretrained (line 196) | def test_peft_add_adapter_from_pretrained(self): method test_peft_add_adapter_modules_to_save (line 216) | def test_peft_add_adapter_modules_to_save(self): method test_peft_add_adapter_training_gradient_checkpointing (line 254) | def test_peft_add_adapter_training_gradient_checkpointing(self): method test_peft_add_multi_adapter (line 300) | def test_peft_add_multi_adapter(self): method test_delete_adapter (line 364) | def test_delete_adapter(self): method test_delete_adapter_with_modules_to_save (line 428) | def test_delete_adapter_with_modules_to_save(self): method test_peft_from_pretrained_kwargs (line 454) | def test_peft_from_pretrained_kwargs(self): method test_peft_save_quantized (line 474) | def test_peft_save_quantized(self): method test_peft_save_quantized_regression (line 517) | def test_peft_save_quantized_regression(self): method test_peft_pipeline (line 556) | def test_peft_pipeline(self): method test_peft_add_adapter_with_state_dict (line 570) | def test_peft_add_adapter_with_state_dict(self): method test_peft_add_adapter_with_state_dict_low_cpu_mem_usage (line 601) | def test_peft_add_adapter_with_state_dict_low_cpu_mem_usage(self): method test_peft_from_pretrained_hub_kwargs (line 630) | def test_peft_from_pretrained_hub_kwargs(self): method test_peft_from_pretrained_unexpected_keys_warning (line 658) | def test_peft_from_pretrained_unexpected_keys_warning(self): method test_peft_from_pretrained_missing_keys_warning (line 684) | def test_peft_from_pretrained_missing_keys_warning(self): method test_peft_load_adapter_training_inference_mode_true (line 723) | def test_peft_load_adapter_training_inference_mode_true(self): method test_peft_load_adapter_training_inference_mode_false (line 741) | def test_peft_load_adapter_training_inference_mode_false(self): method test_prefix_tuning_trainer_load_best_model_at_end_error (line 767) | def test_prefix_tuning_trainer_load_best_model_at_end_error(self): method test_peft_pipeline_no_warning (line 840) | def test_peft_pipeline_no_warning(self): method test_non_lora_load_adapter (line 881) | def test_non_lora_load_adapter(self): method test_non_lora_add_adapter (line 913) | def test_non_lora_add_adapter(self): method test_mixtral_lora_conversion (line 935) | def test_mixtral_lora_conversion(self): class PeftHotswapIntegrationTest (line 975) | class PeftHotswapIntegrationTest(unittest.TestCase): method tearDown (line 976) | def tearDown(self): method _check_model_hotswap (line 982) | def _check_model_hotswap(self, *, rank1, rank2, do_compile): method test_hotswap_wrong_peft_type_raises (line 1047) | def test_hotswap_wrong_peft_type_raises(self): method test_hotswap_without_existing_adapter_raises (line 1061) | def test_hotswap_without_existing_adapter_raises(self): method test_hotswap_different_adapter_name_raises (line 1071) | def test_hotswap_different_adapter_name_raises(self): method test_enable_peft_hotswap_called_after_adapter_added_raises (line 1083) | def test_enable_peft_hotswap_called_after_adapter_added_raises(self): method test_enable_peft_hotswap_called_after_adapter_added_warns (line 1096) | def test_enable_peft_hotswap_called_after_adapter_added_warns(self): method test_enable_peft_hotswap_called_after_adapter_added_ignored (line 1112) | def test_enable_peft_hotswap_called_after_adapter_added_ignored(self): method test_hotswap_without_compile_and_same_ranks_works (line 1126) | def test_hotswap_without_compile_and_same_ranks_works(self): method test_hotswap_without_compile_and_with_lower_rank_works (line 1129) | def test_hotswap_without_compile_and_with_lower_rank_works(self): method test_hotswap_without_compile_and_with_higher_rank_works (line 1132) | def test_hotswap_without_compile_and_with_higher_rank_works(self): method test_hotswap_with_compile_and_same_ranks_works (line 1135) | def test_hotswap_with_compile_and_same_ranks_works(self): method test_hotswap_with_compile_and_lower_rank_works (line 1143) | def test_hotswap_with_compile_and_lower_rank_works(self): method test_hotswap_with_compile_and_higher_rank_works (line 1151) | def test_hotswap_with_compile_and_higher_rank_works(self): method test_maybe_load_adapters_path_not_overwritten_for_complete_model (line 1159) | def test_maybe_load_adapters_path_not_overwritten_for_complete_model(s... FILE: tests/pipelines/test_pipelines_any_to_any.py class AnyToAnyPipelineTests (line 46) | class AnyToAnyPipelineTests(unittest.TestCase): method get_test_pipeline (line 51) | def get_test_pipeline( method run_pipeline_test (line 115) | def run_pipeline_test(self, pipe, examples): method test_small_model_pt_token_text_only (line 178) | def test_small_model_pt_token_text_only(self): method test_small_model_pt_chat_with_response_parsing (line 306) | def test_small_model_pt_chat_with_response_parsing(self): method test_small_model_pt_token_audio_input (line 336) | def test_small_model_pt_token_audio_input(self): method test_small_model_pt_token_audio_gen (line 374) | def test_small_model_pt_token_audio_gen(self): method test_small_model_pt_image_gen (line 454) | def test_small_model_pt_image_gen(self): FILE: tests/pipelines/test_pipelines_audio_classification.py class AudioClassificationPipelineTests (line 43) | class AudioClassificationPipelineTests(unittest.TestCase): method _load_dataset (line 48) | def _load_dataset(cls): method get_test_pipeline (line 55) | def get_test_pipeline( method run_pipeline_test (line 78) | def run_pipeline_test(self, audio_classifier, examples): method run_torchaudio (line 103) | def run_torchaudio(self, audio_classifier): method test_small_model_pt (line 117) | def test_small_model_pt(self): method test_small_model_pt_fp16 (line 144) | def test_small_model_pt_fp16(self): method test_large_model_pt (line 175) | def test_large_model_pt(self): method test_top_k_none_returns_all_labels (line 195) | def test_top_k_none_returns_all_labels(self): method test_top_k_none_with_few_labels (line 214) | def test_top_k_none_with_few_labels(self): method test_top_k_greater_than_labels (line 233) | def test_top_k_greater_than_labels(self): FILE: tests/pipelines/test_pipelines_automatic_speech_recognition.py class AutomaticSpeechRecognitionPipelineTests (line 59) | class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase): method get_test_pipeline (line 65) | def get_test_pipeline( method run_pipeline_test (line 99) | def run_pipeline_test(self, speech_recognizer, examples): method test_pt_defaults (line 163) | def test_pt_defaults(self): method test_small_model_pt (line 167) | def test_small_model_pt(self): method test_small_model_pt_fp16 (line 186) | def test_small_model_pt_fp16(self): method test_small_model_pt_bf16 (line 206) | def test_small_model_pt_bf16(self): method test_whisper_fp16 (line 226) | def test_whisper_fp16(self): method test_small_model_pt_seq2seq (line 237) | def test_small_model_pt_seq2seq(self): method test_small_model_pt_seq2seq_gen_kwargs (line 249) | def test_small_model_pt_seq2seq_gen_kwargs(self): method test_large_model_pt_with_lm (line 262) | def test_large_model_pt_with_lm(self): method test_torch_small_no_tokenizer_files (line 325) | def test_torch_small_no_tokenizer_files(self): method test_torch_large (line 335) | def test_torch_large(self): method test_torch_large_with_input_features (line 352) | def test_torch_large_with_input_features(self): method test_return_timestamps_in_preprocess (line 369) | def test_return_timestamps_in_preprocess(self): method test_return_timestamps_and_language_in_preprocess (line 414) | def test_return_timestamps_and_language_in_preprocess(self): method test_return_timestamps_in_preprocess_longform (line 472) | def test_return_timestamps_in_preprocess_longform(self): method test_return_timestamps_in_init (line 535) | def test_return_timestamps_in_init(self): method test_torch_whisper (line 591) | def test_torch_whisper(self): method test_torch_whisper_batched (line 607) | def test_torch_whisper_batched(self): method test_whisper_timestamp_prediction (line 626) | def test_whisper_timestamp_prediction(self): method test_whisper_large_timestamp_prediction (line 724) | def test_whisper_large_timestamp_prediction(self): method test_whisper_word_timestamps_batched (line 813) | def test_whisper_word_timestamps_batched(self): method test_whisper_large_word_timestamps_batched (line 858) | def test_whisper_large_word_timestamps_batched(self): method test_torch_speech_encoder_decoder (line 902) | def test_torch_speech_encoder_decoder(self): method test_simple_wav2vec2 (line 916) | def test_simple_wav2vec2(self): method test_simple_s2t (line 939) | def test_simple_s2t(self): method test_simple_whisper_asr (line 966) | def test_simple_whisper_asr(self): method test_simple_whisper_translation (line 1035) | def test_simple_whisper_translation(self): method test_whisper_language (line 1070) | def test_whisper_language(self): method test_speculative_decoding_whisper_non_distil (line 1105) | def test_speculative_decoding_whisper_non_distil(self): method test_speculative_decoding_whisper_distil (line 1147) | def test_speculative_decoding_whisper_distil(self): method test_xls_r_to_en (line 1191) | def test_xls_r_to_en(self): method test_xls_r_from_en (line 1206) | def test_xls_r_from_en(self): method test_speech_to_text_leveraged (line 1221) | def test_speech_to_text_leveraged(self): method test_wav2vec2_conformer_float16 (line 1236) | def test_wav2vec2_conformer_float16(self): method test_chunking_fast (line 1254) | def test_chunking_fast(self): method test_input_parameter_passthrough (line 1271) | def test_input_parameter_passthrough(self): method test_return_timestamps_ctc_fast (line 1290) | def test_return_timestamps_ctc_fast(self): method test_chunking_fast_with_lm (line 1334) | def test_chunking_fast_with_lm(self): method test_with_lm_fast (line 1362) | def test_with_lm_fast(self): method test_with_local_lm_fast (line 1388) | def test_with_local_lm_fast(self): method test_whisper_prompted (line 1409) | def test_whisper_prompted(self): method test_whisper_longform (line 1445) | def test_whisper_longform(self): method test_seamless_v2 (line 1482) | def test_seamless_v2(self): method test_chunking_and_timestamps (line 1499) | def test_chunking_and_timestamps(self): method test_chunking_with_lm (line 1617) | def test_chunking_with_lm(self): method test_chunk_iterator (line 1634) | def test_chunk_iterator(self): method test_chunk_iterator_stride (line 1670) | def test_chunk_iterator_stride(self): method test_stride (line 1719) | def test_stride(self): method test_slow_unfinished_sequence (line 1742) | def test_slow_unfinished_sequence(self): method test_pipeline_assisted_generation (line 1769) | def test_pipeline_assisted_generation(self): method test_pipeline_generation_kwargs (line 1783) | def test_pipeline_generation_kwargs(self): function require_ffmpeg (line 1809) | def require_ffmpeg(test_case): function bytes_iter (line 1825) | def bytes_iter(chunk_size, chunks): class AudioUtilsTest (line 1831) | class AudioUtilsTest(unittest.TestCase): method test_chunk_bytes_iter_too_big (line 1832) | def test_chunk_bytes_iter_too_big(self): method test_chunk_bytes_iter (line 1838) | def test_chunk_bytes_iter(self): method test_chunk_bytes_iter_stride (line 1845) | def test_chunk_bytes_iter_stride(self): method test_chunk_bytes_iter_stride_stream (line 1856) | def test_chunk_bytes_iter_stride_stream(self): method test_ffmpeg_no_additional_args (line 1884) | def test_ffmpeg_no_additional_args(self): method test_ffmpeg_additional_args (line 1888) | def test_ffmpeg_additional_args(self): FILE: tests/pipelines/test_pipelines_common.py class ANY (line 74) | class ANY: method __init__ (line 75) | def __init__(self, *_types): method __eq__ (line 78) | def __eq__(self, other): method __repr__ (line 81) | def __repr__(self): class CommonPipelineTest (line 86) | class CommonPipelineTest(unittest.TestCase): method test_pipeline_iteration (line 88) | def test_pipeline_iteration(self): method test_check_task_auto_inference (line 110) | def test_check_task_auto_inference(self): method test_pipeline_batch_size_global (line 116) | def test_pipeline_batch_size_global(self): method test_pipeline_pathlike (line 126) | def test_pipeline_pathlike(self): method test_pipeline_override (line 135) | def test_pipeline_override(self): method test_check_task (line 143) | def test_check_task(self): method test_iterator_data (line 152) | def test_iterator_data(self): method test_unbatch_attentions_hidden_states (line 174) | def test_unbatch_attentions_hidden_states(self): method test_dtype_property (line 187) | def test_dtype_property(self): method test_auto_model_pipeline_registration_from_local_dir (line 210) | def test_auto_model_pipeline_registration_from_local_dir(self): method test_pipeline_from_local_with_embedded_adapter (line 219) | def test_pipeline_from_local_with_embedded_adapter(self): class PipelineScikitCompatTest (line 265) | class PipelineScikitCompatTest(unittest.TestCase): method test_pipeline_predict (line 266) | def test_pipeline_predict(self): method test_pipeline_transform (line 275) | def test_pipeline_transform(self): class PipelinePadTest (line 286) | class PipelinePadTest(unittest.TestCase): method test_pipeline_padding (line 288) | def test_pipeline_padding(self): method test_pipeline_image_padding (line 324) | def test_pipeline_image_padding(self): method test_pipeline_offset_mapping (line 347) | def test_pipeline_offset_mapping(self): class PipelineUtilsTest (line 368) | class PipelineUtilsTest(unittest.TestCase): method test_pipeline_dataset (line 370) | def test_pipeline_dataset(self): method test_pipeline_iterator (line 384) | def test_pipeline_iterator(self): method test_pipeline_iterator_no_len (line 399) | def test_pipeline_iterator_no_len(self): method test_pipeline_batch_unbatch_iterator (line 416) | def test_pipeline_batch_unbatch_iterator(self): method test_pipeline_batch_unbatch_iterator_tensors (line 430) | def test_pipeline_batch_unbatch_iterator_tensors(self): method test_pipeline_chunk_iterator (line 448) | def test_pipeline_chunk_iterator(self): method test_pipeline_pack_iterator (line 463) | def test_pipeline_pack_iterator(self): method test_pipeline_pack_unbatch_iterator (line 496) | def test_pipeline_pack_unbatch_iterator(self): method test_pipeline_negative_device (line 520) | def test_pipeline_negative_device(self): method test_pipeline_no_device (line 529) | def test_pipeline_no_device(self): method test_pipeline_device_not_equal_model_device (line 558) | def test_pipeline_device_not_equal_model_device(self): method test_load_default_pipelines_pt (line 576) | def test_load_default_pipelines_pt(self): method test_load_default_pipelines_pt_table_qa (line 595) | def test_load_default_pipelines_pt_table_qa(self): method test_pipeline_accelerator (line 608) | def test_pipeline_accelerator(self): method test_pipeline_accelerator_indexed (line 615) | def test_pipeline_accelerator_indexed(self): method test_bc_torch_device (line 621) | def test_bc_torch_device(self): method check_default_pipeline (line 647) | def check_default_pipeline(self, task, set_seed_fn, check_models_equal... method check_models_equal_pt (line 689) | def check_models_equal_pt(self, model1, model2): class CustomPipeline (line 698) | class CustomPipeline(Pipeline): method _sanitize_parameters (line 699) | def _sanitize_parameters(self, **kwargs): method preprocess (line 705) | def preprocess(self, text, maybe_arg=2): method _forward (line 709) | def _forward(self, model_inputs): method postprocess (line 713) | def postprocess(self, model_outputs): class CustomPipelineTest (line 718) | class CustomPipelineTest(unittest.TestCase): method test_warning_logs (line 719) | def test_warning_logs(self): method test_register_pipeline (line 736) | def test_register_pipeline(self): method test_dynamic_pipeline (line 756) | def test_dynamic_pipeline(self): method test_cached_pipeline_has_minimum_calls_to_head (line 806) | def test_cached_pipeline_has_minimum_calls_to_head(self): method test_chunk_pipeline_batching_single_file (line 816) | def test_chunk_pipeline_batching_single_file(self): method test_custom_code_with_string_tokenizer (line 839) | def test_custom_code_with_string_tokenizer(self): method test_custom_code_with_string_feature_extractor (line 853) | def test_custom_code_with_string_feature_extractor(self): method test_custom_code_with_string_preprocessor (line 865) | def test_custom_code_with_string_preprocessor(self): class DynamicPipelineTester (line 878) | class DynamicPipelineTester(unittest.TestCase): method setUpClass (line 882) | def setUpClass(cls): method tearDownClass (line 886) | def tearDownClass(cls): method test_push_to_hub_dynamic_pipeline (line 893) | def test_push_to_hub_dynamic_pipeline(self): FILE: tests/pipelines/test_pipelines_depth_estimation.py class Image (line 43) | class Image: method open (line 45) | def open(*args, **kwargs): function hashimage (line 49) | def hashimage(image: Image) -> str: class DepthEstimationPipelineTests (line 58) | class DepthEstimationPipelineTests(unittest.TestCase): method _load_dataset (line 63) | def _load_dataset(cls): method get_test_pipeline (line 72) | def get_test_pipeline( method run_pipeline_test (line 94) | def run_pipeline_test(self, depth_estimator, examples): method test_large_model_pt (line 127) | def test_large_model_pt(self): method test_small_model_pt (line 139) | def test_small_model_pt(self): method test_multiprocess (line 144) | def test_multiprocess(self): FILE: tests/pipelines/test_pipelines_document_question_answering.py class Image (line 48) | class Image: method open (line 50) | def open(*args, **kwargs): function load_image (line 53) | def load_image(_): class DocumentQuestionAnsweringPipelineTests (line 67) | class DocumentQuestionAnsweringPipelineTests(unittest.TestCase): method get_test_pipeline (line 72) | def get_test_pipeline( method run_pipeline_test (line 111) | def run_pipeline_test(self, dqa_pipeline, examples): method test_small_model_pt (line 127) | def test_small_model_pt(self): method test_small_model_pt_bf16 (line 161) | def test_small_model_pt_bf16(self): method test_large_model_pt (line 210) | def test_large_model_pt(self): method test_large_model_pt_chunk (line 255) | def test_large_model_pt_chunk(self): method test_large_model_pt_layoutlm (line 301) | def test_large_model_pt_layoutlm(self): method test_large_model_pt_layoutlm_chunk (line 362) | def test_large_model_pt_layoutlm_chunk(self): method test_large_model_pt_donut (line 413) | def test_large_model_pt_donut(self): FILE: tests/pipelines/test_pipelines_feature_extraction.py class FeatureExtractionPipelineTests (line 36) | class FeatureExtractionPipelineTests(unittest.TestCase): method test_small_model_pt (line 40) | def test_small_model_pt(self): method test_tokenization_small_model_pt (line 48) | def test_tokenization_small_model_pt(self): method test_return_tensors_pt (line 86) | def test_return_tensors_pt(self): method get_shape (line 91) | def get_shape(self, input_, shape=None): method get_test_pipeline (line 107) | def get_test_pipeline( method run_pipeline_test (line 144) | def run_pipeline_test(self, feature_extractor, examples): FILE: tests/pipelines/test_pipelines_fill_mask.py class FillMaskPipelineTests (line 35) | class FillMaskPipelineTests(unittest.TestCase): method tearDown (line 38) | def tearDown(self): method test_small_model_pt (line 46) | def test_small_model_pt(self): method test_fp16_casting (line 109) | def test_fp16_casting(self): method test_large_model_pt (line 127) | def test_large_model_pt(self): method run_large_test (line 131) | def run_large_test(self, unmasker): method test_model_no_pad_pt (line 191) | def test_model_no_pad_pt(self): method get_test_pipeline (line 197) | def get_test_pipeline( method run_pipeline_test (line 222) | def run_pipeline_test(self, fill_masker, examples): method run_test_targets (line 285) | def run_test_targets(self, model, tokenizer): method run_test_top_k (line 339) | def run_test_top_k(self, model, tokenizer): method run_test_top_k_targets (line 361) | def run_test_top_k_targets(self, model, tokenizer): method fill_mask_with_duplicate_targets_and_top_k (line 378) | def fill_mask_with_duplicate_targets_and_top_k(self, model, tokenizer): method fill_mask_with_multiple_masks (line 390) | def fill_mask_with_multiple_masks(self, model, tokenizer): FILE: tests/pipelines/test_pipelines_image_classification.py class Image (line 46) | class Image: method open (line 48) | def open(*args, **kwargs): class ImageClassificationPipelineTests (line 55) | class ImageClassificationPipelineTests(unittest.TestCase): method _load_dataset (line 60) | def _load_dataset(cls): method get_test_pipeline (line 69) | def get_test_pipeline( method run_pipeline_test (line 93) | def run_pipeline_test(self, image_classifier, examples): method test_small_model_pt (line 149) | def test_small_model_pt(self): method test_custom_tokenizer (line 174) | def test_custom_tokenizer(self): method test_torch_float16_pipeline (line 185) | def test_torch_float16_pipeline(self): method test_torch_bfloat16_pipeline (line 197) | def test_torch_bfloat16_pipeline(self): method test_perceiver (line 210) | def test_perceiver(self): method test_multilabel_classification (line 255) | def test_multilabel_classification(self): method test_function_to_apply (line 284) | def test_function_to_apply(self): FILE: tests/pipelines/test_pipelines_image_feature_extraction.py function prepare_img (line 39) | def prepare_img(): class ImageFeatureExtractionPipelineTests (line 45) | class ImageFeatureExtractionPipelineTests(unittest.TestCase): method test_small_model_pt (line 49) | def test_small_model_pt(self): method test_small_model_w_pooler_pt (line 58) | def test_small_model_w_pooler_pt(self): method test_image_processing_small_model_pt (line 69) | def test_image_processing_small_model_pt(self): method test_return_tensors_pt (line 89) | def test_return_tensors_pt(self): method get_test_pipeline (line 95) | def get_test_pipeline( method run_pipeline_test (line 132) | def run_pipeline_test(self, feature_extractor, examples): FILE: tests/pipelines/test_pipelines_image_segmentation.py class Image (line 55) | class Image: method open (line 57) | def open(*args, **kwargs): function hashimage (line 61) | def hashimage(image: Image) -> str: function mask_to_test_readable (line 66) | def mask_to_test_readable(mask: Image) -> dict: function mask_to_test_readable_only_shape (line 73) | def mask_to_test_readable_only_shape(mask: Image) -> dict: class ImageSegmentationPipelineTests (line 83) | class ImageSegmentationPipelineTests(unittest.TestCase): method _load_dataset (line 92) | def _load_dataset(cls): method get_test_pipeline (line 101) | def get_test_pipeline( method run_pipeline_test (line 123) | def run_pipeline_test(self, image_segmenter, examples): method test_small_model_pt_no_panoptic (line 205) | def test_small_model_pt_no_panoptic(self): method test_small_model_pt (line 228) | def test_small_model_pt(self): method test_small_model_pt_semantic (line 365) | def test_small_model_pt_semantic(self): method test_integration_torch_image_segmentation (line 391) | def test_integration_torch_image_segmentation(self): method test_threshold (line 528) | def test_threshold(self): method test_maskformer (line 591) | def test_maskformer(self): method test_oneformer (line 651) | def test_oneformer(self): method test_save_load (line 751) | def test_save_load(self): FILE: tests/pipelines/test_pipelines_image_text_to_text.py class Image (line 36) | class Image: method open (line 38) | def open(*args, **kwargs): class ImageTextToTextPipelineTests (line 44) | class ImageTextToTextPipelineTests(unittest.TestCase): method get_test_pipeline (line 47) | def get_test_pipeline(self, model, tokenizer, processor, image_process... method run_pipeline_test (line 62) | def run_pipeline_test(self, pipe, examples): method test_small_model_pt_token_text_only (line 72) | def test_small_model_pt_token_text_only(self): method test_small_model_pt_token (line 167) | def test_small_model_pt_token(self): method test_consistent_batching_behaviour (line 231) | def test_consistent_batching_behaviour(self): method test_model_pt_chat_template_with_response_parsing (line 242) | def test_model_pt_chat_template_with_response_parsing(self): method test_model_pt_chat_template (line 281) | def test_model_pt_chat_template(self): method test_model_pt_chat_template_continue_final_message (line 364) | def test_model_pt_chat_template_continue_final_message(self): method test_model_pt_chat_template_new_text (line 429) | def test_model_pt_chat_template_new_text(self): method test_model_pt_chat_template_image_url (line 467) | def test_model_pt_chat_template_image_url(self): method test_model_pt_chat_template_image_url_base64 (line 488) | def test_model_pt_chat_template_image_url_base64(self): FILE: tests/pipelines/test_pipelines_keypoint_matching.py class KeypointMatchingPipelineTests (line 37) | class KeypointMatchingPipelineTests(unittest.TestCase): method _load_dataset (line 42) | def _load_dataset(cls): method get_test_pipeline (line 47) | def get_test_pipeline( method run_pipeline_test (line 70) | def run_pipeline_test(self, image_matcher, examples): method test_single_image (line 119) | def test_single_image(self): method test_single_pair (line 136) | def test_single_pair(self): method test_multiple_pairs (line 153) | def test_multiple_pairs(self): FILE: tests/pipelines/test_pipelines_mask_generation.py class Image (line 47) | class Image: method open (line 49) | def open(*args, **kwargs): function hashimage (line 53) | def hashimage(image: Image) -> str: function mask_to_test_readable (line 58) | def mask_to_test_readable(mask: Image) -> dict: class MaskGenerationPipelineTests (line 67) | class MaskGenerationPipelineTests(unittest.TestCase): method get_test_pipeline (line 70) | def get_test_pipeline( method run_pipeline_test (line 93) | def run_pipeline_test(self, mask_generator, examples): method test_small_model_pt (line 98) | def test_small_model_pt(self): method test_threshold (line 154) | def test_threshold(self): FILE: tests/pipelines/test_pipelines_object_detection.py class Image (line 46) | class Image: method open (line 48) | def open(*args, **kwargs): class ObjectDetectionPipelineTests (line 56) | class ObjectDetectionPipelineTests(unittest.TestCase): method _load_dataset (line 61) | def _load_dataset(cls): method get_test_pipeline (line 70) | def get_test_pipeline( method run_pipeline_test (line 89) | def run_pipeline_test(self, object_detector, examples): method test_small_model_pt (line 131) | def test_small_model_pt(self): method test_large_model_pt (line 172) | def test_large_model_pt(self): method test_integration_torch_object_detection (line 219) | def test_integration_torch_object_detection(self): method test_threshold (line 264) | def test_threshold(self): method test_layoutlm (line 282) | def test_layoutlm(self): FILE: tests/pipelines/test_pipelines_table_question_answering.py class TQAPipelineTests (line 32) | class TQAPipelineTests(unittest.TestCase): method test_small_model_pt (line 38) | def test_small_model_pt(self, dtype="float32"): method test_small_model_pt_fp16 (line 140) | def test_small_model_pt_fp16(self): method test_slow_tokenizer_sqa_pt (line 144) | def test_slow_tokenizer_sqa_pt(self, dtype="float32"): method test_slow_tokenizer_sqa_pt_fp16 (line 263) | def test_slow_tokenizer_sqa_pt_fp16(self): method test_integration_wtq_pt (line 268) | def test_integration_wtq_pt(self, dtype="float32"): method test_integration_wtq_pt_fp16 (line 313) | def test_integration_wtq_pt_fp16(self): method test_integration_sqa_pt (line 318) | def test_integration_sqa_pt(self, dtype="float32"): method test_integration_sqa_pt_fp16 (line 343) | def test_integration_sqa_pt_fp16(self): method test_large_model_pt_tapex (line 348) | def test_large_model_pt_tapex(self, dtype="float32"): FILE: tests/pipelines/test_pipelines_text_classification.py class TextClassificationPipelineTests (line 45) | class TextClassificationPipelineTests(unittest.TestCase): method test_small_model_pt (line 52) | def test_small_model_pt(self): method test_accepts_torch_device (line 82) | def test_accepts_torch_device(self): method test_accepts_torch_fp16 (line 93) | def test_accepts_torch_fp16(self): method test_accepts_torch_bf16 (line 105) | def test_accepts_torch_bf16(self): method test_pt_bert (line 118) | def test_pt_bert(self): method get_test_pipeline (line 128) | def get_test_pipeline( method run_pipeline_test (line 147) | def run_pipeline_test(self, text_classifier, _): FILE: tests/pipelines/test_pipelines_text_generation.py class TextGenerationPipelineTests (line 38) | class TextGenerationPipelineTests(unittest.TestCase): method test_small_model_pt (line 42) | def test_small_model_pt(self): method test_small_chat_model_pt (line 71) | def test_small_chat_model_pt(self): method test_small_chat_model_continue_final_message (line 116) | def test_small_chat_model_continue_final_message(self): method test_small_chat_model_continue_final_message_override (line 149) | def test_small_chat_model_continue_final_message_override(self): method test_small_chat_model_with_dataset_pt (line 180) | def test_small_chat_model_with_dataset_pt(self): method test_small_chat_model_with_iterator_pt (line 222) | def test_small_chat_model_with_iterator_pt(self): method test_small_chat_model_with_response_parsing (line 264) | def test_small_chat_model_with_response_parsing(self): method get_test_pipeline (line 288) | def get_test_pipeline( method test_stop_sequence_stopping_criteria (line 305) | def test_stop_sequence_stopping_criteria(self): method run_pipeline_test (line 319) | def run_pipeline_test(self, text_generator, _): method test_small_model_pt_bloom_accelerate (line 418) | def test_small_model_pt_bloom_accelerate(self): method test_small_model_fp16 (line 463) | def test_small_model_fp16(self): method test_pipeline_accelerate_top_p (line 477) | def test_pipeline_accelerate_top_p(self): method test_pipeline_length_setting_warning (line 488) | def test_pipeline_length_setting_warning(self): method test_return_dict_in_generate (line 508) | def test_return_dict_in_generate(self): method test_pipeline_assisted_generation (line 534) | def test_pipeline_assisted_generation(self): method test_pipeline_skip_special_tokens (line 548) | def test_pipeline_skip_special_tokens(self): method test_forward_tokenizer_kwargs (line 563) | def test_forward_tokenizer_kwargs(self): FILE: tests/pipelines/test_pipelines_text_to_audio.py class TextToAudioPipelineTests (line 40) | class TextToAudioPipelineTests(unittest.TestCase): method test_small_speecht5_pt (line 45) | def test_small_speecht5_pt(self): method test_small_musicgen_pt (line 77) | def test_small_musicgen_pt(self): method test_medium_seamless_m4t_pt (line 103) | def test_medium_seamless_m4t_pt(self): method test_small_bark_pt (line 124) | def test_small_bark_pt(self): method test_conversion_additional_tensor (line 176) | def test_conversion_additional_tensor(self): method test_vits_model_pt (line 213) | def test_vits_model_pt(self): method test_forward_model_kwargs (line 232) | def test_forward_model_kwargs(self): method test_generative_model_kwargs (line 256) | def test_generative_model_kwargs(self): method test_csm_model_pt (line 285) | def test_csm_model_pt(self): method test_dia_model (line 315) | def test_dia_model(self): method get_test_pipeline (line 348) | def get_test_pipeline( method run_pipeline_test (line 373) | def run_pipeline_test(self, speech_generator, _): FILE: tests/pipelines/test_pipelines_token_classification.py class TokenClassificationPipelineTests (line 52) | class TokenClassificationPipelineTests(unittest.TestCase): method get_test_pipeline (line 58) | def get_test_pipeline( method run_pipeline_test (line 77) | def run_pipeline_test(self, token_classifier, _): method run_aggregation_strategy (line 136) | def run_aggregation_strategy(self, model, tokenizer): method test_chunking (line 217) | def test_chunking(self): method test_is_split_into_words (line 298) | def test_is_split_into_words(self): method test_chunking_fast (line 347) | def test_chunking_fast(self): method test_spanish_bert (line 408) | def test_spanish_bert(self): method test_accelerator (line 472) | def test_accelerator(self): method test_dbmdz_english (line 485) | def test_dbmdz_english(self): method test_aggregation_strategy_byte_level_tokenizer (line 544) | def test_aggregation_strategy_byte_level_tokenizer(self): method test_aggregation_strategy_no_b_i_prefix (line 556) | def test_aggregation_strategy_no_b_i_prefix(self): method test_aggregation_strategy (line 605) | def test_aggregation_strategy(self): method test_aggregation_strategy_example2 (line 678) | def test_aggregation_strategy_example2(self): method test_aggregation_strategy_offsets_with_leading_space (line 741) | def test_aggregation_strategy_offsets_with_leading_space(self): method test_gather_pre_entities (line 754) | def test_gather_pre_entities(self): method test_word_heuristic_leading_space (line 799) | def test_word_heuristic_leading_space(self): method test_no_offset_tokenizer (line 834) | def test_no_offset_tokenizer(self): method test_small_model_pt (line 854) | def test_small_model_pt(self): method test_small_model_pt_fp16 (line 922) | def test_small_model_pt_fp16(self): method test_small_model_pt_bf16 (line 940) | def test_small_model_pt_bf16(self): method test_pt_ignore_subwords_slow_tokenizer_raises (line 958) | def test_pt_ignore_subwords_slow_tokenizer_raises(self): method test_simple (line 973) | def test_simple(self): class TokenClassificationArgumentHandlerTestCase (line 1014) | class TokenClassificationArgumentHandlerTestCase(unittest.TestCase): method setUp (line 1015) | def setUp(self): method test_simple (line 1018) | def test_simple(self): method test_errors (line 1044) | def test_errors(self): FILE: tests/pipelines/test_pipelines_video_classification.py class VideoClassificationPipelineTests (line 37) | class VideoClassificationPipelineTests(unittest.TestCase): method _load_dataset (line 42) | def _load_dataset(cls): method get_test_pipeline (line 49) | def get_test_pipeline( method run_pipeline_test (line 75) | def run_pipeline_test(self, video_classifier, examples): method test_small_model_pt (line 90) | def test_small_model_pt(self): FILE: tests/pipelines/test_pipelines_zero_shot.py class ZeroShotClassificationPipelineTests (line 43) | class ZeroShotClassificationPipelineTests(unittest.TestCase): method get_test_pipeline (line 49) | def get_test_pipeline( method run_pipeline_test (line 69) | def run_pipeline_test(self, classifier, _): method run_entailment_id (line 143) | def run_entailment_id(self, zero_shot_classifier: Pipeline): method test_truncation (line 164) | def test_truncation(self): method test_small_model_pt (line 177) | def test_small_model_pt(self): method test_small_model_pt_fp16 (line 196) | def test_small_model_pt_fp16(self): method test_small_model_pt_bf16 (line 216) | def test_small_model_pt_bf16(self): method test_large_model_pt (line 237) | def test_large_model_pt(self): FILE: tests/pipelines/test_pipelines_zero_shot_audio_classification.py class ZeroShotAudioClassificationPipelineTests (line 25) | class ZeroShotAudioClassificationPipelineTests(unittest.TestCase): method test_small_model_pt (line 31) | def test_small_model_pt(self, dtype="float32"): method test_small_model_pt_fp16 (line 46) | def test_small_model_pt_fp16(self): method test_large_model_pt (line 51) | def test_large_model_pt(self): FILE: tests/pipelines/test_pipelines_zero_shot_image_classification.py class Image (line 37) | class Image: method open (line 39) | def open(*args, **kwargs): class ZeroShotImageClassificationPipelineTests (line 45) | class ZeroShotImageClassificationPipelineTests(unittest.TestCase): method test_small_model_pt (line 76) | def test_small_model_pt(self, dtype="float32"): method test_small_model_pt_fp16 (line 137) | def test_small_model_pt_fp16(self): method test_large_model_pt (line 142) | def test_large_model_pt(self): method test_siglip_model_pt (line 175) | def test_siglip_model_pt(self): method test_blip2_model_pt (line 209) | def test_blip2_model_pt(self): FILE: tests/pipelines/test_pipelines_zero_shot_object_detection.py class Image (line 38) | class Image: method open (line 40) | def open(*args, **kwargs): class ZeroShotObjectDetectionPipelineTests (line 47) | class ZeroShotObjectDetectionPipelineTests(unittest.TestCase): method get_test_pipeline (line 50) | def get_test_pipeline( method run_pipeline_test (line 75) | def run_pipeline_test(self, object_detector, examples): method test_small_model_pt (line 93) | def test_small_model_pt(self): method test_large_model_pt (line 148) | def test_large_model_pt(self): method test_threshold (line 200) | def test_threshold(self): method test_top_k (line 220) | def test_top_k(self): FILE: tests/quantization/aqlm_integration/test_aqlm.py class AqlmConfigTest (line 42) | class AqlmConfigTest(unittest.TestCase): method test_to_dict (line 43) | def test_to_dict(self): method test_from_dict (line 53) | def test_from_dict(self): class AqlmTest (line 75) | class AqlmTest(unittest.TestCase): method setUpClass (line 85) | def setUpClass(cls): method tearDown (line 95) | def tearDown(self): method test_quantized_model_conversion (line 100) | def test_quantized_model_conversion(self): method test_quantized_model (line 145) | def test_quantized_model(self): method test_raise_if_non_quantized (line 154) | def test_raise_if_non_quantized(self): method test_save_pretrained (line 164) | def test_save_pretrained(self): method test_quantized_model_multi_gpu (line 181) | def test_quantized_model_multi_gpu(self): method test_quantized_model_compile (line 200) | def test_quantized_model_compile(self): FILE: tests/quantization/autoawq/test_awq.py class AwqConfigTest (line 39) | class AwqConfigTest(unittest.TestCase): method test_wrong_backend (line 40) | def test_wrong_backend(self): method test_to_dict (line 57) | def test_to_dict(self): method test_from_dict (line 72) | def test_from_dict(self): class AwqTest (line 88) | class AwqTest(unittest.TestCase): method setUpClass (line 126) | def setUpClass(cls): method tearDown (line 133) | def tearDown(self): method test_quantized_model_conversion (line 138) | def test_quantized_model_conversion(self): method test_quantized_model (line 180) | def test_quantized_model(self): method test_raise_if_non_quantized (line 189) | def test_raise_if_non_quantized(self): method test_quantized_model_bf16 (line 196) | def test_quantized_model_bf16(self): method test_quantized_model_exllama (line 208) | def test_quantized_model_exllama(self): method test_quantized_model_no_device_map (line 222) | def test_quantized_model_no_device_map(self): method test_save_pretrained (line 233) | def test_save_pretrained(self): method test_quantized_model_multi_accelerator (line 251) | def test_quantized_model_multi_accelerator(self): method test_quantized_model_no_k_proj_quantized (line 265) | def test_quantized_model_no_k_proj_quantized(self): class AwqScaleTest (line 288) | class AwqScaleTest(unittest.TestCase): method test_load_quantized_model (line 291) | def test_load_quantized_model(self): class AwqTorchFusedTest (line 306) | class AwqTorchFusedTest(unittest.TestCase): method test_quantized_model_torch_fused (line 307) | def test_quantized_model_torch_fused(self): FILE: tests/quantization/autoround/test_auto_round.py class AutoRoundTest (line 43) | class AutoRoundTest(unittest.TestCase): method setUpClass (line 65) | def setUpClass(cls): method tearDown (line 75) | def tearDown(self): method test_quantized_model (line 80) | def test_quantized_model(self): method test_raise_if_non_quantized (line 88) | def test_raise_if_non_quantized(self): method test_quantized_model_bf16 (line 94) | def test_quantized_model_bf16(self): method test_quantized_model_on_cpu (line 111) | def test_quantized_model_on_cpu(self): method test_save_pretrained (line 122) | def test_save_pretrained(self): method test_quantized_model_multi_accelerator (line 147) | def test_quantized_model_multi_accelerator(self): method test_convert_from_gptq (line 161) | def test_convert_from_gptq(self): method test_convert_from_awq_cpu (line 179) | def test_convert_from_awq_cpu(self): method test_mixed_bits (line 197) | def test_mixed_bits(self): FILE: tests/quantization/bitnet_integration/test_bitnet.py class BitNetPackedWeightsTest (line 39) | class BitNetPackedWeightsTest(unittest.TestCase): method test_offline_autobitlinear_weight_conversion (line 40) | def test_offline_autobitlinear_weight_conversion(self): method test_unpack_packed_weights (line 51) | def test_unpack_packed_weights(self): class BitNetQuantConfigTest (line 76) | class BitNetQuantConfigTest(unittest.TestCase): method test_to_dict (line 77) | def test_to_dict(self): class BitNetTest (line 91) | class BitNetTest(unittest.TestCase): method setUpClass (line 96) | def setUpClass(cls): method tearDown (line 105) | def tearDown(self): method test_replace_with_bitlinear (line 110) | def test_replace_with_bitlinear(self): method test_quantized_model (line 132) | def test_quantized_model(self): method test_packing_unpacking (line 142) | def test_packing_unpacking(self): method test_activation_quant (line 156) | def test_activation_quant(self): method test_weights_dtype (line 178) | def test_weights_dtype(self): method test_replace_with_bitlinear_shape (line 199) | def test_replace_with_bitlinear_shape(self): class BitNetSerializationTest (line 236) | class BitNetSerializationTest(unittest.TestCase): method test_model_serialization (line 237) | def test_model_serialization(self): FILE: tests/quantization/bnb/test_4bit.py function get_some_linear_layer (line 47) | def get_some_linear_layer(model): class LoRALayer (line 66) | class LoRALayer(nn.Module): method __init__ (line 69) | def __init__(self, module: nn.Module, rank: int): method forward (line 81) | def forward(self, input, *args, **kwargs): class Base4bitTest (line 93) | class Base4bitTest(unittest.TestCase): method setUp (line 116) | def setUp(self): class Bnb4BitTest (line 122) | class Bnb4BitTest(Base4bitTest): method setUp (line 123) | def setUp(self): method tearDown (line 135) | def tearDown(self): method test_quantization_num_parameters (line 146) | def test_quantization_num_parameters(self): method test_compute_module_sizes (line 157) | def test_compute_module_sizes(self): method test_quantization_config_json_serialization (line 203) | def test_quantization_config_json_serialization(self): method test_memory_footprint (line 216) | def test_memory_footprint(self): method test_linear_are_4bit (line 230) | def test_linear_are_4bit(self): method test_generate_quality (line 246) | def test_generate_quality(self): method test_generate_quality_config (line 259) | def test_generate_quality_config(self): method test_generate_quality_dequantize (line 277) | def test_generate_quality_dequantize(self): method test_clear_quantization_trace (line 295) | def test_clear_quantization_trace(self): method test_to_device_dequantized (line 310) | def test_to_device_dequantized(self): method test_device_assignment (line 321) | def test_device_assignment(self): method test_device_and_dtype_assignment (line 335) | def test_device_and_dtype_assignment(self): method test_fp32_4bit_conversion (line 378) | def test_fp32_4bit_conversion(self): method test_bnb_4bit_wrong_config (line 387) | def test_bnb_4bit_wrong_config(self): class Bnb4BitT5Test (line 400) | class Bnb4BitT5Test(unittest.TestCase): method setUpClass (line 402) | def setUpClass(cls): method tearDown (line 408) | def tearDown(self): method test_inference_without_keep_in_fp32 (line 416) | def test_inference_without_keep_in_fp32(self): method test_inference_with_keep_in_fp32 (line 442) | def test_inference_with_keep_in_fp32(self): class Classes4BitModelTest (line 470) | class Classes4BitModelTest(Base4bitTest): method setUp (line 471) | def setUp(self): method tearDown (line 495) | def tearDown(self): method test_correct_head_class (line 508) | def test_correct_head_class(self): class Pipeline4BitTest (line 524) | class Pipeline4BitTest(Base4bitTest): method setUp (line 525) | def setUp(self): method tearDown (line 528) | def tearDown(self): method test_pipeline (line 539) | def test_pipeline(self): class Bnb4bitTestMultiAccelerator (line 567) | class Bnb4bitTestMultiAccelerator(Base4bitTest): method setUp (line 568) | def setUp(self): method test_multi_accelerator_loading (line 571) | def test_multi_accelerator_loading(self): class Bnb4BitTestTraining (line 625) | class Bnb4BitTestTraining(Base4bitTest): method setUp (line 626) | def setUp(self): method test_training (line 630) | def test_training(self): class Bnb4BitGPT2Test (line 675) | class Bnb4BitGPT2Test(Bnb4BitTest): class Bnb4BitLlamaTest (line 681) | class Bnb4BitLlamaTest(Bnb4BitTest): class BaseSerializationTest (line 691) | class BaseSerializationTest(unittest.TestCase): method tearDown (line 695) | def tearDown(self): method test_serialization (line 699) | def test_serialization(self, quant_type="nf4", double_quant=True): class ExtendedSerializationTest (line 786) | class ExtendedSerializationTest(BaseSerializationTest): method test_nf4_single_safe (line 791) | def test_nf4_single_safe(self): method test_fp4_single_safe (line 796) | def test_fp4_single_safe(self): method test_fp4_double_safe (line 799) | def test_fp4_double_safe(self): class BloomSerializationTest (line 803) | class BloomSerializationTest(BaseSerializationTest): class GPTSerializationTest (line 811) | class GPTSerializationTest(BaseSerializationTest): class LlamaSerializationTest (line 819) | class LlamaSerializationTest(BaseSerializationTest): class Bnb4BitTestBasicConfigTest (line 831) | class Bnb4BitTestBasicConfigTest(unittest.TestCase): method test_set_load_in_8_bit (line 832) | def test_set_load_in_8_bit(self): class Bnb4bitCompile (line 842) | class Bnb4bitCompile(unittest.TestCase): method setUp (line 846) | def setUp(self): method test_generate_compile (line 854) | def test_generate_compile(self): FILE: tests/quantization/bnb/test_mixed_int8.py function get_some_linear_layer (line 48) | def get_some_linear_layer(model): class LoRALayer (line 67) | class LoRALayer(nn.Module): method __init__ (line 70) | def __init__(self, module: nn.Module, rank: int, dtype: torch.dtype): method forward (line 82) | def forward(self, input, *args, **kwargs): class BaseMixedInt8Test (line 94) | class BaseMixedInt8Test(unittest.TestCase): method setUp (line 117) | def setUp(self): class MixedInt8Test (line 123) | class MixedInt8Test(BaseMixedInt8Test): method setUp (line 124) | def setUp(self): method tearDown (line 136) | def tearDown(self): method test_get_keys_to_not_convert (line 147) | def test_get_keys_to_not_convert(self): method test_quantization_config_json_serialization (line 180) | def test_quantization_config_json_serialization(self): method test_memory_footprint (line 193) | def test_memory_footprint(self): method test_linear_are_8bit (line 206) | def test_linear_are_8bit(self): method test_llm_skip (line 221) | def test_llm_skip(self): method test_generate_quality (line 240) | def test_generate_quality(self): method test_generate_quality_config (line 253) | def test_generate_quality_config(self): method test_generate_quality_dequantize (line 271) | def test_generate_quality_dequantize(self): method test_device_and_dtype_assignment (line 290) | def test_device_and_dtype_assignment(self): method test_fp32_int8_conversion (line 331) | def test_fp32_int8_conversion(self): method test_int8_serialization (line 340) | def test_int8_serialization(self): method test_int8_serialization_sharded (line 369) | def test_int8_serialization_sharded(self): method test_int8_from_pretrained (line 396) | def test_int8_from_pretrained(self): method test_compute_module_sizes (line 416) | def test_compute_module_sizes(self): class MixedInt8T5Test (line 467) | class MixedInt8T5Test(unittest.TestCase): method setUpClass (line 469) | def setUpClass(cls): method tearDown (line 475) | def tearDown(self): method test_inference_without_keep_in_fp32 (line 483) | def test_inference_without_keep_in_fp32(self): method test_inference_with_keep_in_fp32 (line 509) | def test_inference_with_keep_in_fp32(self): method test_inference_with_keep_in_fp32_serialized (line 536) | def test_inference_with_keep_in_fp32_serialized(self): class MixedInt8ModelClassesTest (line 570) | class MixedInt8ModelClassesTest(BaseMixedInt8Test): method setUp (line 571) | def setUp(self): method tearDown (line 595) | def tearDown(self): method test_correct_head_class (line 608) | def test_correct_head_class(self): class MixedInt8TestPipeline (line 626) | class MixedInt8TestPipeline(BaseMixedInt8Test): method setUp (line 627) | def setUp(self): method tearDown (line 630) | def tearDown(self): method test_pipeline (line 641) | def test_pipeline(self): class MixedInt8TestMultiGpu (line 694) | class MixedInt8TestMultiGpu(BaseMixedInt8Test): method setUp (line 695) | def setUp(self): method test_multi_gpu_loading (line 698) | def test_multi_gpu_loading(self): class MixedInt8TestCpuGpu (line 753) | class MixedInt8TestCpuGpu(BaseMixedInt8Test): method setUp (line 754) | def setUp(self): method check_inference_correctness (line 757) | def check_inference_correctness(self, model): method test_cpu_accelerator_loading_random_device_map (line 768) | def test_cpu_accelerator_loading_random_device_map(self): method test_cpu_accelerator_loading_custom_device_map (line 816) | def test_cpu_accelerator_loading_custom_device_map(self): method test_cpu_accelerator_disk_loading_custom_device_map (line 843) | def test_cpu_accelerator_disk_loading_custom_device_map(self): method test_cpu_accelerator_disk_loading_custom_device_map_kwargs (line 870) | def test_cpu_accelerator_disk_loading_custom_device_map_kwargs(self): class MixedInt8TestTraining (line 898) | class MixedInt8TestTraining(BaseMixedInt8Test): method setUp (line 899) | def setUp(self): method test_training (line 903) | def test_training(self): class MixedInt8GPT2Test (line 949) | class MixedInt8GPT2Test(MixedInt8Test): method test_int8_from_pretrained (line 963) | def test_int8_from_pretrained(self): class MixedInt8LlamaTest (line 984) | class MixedInt8LlamaTest(MixedInt8Test): method test_int8_from_pretrained (line 995) | def test_int8_from_pretrained(self): class Bnb8bitCompile (line 1021) | class Bnb8bitCompile(unittest.TestCase): method setUp (line 1025) | def setUp(self): method test_generate_compile (line 1033) | def test_generate_compile(self): FILE: tests/quantization/compressed_tensors_integration/test_compressed_models.py class StackCompressedModelTest (line 17) | class StackCompressedModelTest(unittest.TestCase): method tearDown (line 42) | def tearDown(self): method test_compressed_uncompressed_model_shapes (line 47) | def test_compressed_uncompressed_model_shapes(self): method test_outputs_match (line 98) | def test_outputs_match(self): method test_no_warnings_for_all_models (line 129) | def test_no_warnings_for_all_models(self): class RunCompressedTest (line 159) | class RunCompressedTest(unittest.TestCase): method tearDown (line 167) | def tearDown(self): method test_default_run_compressed__True (line 172) | def test_default_run_compressed__True(self): method test_default_run_compressed__False (line 191) | def test_default_run_compressed__False(self): method test_run_compressed_outputs_match (line 215) | def test_run_compressed_outputs_match(self): FILE: tests/quantization/compressed_tensors_integration/test_compressed_tensors.py class CompressedTensorsTest (line 15) | class CompressedTensorsTest(unittest.TestCase): method tearDown (line 23) | def tearDown(self): method test_config_args (line 28) | def test_config_args(self): method test_config_to_from_dict (line 39) | def test_config_to_from_dict(self): method test_tinyllama_w4a16 (line 49) | def test_tinyllama_w4a16(self): method test_tinyllama_int8 (line 52) | def test_tinyllama_int8(self): method test_tinyllama_fp8 (line 55) | def test_tinyllama_fp8(self): method test_tinyllama_w8a16 (line 58) | def test_tinyllama_w8a16(self): method _test_quantized_model (line 61) | def _test_quantized_model(self, model_name: str, expected_perplexity: ... FILE: tests/quantization/eetq_integration/test_eetq.py class EetqConfigTest (line 37) | class EetqConfigTest(unittest.TestCase): method test_to_dict (line 38) | def test_to_dict(self): method test_from_dict (line 48) | def test_from_dict(self): class EetqTest (line 64) | class EetqTest(unittest.TestCase): method setUpClass (line 76) | def setUpClass(cls): method tearDown (line 86) | def tearDown(self): method test_quantized_model_conversion (line 91) | def test_quantized_model_conversion(self): method test_quantized_model (line 128) | def test_quantized_model(self): method test_save_pretrained (line 137) | def test_save_pretrained(self): method test_quantized_model_multi_gpu (line 152) | def test_quantized_model_multi_gpu(self): FILE: tests/quantization/fbgemm_fp8/test_fbgemm_fp8.py class FbgemmFp8ConfigTest (line 43) | class FbgemmFp8ConfigTest(unittest.TestCase): method test_to_dict (line 44) | def test_to_dict(self): method test_from_dict (line 54) | def test_from_dict(self): class FbgemmFp8Test (line 72) | class FbgemmFp8Test(unittest.TestCase): method setUpClass (line 128) | def setUpClass(cls): method tearDown (line 138) | def tearDown(self): method test_quantized_model_conversion (line 143) | def test_quantized_model_conversion(self): method test_quantized_model (line 184) | def test_quantized_model(self): method test_save_pretrained (line 194) | def test_save_pretrained(self): method test_change_loading_attributes (line 208) | def test_change_loading_attributes(self): method test_quantized_model_multi_gpu (line 229) | def test_quantized_model_multi_gpu(self): method test_quantized_model_offload (line 247) | def test_quantized_model_offload(self): method test_save_pretrained_offload (line 261) | def test_save_pretrained_offload(self): method test_save_pretrained_multi_gpu (line 276) | def test_save_pretrained_multi_gpu(self): FILE: tests/quantization/finegrained_fp8/test_fp8.py function _patch_no_accelerator (line 42) | def _patch_no_accelerator(): class FineGrainedFP8ConfigTest (line 54) | class FineGrainedFP8ConfigTest(unittest.TestCase): method test_to_dict (line 55) | def test_to_dict(self): method test_from_dict (line 65) | def test_from_dict(self): class FP8QuantizerTest (line 84) | class FP8QuantizerTest(unittest.TestCase): method setUpClass (line 119) | def setUpClass(cls): method setup (line 129) | def setup(self): method tearDown (line 137) | def tearDown(self): method test_moe_conversion_doesnt_raise (line 148) | def test_moe_conversion_doesnt_raise(self, model_id): method test_quantized_model_conversion (line 152) | def test_quantized_model_conversion(self): method test_quantizer_validation_no_accelerator (line 186) | def test_quantizer_validation_no_accelerator(self): method test_dequantization_no_accelerator (line 196) | def test_dequantization_no_accelerator(self): method test_quantized_model (line 205) | def test_quantized_model(self): method test_dequantized_model (line 215) | def test_dequantized_model(self): method test_dequantize_when_no_accelerator (line 229) | def test_dequantize_when_no_accelerator(self): method test_save_pretrained (line 241) | def test_save_pretrained(self): method test_weight_and_weight_scale_inv (line 255) | def test_weight_and_weight_scale_inv(self): method test_block_size (line 265) | def test_block_size(self): method test_quantized_model_multi_accelerators (line 277) | def test_quantized_model_multi_accelerators(self): method test_save_pretrained_multi_accelerators (line 299) | def test_save_pretrained_multi_accelerators(self): method test_quantized_model_offload (line 317) | def test_quantized_model_offload(self): method test_save_pretrained_offload (line 328) | def test_save_pretrained_offload(self): method test_compute_module_sizes (line 341) | def test_compute_module_sizes(self): method test_quantized_moe_forward (line 390) | def test_quantized_moe_forward(self, experts_implementation): class FP8LinearTest (line 430) | class FP8LinearTest(unittest.TestCase): method test_linear_preserves_shape (line 433) | def test_linear_preserves_shape(self): method test_linear_with_diff_feature_size_preserves_shape (line 445) | def test_linear_with_diff_feature_size_preserves_shape(self): FILE: tests/quantization/fouroversix_integration/test_fouroversix.py class FourOverSixConfigTest (line 32) | class FourOverSixConfigTest(unittest.TestCase): method test_to_dict (line 33) | def test_to_dict(self): method test_from_dict (line 43) | def test_from_dict(self): class FourOverSixBaseTest (line 61) | class FourOverSixBaseTest(unittest.TestCase): method getQuantizationConfig (line 72) | def getQuantizationConfig(cls): method setUpClass (line 77) | def setUpClass(cls): method tearDown (line 90) | def tearDown(self): method test_quantized_model (line 95) | def test_quantized_model(self): method test_save_pretrained (line 107) | def test_save_pretrained(self): method test_quantized_model_multi_accelerator (line 125) | def test_quantized_model_multi_accelerator(self): method test_save_pretrained_multi_accelerator (line 147) | def test_save_pretrained_multi_accelerator(self): class FourOverSixMSETest (line 170) | class FourOverSixMSETest(FourOverSixBaseTest): method getQuantizationConfig (line 172) | def getQuantizationConfig(cls): class FourOverSixStatic6Test (line 176) | class FourOverSixStatic6Test(FourOverSixBaseTest): method getQuantizationConfig (line 178) | def getQuantizationConfig(cls): class FourOverSixKeepMasterWeightsTest (line 182) | class FourOverSixKeepMasterWeightsTest(FourOverSixBaseTest): method getQuantizationConfig (line 184) | def getQuantizationConfig(cls): FILE: tests/quantization/fp_quant_integration/test_fp_quant.py class FPQuantConfigTest (line 35) | class FPQuantConfigTest(unittest.TestCase): method test_to_dict (line 36) | def test_to_dict(self): method test_from_dict (line 46) | def test_from_dict(self): class FPQuantBaseTest (line 61) | class FPQuantBaseTest(unittest.TestCase): method getQuantizationConfig (line 72) | def getQuantizationConfig(cls): method setUpClass (line 77) | def setUpClass(cls): method tearDown (line 88) | def tearDown(self): method test_quantized_model (line 93) | def test_quantized_model(self): method test_save_pretrained (line 102) | def test_save_pretrained(self): method test_quantized_model_multi_accelerator (line 117) | def test_quantized_model_multi_accelerator(self): method test_save_pretrained_multi_accelerator (line 134) | def test_save_pretrained_multi_accelerator(self): class FPQuantMXFP4PseudoquantTest (line 150) | class FPQuantMXFP4PseudoquantTest(FPQuantBaseTest): method getQuantizationConfig (line 152) | def getQuantizationConfig(cls): method test_quantized_model_multi_accelerator (line 156) | def test_quantized_model_multi_accelerator(self): method test_save_pretrained_multi_accelerator (line 160) | def test_save_pretrained_multi_accelerator(self): class FPQuantNVFP4PseudoquantTest (line 168) | class FPQuantNVFP4PseudoquantTest(FPQuantBaseTest): method getQuantizationConfig (line 170) | def getQuantizationConfig(cls): method test_quantized_model_multi_accelerator (line 174) | def test_quantized_model_multi_accelerator(self): method test_save_pretrained_multi_accelerator (line 178) | def test_save_pretrained_multi_accelerator(self): class FPQuantMXFP4Test (line 183) | class FPQuantMXFP4Test(FPQuantBaseTest): method getQuantizationConfig (line 185) | def getQuantizationConfig(cls): class FPQuantNVFP4Test (line 190) | class FPQuantNVFP4Test(FPQuantBaseTest): method getQuantizationConfig (line 192) | def getQuantizationConfig(cls): class FPQuantMXFP4GS128Test (line 197) | class FPQuantMXFP4GS128Test(FPQuantBaseTest): method getQuantizationConfig (line 199) | def getQuantizationConfig(cls): class FPQuantNVFP4GS128Test (line 204) | class FPQuantNVFP4GS128Test(FPQuantBaseTest): method getQuantizationConfig (line 206) | def getQuantizationConfig(cls): FILE: tests/quantization/ggml/test_ggml.py class GgufQuantizationTests (line 46) | class GgufQuantizationTests(unittest.TestCase): method run_gguf_model (line 56) | def run_gguf_model(self, gguf_model_id: str, gguf_filename: str, expec... method test_standard_quants (line 72) | def test_standard_quants(self, quant_type: str, expected_text: str): method test_k_quants (line 88) | def test_k_quants(self, quant_type: str, expected_text: str): method test_imatrix_quants (line 108) | def test_imatrix_quants(self, quant_type: str, expected_text: str): class GgufIntegrationTests (line 118) | class GgufIntegrationTests(unittest.TestCase): method test_tokenization_xnli (line 130) | def test_tokenization_xnli(self): method test_q2_k_serialization (line 188) | def test_q2_k_serialization(self): method test_q6_k_fp16 (line 211) | def test_q6_k_fp16(self): method test_gguf_errors_disk_offload (line 227) | def test_gguf_errors_disk_offload(self): class GgufModelTests (line 274) | class GgufModelTests(unittest.TestCase): method test_mistral_q4_0 (line 357) | def test_mistral_q4_0(self): method test_qwen2_q4_0 (line 372) | def test_qwen2_q4_0(self): method test_qwen2moe_q8 (line 387) | def test_qwen2moe_q8(self): method test_qwen2moe_weights_conversion_fp16 (line 401) | def test_qwen2moe_weights_conversion_fp16(self): method test_phi3_q4_0 (line 420) | def test_phi3_q4_0(self): method test_llama3_q4_0_tokenizer (line 432) | def test_llama3_q4_0_tokenizer(self): method test_llama3_q4_0 (line 441) | def test_llama3_q4_0(self): method test_bloom_fp16 (line 456) | def test_bloom_fp16(self): method test_bloom_q8_0 (line 471) | def test_bloom_q8_0(self): method test_bloom_weights_conversion_fp16 (line 486) | def test_bloom_weights_conversion_fp16(self): method test_t5_f16 (line 512) | def test_t5_f16(self): method test_t5_q8_0 (line 526) | def test_t5_q8_0(self): method test_t5_weights_conversion_fp16 (line 540) | def test_t5_weights_conversion_fp16(self): method test_gpt2_q8 (line 562) | def test_gpt2_q8(self): method test_gpt2_weights_conversion_fp16 (line 576) | def test_gpt2_weights_conversion_fp16(self): method test_gpt2_xl_Q6_K (line 597) | def test_gpt2_xl_Q6_K(self): method test_falcon40b_q2_k (line 612) | def test_falcon40b_q2_k(self): method test_falcon7b_q2_k (line 627) | def test_falcon7b_q2_k(self): method test_falcon7b_weights_conversion_fp16 (line 643) | def test_falcon7b_weights_conversion_fp16(self): method test_stablelm_q4_k_m (line 666) | def test_stablelm_q4_k_m(self): method test_stablelm_fp16 (line 681) | def test_stablelm_fp16(self): method test_stablelm_weights_conversion_fp16 (line 705) | def test_stablelm_weights_conversion_fp16(self): method test_starcoder2_weights_conversion_fp16 (line 729) | def test_starcoder2_weights_conversion_fp16(self): method test_starcoder2_q6_k (line 753) | def test_starcoder2_q6_k(self): method test_mamba_weights_conversion_fp16 (line 769) | def test_mamba_weights_conversion_fp16(self): method test_mamba_q6_k (line 796) | def test_mamba_q6_k(self): method test_nemotron_weights_conversion_fp16 (line 810) | def test_nemotron_weights_conversion_fp16(self): method test_nemotron_q6_k (line 832) | def test_nemotron_q6_k(self): method test_gemma2_q3_k (line 846) | def test_gemma2_q3_k(self): method test_gemma2_q8_0 (line 860) | def test_gemma2_q8_0(self): method test_gemma2_fp32 (line 874) | def test_gemma2_fp32(self): method test_gemma2_weights_conversion_fp32 (line 888) | def test_gemma2_weights_conversion_fp32(self): method test_gemma3_qat_q4_0 (line 911) | def test_gemma3_qat_q4_0(self): method test_gemma3_text_weights_conversion_bf16 (line 927) | def test_gemma3_text_weights_conversion_bf16(self): method test_gemma3_vision_weights_conversion_bf16 (line 952) | def test_gemma3_vision_weights_conversion_bf16(self): method test_deci_q8_0 (line 974) | def test_deci_q8_0(self): method test_deci_weights_conversion_fp16 (line 990) | def test_deci_weights_conversion_fp16(self): method test_deci_config_mapping (line 1018) | def test_deci_config_mapping(self): method test_deci_architecture_mapping (line 1043) | def test_deci_architecture_mapping(self): method test_qwen3_q8_0 (line 1054) | def test_qwen3_q8_0(self): method test_qwen3moe_q4_k_m (line 1068) | def test_qwen3moe_q4_k_m(self): method test_umt5_encoder_q8_0 (line 1082) | def test_umt5_encoder_q8_0(self): method test_lfm2_q4_k_m (line 1119) | def test_lfm2_q4_k_m(self): FILE: tests/quantization/gptq/test_gptq.py class GPTQConfigTest (line 43) | class GPTQConfigTest(unittest.TestCase): method test_bits (line 44) | def test_bits(self): method test_dataset (line 51) | def test_dataset(self): method test_damp_percent (line 56) | def test_damp_percent(self): method test_to_dict (line 63) | def test_to_dict(self): method test_from_dict (line 67) | def test_from_dict(self): method test_optimum_config (line 74) | def test_optimum_config(self): class GPTQTest (line 87) | class GPTQTest(unittest.TestCase): method setUpClass (line 125) | def setUpClass(cls): method test_memory_footprint (line 155) | def test_memory_footprint(self): method test_device_and_dtype_assignment (line 165) | def test_device_and_dtype_assignment(self): method test_quantized_layers_class (line 178) | def test_quantized_layers_class(self): method check_inference_correctness (line 204) | def check_inference_correctness(self, model): method check_quantized_layers_type (line 219) | def check_quantized_layers_type(self, model, value): method test_generate_quality (line 222) | def test_generate_quality(self): method test_serialization (line 233) | def test_serialization(self): method test_serialization_big_model_inference (line 250) | def test_serialization_big_model_inference(self): class GPTQTestCUDA (line 262) | class GPTQTestCUDA(GPTQTest): method test_change_loading_attributes (line 265) | def test_change_loading_attributes(self): class GPTQTestDeviceMap (line 284) | class GPTQTestDeviceMap(GPTQTestCUDA): class GPTQTestActOrderExllamaV2 (line 293) | class GPTQTestActOrderExllamaV2(unittest.TestCase): method setUpClass (line 312) | def setUpClass(cls): method check_inference_correctness (line 331) | def check_inference_correctness(self, model): method test_quantized_layers_type (line 347) | def test_quantized_layers_type(self): method test_generate_quality (line 350) | def test_generate_quality(self): class GPTQTestExllamaV2 (line 362) | class GPTQTestExllamaV2(unittest.TestCase): method setUpClass (line 377) | def setUpClass(cls): method test_quantized_layers_type (line 390) | def test_quantized_layers_type(self): method check_inference_correctness (line 396) | def check_inference_correctness(self, model): method test_generate_quality (line 412) | def test_generate_quality(self): class GPTQTestDeviceMapCPUOffload (line 423) | class GPTQTestDeviceMapCPUOffload(GPTQTest): FILE: tests/quantization/higgs/test_higgs.py class HiggsConfigTest (line 37) | class HiggsConfigTest(unittest.TestCase): method test_to_dict (line 38) | def test_to_dict(self): method test_from_dict (line 48) | def test_from_dict(self): class HiggsTest (line 64) | class HiggsTest(unittest.TestCase): method setUpClass (line 76) | def setUpClass(cls): method tearDown (line 86) | def tearDown(self): method test_quantized_model_conversion (line 91) | def test_quantized_model_conversion(self): method test_quantized_model (line 129) | def test_quantized_model(self): method test_save_pretrained (line 138) | def test_save_pretrained(self): method test_quantized_model_multi_gpu (line 153) | def test_quantized_model_multi_gpu(self): method test_save_pretrained_multi_gpu (line 169) | def test_save_pretrained_multi_gpu(self): method test_dequantize (line 185) | def test_dequantize(self): FILE: tests/quantization/hqq/test_hqq.py class HQQLLMRunner (line 42) | class HQQLLMRunner: method __init__ (line 43) | def __init__(self, model_id, quant_config, compute_dtype, device, cach... function cleanup (line 56) | def cleanup(): function check_hqqlayer (line 61) | def check_hqqlayer(test_module, hqq_layer, batch_size=1, context_size=10... function check_forward (line 80) | def check_forward(test_module, model, batch_size=1, context_size=1024): class HqqConfigTest (line 94) | class HqqConfigTest(unittest.TestCase): method test_to_dict (line 95) | def test_to_dict(self): class HQQTest (line 110) | class HQQTest(unittest.TestCase): method tearDown (line 111) | def tearDown(self): method test_fp16_quantized_model (line 114) | def test_fp16_quantized_model(self): method test_quantized_model_to_new_device_and_new_dtype (line 127) | def test_quantized_model_to_new_device_and_new_dtype(self): method test_quantized_model_fake_weight_dtype (line 151) | def test_quantized_model_fake_weight_dtype(self): class HQQTestMultiGPU (line 168) | class HQQTestMultiGPU(unittest.TestCase): method tearDown (line 169) | def tearDown(self): method test_fp16_quantized_model_multipgpu (line 172) | def test_fp16_quantized_model_multipgpu(self): class HQQTestBias (line 192) | class HQQTestBias(unittest.TestCase): method tearDown (line 193) | def tearDown(self): method test_fp16_quantized_model (line 196) | def test_fp16_quantized_model(self): method test_save_and_load_quantized_model (line 210) | def test_save_and_load_quantized_model(self): class HQQSerializationTest (line 249) | class HQQSerializationTest(unittest.TestCase): method tearDown (line 250) | def tearDown(self): method test_model_serialization (line 253) | def test_model_serialization(self): method test_model_serialization_dynamic_quant_with_skip (line 288) | def test_model_serialization_dynamic_quant_with_skip(self): FILE: tests/quantization/metal/test_metal.py function _patch_mps_available (line 36) | def _patch_mps_available(available: bool = True): function _patch_no_mps (line 43) | def _patch_no_mps(): function _patch_has_mps (line 50) | def _patch_has_mps(): class MetalConfigTest (line 59) | class MetalConfigTest(unittest.TestCase): method test_default_values (line 62) | def test_default_values(self): method test_custom_values (line 70) | def test_custom_values(self): method test_invalid_bits_raises (line 77) | def test_invalid_bits_raises(self): method test_valid_bits (line 82) | def test_valid_bits(self): method test_invalid_group_size_raises (line 87) | def test_invalid_group_size_raises(self): method test_to_dict (line 93) | def test_to_dict(self): method test_from_dict (line 101) | def test_from_dict(self): method test_to_dict_from_dict (line 107) | def test_to_dict_from_dict(self): method test_get_loading_attributes (line 115) | def test_get_loading_attributes(self): class MetalQuantizerEnvironmentTest (line 123) | class MetalQuantizerEnvironmentTest(unittest.TestCase): method test_no_mps_prequantized_triggers_dequantize (line 126) | def test_no_mps_prequantized_triggers_dequantize(self): method test_no_mps_not_prequantized_raises (line 135) | def test_no_mps_not_prequantized_raises(self): method test_dequantize_flag_skips_mps_check (line 144) | def test_dequantize_flag_skips_mps_check(self): method test_missing_kernels_raises (line 152) | def test_missing_kernels_raises(self): method test_cpu_in_device_map_not_prequantized_raises (line 165) | def test_cpu_in_device_map_not_prequantized_raises(self): method test_disk_in_device_map_not_prequantized_raises (line 174) | def test_disk_in_device_map_not_prequantized_raises(self): method test_update_device_map_defaults_to_mps (line 183) | def test_update_device_map_defaults_to_mps(self): method test_is_serializable (line 189) | def test_is_serializable(self): method test_is_not_trainable (line 194) | def test_is_not_trainable(self): class AffineQuantizeDequantizeTest (line 201) | class AffineQuantizeDequantizeTest(unittest.TestCase): method _roundtrip (line 204) | def _roundtrip(self, bits, group_size, N=64, K=256, dtype=torch.float32): method test_roundtrip_4bit_gs64 (line 220) | def test_roundtrip_4bit_gs64(self): method test_roundtrip_4bit_gs128 (line 225) | def test_roundtrip_4bit_gs128(self): method test_roundtrip_8bit_gs64 (line 230) | def test_roundtrip_8bit_gs64(self): method test_roundtrip_2bit_gs64 (line 235) | def test_roundtrip_2bit_gs64(self): method test_quantize_shapes_2bit (line 240) | def test_quantize_shapes_2bit(self): method test_quantize_preserves_device (line 250) | def test_quantize_preserves_device(self): method test_dequantize_returns_correct_dtype (line 259) | def test_dequantize_returns_correct_dtype(self): class MetalLinearTest (line 270) | class MetalLinearTest(unittest.TestCase): method test_prequantized_weight_shape (line 273) | def test_prequantized_weight_shape(self): method test_quantize_on_the_fly_weight_shape (line 284) | def test_quantize_on_the_fly_weight_shape(self): method test_no_bias_by_default (line 292) | def test_no_bias_by_default(self): method test_with_bias (line 298) | def test_with_bias(self): method test_forward_fallback_when_not_uint32 (line 305) | def test_forward_fallback_when_not_uint32(self): method test_forward_fallback_with_bias (line 315) | def test_forward_fallback_with_bias(self): method test_prequantized_shapes_8bit (line 325) | def test_prequantized_shapes_8bit(self): method test_prequantized_shapes_2bit (line 332) | def test_prequantized_shapes_2bit(self): class ReplaceWithMetalLinearTest (line 341) | class ReplaceWithMetalLinearTest(unittest.TestCase): method _make_small_model (line 344) | def _make_small_model(self): method test_all_linears_replaced (line 350) | def test_all_linears_replaced(self): method test_modules_to_not_convert (line 363) | def test_modules_to_not_convert(self): method test_dequantize_skips_replacement (line 377) | def test_dequantize_skips_replacement(self): method test_prequantized_dtype_is_uint32 (line 387) | def test_prequantized_dtype_is_uint32(self): method test_quantize_on_the_fly_dtype_is_not_uint32 (line 399) | def test_quantize_on_the_fly_dtype_is_not_uint32(self): class MetalConversionOpsTest (line 413) | class MetalConversionOpsTest(unittest.TestCase): method _make_quantizer (line 416) | def _make_quantizer(self, bits=4, group_size=64): method test_metal_quantize_produces_correct_keys (line 422) | def test_metal_quantize_produces_correct_keys(self): method test_metal_quantize_preserves_original_dtype (line 434) | def test_metal_quantize_preserves_original_dtype(self): method test_metal_dequantize_returns_target_dtype (line 445) | def test_metal_dequantize_returns_target_dtype(self): method test_quantize_then_dequantize_roundtrip (line 473) | def test_quantize_then_dequantize_roundtrip(self): class MetalWeightConversionsTest (line 497) | class MetalWeightConversionsTest(unittest.TestCase): method test_get_weight_conversions_empty_when_not_dequantize (line 498) | def test_get_weight_conversions_empty_when_not_dequantize(self): method test_get_weight_conversions_has_entry_when_dequantize (line 504) | def test_get_weight_conversions_has_entry_when_dequantize(self): method test_get_weight_conversions_empty_when_not_prequantized (line 511) | def test_get_weight_conversions_empty_when_not_prequantized(self): class MetalModelConversionTest (line 519) | class MetalModelConversionTest(unittest.TestCase): method setUp (line 522) | def setUp(self): method tearDown (line 525) | def tearDown(self): method test_quantized_model_conversion (line 528) | def test_quantized_model_conversion(self): method test_quantized_model_conversion_with_exclusion (line 543) | def test_quantized_model_conversion_with_exclusion(self): method test_param_needs_quantization (line 561) | def test_param_needs_quantization(self): method test_param_needs_quantization_prequantized_is_false (line 582) | def test_param_needs_quantization_prequantized_is_false(self): class MetalSlowIntegrationTest (line 607) | class MetalSlowIntegrationTest(unittest.TestCase): method setUp (line 615) | def setUp(self): method tearDown (line 618) | def tearDown(self): method test_load_prequantized_dequantize_on_cpu (line 621) | def test_load_prequantized_dequantize_on_cpu(self): method test_quantized_model (line 630) | def test_quantized_model(self): FILE: tests/quantization/mxfp4/test_mxfp4.py function _empty_accelerator_cache (line 50) | def _empty_accelerator_cache(): function _patch_no_accelerator (line 58) | def _patch_no_accelerator(): class Mxfp4ConfigTest (line 67) | class Mxfp4ConfigTest(unittest.TestCase): method test_basic_config_creation (line 68) | def test_basic_config_creation(self): method test_config_with_modules_to_not_convert (line 75) | def test_config_with_modules_to_not_convert(self): method test_config_with_dequantize (line 81) | def test_config_with_dequantize(self): method test_get_loading_attributes (line 86) | def test_get_loading_attributes(self): method test_to_dict (line 92) | def test_to_dict(self): method test_from_dict (line 101) | def test_from_dict(self): class Mxfp4QuantizerTest (line 109) | class Mxfp4QuantizerTest(unittest.TestCase): method setUp (line 112) | def setUp(self): method test_quantizer_validation_no_torch (line 119) | def test_quantizer_validation_no_torch(self): method test_quantizer_validation_no_accelerator (line 130) | def test_quantizer_validation_no_accelerator(self): method test_quantizer_validation_low_compute_capability (line 147) | def test_quantizer_validation_low_compute_capability(self): method test_quantizer_validation_low_compute_capability_with_prequantized (line 160) | def test_quantizer_validation_low_compute_capability_with_prequantized... method test_quantizer_validation_low_compute_capability_with_dequantize (line 173) | def test_quantizer_validation_low_compute_capability_with_dequantize(s... method test_quantizer_validation_order_dequantize_before_accelerator_check (line 188) | def test_quantizer_validation_order_dequantize_before_accelerator_chec... method test_quantizer_validation_missing_triton (line 214) | def test_quantizer_validation_missing_triton(self): method test_quantizer_validation_missing_triton_pre_quantized_no_dequantize (line 228) | def test_quantizer_validation_missing_triton_pre_quantized_no_dequanti... method test_is_trainable (line 244) | def test_is_trainable(self): method test_warning_distinguishes_triton_from_kernels (line 255) | def test_warning_distinguishes_triton_from_kernels(self): method test_error_distinguishes_triton_from_kernels (line 292) | def test_error_distinguishes_triton_from_kernels(self): class Mxfp4IntegrationTest (line 325) | class Mxfp4IntegrationTest(unittest.TestCase): method test_should_convert_module (line 328) | def test_should_convert_module(self): method test_convert_moe_packed_tensors (line 342) | def test_convert_moe_packed_tensors(self): method test_quantize_to_mxfp4 (line 357) | def test_quantize_to_mxfp4(self): class Mxfp4ModelTest (line 380) | class Mxfp4ModelTest(unittest.TestCase): method setUp (line 392) | def setUp(self): method tearDown (line 396) | def tearDown(self): method check_inference_correctness_quantized (line 400) | def check_inference_correctness_quantized(self, model, tokenizer): method test_gpt_oss_model_loading_quantized_with_device_map (line 421) | def test_gpt_oss_model_loading_quantized_with_device_map(self): method test_gpt_oss_model_loading_dequantized_with_device_map (line 432) | def test_gpt_oss_model_loading_dequantized_with_device_map(self): method test_model_device_map_validation (line 449) | def test_model_device_map_validation(self): method test_memory_footprint_comparison (line 460) | def test_memory_footprint_comparison(self): method test_save_mxfp4 (line 480) | def test_save_mxfp4(self): method test_save_mxfp4_non_quantized (line 511) | def test_save_mxfp4_non_quantized(self): method test_compute_module_sizes (line 542) | def test_compute_module_sizes(self): FILE: tests/quantization/quanto_integration/test_quanto.py class QuantoTestIntegration (line 41) | class QuantoTestIntegration(unittest.TestCase): method setUp (line 44) | def setUp(self): method test_weight_only_quantization_conversion (line 56) | def test_weight_only_quantization_conversion(self): method test_weight_and_activation_quantization_conversion (line 72) | def test_weight_and_activation_quantization_conversion(self): method test_conversion_with_modules_to_not_convert (line 92) | def test_conversion_with_modules_to_not_convert(self): class QuantoQuantizationTest (line 118) | class QuantoQuantizationTest(unittest.TestCase): method setUp (line 132) | def setUp(self): method check_inference_correctness (line 154) | def check_inference_correctness(self, model, device): method test_generate_quality_cpu (line 166) | def test_generate_quality_cpu(self): method test_generate_quality_accelerator (line 172) | def test_generate_quality_accelerator(self): method test_quantized_model_layers (line 178) | def test_quantized_model_layers(self): method test_serialization_safetensors (line 203) | def test_serialization_safetensors(self): method check_same_model (line 212) | def check_same_model(self, model1, model2): method test_compare_with_quanto (line 223) | def test_compare_with_quanto(self): method test_compute_module_sizes (line 238) | def test_compute_module_sizes(self): class QuantoQuantizationQBitsTensorTest (line 287) | class QuantoQuantizationQBitsTensorTest(QuantoQuantizationTest): class QuantoQuantizationActivationTest (line 293) | class QuantoQuantizationActivationTest(unittest.TestCase): method test_quantize_activation (line 294) | def test_quantize_activation(self): class QuantoKVCacheQuantizationTest (line 306) | class QuantoKVCacheQuantizationTest(unittest.TestCase): method test_quantized_cache (line 308) | def test_quantized_cache(self): FILE: tests/quantization/quark_integration/test_quark.py class QuarkConfigTest (line 38) | class QuarkConfigTest(unittest.TestCase): method test_common_args (line 39) | def test_common_args(self): class QuarkTest (line 47) | class QuarkTest(unittest.TestCase): method setUpClass (line 67) | def setUpClass(cls): method tearDown (line 84) | def tearDown(self): method test_memory_footprint (line 91) | def test_memory_footprint(self): method test_device_and_dtype_assignment (line 96) | def test_device_and_dtype_assignment(self): method test_quantized_layers_class (line 109) | def test_quantized_layers_class(self): method check_inference_correctness (line 115) | def check_inference_correctness(self, model): method test_generate_quality (line 138) | def test_generate_quality(self): class QuarkTestDeviceMap (line 151) | class QuarkTestDeviceMap(QuarkTest): FILE: tests/quantization/sinq/test_sinq.py class SinqConfigTest (line 34) | class SinqConfigTest(unittest.TestCase): method test_default_config (line 37) | def test_default_config(self): method test_custom_config (line 45) | def test_custom_config(self): method test_modules_to_not_convert (line 58) | def test_modules_to_not_convert(self): method test_to_dict (line 64) | def test_to_dict(self): method test_from_dict (line 72) | def test_from_dict(self): method test_method_validation (line 85) | def test_method_validation(self): class SinqTest (line 93) | class SinqTest(unittest.TestCase): method setUpClass (line 109) | def setUpClass(cls): method tearDown (line 124) | def tearDown(self): method test_quantizer_validation_no_cuda (line 129) | def test_quantizer_validation_no_cuda(self): method test_asinq_not_supported (line 141) | def test_asinq_not_supported(self): method test_quantized_model_conversion (line 152) | def test_quantized_model_conversion(self): method test_quantized_model (line 164) | def test_quantized_model(self): method test_save_pretrained (line 175) | def test_save_pretrained(self): FILE: tests/quantization/spqr_integration/test_spqr.py class SpQRConfigTest (line 39) | class SpQRConfigTest(unittest.TestCase): method test_to_dict (line 40) | def test_to_dict(self): method test_from_dict (line 50) | def test_from_dict(self): class SpQRTest (line 74) | class SpQRTest(unittest.TestCase): method setUpClass (line 87) | def setUpClass(cls): method tearDown (line 97) | def tearDown(self): method test_quantized_model_conversion (line 102) | def test_quantized_model_conversion(self): method test_quantized_model (line 136) | def test_quantized_model(self): method test_raise_if_non_quantized (line 145) | def test_raise_if_non_quantized(self): method test_save_pretrained (line 153) | def test_save_pretrained(self): method test_quantized_model_multi_gpu (line 167) | def test_quantized_model_multi_gpu(self): method test_quantized_model_compile (line 182) | def test_quantized_model_compile(self): FILE: tests/quantization/torchao_integration/test_torchao.py class TorchAoConfigTest (line 58) | class TorchAoConfigTest(unittest.TestCase): method test_to_dict (line 59) | def test_to_dict(self): method test_repr (line 70) | def test_repr(self): method test_json_serializable (line 78) | def test_json_serializable(self): class TorchAoTestBase (line 91) | class TorchAoTestBase: method tearDown (line 98) | def tearDown(self): method test_int4wo_quant (line 103) | def test_int4wo_quant(self): method test_int8_dynamic_activation_int8_weight_quant (line 133) | def test_int8_dynamic_activation_int8_weight_quant(self): method test_include_input_output_embeddings (line 154) | def test_include_input_output_embeddings(self): method test_per_module_config_skip (line 183) | def test_per_module_config_skip(self): method test_fqn_to_config_regex_basic (line 203) | def test_fqn_to_config_regex_basic(self): method test_fqn_to_config_regex_fullmatch (line 223) | def test_fqn_to_config_regex_fullmatch(self): method test_fqn_to_config_module_regex_precedence (line 256) | def test_fqn_to_config_module_regex_precedence(self): method test_fqn_to_config_regex_precedence (line 287) | def test_fqn_to_config_regex_precedence(self): method test_fqn_to_config_param_over_module_regex_precedence (line 315) | def test_fqn_to_config_param_over_module_regex_precedence(self): method test_fqn_to_config_param_over_module_precedence (line 342) | def test_fqn_to_config_param_over_module_precedence(self): method test_fqn_to_config_exact_over_regex_precedence (line 369) | def test_fqn_to_config_exact_over_regex_precedence(self): method test_fqn_to_config_non_weight_param (line 399) | def test_fqn_to_config_non_weight_param(self): method test_compute_module_sizes (line 423) | def test_compute_module_sizes(self): class TorchAoCPUTest (line 475) | class TorchAoCPUTest(TorchAoTestBase, unittest.TestCase): method test_int4wo_quant (line 479) | def test_int4wo_quant(self): class TorchAoAcceleratorTest (line 484) | class TorchAoAcceleratorTest(TorchAoTestBase, unittest.TestCase): method test_int4wo_offload (line 487) | def test_int4wo_offload(self): method test_int4wo_quant_multi_accelerator (line 545) | def test_int4wo_quant_multi_accelerator(self): class TorchAoSerializationTest (line 578) | class TorchAoSerializationTest(unittest.TestCase): method tearDown (line 603) | def tearDown(self): method _check_serialization (line 608) | def _check_serialization(self, device, config, expected_output): method test_serialization_cpu (line 632) | def test_serialization_cpu(self, config, expected_outputs): method test_serialization_accelerator (line 641) | def test_serialization_accelerator(self, config, expected_outputs): FILE: tests/quantization/vptq_integration/test_vptq.py class VptqConfigTest (line 36) | class VptqConfigTest(unittest.TestCase): method test_to_dict (line 37) | def test_to_dict(self): class VptqTest (line 51) | class VptqTest(unittest.TestCase): method setUpClass (line 63) | def setUpClass(cls): method tearDown (line 73) | def tearDown(self): method test_quantized_model (line 78) | def test_quantized_model(self): method test_raise_if_non_quantized (line 87) | def test_raise_if_non_quantized(self): method test_save_pretrained (line 94) | def test_save_pretrained(self): method test_quantized_model_multi_gpu (line 108) | def test_quantized_model_multi_gpu(self): method test_quantized_model_conversion (line 122) | def test_quantized_model_conversion(self): FILE: tests/repo_utils/modular/test_conversion_order.py function appear_after (line 46) | def appear_after(model1: str, model2: str, priority_list: list[list[str]... class ConversionOrderTest (line 59) | class ConversionOrderTest(unittest.TestCase): method test_conversion_order (line 60) | def test_conversion_order(self): FILE: tests/repo_utils/test_check_copies.py function replace_in_file (line 237) | def replace_in_file(filename, old, new): function create_tmp_repo (line 247) | def create_tmp_repo(tmp_dir): function patch_transformer_repo_path (line 275) | def patch_transformer_repo_path(new_folder): class CopyCheckTester (line 294) | class CopyCheckTester(unittest.TestCase): method test_find_code_in_transformers (line 295) | def test_find_code_in_transformers(self): method test_is_copy_consistent (line 306) | def test_is_copy_consistent(self): method test_is_copy_consistent_with_ignored_match (line 330) | def test_is_copy_consistent_with_ignored_match(self): method test_is_copy_consistent_with_ignored_no_match (line 340) | def test_is_copy_consistent_with_ignored_no_match(self): method test_convert_to_localized_md (line 366) | def test_convert_to_localized_md(self): FILE: tests/repo_utils/test_check_docstrings.py class CheckDostringsTested (line 37) | class CheckDostringsTested(unittest.TestCase): method test_replace_default_in_arg_description (line 38) | def test_replace_default_in_arg_description(self): method test_get_default_description (line 98) | def test_get_default_description(self): class TestGetAutoDocstringNames (line 111) | class TestGetAutoDocstringNames(unittest.TestCase): method setUp (line 114) | def setUp(self): method _write_temp (line 117) | def _write_temp(self, source): method test_detects_simple_decorator (line 123) | def test_detects_simple_decorator(self): method test_detects_decorator_with_call (line 137) | def test_detects_decorator_with_call(self): method test_ignores_other_decorators (line 149) | def test_ignores_other_decorators(self): method test_multiple_classes (line 161) | def test_multiple_classes(self): method test_caching (line 180) | def test_caching(self): method test_syntax_error_returns_empty (line 193) | def test_syntax_error_returns_empty(self): method test_has_auto_docstring_decorator_uses_cache (line 199) | def test_has_auto_docstring_decorator_uses_cache(self): class TestBuildAstIndexes (line 221) | class TestBuildAstIndexes(unittest.TestCase): method test_finds_decorated_items (line 224) | def test_finds_decorated_items(self): method test_shared_tree (line 238) | def test_shared_tree(self): method test_no_decorated_items (line 251) | def test_no_decorated_items(self): method test_function_decorated (line 260) | def test_function_decorated(self): method test_custom_args_from_variable (line 274) | def test_custom_args_from_variable(self): class TestFindTypedDictClasses (line 289) | class TestFindTypedDictClasses(unittest.TestCase): method test_finds_typed_dict (line 292) | def test_finds_typed_dict(self): method test_shared_tree (line 307) | def test_shared_tree(self): method test_skips_standard_kwargs (line 319) | def test_skips_standard_kwargs(self): method test_no_typed_dicts (line 328) | def test_no_typed_dicts(self): method test_skips_private_fields (line 337) | def test_skips_private_fields(self): FILE: tests/repo_utils/test_check_repo.py class RecordingNamespace (line 33) | class RecordingNamespace: method __init__ (line 36) | def __init__(self, mapping): method __dir__ (line 41) | def __dir__(self): method __getattr__ (line 45) | def __getattr__(self, name): function patch_transformers_path (line 54) | def patch_transformers_path(path: Path): class CheckRepoTest (line 64) | class CheckRepoTest(unittest.TestCase): method setUp (line 65) | def setUp(self): method _write_modeling_file (line 70) | def _write_modeling_file(self, root: Path, model_name: str, content: s... method test_get_model_modules_is_cached (line 76) | def test_get_model_modules_is_cached(self): method test_check_models_have_kwargs_ignores_nested_classes (line 94) | def test_check_models_have_kwargs_ignores_nested_classes(self): method test_check_models_have_kwargs_still_checks_top_level_models (line 122) | def test_check_models_have_kwargs_still_checks_top_level_models(self): FILE: tests/repo_utils/test_checkers.py function patch_checkers_paths (line 34) | def patch_checkers_paths(repo_root: Path): class CheckersCacheTest (line 44) | class CheckersCacheTest(unittest.TestCase): method _create_fake_repo (line 45) | def _create_fake_repo(self, tmpdir: str) -> Path: method _run_main (line 54) | def _run_main(self, *args: str) -> str: method test_checker_cache_detects_checker_script_changes (line 63) | def test_checker_cache_detects_checker_script_changes(self): method test_main_skips_cached_runs (line 77) | def test_main_skips_cached_runs(self): method test_main_reruns_with_no_cache (line 96) | def test_main_reruns_with_no_cache(self): FILE: tests/repo_utils/test_get_test_info.py class GetTestInfoTester (line 35) | class GetTestInfoTester(unittest.TestCase): method test_get_test_to_tester_mapping (line 36) | def test_get_test_to_tester_mapping(self): method test_get_model_to_test_mapping (line 54) | def test_get_model_to_test_mapping(self): method test_get_model_to_tester_mapping (line 82) | def test_get_model_to_tester_mapping(self): FILE: tests/repo_utils/test_mlinter.py class CheckModelingStructureTest (line 34) | class CheckModelingStructureTest(unittest.TestCase): method test_trf001_valid_config_class (line 37) | def test_trf001_valid_config_class(self): method test_trf001_invalid_config_class (line 47) | def test_trf001_invalid_config_class(self): method test_trf002_valid_prefix (line 60) | def test_trf002_valid_prefix(self): method test_trf002_invalid_empty_prefix (line 70) | def test_trf002_invalid_empty_prefix(self): method test_trf003_flags_old_return_dict_branching (line 83) | def test_trf003_flags_old_return_dict_branching(self): method test_trf003_allows_no_return_dict_arg (line 100) | def test_trf003_allows_no_return_dict_arg(self): method test_trf003_allows_return_dict_without_branching (line 114) | def test_trf003_allows_return_dict_without_branching(self): method test_trf004_flags_any_tie_weights_override (line 130) | def test_trf004_flags_any_tie_weights_override(self): method test_trf004_allows_no_tie_weights (line 142) | def test_trf004_allows_no_tie_weights(self): method test_trf005_valid_no_split_modules (line 154) | def test_trf005_valid_no_split_modules(self): method test_trf005_invalid_empty_string (line 164) | def test_trf005_invalid_empty_string(self): method test_trf006_catches_unused_cache_args (line 176) | def test_trf006_catches_unused_cache_args(self): method test_trf007_flags_assignment_after_post_init (line 193) | def test_trf007_flags_assignment_after_post_init(self): method test_trf007_allows_post_init_at_end (line 210) | def test_trf007_allows_post_init_at_end(self): method test_trf008_flags_empty_add_start_docstrings (line 228) | def test_trf008_flags_empty_add_start_docstrings(self): method test_trf008_allows_non_empty_add_start_docstrings (line 240) | def test_trf008_allows_non_empty_add_start_docstrings(self): method test_trf009_flags_cross_model_import_in_modeling_file (line 253) | def test_trf009_flags_cross_model_import_in_modeling_file(self): method test_trf009_allows_same_model_import_in_modeling_file (line 263) | def test_trf009_allows_same_model_import_in_modeling_file(self): method test_trf009_ignores_modular_files (line 273) | def test_trf009_ignores_modular_files(self): method test_trf010_allows_direct_config_with_strict (line 284) | def test_trf010_allows_direct_config_with_strict(self): method test_trf010_flags_missing_strict_on_direct_config (line 297) | def test_trf010_flags_missing_strict_on_direct_config(self): method test_trf010_ignores_non_direct_config_alias_wrappers (line 308) | def test_trf010_ignores_non_direct_config_alias_wrappers(self): method test_trf011_flags_layer_attr_access_in_forward_loop (line 327) | def test_trf011_flags_layer_attr_access_in_forward_loop(self): method test_trf011_flags_enumerate_loop_variant (line 348) | def test_trf011_flags_enumerate_loop_variant(self): method test_trf011_flags_sliced_layers_loop (line 367) | def test_trf011_flags_sliced_layers_loop(self): method test_trf011_flags_non_layers_pp_loop (line 385) | def test_trf011_flags_non_layers_pp_loop(self): method test_trf011_flags_embedding_attr_access (line 404) | def test_trf011_flags_embedding_attr_access(self): method test_trf011_flags_final_norm_attr_access (line 421) | def test_trf011_flags_final_norm_attr_access(self): method test_trf011_allows_config_based_lookup (line 437) | def test_trf011_allows_config_based_lookup(self): method test_trf011_allows_nn_module_attrs (line 457) | def test_trf011_allows_nn_module_attrs(self): method test_trf011_allows_nn_module_attrs_on_direct_pp_submodule (line 475) | def test_trf011_allows_nn_module_attrs_on_direct_pp_submodule(self): method test_trf011_skips_models_without_pp_plan (line 491) | def test_trf011_skips_models_without_pp_plan(self): method test_trf011_suppression_works (line 509) | def test_trf011_suppression_works(self): method test_trf012_flags_inplace_module_weight_ops (line 528) | def test_trf012_flags_inplace_module_weight_ops(self): method test_trf012_allows_init_primitives (line 540) | def test_trf012_allows_init_primitives(self): method test_trf013_flags_missing_post_init (line 553) | def test_trf013_flags_missing_post_init(self): method test_trf013_allows_post_init (line 569) | def test_trf013_allows_post_init(self): method test_analyze_file_allows_subscripted_class_bases (line 587) | def test_analyze_file_allows_subscripted_class_bases(self): method test_get_changed_modeling_files_includes_configuration_files (line 599) | def test_get_changed_modeling_files_includes_configuration_files(self,... method test_get_changed_modeling_files_includes_uncommitted_worktree_changes (line 627) | def test_get_changed_modeling_files_includes_uncommitted_worktree_chan... FILE: tests/repo_utils/test_tests_fetcher.py function create_tmp_repo (line 89) | def create_tmp_repo(tmp_dir, models=None): function patch_transformer_repo_path (line 178) | def patch_transformer_repo_path(new_folder): function commit_changes (line 196) | def commit_changes(filenames, contents, repo, commit_message="Commit"): class TestFetcherTester (line 214) | class TestFetcherTester(unittest.TestCase): method test_checkout_commit (line 215) | def test_checkout_commit(self): method test_clean_code (line 232) | def test_clean_code(self): method test_get_all_tests (line 241) | def test_get_all_tests(self): method test_get_all_tests_on_full_repo (line 248) | def test_get_all_tests_on_full_repo(self): method test_get_repo_utils_tests_on_full_repo (line 259) | def test_get_repo_utils_tests_on_full_repo(self): method test_should_run_repo_utils_tests (line 264) | def test_should_run_repo_utils_tests(self): method test_create_test_list_from_filter_routes_repo_utils_tests (line 268) | def test_create_test_list_from_filter_routes_repo_utils_tests(self): method test_infer_tests_to_run_adds_repo_utils_for_utils_changes (line 287) | def test_infer_tests_to_run_adds_repo_utils_for_utils_changes(self): method test_diff_is_docstring_only (line 304) | def test_diff_is_docstring_only(self): method test_get_diff_ignores_docstring_only_changes (line 317) | def test_get_diff_ignores_docstring_only_changes(self): method test_extract_imports_relative (line 334) | def test_extract_imports_relative(self): method test_extract_imports_absolute (line 375) | def test_extract_imports_absolute(self): method test_get_module_dependencies (line 415) | def test_get_module_dependencies(self): method test_create_reverse_dependency_tree (line 479) | def test_create_reverse_dependency_tree(self): method test_get_tree_starting_at (line 508) | def test_get_tree_starting_at(self): method test_print_tree_deps_of (line 538) | def test_print_tree_deps_of(self): method test_init_test_examples_dependencies (line 564) | def test_init_test_examples_dependencies(self): method test_create_reverse_dependency_map (line 586) | def test_create_reverse_dependency_map(self): method test_infer_tests_to_run (line 647) | def test_infer_tests_to_run(self): method test_infer_tests_to_run_with_test_modifs (line 729) | def test_infer_tests_to_run_with_test_modifs(self): method test_infer_tests_to_run_with_examples_modifs (line 749) | def test_infer_tests_to_run_with_examples_modifs(self): method test_parse_commit_message (line 784) | def test_parse_commit_message(self): FILE: tests/sagemaker/__init__.py function is_sagemaker_available (line 4) | def is_sagemaker_available(): FILE: tests/sagemaker/conftest.py class SageMakerTestEnvironment (line 14) | class SageMakerTestEnvironment: method metric_definitions (line 30) | def metric_definitions(self) -> str: method base_job_name (line 38) | def base_job_name(self) -> str: method test_path (line 42) | def test_path(self) -> str: method image_uri (line 46) | def image_uri(self) -> str: function sm_env (line 51) | def sm_env(request): FILE: tests/sagemaker/scripts/pytorch/run_ddp.py function parse_args (line 11) | def parse_args(): function main (line 21) | def main(): FILE: tests/sagemaker/scripts/pytorch/run_glue_model_parallelism.py class DataTrainingArguments (line 63) | class DataTrainingArguments: method __post_init__ (line 132) | def __post_init__(self): class ModelArguments (line 149) | class ModelArguments: function main (line 177) | def main(): function _mp_fn (line 501) | def _mp_fn(index): FILE: tests/sagemaker/test_multi_node_data_parallel.py class MultiNodeTest (line 39) | class MultiNodeTest(unittest.TestCase): method setUp (line 40) | def setUp(self): method create_estimator (line 48) | def create_estimator(self, instance_count): method save_results_as_csv (line 69) | def save_results_as_csv(self, job_name): method test_script (line 74) | def test_script(self, instance_count): FILE: tests/sagemaker/test_multi_node_model_parallel.py class MultiNodeTest (line 39) | class MultiNodeTest(unittest.TestCase): method setUp (line 40) | def setUp(self): method create_estimator (line 48) | def create_estimator(self, instance_count): method save_results_as_csv (line 89) | def save_results_as_csv(self, job_name): method test_scripz (line 94) | def test_scripz(self, instance_count): FILE: tests/sagemaker/test_single_node_gpu.py class SingleNodeTest (line 33) | class SingleNodeTest(unittest.TestCase): method setUp (line 34) | def setUp(self): method create_estimator (line 42) | def create_estimator(self, instance_count=1): method save_results_as_csv (line 58) | def save_results_as_csv(self, job_name): method test_glue (line 61) | def test_glue(self): FILE: tests/tensor_parallel/test_tensor_parallel.py class TestTensorParallelUtils (line 35) | class TestTensorParallelUtils(TestCasePlus): method test_packed_unpacked_conversion (line 36) | def test_packed_unpacked_conversion(self): class TestTensorParallelProperties (line 65) | class TestTensorParallelProperties(TestCasePlus): method test_tp_plan_property_setter_getter (line 66) | def test_tp_plan_property_setter_getter(self): method test_tp_plan_validation_invalid_style (line 93) | def test_tp_plan_validation_invalid_style(self): method test_tp_plan_validation_nonexistent_layer_warning (line 105) | def test_tp_plan_validation_nonexistent_layer_warning(self): method test_tp_plan_valid_layer_patterns (line 121) | def test_tp_plan_valid_layer_patterns(self): method test_tp_plan_none_handling (line 156) | def test_tp_plan_none_handling(self): class TestTensorParallelLayer (line 171) | class TestTensorParallelLayer(TestCasePlus): class MockDeviceMesh (line 172) | class MockDeviceMesh: method __init__ (line 173) | def __init__(self, world_size, rank): method size (line 178) | def size(self): method get_local_rank (line 181) | def get_local_rank(self): method test_colwise_get_expected_sharded_shape (line 184) | def test_colwise_get_expected_sharded_shape(self): method test_rowwise_get_expected_sharded_shape (line 204) | def test_rowwise_get_expected_sharded_shape(self): method test_embedding_get_expected_sharded_shape (line 228) | def test_embedding_get_expected_sharded_shape(self): method test_grouped_gemm_get_expected_sharded_shape (line 259) | def test_grouped_gemm_get_expected_sharded_shape(self): method test_colwise_update_module_attributes (line 276) | def test_colwise_update_module_attributes(self): method test_rowwise_update_module_attributes (line 291) | def test_rowwise_update_module_attributes(self): method test_embedding_update_module_attributes (line 299) | def test_embedding_update_module_attributes(self): method test_grouped_gemm_update_module_attributes (line 320) | def test_grouped_gemm_update_module_attributes(self): method test_update_module_attributes_missing_attribute (line 330) | def test_update_module_attributes_missing_attribute(self): method test_shard_tensor_shape_consistency (line 343) | def test_shard_tensor_shape_consistency(self): method test_packed_colwise_shard_tensor (line 368) | def test_packed_colwise_shard_tensor(self): method test_packed_rowwise_shard_tensor (line 395) | def test_packed_rowwise_shard_tensor(self): FILE: tests/test_backbone_common.py class BackboneTesterMixin (line 24) | class BackboneTesterMixin: method test_config (line 28) | def test_config(self): method test_forward_signature (line 64) | def test_forward_signature(self): method test_config_save_pretrained (line 75) | def test_config_save_pretrained(self): method test_channels (line 85) | def test_channels(self): method test_create_from_modified_config (line 108) | def test_create_from_modified_config(self): method test_backbone_common_attributes (line 143) | def test_backbone_common_attributes(self): method test_backbone_outputs (line 165) | def test_backbone_outputs(self): method test_backbone_stage_selection (line 196) | def test_backbone_stage_selection(self): FILE: tests/test_configuration_common.py class ConfigTester (line 30) | class ConfigTester: method __init__ (line 31) | def __init__(self, parent, config_class=None, has_text_modality=True, ... method create_and_test_config_common_properties (line 38) | def create_and_test_config_common_properties(self): method create_and_test_config_to_json_string (line 55) | def create_and_test_config_to_json_string(self): method create_and_test_config_to_json_file (line 61) | def create_and_test_config_to_json_file(self): method create_and_test_config_from_and_save_pretrained (line 71) | def create_and_test_config_from_and_save_pretrained(self): method create_and_test_config_from_and_save_pretrained_subfolder (line 83) | def create_and_test_config_from_and_save_pretrained_subfolder(self): method create_and_test_config_from_and_save_pretrained_composite (line 94) | def create_and_test_config_from_and_save_pretrained_composite(self): method create_and_test_config_from_pretrained_custom_kwargs (line 135) | def create_and_test_config_from_pretrained_custom_kwargs(self): method create_and_test_config_with_num_labels (line 170) | def create_and_test_config_with_num_labels(self): method check_config_can_be_init_without_params (line 179) | def check_config_can_be_init_without_params(self): method check_config_arguments_init (line 187) | def check_config_arguments_init(self): method run_common_tests (line 210) | def run_common_tests(self): FILE: tests/test_executorch.py class ExecutorchTest (line 30) | class ExecutorchTest(unittest.TestCase): method setUp (line 31) | def setUp(self): method test_static_cache_module_forward (line 47) | def test_static_cache_module_forward(self): method test_hybrid_cache_module_forward (line 69) | def test_hybrid_cache_module_forward(self): method test_decoder_only_lm_export_validation (line 95) | def test_decoder_only_lm_export_validation(self): method test_decoder_only_lm_export (line 107) | def test_decoder_only_lm_export(self): FILE: tests/test_feature_extraction_common.py class FeatureExtractionSavingTestMixin (line 23) | class FeatureExtractionSavingTestMixin: method test_feat_extract_to_json_string (line 26) | def test_feat_extract_to_json_string(self): method test_feat_extract_to_json_file (line 32) | def test_feat_extract_to_json_file(self): method test_feat_extract_from_and_save_pretrained (line 42) | def test_feat_extract_from_and_save_pretrained(self): method test_init_without_params (line 52) | def test_init_without_params(self): FILE: tests/test_image_processing_common.py function prepare_image_inputs (line 54) | def prepare_image_inputs( function prepare_video (line 98) | def prepare_video(num_frames, num_channels, width=10, height=10, numpify... function prepare_video_inputs (line 115) | def prepare_video_inputs( class ImageProcessingTestMixin (line 152) | class ImageProcessingTestMixin: method setUp (line 155) | def setUp(self): method _assert_tensors_equivalence (line 169) | def _assert_tensors_equivalence(self, tensor1, tensor2, atol=1e-1, rto... method test_backends_equivalence (line 176) | def test_backends_equivalence(self): method test_backends_equivalence_batched (line 201) | def test_backends_equivalence_batched(self): method test_image_processor_to_json_string (line 220) | def test_image_processor_to_json_string(self): method test_image_processor_to_json_file (line 227) | def test_image_processor_to_json_file(self): method test_image_processor_from_and_save_pretrained (line 238) | def test_image_processor_from_and_save_pretrained(self): method test_image_processor_save_load_with_autoimageprocessor (line 249) | def test_image_processor_save_load_with_autoimageprocessor(self): method test_save_load_backends (line 261) | def test_save_load_backends(self): method test_save_load_backends_auto (line 304) | def test_save_load_backends_auto(self): method test_init_without_params (line 347) | def test_init_without_params(self): method test_cast_dtype_device (line 354) | def test_cast_dtype_device(self): method test_call_pil (line 388) | def test_call_pil(self): method test_call_numpy (line 409) | def test_call_numpy(self): method test_call_pytorch (line 430) | def test_call_pytorch(self): method test_call_numpy_4_channels (line 453) | def test_call_numpy_4_channels(self): method test_image_processor_preprocess_arguments (line 487) | def test_image_processor_preprocess_arguments(self): method test_override_instance_attributes_does_not_affect_other_instances (line 524) | def test_override_instance_attributes_does_not_affect_other_instances(... method test_can_compile_torchvision_backend (line 562) | def test_can_compile_torchvision_backend(self): method test_new_models_require_torchvision_backend (line 578) | def test_new_models_require_torchvision_backend(self): method test_fast_image_processor_explicit_none_preserved (line 632) | def test_fast_image_processor_explicit_none_preserved(self): class AnnotationFormatTestMixin (line 665) | class AnnotationFormatTestMixin: method test_processor_can_use_legacy_annotation_format (line 666) | def test_processor_can_use_legacy_annotation_format(self): FILE: tests/test_image_transforms.py function get_random_image (line 47) | def get_random_image(height, width, num_channels=3, channels_first=True): class ImageTransformsTester (line 54) | class ImageTransformsTester(unittest.TestCase): method test_to_pil_image (line 66) | def test_to_pil_image(self, name, image_shape, dtype): method test_to_pil_image_from_float (line 84) | def test_to_pil_image_from_float(self, name, image_shape, dtype): method test_to_pil_image_from_mask (line 99) | def test_to_pil_image_from_mask(self): method test_to_pil_image_from_torch (line 120) | def test_to_pil_image_from_torch(self): method test_to_channel_dimension_format (line 133) | def test_to_channel_dimension_format(self): method test_get_resize_output_image_size (line 157) | def test_get_resize_output_image_size(self): method test_resize (line 211) | def test_resize(self): method test_normalize (line 244) | def test_normalize(self): method test_center_crop (line 313) | def test_center_crop(self): method test_center_to_corners_format (line 345) | def test_center_to_corners_format(self): method test_corners_to_center_format (line 353) | def test_corners_to_center_format(self): method test_rgb_to_id (line 361) | def test_rgb_to_id(self): method test_id_to_rgb (line 384) | def test_id_to_rgb(self): method test_pad (line 406) | def test_pad(self): method test_convert_to_rgb (line 566) | def test_convert_to_rgb(self): method test_flip_channel_order (line 594) | def test_flip_channel_order(self): FILE: tests/test_modeling_common.py function _test_eager_matches_sdpa_inference (line 155) | def _test_eager_matches_sdpa_inference( function _get_output_tensors (line 527) | def _get_output_tensors(outputs): function _test_eager_matches_batched_and_grouped_inference (line 542) | def _test_eager_matches_batched_and_grouped_inference(self, name, dtype): function _config_zero_init (line 630) | def _config_zero_init(config): function _mock_init_weights (line 647) | def _mock_init_weights(self, module): function _mock_all_init_weights (line 654) | def _mock_all_init_weights(self): function _deepspeed_zero3 (line 669) | def _deepspeed_zero3(ds_config): function sdpa_kernel (line 677) | def sdpa_kernel(enable_flash, enable_math, enable_mem_efficient): class ModelTesterMixin (line 689) | class ModelTesterMixin: method __init_subclass__ (line 706) | def __init_subclass__(cls, **kwargs): method all_generative_model_classes (line 715) | def all_generative_model_classes(self): method _prepare_for_class (line 718) | def _prepare_for_class(self, inputs_dict, model_class, return_labels=F... method test_num_layers_is_small (line 786) | def test_num_layers_is_small(self): method test_save_load (line 828) | def test_save_load(self): method test_from_pretrained_no_checkpoint (line 866) | def test_from_pretrained_no_checkpoint(self): method test_keep_in_fp32_modules_exist (line 888) | def test_keep_in_fp32_modules_exist(self): method test_keep_in_fp32_modules (line 924) | def test_keep_in_fp32_modules(self): method test_save_load_keys_to_ignore_on_save (line 959) | def test_save_load_keys_to_ignore_on_save(self): method test_load_contiguous_weights (line 994) | def test_load_contiguous_weights(self): method test_gradient_checkpointing_backward_compatibility (line 1011) | def test_gradient_checkpointing_backward_compatibility(self): method test_gradient_checkpointing_enable_disable (line 1022) | def test_gradient_checkpointing_enable_disable(self): method test_peft_gradient_checkpointing_enable_disable (line 1061) | def test_peft_gradient_checkpointing_enable_disable(self): method test_enable_input_require_grads (line 1099) | def test_enable_input_require_grads(self): method test_enable_input_require_grads_with_gradient_checkpointing (line 1112) | def test_enable_input_require_grads_with_gradient_checkpointing(self): method test_can_init_all_missing_weights (line 1206) | def test_can_init_all_missing_weights(self): method test_init_weights_can_init_buffers (line 1293) | def test_init_weights_can_init_buffers(self): method test_all_tensors_are_parameter_or_buffer (line 1355) | def test_all_tensors_are_parameter_or_buffer(self) -> None: method test_torch_save_load (line 1396) | def test_torch_save_load(self): method test_determinism (line 1445) | def test_determinism(self): method test_batching_equivalence (line 1477) | def test_batching_equivalence(self, atol=1e-5, rtol=1e-5): method test_model_forward_default_config_values (line 1567) | def test_model_forward_default_config_values( method check_training_gradient_checkpointing (line 1623) | def check_training_gradient_checkpointing(self, gradient_checkpointing... method test_training (line 1715) | def test_training(self): method test_training_gradient_checkpointing (line 1736) | def test_training_gradient_checkpointing(self): method test_training_gradient_checkpointing_use_reentrant_false (line 1740) | def test_training_gradient_checkpointing_use_reentrant_false(self): method test_training_gradient_checkpointing_use_reentrant_true (line 1745) | def test_training_gradient_checkpointing_use_reentrant_true(self): method _set_subconfig_attributes (line 1749) | def _set_subconfig_attributes(self, config, attribute_name, value): method test_attention_outputs (line 1760) | def test_attention_outputs(self): method test_hidden_states_output (line 1885) | def test_hidden_states_output(self): method test_retain_grad_hidden_states_attentions (line 1938) | def test_retain_grad_hidden_states_attentions(self): method _prepare_config_and_inputs_for_retain_grad_hidden_states_attentions (line 2004) | def _prepare_config_and_inputs_for_retain_grad_hidden_states_attention... method test_feed_forward_chunking (line 2007) | def test_feed_forward_chunking(self): method test_resize_position_vector_embeddings (line 2029) | def test_resize_position_vector_embeddings(self): method test_resize_tokens_embeddings (line 2108) | def test_resize_tokens_embeddings(self): method test_resize_tokens_embeddings_with_deepspeed (line 2266) | def test_resize_tokens_embeddings_with_deepspeed(self): method test_resize_tokens_embeddings_with_deepspeed_multi_gpu (line 2278) | def test_resize_tokens_embeddings_with_deepspeed_multi_gpu(self): method test_resize_embeddings_untied (line 2287) | def test_resize_embeddings_untied(self): method test_resize_embeddings_untied_with_deepspeed (line 2380) | def test_resize_embeddings_untied_with_deepspeed(self): method test_resize_embeddings_untied_with_deepspeed_multi_gpu (line 2392) | def test_resize_embeddings_untied_with_deepspeed_multi_gpu(self): method test_model_get_set_embeddings (line 2401) | def test_model_get_set_embeddings(self): method test_model_main_input_name (line 2415) | def test_model_main_input_name(self): method test_model_base_model_prefix (line 2422) | def test_model_base_model_prefix(self): method test_correct_missing_keys (line 2436) | def test_correct_missing_keys(self): method test_can_use_safetensors (line 2462) | def test_can_use_safetensors(self): method test_load_save_without_tied_weights (line 2506) | def test_load_save_without_tied_weights(self): method test_tied_weights_keys (line 2538) | def test_tied_weights_keys(self): method test_model_weights_reload_no_missing_tied_weights (line 2579) | def test_model_weights_reload_no_missing_tied_weights(self): method test_model_outputs_equivalence (line 2637) | def test_model_outputs_equivalence(self): method test_inputs_embeds (line 2712) | def test_inputs_embeds(self): method test_inputs_embeds_matches_input_ids (line 2745) | def test_inputs_embeds_matches_input_ids(self): method test_multi_gpu_data_parallel_forward (line 2794) | def test_multi_gpu_data_parallel_forward(self): method check_device_map_is_respected (line 2818) | def check_device_map_is_respected(self, model, device_map): method test_disk_offload_bin (line 2838) | def test_disk_offload_bin(self): method test_disk_offload_safetensors (line 2887) | def test_disk_offload_safetensors(self): method test_cpu_offload (line 2927) | def test_cpu_offload(self): method test_model_parallelism (line 2970) | def test_model_parallelism(self): method test_problem_types (line 3008) | def test_problem_types(self): method test_load_with_mismatched_shapes (line 3054) | def test_load_with_mismatched_shapes(self): method test_can_load_ignoring_mismatched_shapes (line 3097) | def test_can_load_ignoring_mismatched_shapes(self): method test_model_is_small (line 3188) | def test_model_is_small(self): method flash_attn_inference_equivalence (line 3199) | def flash_attn_inference_equivalence( method test_flash_attn_kernels_inference_equivalence (line 3358) | def test_flash_attn_kernels_inference_equivalence(self): method test_flash_attn_kernels_mps_inference_equivalence (line 3366) | def test_flash_attn_kernels_mps_inference_equivalence(self): method test_flash_attn_2_inference_equivalence (line 3376) | def test_flash_attn_2_inference_equivalence(self): method test_flash_attn_2_inference_equivalence_right_padding (line 3384) | def test_flash_attn_2_inference_equivalence_right_padding(self): method test_flash_attn_3_inference_equivalence (line 3392) | def test_flash_attn_3_inference_equivalence(self): method test_flash_attn_3_inference_equivalence_right_padding (line 3400) | def test_flash_attn_3_inference_equivalence_right_padding(self): method test_flash_attn_4_inference_equivalence (line 3408) | def test_flash_attn_4_inference_equivalence(self): method test_flash_attn_4_inference_equivalence_right_padding (line 3416) | def test_flash_attn_4_inference_equivalence_right_padding(self): method test_attn_implementation_composite_models (line 3419) | def test_attn_implementation_composite_models(self): method test_sdpa_can_dispatch_non_composite_models (line 3479) | def test_sdpa_can_dispatch_non_composite_models(self): method test_sdpa_can_dispatch_composite_models (line 3516) | def test_sdpa_can_dispatch_composite_models(self): method test_eager_matches_sdpa_inference (line 3577) | def test_eager_matches_sdpa_inference( method test_eager_matches_batched_and_grouped_inference (line 3585) | def test_eager_matches_batched_and_grouped_inference(self, name, dtype): method test_sdpa_can_dispatch_on_flash (line 3590) | def test_sdpa_can_dispatch_on_flash(self): method test_sdpa_can_compile_dynamic (line 3677) | def test_sdpa_can_compile_dynamic(self): method flash_attn_can_dispatch_composite_models (line 3739) | def flash_attn_can_dispatch_composite_models(self, attn_implementation... method test_flash_attn_2_can_dispatch_composite_models (line 3818) | def test_flash_attn_2_can_dispatch_composite_models(self): method test_flash_attn_3_can_dispatch_composite_models (line 3824) | def test_flash_attn_3_can_dispatch_composite_models(self): method test_flash_attn_4_can_dispatch_composite_models (line 3830) | def test_flash_attn_4_can_dispatch_composite_models(self): method test_flash_attn_2_fp32_ln (line 3838) | def test_flash_attn_2_fp32_ln(self): method test_flash_attn_2_can_compile_with_attention_mask_None_without_graph_break (line 3899) | def test_flash_attn_2_can_compile_with_attention_mask_None_without_gra... method flash_attn_from_config (line 3932) | def flash_attn_from_config(self, attn_implementation: str, test_fwd_in... method test_flash_attn_2_from_config (line 3990) | def test_flash_attn_2_from_config(self): method test_flash_attn_3_from_config (line 3997) | def test_flash_attn_3_from_config(self): method test_flash_attn_4_from_config (line 4004) | def test_flash_attn_4_from_config(self): method test_sliding_window_mask (line 4007) | def test_sliding_window_mask(self): method test_torch_compile_for_training (line 4064) | def test_torch_compile_for_training(self): method test_torch_export (line 4110) | def test_torch_export(self, atol=1e-4, rtol=1e-4): method _prepare_config_headdim (line 4246) | def _prepare_config_headdim(config, requested_dim): method test_flex_attention_with_grads (line 4326) | def test_flex_attention_with_grads(self): method test_generation_tester_mixin_inheritance (line 4364) | def test_generation_tester_mixin_inheritance(self): method test_can_be_initialized_on_meta (line 4391) | def test_can_be_initialized_on_meta(self): method test_can_load_with_device_context_manager (line 4399) | def test_can_load_with_device_context_manager(self): method test_can_load_with_global_device_set (line 4426) | def test_can_load_with_global_device_set(self): method test_cannot_load_with_meta_device_context_manager (line 4454) | def test_cannot_load_with_meta_device_context_manager(self): method test_config_attn_implementation_setter (line 4469) | def test_config_attn_implementation_setter(self): method test_internal_model_config_and_subconfig_are_same (line 4497) | def test_internal_model_config_and_subconfig_are_same(self): method test_can_set_attention_dynamically (line 4536) | def test_can_set_attention_dynamically(self): method test_can_set_attention_dynamically_composite_model (line 4585) | def test_can_set_attention_dynamically_composite_model(self): method test_bc_torch_dtype (line 4622) | def test_bc_torch_dtype(self): method test_tp_plan_matches_params (line 4648) | def test_tp_plan_matches_params(self): method test_reverse_loading_mapping (line 4690) | def test_reverse_loading_mapping(self, check_keys_were_modified=True): method test_can_load_from_already_mapped_keys (line 4784) | def test_can_load_from_already_mapped_keys(self): method _text_features_prepare_config_and_inputs (line 4807) | def _text_features_prepare_config_and_inputs(self): method _image_features_prepare_config_and_inputs (line 4825) | def _image_features_prepare_config_and_inputs(self): method _audio_features_prepare_config_and_inputs (line 4846) | def _audio_features_prepare_config_and_inputs(self): method _video_features_prepare_config_and_inputs (line 4868) | def _video_features_prepare_config_and_inputs(self): method _text_features_get_expected_num_attentions (line 4896) | def _text_features_get_expected_num_attentions(self, model_tester=None): method _text_features_get_expected_num_hidden_states (line 4908) | def _text_features_get_expected_num_hidden_states(self, model_tester=N... method _image_features_get_expected_num_attentions (line 4911) | def _image_features_get_expected_num_attentions(self, model_tester=None): method _image_features_get_expected_num_hidden_states (line 4929) | def _image_features_get_expected_num_hidden_states(self, model_tester=... method _audio_features_get_expected_num_attentions (line 4932) | def _audio_features_get_expected_num_attentions(self, model_tester=None): method _audio_features_get_expected_num_hidden_states (line 4951) | def _audio_features_get_expected_num_hidden_states(self, model_tester=... method _video_features_get_expected_num_attentions (line 4954) | def _video_features_get_expected_num_attentions(self, model_tester=None): method _video_features_get_expected_num_hidden_states (line 4975) | def _video_features_get_expected_num_hidden_states(self, model_tester=... method test_get_text_features_output (line 4979) | def test_get_text_features_output(self, return_dict: bool | None): method test_get_text_features_hidden_states (line 5028) | def test_get_text_features_hidden_states(self): method test_get_text_features_attentions (line 5060) | def test_get_text_features_attentions(self): method test_get_image_features_output (line 5097) | def test_get_image_features_output(self, return_dict: bool | None): method test_get_image_features_hidden_states (line 5183) | def test_get_image_features_hidden_states(self): method test_get_image_features_attentions (line 5218) | def test_get_image_features_attentions(self): method test_get_audio_features_output (line 5258) | def test_get_audio_features_output(self, return_dict: bool | None): method test_get_audio_features_hidden_states (line 5329) | def test_get_audio_features_hidden_states(self): method test_get_audio_features_attentions (line 5360) | def test_get_audio_features_attentions(self): method test_get_video_features_output (line 5396) | def test_get_video_features_output(self, return_dict: bool | None): method test_get_video_features_hidden_states (line 5463) | def test_get_video_features_hidden_states(self): method test_get_video_features_attentions (line 5494) | def test_get_video_features_attentions(self): method test_capture_outputs_decorator (line 5529) | def test_capture_outputs_decorator(self): function compare_state_dicts (line 5608) | def compare_state_dicts(state_dict1, state_dict2) -> bool: function seeded_weight_init (line 5625) | def seeded_weight_init(): function skip_weight_init (line 5645) | def skip_weight_init(): function find_parent_traceback (line 5662) | def find_parent_traceback(full_param_name: str, model: PreTrainedModel) ... function ids_tensor (line 5681) | def ids_tensor(shape, vocab_size, rng=None, name=None): function random_attention_mask (line 5697) | def random_attention_mask(shape, rng=None, name=None): function floats_tensor (line 5705) | def floats_tensor(shape, scale=1.0, rng=None, name=None): FILE: tests/test_monkey_patching.py class MonkeyPatchTest (line 37) | class MonkeyPatchTest(unittest.TestCase): method setUp (line 38) | def setUp(self): method tearDown (line 42) | def tearDown(self): method test_register_patch_mapping (line 46) | def test_register_patch_mapping(self): method test_register_duplicate_with_overwrite (line 60) | def test_register_duplicate_with_overwrite(self): method test_register_non_nn_module_raises_error (line 79) | def test_register_non_nn_module_raises_error(self): method test_unregister_patch_mapping (line 91) | def test_unregister_patch_mapping(self): method test_unregister_nonexistent_class (line 105) | def test_unregister_nonexistent_class(self): method test_clear_patch_mapping (line 114) | def test_clear_patch_mapping(self): method test_get_patch_mapping_returns_copy (line 133) | def test_get_patch_mapping_returns_copy(self): method test_apply_patches_context_manager (line 149) | def test_apply_patches_context_manager(self): method test_thread_safety_concurrent_access (line 180) | def test_thread_safety_concurrent_access(self): method test_patch_output_recorders_with_output_recorder_instance (line 211) | def test_patch_output_recorders_with_output_recorder_instance(self): method test_patch_output_recorders_with_class_type (line 240) | def test_patch_output_recorders_with_class_type(self): method test_pattern_matching_wildcard (line 268) | def test_pattern_matching_wildcard(self): method test_exact_match_precedence_over_pattern (line 298) | def test_exact_match_precedence_over_pattern(self): method test_pattern_with_output_recorders (line 327) | def test_pattern_with_output_recorders(self): FILE: tests/test_pipeline_mixin.py class PipelineTesterMixin (line 151) | class PipelineTesterMixin: method run_task_tests (line 155) | def run_task_tests(self, task, dtype="float32"): method run_model_pipeline_tests (line 235) | def run_model_pipeline_tests( method run_pipeline_test (line 329) | def run_pipeline_test( method test_pipeline_audio_classification (line 474) | def test_pipeline_audio_classification(self): method test_pipeline_audio_classification_fp16 (line 479) | def test_pipeline_audio_classification_fp16(self): method test_pipeline_automatic_speech_recognition (line 483) | def test_pipeline_automatic_speech_recognition(self): method test_pipeline_automatic_speech_recognition_fp16 (line 488) | def test_pipeline_automatic_speech_recognition_fp16(self): method test_pipeline_depth_estimation (line 495) | def test_pipeline_depth_estimation(self): method test_pipeline_depth_estimation_fp16 (line 502) | def test_pipeline_depth_estimation_fp16(self): method test_pipeline_document_question_answering (line 509) | def test_pipeline_document_question_answering(self): method test_pipeline_document_question_answering_fp16 (line 516) | def test_pipeline_document_question_answering_fp16(self): method test_pipeline_feature_extraction (line 520) | def test_pipeline_feature_extraction(self): method test_pipeline_feature_extraction_fp16 (line 525) | def test_pipeline_feature_extraction_fp16(self): method test_pipeline_fill_mask (line 529) | def test_pipeline_fill_mask(self): method test_pipeline_fill_mask_fp16 (line 534) | def test_pipeline_fill_mask_fp16(self): method test_pipeline_image_classification (line 540) | def test_pipeline_image_classification(self): method test_pipeline_image_classification_fp16 (line 546) | def test_pipeline_image_classification_fp16(self): method test_pipeline_image_segmentation (line 553) | def test_pipeline_image_segmentation(self): method test_pipeline_image_segmentation_fp16 (line 560) | def test_pipeline_image_segmentation_fp16(self): method test_pipeline_image_text_to_text (line 566) | def test_pipeline_image_text_to_text(self): method test_pipeline_image_text_to_text_fp16 (line 572) | def test_pipeline_image_text_to_text_fp16(self): method test_pipeline_any_to_any (line 578) | def test_pipeline_any_to_any(self): method test_pipeline_any_to_any_fp16 (line 584) | def test_pipeline_any_to_any_fp16(self): method test_pipeline_image_feature_extraction (line 591) | def test_pipeline_image_feature_extraction(self): method test_pipeline_image_feature_extraction_fp16 (line 598) | def test_pipeline_image_feature_extraction_fp16(self): method test_pipeline_mask_generation (line 605) | def test_pipeline_mask_generation(self): method test_pipeline_mask_generation_fp16 (line 612) | def test_pipeline_mask_generation_fp16(self): method test_pipeline_object_detection (line 619) | def test_pipeline_object_detection(self): method test_pipeline_object_detection_fp16 (line 626) | def test_pipeline_object_detection_fp16(self): method test_pipeline_table_question_answering (line 630) | def test_pipeline_table_question_answering(self): method test_pipeline_table_question_answering_fp16 (line 635) | def test_pipeline_table_question_answering_fp16(self): method test_pipeline_text_classification (line 639) | def test_pipeline_text_classification(self): method test_pipeline_text_classification_fp16 (line 644) | def test_pipeline_text_classification_fp16(self): method test_pipeline_text_generation (line 649) | def test_pipeline_text_generation(self): method test_pipeline_text_generation_fp16 (line 654) | def test_pipeline_text_generation_fp16(self): method test_pipeline_text_to_audio (line 659) | def test_pipeline_text_to_audio(self): method test_pipeline_text_to_audio_fp16 (line 664) | def test_pipeline_text_to_audio_fp16(self): method test_pipeline_token_classification (line 668) | def test_pipeline_token_classification(self): method test_pipeline_token_classification_fp16 (line 673) | def test_pipeline_token_classification_fp16(self): method test_pipeline_video_classification (line 680) | def test_pipeline_video_classification(self): method test_pipeline_video_classification_fp16 (line 687) | def test_pipeline_video_classification_fp16(self): method test_pipeline_zero_shot (line 691) | def test_pipeline_zero_shot(self): method test_pipeline_zero_shot_fp16 (line 696) | def test_pipeline_zero_shot_fp16(self): method test_pipeline_zero_shot_audio_classification (line 701) | def test_pipeline_zero_shot_audio_classification(self): method test_pipeline_zero_shot_audio_classification_fp16 (line 706) | def test_pipeline_zero_shot_audio_classification_fp16(self): method test_pipeline_zero_shot_image_classification (line 711) | def test_pipeline_zero_shot_image_classification(self): method test_pipeline_zero_shot_image_classification_fp16 (line 717) | def test_pipeline_zero_shot_image_classification_fp16(self): method test_pipeline_zero_shot_object_detection (line 723) | def test_pipeline_zero_shot_object_detection(self): method test_pipeline_zero_shot_object_detection_fp16 (line 729) | def test_pipeline_zero_shot_object_detection_fp16(self): method is_pipeline_test_to_skip (line 733) | def is_pipeline_test_to_skip( method is_pipeline_test_to_skip_more (line 758) | def is_pipeline_test_to_skip_more( function validate_test_components (line 782) | def validate_test_components(model, tokenizer): function get_arg_names_from_hub_spec (line 805) | def get_arg_names_from_hub_spec(hub_spec, first_level=True): function parse_args_from_docstring_by_indentation (line 826) | def parse_args_from_docstring_by_indentation(docstring): function compare_pipeline_args_to_hub_spec (line 857) | def compare_pipeline_args_to_hub_spec(pipeline_class, hub_spec): FILE: tests/test_processing_common.py function prepare_image_inputs (line 75) | def prepare_image_inputs(): function floats_list (line 83) | def floats_list(shape, scale=1.0, rng=None, name=None): class ProcessorTesterMixin (line 99) | class ProcessorTesterMixin: method setUpClass (line 129) | def setUpClass(cls): method _setup_test_attributes (line 155) | def _setup_test_attributes(cls, processor): method _setup_from_pretrained (line 161) | def _setup_from_pretrained(cls, model_id, **kwargs): method _setup_from_components (line 182) | def _setup_from_components(cls): method _setup_component (line 197) | def _setup_component(cls, attribute): method _get_component_class_from_processor (line 242) | def _get_component_class_from_processor(cls, attribute, use_fast: bool... method tearDownClass (line 343) | def tearDownClass(cls): method prepare_processor_dict (line 349) | def prepare_processor_dict(): method get_component (line 353) | def get_component(self, attribute, **kwargs): method prepare_components (line 367) | def prepare_components(self, **kwargs): method get_processor (line 375) | def get_processor(self): method prepare_text_inputs (line 379) | def prepare_text_inputs(self, batch_size: int | None = None, modalitie... method prepare_image_inputs (line 401) | def prepare_image_inputs(self, batch_size: int | None = None, nested: ... method prepare_video_inputs (line 412) | def prepare_video_inputs(self, batch_size: int | None = None): method prepare_audio_inputs (line 420) | def prepare_audio_inputs(self, batch_size: int | None = None): method test_processor_to_json_string (line 428) | def test_processor_to_json_string(self): method test_processor_from_and_save_pretrained (line 444) | def test_processor_from_and_save_pretrained(self): method test_processor_from_and_save_pretrained_as_nested_dict (line 471) | def test_processor_from_and_save_pretrained_as_nested_dict(self): method test_save_load_pretrained_additional_features (line 496) | def test_save_load_pretrained_additional_features(self): method test_processor_from_pretrained_vs_from_components (line 530) | def test_processor_from_pretrained_vs_from_components(self): method test_model_input_names (line 549) | def test_model_input_names(self): method test_image_processor_defaults (line 566) | def test_image_processor_defaults(self): method test_tokenizer_defaults (line 597) | def test_tokenizer_defaults(self): method test_feature_extractor_defaults (line 629) | def test_feature_extractor_defaults(self): method test_video_processor_defaults (line 667) | def test_video_processor_defaults(self): method test_tokenizer_decode_defaults (line 699) | def test_tokenizer_decode_defaults(self): method test_processor_with_multiple_inputs (line 723) | def test_processor_with_multiple_inputs(self): method test_processor_text_has_no_visual (line 784) | def test_processor_text_has_no_visual(self): method skip_processor_without_typed_kwargs (line 873) | def skip_processor_without_typed_kwargs(self, processor): method test_tokenizer_defaults_preserved_by_kwargs (line 886) | def test_tokenizer_defaults_preserved_by_kwargs(self): method test_image_processor_defaults_preserved_by_image_kwargs (line 904) | def test_image_processor_defaults_preserved_by_image_kwargs(self): method test_kwargs_overrides_default_tokenizer_kwargs (line 932) | def test_kwargs_overrides_default_tokenizer_kwargs(self): method test_kwargs_overrides_default_image_processor_kwargs (line 954) | def test_kwargs_overrides_default_image_processor_kwargs(self): method test_unstructured_kwargs (line 979) | def test_unstructured_kwargs(self): method test_unstructured_kwargs_batched (line 1002) | def test_unstructured_kwargs_batched(self): method test_doubly_passed_kwargs (line 1028) | def test_doubly_passed_kwargs(self): method test_args_overlap_kwargs (line 1047) | def test_args_overlap_kwargs(self): method test_structured_kwargs_nested (line 1059) | def test_structured_kwargs_nested(self): method test_structured_kwargs_nested_from_dict (line 1083) | def test_structured_kwargs_nested_from_dict(self): method test_tokenizer_defaults_preserved_by_kwargs_audio (line 1106) | def test_tokenizer_defaults_preserved_by_kwargs_audio(self): method test_kwargs_overrides_default_tokenizer_kwargs_audio (line 1129) | def test_kwargs_overrides_default_tokenizer_kwargs_audio(self): method test_unstructured_kwargs_audio (line 1159) | def test_unstructured_kwargs_audio(self): method test_doubly_passed_kwargs_audio (line 1184) | def test_doubly_passed_kwargs_audio(self): method test_structured_kwargs_audio_nested (line 1208) | def test_structured_kwargs_audio_nested(self): method test_tokenizer_defaults_preserved_by_kwargs_video (line 1238) | def test_tokenizer_defaults_preserved_by_kwargs_video(self): method test_video_processor_defaults_preserved_by_video_kwargs (line 1256) | def test_video_processor_defaults_preserved_by_video_kwargs(self): method test_kwargs_overrides_default_tokenizer_kwargs_video (line 1284) | def test_kwargs_overrides_default_tokenizer_kwargs_video(self): method test_kwargs_overrides_default_video_processor_kwargs (line 1307) | def test_kwargs_overrides_default_video_processor_kwargs(self): method test_unstructured_kwargs_video (line 1337) | def test_unstructured_kwargs_video(self): method test_unstructured_kwargs_batched_video (line 1361) | def test_unstructured_kwargs_batched_video(self): method test_doubly_passed_kwargs_video (line 1388) | def test_doubly_passed_kwargs_video(self): method test_structured_kwargs_nested_video (line 1408) | def test_structured_kwargs_nested_video(self): method test_structured_kwargs_nested_from_dict_video (line 1432) | def test_structured_kwargs_nested_from_dict_video(self): method test_overlapping_text_image_kwargs_handling (line 1455) | def test_overlapping_text_image_kwargs_handling(self): method test_overlapping_text_audio_kwargs_handling (line 1476) | def test_overlapping_text_audio_kwargs_handling(self): method test_chat_template_save_loading (line 1499) | def test_chat_template_save_loading(self): method _test_apply_chat_template (line 1539) | def _test_apply_chat_template( method test_apply_chat_template_audio (line 1644) | def test_apply_chat_template_audio(self, batch_size: int, return_tenso... method test_apply_chat_template_decoded_video (line 1666) | def test_apply_chat_template_decoded_video(self, batch_size: int, retu... method test_apply_chat_template_video (line 1675) | def test_apply_chat_template_video(self, batch_size: int, return_tenso... method test_apply_chat_template_image (line 1681) | def test_apply_chat_template_image(self, batch_size: int, return_tenso... method test_apply_chat_template_video_frame_sampling (line 1687) | def test_apply_chat_template_video_frame_sampling(self): method test_chat_template_audio_from_video (line 1819) | def test_chat_template_audio_from_video(self): method test_chat_template_jinja_kwargs (line 1880) | def test_chat_template_jinja_kwargs(self): method test_apply_chat_template_assistant_mask (line 1920) | def test_apply_chat_template_assistant_mask(self): method test_get_num_multimodal_tokens_matches_processor_call (line 1993) | def test_get_num_multimodal_tokens_matches_processor_call(self): FILE: tests/test_sentencepiece_backend_mixin.py class SentencePieceBackendTesterMixin (line 15) | class SentencePieceBackendTesterMixin: method setUpClass (line 30) | def setUpClass(cls) -> None: method tearDownClass (line 34) | def tearDownClass(cls): method get_tokenizer (line 38) | def get_tokenizer(cls, **kwargs) -> PythonBackend: method get_rust_tokenizer (line 46) | def get_rust_tokenizer(cls, **kwargs) -> TokenizersBackend: method get_tokenizers (line 49) | def get_tokenizers(self, fast=True, **kwargs): method test_sentencepiece_tokenize_and_convert_tokens_to_string (line 59) | def test_sentencepiece_tokenize_and_convert_tokens_to_string(self): method test_sentencepiece_tokenize_and_decode (line 92) | def test_sentencepiece_tokenize_and_decode(self): method test_save_sentencepiece_tokenizer (line 109) | def test_save_sentencepiece_tokenizer(self) -> None: method test_added_token_are_matched_longest_first (line 132) | def test_added_token_are_matched_longest_first(self): method test_added_tokens_do_lower_case (line 156) | def test_added_tokens_do_lower_case(self): method test_add_tokens_tokenizer (line 193) | def test_add_tokens_tokenizer(self): method test_add_special_tokens (line 245) | def test_add_special_tokens(self): method test_add_tokens (line 248) | def test_add_tokens(self): method test_compare_add_special_tokens (line 275) | def test_compare_add_special_tokens(self): method test_special_tokens_initialization (line 305) | def test_special_tokens_initialization(self): method test_special_token_addition (line 317) | def test_special_token_addition(self): method test_alignment_methods (line 341) | def test_alignment_methods(self): FILE: tests/test_sequence_feature_extraction_common.py class SequenceFeatureExtractionTestMixin (line 24) | class SequenceFeatureExtractionTestMixin(FeatureExtractionSavingTestMixin): method feat_extract_dict (line 30) | def feat_extract_dict(self): method test_feat_extract_common_properties (line 33) | def test_feat_extract_common_properties(self): method test_batch_feature (line 39) | def test_batch_feature(self): method test_batch_feature_pt (line 62) | def test_batch_feature_pt(self): method _check_padding (line 79) | def _check_padding(self, numpify=False): method _check_truncation (line 201) | def _check_truncation(self, numpify=False): method test_padding_from_list (line 332) | def test_padding_from_list(self): method test_padding_from_array (line 335) | def test_padding_from_array(self): method test_truncation_from_list (line 338) | def test_truncation_from_list(self): method test_truncation_from_array (line 341) | def test_truncation_from_array(self): method test_padding_accepts_tensors_pt (line 345) | def test_padding_accepts_tensors_pt(self): method test_attention_mask (line 357) | def test_attention_mask(self): method test_attention_mask_with_truncation (line 372) | def test_attention_mask_with_truncation(self): FILE: tests/test_tensor_parallel_mixin.py function _find_free_port (line 38) | def _find_free_port(): function get_packed_grad_shard (line 46) | def get_packed_grad_shard(grad, world_size, rank, dim): function _global_wrapper (line 71) | def _global_wrapper(rank, func, tp, port, func_args, func_kwargs): function _init_distributed (line 92) | def _init_distributed(tp: int, max_retries: int = 5): function _load_tp_and_reference_models (line 114) | def _load_tp_and_reference_models(model_path, model_class): function _verify_tp_sharding (line 130) | def _verify_tp_sharding(rank, model_tp, model_ref): function _test_tp_forward_impl (line 164) | def _test_tp_forward_impl(_rank, model_path, model_class, atol, rtol): function _test_tp_backward_impl (line 191) | def _test_tp_backward_impl(rank, model_path, model_class, atol, rtol): function _test_tp_generation_impl (line 250) | def _test_tp_generation_impl(_rank, model_path, model_class, atol, rtol,... function _test_tp_generation_quantized_impl (line 293) | def _test_tp_generation_quantized_impl(_rank, model_path, model_class, m... class TensorParallelTesterMixin (line 347) | class TensorParallelTesterMixin(ABC): method model_tester (line 367) | def model_tester(self): method _has_tp_plan (line 374) | def _has_tp_plan(self) -> bool: method _get_tp_model_class (line 379) | def _get_tp_model_class(self): method _skip_if_not_supported (line 385) | def _skip_if_not_supported(self): method test_tp_forward (line 415) | def test_tp_forward(self): method test_tp_backward (line 431) | def test_tp_backward(self): method test_tp_generation (line 447) | def test_tp_generation(self): method test_tp_generation_quantized (line 467) | def test_tp_generation_quantized(self): FILE: tests/test_tokenization_common.py function use_cache_if_possible (line 88) | def use_cache_if_possible(func): function filter_non_english (line 126) | def filter_non_english(_, pretrained_name: str): function filter_roberta_detectors (line 131) | def filter_roberta_detectors(_, pretrained_name: str): function merge_model_tokenizer_mappings (line 135) | def merge_model_tokenizer_mappings( function check_subword_sampling (line 158) | def check_subword_sampling( class TokenizersExtractor (line 200) | class TokenizersExtractor: method __init__ (line 209) | def __init__(self, tokenizer_file: str): method extract (line 225) | def extract(self) -> tuple[dict[str, int], list[tuple[str, float]], li... class TokenizerTesterMixin (line 305) | class TokenizerTesterMixin: method setUpClass (line 342) | def setUpClass(cls) -> None: method tearDownClass (line 374) | def tearDownClass(cls): method get_input_output_texts (line 377) | def get_input_output_texts(self, tokenizer): method get_clean_sequence (line 381) | def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_l... method get_tokenizers (line 409) | def get_tokenizers(self, **kwargs) -> list[PreTrainedTokenizerBase]: method get_tokenizer (line 417) | def get_tokenizer(cls, pretrained_name=None, **kwargs) -> PreTrainedTo... method get_extracted_tokenizer (line 422) | def get_extracted_tokenizer(self, reference_tokenizer=None): method get_extracted_tokenizer_from_sentencepiece (line 477) | def get_extracted_tokenizer_from_sentencepiece(self, reference_tokeniz... method tokenizer_integration_test_util (line 497) | def tokenizer_integration_test_util( method assert_padded_input_match (line 567) | def assert_padded_input_match(self, input_r: list, input_p: list, max_... method assert_batch_padded_input_match (line 577) | def assert_batch_padded_input_match( method convert_batch_to_list_format (line 604) | def convert_batch_to_list_format(batch_encode_plus_sequences): method test_tokenize_special_tokens (line 613) | def test_tokenize_special_tokens(self): method test_model_input_names_signature (line 633) | def test_model_input_names_signature(self): method test_tokenizer_store_full_signature (line 644) | def test_tokenizer_store_full_signature(self): method test_tokenizers_common_properties (line 661) | def test_tokenizers_common_properties(self): method test_tokenizers_common_ids_setters (line 693) | def test_tokenizers_common_ids_setters(self): method test_save_and_load_tokenizer (line 726) | def test_save_and_load_tokenizer(self): method _run_integration_checks (line 811) | def _run_integration_checks(self, tokenizer, tokenizer_type): method test_integration (line 837) | def test_integration(self): method test_integration_from_extractor (line 859) | def test_integration_from_extractor(self): method test_internal_consistency (line 892) | def test_internal_consistency(self): method test_mask_output (line 908) | def test_mask_output(self): method test_token_type_ids (line 916) | def test_token_type_ids(self): method test_sequence_ids (line 927) | def test_sequence_ids(self): method test_chat_template (line 951) | def test_chat_template(self): method test_chat_template_save_loading (line 1014) | def test_chat_template_save_loading(self): method test_chat_template_batched (line 1056) | def test_chat_template_batched(self): method test_jinja_loopcontrols (line 1090) | def test_jinja_loopcontrols(self): method test_jinja_strftime (line 1110) | def test_jinja_strftime(self): method test_chat_template_return_assistant_tokens_mask (line 1130) | def test_chat_template_return_assistant_tokens_mask(self): method test_chat_template_return_assistant_tokens_mask_truncated (line 1323) | def test_chat_template_return_assistant_tokens_mask_truncated(self): method test_continue_final_message (line 1434) | def test_continue_final_message(self): method test_continue_final_message_with_trim (line 1462) | def test_continue_final_message_with_trim(self): method test_continue_final_message_with_decoy_earlier_message (line 1492) | def test_continue_final_message_with_decoy_earlier_message(self): method test_chat_template_dict (line 1517) | def test_chat_template_dict(self): method test_chat_template_dict_saving (line 1533) | def test_chat_template_dict_saving(self): method test_chat_template_file_priority (line 1565) | def test_chat_template_file_priority(self): method test_number_of_added_tokens (line 1578) | def test_number_of_added_tokens(self): method test_maximum_encoding_length_single_input (line 1590) | def test_maximum_encoding_length_single_input(self): method test_maximum_encoding_length_pair_input (line 1685) | def test_maximum_encoding_length_pair_input(self): method test_special_tokens_mask (line 1941) | def test_special_tokens_mask(self): method test_special_tokens_mask_input_pairs (line 1958) | def test_special_tokens_mask_input_pairs(self): method test_padding_side_in_kwargs (line 1981) | def test_padding_side_in_kwargs(self): method test_truncation_side_in_kwargs (line 1998) | def test_truncation_side_in_kwargs(self): method test_encode_basic_padding (line 2015) | def test_encode_basic_padding(self): method test_right_and_left_truncation (line 2044) | def test_right_and_left_truncation(self): method test_padding_to_multiple_of (line 2098) | def test_padding_to_multiple_of(self): method test_padding_with_attention_mask (line 2130) | def test_padding_with_attention_mask(self): method test_encode_plus_with_padding (line 2148) | def test_encode_plus_with_padding(self, use_padding_as_call_kwarg: bool): method test_get_vocab (line 2259) | def test_get_vocab(self): method test_conversion_reversible (line 2273) | def test_conversion_reversible(self): method test_call (line 2282) | def test_call(self): method test_batch_encode_plus_batch_sequence_length (line 2311) | def test_batch_encode_plus_batch_sequence_length(self): method test_batch_encode_plus_padding (line 2359) | def test_batch_encode_plus_padding(self): method test_pretokenized_inputs (line 2405) | def test_pretokenized_inputs(self): method _check_no_pad_token_padding (line 2473) | def _check_no_pad_token_padding(self, tokenizer, sequences): method test_prepare_seq2seq_batch (line 2486) | def test_prepare_seq2seq_batch(self): method test_batch_encode_dynamic_overflowing (line 2527) | def test_batch_encode_dynamic_overflowing(self): method test_added_tokens_serialization (line 2590) | def test_added_tokens_serialization(self): method test_tokenizer_initialization_with_conflicting_key (line 2617) | def test_tokenizer_initialization_with_conflicting_key(self): method test_empty_input_string (line 2624) | def test_empty_input_string(self): method test_pad_token_initialization (line 2652) | def test_pad_token_initialization(self): method test_bos_token_with_add_bos_token_true (line 2685) | def test_bos_token_with_add_bos_token_true(self): method test_bos_token_with_add_bos_token_false (line 2702) | def test_bos_token_with_add_bos_token_false(self): method test_local_files_only (line 2719) | def test_local_files_only(self): class TokenizersBackendCommonTest (line 2744) | class TokenizersBackendCommonTest(TokenizersBackendTesterMixin, unittest... class SentencePieceBackendCommonTest (line 2756) | class SentencePieceBackendCommonTest(unittest.TestCase, SentencePieceBac... method test_add_tokens (line 2769) | def test_add_tokens(self): method test_add_tokens_tokenizer (line 2788) | def test_add_tokens_tokenizer(self): method test_alignment_methods (line 2823) | def test_alignment_methods(self): method test_local_files_only (line 2826) | def test_local_files_only(self): FILE: tests/test_tokenization_mistral_common.py class TestMistralCommonBackend (line 72) | class TestMistralCommonBackend(unittest.TestCase): method setUpClass (line 74) | def setUpClass(cls): method tearDownClass (line 128) | def tearDownClass(cls): method _ref_piece_to_id (line 139) | def _ref_piece_to_id(self, piece: str) -> int: method _get_spm_tokenizer (line 152) | def _get_spm_tokenizer(self, mode: str = "test") -> MistralCommonBackend: method test_spm_vs_tekken_piece_to_id (line 158) | def test_spm_vs_tekken_piece_to_id(self): method test_vocab_size (line 172) | def test_vocab_size(self): method test_save_pretrained (line 175) | def test_save_pretrained(self): method test_encode (line 193) | def test_encode(self): method test_decode (line 281) | def test_decode(self): method test_decode_on_batch (line 322) | def test_decode_on_batch(self): method test_decode_transcription_mode (line 355) | def test_decode_transcription_mode(self): method test_batch_decode (line 380) | def test_batch_decode(self): method test_convert_ids_to_tokens (line 427) | def test_convert_ids_to_tokens(self): method test_convert_tokens_to_ids (line 455) | def test_convert_tokens_to_ids(self): method test_tokenize (line 474) | def test_tokenize(self): method test_get_special_tokens_mask (line 495) | def test_get_special_tokens_mask(self): method test_pad_batch_encoding_input (line 535) | def test_pad_batch_encoding_input(self): method test_list_batch_encoding_input (line 646) | def test_list_batch_encoding_input(self): method test_truncate_sequences (line 817) | def test_truncate_sequences(self): method test_apply_chat_template_basic (line 881) | def test_apply_chat_template_basic(self): method test_apply_chat_template_continue_final_message (line 910) | def test_apply_chat_template_continue_final_message(self): method test_apply_chat_template_with_add_generation_prompt (line 935) | def test_apply_chat_template_with_add_generation_prompt(self): method test_apply_chat_template_with_tools (line 969) | def test_apply_chat_template_with_tools(self): method test_apply_chat_template_with_image (line 1024) | def test_apply_chat_template_with_image(self): method test_apply_chat_template_with_audio (line 1107) | def test_apply_chat_template_with_audio(self): method test_apply_chat_template_with_truncation (line 1161) | def test_apply_chat_template_with_truncation(self): method test_batch_apply_chat_template (line 1192) | def test_batch_apply_chat_template(self): method test_batch_apply_chat_template_images (line 1277) | def test_batch_apply_chat_template_images(self): method test_batch_apply_chat_template_with_continue_final_message (line 1358) | def test_batch_apply_chat_template_with_continue_final_message(self): method test_batch_apply_chat_template_with_add_generation_prompt (line 1411) | def test_batch_apply_chat_template_with_add_generation_prompt(self): method test_batch_apply_chat_template_with_truncation (line 1459) | def test_batch_apply_chat_template_with_truncation( method test_batch_apply_chat_template_with_padding (line 1487) | def test_batch_apply_chat_template_with_padding( method test_batch_apply_chat_template_with_padding_and_truncation (line 1533) | def test_batch_apply_chat_template_with_padding_and_truncation( method test_batch_apply_chat_template_return_tensors (line 1564) | def test_batch_apply_chat_template_return_tensors(self): method test_batch_apply_chat_template_return_dict (line 1583) | def test_batch_apply_chat_template_return_dict(self): method test_call (line 1602) | def test_call(self): method test_call_with_truncation (line 1681) | def test_call_with_truncation(self): method test_call_with_padding (line 1732) | def test_call_with_padding(self): method test_batch_call (line 1777) | def test_batch_call(self): method test_batch_call_with_truncation (line 1880) | def test_batch_call_with_truncation(self): method test_batch_call_with_padding (line 1936) | def test_batch_call_with_padding(self): method test_batch_call_with_padding_and_truncation (line 2068) | def test_batch_call_with_padding_and_truncation(self): method test_get_vocab (line 2124) | def test_get_vocab(self): method test_get_validation_mode (line 2137) | def test_get_validation_mode(self): method test_all_special_ids (line 2150) | def test_all_special_ids(self): method test_all_special_tokens (line 2158) | def test_all_special_tokens(self): method test_mode (line 2166) | def test_mode(self): method test_build_inputs_with_special_tokens (line 2177) | def test_build_inputs_with_special_tokens(self): method test_create_token_type_ids_from_sequences (line 2197) | def test_create_token_type_ids_from_sequences(self): method test_num_special_tokens_to_add (line 2210) | def test_num_special_tokens_to_add(self): method test_prepare_for_model (line 2227) | def test_prepare_for_model(self): FILE: tests/test_tokenizers_backend_mixin.py class TokenizersBackendTesterMixin (line 25) | class TokenizersBackendTesterMixin: method setUpClass (line 37) | def setUpClass(cls) -> None: method tearDownClass (line 67) | def tearDownClass(cls): method get_rust_tokenizer (line 71) | def get_rust_tokenizer(cls, pretrained_name=None, **kwargs) -> Tokeniz... method test_alignment_methods (line 76) | def test_alignment_methods(self): method test_offsets_mapping (line 304) | def test_offsets_mapping(self): method test_training_new_tokenizer (line 338) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 370) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_rust_tokenizer_add_prefix_space (line 434) | def test_rust_tokenizer_add_prefix_space(self, add_prefix_space): method test_add_bos_token_without_bos_token (line 442) | def test_add_bos_token_without_bos_token(self): method test_local_files_only (line 466) | def test_local_files_only(self): class TokenizersBackendV5RoundtripIntegrationTest (line 492) | class TokenizersBackendV5RoundtripIntegrationTest(unittest.TestCase): method test_decode_encode_roundtrip (line 564) | def test_decode_encode_roundtrip(self, model_id: str, expected_decoded... method test_additional_roundtrip_cases (line 579) | def test_additional_roundtrip_cases(self, model_id: str, _expected_dec... FILE: tests/test_training_mixin.py class TrainingTesterMixin (line 30) | class TrainingTesterMixin(ABC): method model_tester (line 57) | def model_tester(self): method _get_model_modality (line 64) | def _get_model_modality(self) -> str: method _create_text_training_batch (line 80) | def _create_text_training_batch( method _create_image_training_batch (line 94) | def _create_image_training_batch( method _create_audio_training_batch (line 104) | def _create_audio_training_batch( method _decode_text_tokens (line 113) | def _decode_text_tokens(self, tokens: list[int], max_display: int = 40... method _get_trainable_model_class (line 120) | def _get_trainable_model_class(self): method test_training_overfit (line 134) | def test_training_overfit(self): FILE: tests/test_video_processing_common.py function prepare_video (line 45) | def prepare_video(num_frames, num_channels, width=10, height=10, return_... function prepare_video_inputs (line 65) | def prepare_video_inputs( class VideoProcessingTestMixin (line 98) | class VideoProcessingTestMixin: method setUp (line 104) | def setUp(self): method test_video_processor_to_json_string (line 112) | def test_video_processor_to_json_string(self): method test_video_processor_to_json_file (line 119) | def test_video_processor_to_json_file(self): method test_video_processor_from_dict_with_kwargs (line 130) | def test_video_processor_from_dict_with_kwargs(self): method test_video_processor_from_and_save_pretrained (line 139) | def test_video_processor_from_and_save_pretrained(self): method test_video_processor_save_load_with_autovideoprocessor (line 150) | def test_video_processor_save_load_with_autovideoprocessor(self): method test_init_without_params (line 163) | def test_init_without_params(self): method test_video_processor_explicit_none_preserved (line 168) | def test_video_processor_explicit_none_preserved(self): method test_can_compile_fast_video_processor (line 201) | def test_can_compile_fast_video_processor(self): method test_cast_dtype_device (line 221) | def test_cast_dtype_device(self): method test_call_pil (line 257) | def test_call_pil(self): method test_call_numpy (line 279) | def test_call_numpy(self): method test_call_pytorch (line 302) | def test_call_pytorch(self): method test_call_sample_frames (line 327) | def test_call_sample_frames(self): method test_nested_input (line 387) | def test_nested_input(self): method test_call_numpy_4_channels (line 409) | def test_call_numpy_4_channels(self): method test_video_processor_preprocess_arguments (line 451) | def test_video_processor_preprocess_arguments(self): method test_override_instance_attributes_does_not_affect_other_instances (line 488) | def test_override_instance_attributes_does_not_affect_other_instances(... FILE: tests/tokenization/test_tokenization_fast.py class PreTrainedTokenizationFastTest (line 30) | class PreTrainedTokenizationFastTest(unittest.TestCase): method setUpClass (line 35) | def setUpClass(cls): method tearDownClass (line 42) | def tearDownClass(cls): method _create_test_tokenizers (line 46) | def _create_test_tokenizers(cls): method test_encode_decode_with_spaces (line 92) | def test_encode_decode_with_spaces(self): method test_added_tokens_serialization (line 98) | def test_added_tokens_serialization(self): method test_additional_special_tokens_serialization (line 104) | def test_additional_special_tokens_serialization(self): method test_training_new_tokenizer (line 107) | def test_training_new_tokenizer(self): method test_training_new_tokenizer_with_special_tokens_change (line 125) | def test_training_new_tokenizer_with_special_tokens_change(self): method test_training_new_tokenizer_with_bytelevel (line 144) | def test_training_new_tokenizer_with_bytelevel(self): method test_init_from_tokenizers_model (line 154) | def test_init_from_tokenizers_model(self): method test_class_after_save_and_reload (line 202) | def test_class_after_save_and_reload(self): class TokenizerVersioningTest (line 222) | class TokenizerVersioningTest(unittest.TestCase): method test_local_versioning (line 223) | def test_local_versioning(self): method test_repo_versioning (line 250) | def test_repo_versioning(self): class ReduceMutableBorrowTests (line 276) | class ReduceMutableBorrowTests(unittest.TestCase): method test_async_share_tokenizer (line 277) | def test_async_share_tokenizer(self): method fetch (line 288) | def fetch(self, tokenizer, text): FILE: tests/tokenization/test_tokenization_utils.py class TokenizerUtilsTest (line 51) | class TokenizerUtilsTest(unittest.TestCase): method check_tokenizer_from_pretrained (line 52) | def check_tokenizer_from_pretrained(self, tokenizer_class): method test_pretrained_tokenizers (line 70) | def test_pretrained_tokenizers(self): method test_tensor_type_from_str (line 73) | def test_tensor_type_from_str(self): method test_batch_encoding_word_to_tokens (line 78) | def test_batch_encoding_word_to_tokens(self): method test_batch_encoding_with_labels (line 86) | def test_batch_encoding_with_labels(self): method test_batch_encoding_with_labels_pt (line 102) | def test_batch_encoding_with_labels_pt(self): method test_padding_accepts_tensors (line 117) | def test_padding_accepts_tensors(self): method test_decoding_single_token (line 129) | def test_decoding_single_token(self): method test_extra_special_tokens_multimodal (line 155) | def test_extra_special_tokens_multimodal(self): method test_decoding_skip_special_tokens (line 204) | def test_decoding_skip_special_tokens(self): method test_padding_accepts_tensors_pt (line 242) | def test_padding_accepts_tensors_pt(self): method test_instantiation_from_tokenizers (line 256) | def test_instantiation_from_tokenizers(self): method test_instantiation_from_tokenizers_json_file (line 261) | def test_instantiation_from_tokenizers_json_file(self): method test_len_tokenizer (line 267) | def test_len_tokenizer(self): method test_sentencepiece_cohabitation (line 280) | def test_sentencepiece_cohabitation(self): method test_training_new_tokenizer_edge_cases (line 289) | def test_training_new_tokenizer_edge_cases(self): method test_encode_message (line 307) | def test_encode_message(self): method test_encode_message_raises_on_add_generation_prompt (line 327) | def test_encode_message_raises_on_add_generation_prompt(self): method test_special_tokens_overwrite (line 337) | def test_special_tokens_overwrite(self): FILE: tests/trainer/distributed/scripts/dispatch_batches.py class RegressionModel (line 32) | class RegressionModel(nn.Module): method __init__ (line 33) | def __init__(self, a=0, b=0): method forward (line 39) | def forward(self, input_x, labels=None, **kwargs): class RegressionDataset (line 47) | class RegressionDataset: method __init__ (line 48) | def __init__(self, a=2, b=3, length=64, seed=42, label_names=None): method __len__ (line 56) | def __len__(self): method __getitem__ (line 59) | def __getitem__(self, i): class FiniteIterableDataset (line 65) | class FiniteIterableDataset(IterableDataset): method __init__ (line 66) | def __init__(self, a=2, b=3, length=64, seed=42, label_names=None): method __iter__ (line 70) | def __iter__(self): FILE: tests/trainer/distributed/scripts/eval_ddp.py class DummyDataset (line 34) | class DummyDataset(Dataset): method __init__ (line 35) | def __init__(self, length: int = 101): method __len__ (line 38) | def __len__(self): method __getitem__ (line 41) | def __getitem__(self, i) -> int: class DummyDataCollator (line 45) | class DummyDataCollator: method __call__ (line 46) | def __call__(self, features): class DummyModel (line 50) | class DummyModel(nn.Module): method __init__ (line 51) | def __init__(self): method forward (line 56) | def forward(self, input_ids, labels=None): function compute_metrics (line 70) | def compute_metrics(p: EvalPrediction) -> dict: FILE: tests/trainer/distributed/scripts/fsdp_generate.py function manage_process_group (line 44) | def manage_process_group(func: Callable[..., Any]) -> Callable[..., Any]: function fsdp_generate (line 59) | def fsdp_generate(): function fsdp2_generate (line 84) | def fsdp2_generate(): class CLIArgs (line 110) | class CLIArgs(argparse.Namespace): FILE: tests/trainer/distributed/scripts/loss_averaging.py class StoreLossCallback (line 46) | class StoreLossCallback(TrainerCallback): method __init__ (line 49) | def __init__(self): method on_log (line 52) | def on_log(self, args, state, control, logs=None, **kwargs): function run_distributed_training (line 57) | def run_distributed_training(training_args, loss_file): FILE: tests/trainer/distributed/scripts/torchrun_env_check.py function main (line 33) | def main(): FILE: tests/trainer/distributed/scripts/train.py function _pop_custom_arg (line 44) | def _pop_custom_arg(name): function main (line 55) | def main(): FILE: tests/trainer/distributed/scripts/worker_seed.py function gather_from_all_gpus (line 36) | def gather_from_all_gpus(tensor, world_size): class DummyDataset (line 42) | class DummyDataset(Dataset): method __init__ (line 43) | def __init__(self): method __len__ (line 46) | def __len__(self): method __getitem__ (line 49) | def __getitem__(self, i) -> int: class DummyModel (line 56) | class DummyModel(nn.Module): method __init__ (line 57) | def __init__(self): method forward (line 61) | def forward(self, x): function run_distributed_training (line 69) | def run_distributed_training(training_args): FILE: tests/trainer/distributed/test_trainer_distributed.py class TrainerDistributedCommon (line 48) | class TrainerDistributedCommon(ABC): method get_accelerate_cmd (line 67) | def get_accelerate_cmd(self, script, config_file, launch_args=None, sc... method _get_default_script_args (line 84) | def _get_default_script_args(self, output_dir, num_epochs=1, logging_s... method _train_and_get_log_history (line 104) | def _train_and_get_log_history(self, cmd, output_dir): method check_training (line 114) | def check_training(self, dtype="bf16", **cmd_kwargs): method check_mixed_precision (line 123) | def check_mixed_precision(self, dtype="bf16", **cmd_kwargs): method check_gradient_accumulation (line 135) | def check_gradient_accumulation(self, **cmd_kwargs): method check_resume (line 144) | def check_resume(self, **cmd_kwargs): method check_eval (line 167) | def check_eval(self, **cmd_kwargs): FILE: tests/trainer/distributed/test_trainer_distributed_ddp.py function _parameterized_custom_name_func (line 52) | def _parameterized_custom_name_func(func, param_num, param): class DDPCommandsMixin (line 57) | class DDPCommandsMixin: method get_torchrun_cmd (line 60) | def get_torchrun_cmd(self, script, script_args=None, num_processes=None): method get_accelerate_cmd (line 75) | def get_accelerate_cmd( class TestTrainerDistributedDDP (line 101) | class TestTrainerDistributedDDP(DDPCommandsMixin, TestCasePlus): method test_eval_order (line 105) | def test_eval_order(self): method test_loss_averaging (line 115) | def test_loss_averaging(self): method test_worker_seed (line 169) | def test_worker_seed(self): method test_torchrun_accelerate_env_parity (line 182) | def test_torchrun_accelerate_env_parity(self): method test_log_level_replica (line 245) | def test_log_level_replica(self, _name, extra_args_str, expected_match... class TestTrainerDistributedDDPCommon (line 276) | class TestTrainerDistributedDDPCommon(DDPCommandsMixin, TrainerDistribut... method test_training (line 283) | def test_training(self, dtype): method test_training_mixed_precision (line 287) | def test_training_mixed_precision(self, dtype): method test_training_with_gradient_accumulation (line 290) | def test_training_with_gradient_accumulation(self): method test_training_and_can_resume_normally (line 293) | def test_training_and_can_resume_normally(self): method test_eval (line 296) | def test_eval(self): FILE: tests/trainer/distributed/test_trainer_distributed_deepspeed.py function load_json (line 128) | def load_json(path): function require_deepspeed_aio (line 133) | def require_deepspeed_aio(test_case): function _parameterized_custom_name_func (line 156) | def _parameterized_custom_name_func(func, param_num, param): class DeepSpeedCommandsMixin (line 175) | class DeepSpeedCommandsMixin: method get_torchrun_cmd (line 178) | def get_torchrun_cmd(self, script, script_args=None, num_processes=None): method get_accelerate_cmd (line 193) | def get_accelerate_cmd( class TestTrainerIntegrationDeepSpeed (line 224) | class TestTrainerIntegrationDeepSpeed(TestCasePlus): method setUp (line 232) | def setUp(self): method tearDown (line 244) | def tearDown(self): method get_config_dict (line 250) | def get_config_dict(self, stage): method check_trainer_state_are_the_same (line 254) | def check_trainer_state_are_the_same(self, trainer_state, trainer_stat... method test_hf_ds_config_mismatch (line 274) | def test_hf_ds_config_mismatch(self): method test_deepspeed_plugin_from_config (line 326) | def test_deepspeed_plugin_from_config(self): method test_auto_value_resolution (line 337) | def test_auto_value_resolution(self): method test_ds_config_dtype_resolution (line 362) | def test_ds_config_dtype_resolution(self): method test_ds_config_file_path_vs_dict_equivalent (line 379) | def test_ds_config_file_path_vs_dict_equivalent(self): method test_ds_config_no_optimizer_no_scheduler (line 393) | def test_ds_config_no_optimizer_no_scheduler(self): method test_ds_config_auto_vs_missing_fields (line 413) | def test_ds_config_auto_vs_missing_fields(self): method test_mixed_precision_model_and_optimizer_dtypes (line 466) | def test_mixed_precision_model_and_optimizer_dtypes(self, stage): method test_ds_config_object (line 490) | def test_ds_config_object(self): method test_basic_training (line 525) | def test_basic_training(self, stage, dtype): method test_optimizer_scheduler_combos (line 546) | def test_optimizer_scheduler_combos(self, _, use_hf_optim, use_hf_sche... method test_gradient_accumulation (line 564) | def test_gradient_accumulation(self, stage, dtype): method test_optimizer_with_cpu_offload (line 615) | def test_optimizer_with_cpu_offload(self, stage, use_hf_optim): method test_stage3_nvme_offload (line 634) | def test_stage3_nvme_offload(self): method test_early_get_last_lr (line 653) | def test_early_get_last_lr(self, stage, dtype): method check_saved_checkpoints_deepspeed (line 680) | def check_saved_checkpoints_deepspeed(self, output_dir, freq, total, s... method test_save_checkpoints (line 715) | def test_save_checkpoints(self, stage, dtype): method test_can_resume_training_errors (line 744) | def test_can_resume_training_errors(self, stage, dtype): method test_can_resume_training_normal (line 764) | def test_can_resume_training_normal(self, stage, dtype, optim, schedul... method test_load_state_dict_from_zero_checkpoint (line 831) | def test_load_state_dict_from_zero_checkpoint(self, stage, dtype): method test_load_best_model (line 863) | def test_load_best_model(self, stage): method test_hyperparameter_search (line 928) | def test_hyperparameter_search(self): class TestTrainerDistributedDeepSpeed (line 961) | class TestTrainerDistributedDeepSpeed(DeepSpeedCommandsMixin, TestCasePl... method _run_env_check (line 962) | def _run_env_check(self, cmd, num_processes): method test_torchrun_accelerate_deepspeed_zero2_env_parity (line 972) | def test_torchrun_accelerate_deepspeed_zero2_env_parity(self): method test_torchrun_accelerate_deepspeed_zero3_env_parity (line 997) | def test_torchrun_accelerate_deepspeed_zero3_env_parity(self): method _check_parity (line 1022) | def _check_parity(self, torchrun_results, accel_results, num_processes... class TestTrainerDistributedDeepSpeedCommon (line 1064) | class TestTrainerDistributedDeepSpeedCommon(DeepSpeedCommandsMixin, Trai... method test_training (line 1078) | def test_training(self, stage, model_dtype): method test_training_mixed_precision (line 1083) | def test_training_mixed_precision(self, stage, dtype): method test_training_with_gradient_accumulation (line 1087) | def test_training_with_gradient_accumulation(self, stage): method test_training_and_can_resume_normally (line 1091) | def test_training_and_can_resume_normally(self, stage): method test_basic_run_with_cpu_offload (line 1102) | def test_basic_run_with_cpu_offload(self, stage, offload_param): method test_eval (line 1115) | def test_eval(self): method test_alst_ulysses_sp (line 1119) | def test_alst_ulysses_sp(self): class TestNonTrainerIntegrationDeepSpeed (line 1201) | class TestNonTrainerIntegrationDeepSpeed(TestCasePlus): method setUp (line 1206) | def setUp(self): method tearDown (line 1218) | def tearDown(self): method _get_zero3_ds_config (line 1224) | def _get_zero3_ds_config(self, **extra): method _load_with_logging (line 1232) | def _load_with_logging(self, model_cls, model_name, expect_zero3=True,... method _check_zero3_init_and_removal (line 1245) | def _check_zero3_init_and_removal(self, extra_ds_config=None): method test_init_zero3 (line 1266) | def test_init_zero3(self, dtype): method test_from_config_zero3_weight_init (line 1291) | def test_from_config_zero3_weight_init(self): method test_init_zero3_missing_params (line 1332) | def test_init_zero3_missing_params(self): method test_arange_bf16 (line 1382) | def test_arange_bf16(self): method test_init_zero3_moe_weight_conversion (line 1409) | def test_init_zero3_moe_weight_conversion(self): method test_init_zero3_variance_scaling (line 1460) | def test_init_zero3_variance_scaling(self): method test_resize_token_embeddings_zero3 (line 1509) | def test_resize_token_embeddings_zero3(self): function _make_zoo_tasks (line 1571) | def _make_zoo_tasks(): class TestDeepSpeedModelZoo (line 1632) | class TestDeepSpeedModelZoo(DeepSpeedCommandsMixin, TestCasePlus): method test_zero_to_fp32 (line 1636) | def test_zero_to_fp32(self, stage, task): FILE: tests/trainer/distributed/test_trainer_distributed_fsdp.py class _BaseModel (line 107) | class _BaseModel(PreTrainedModel): method __init__ (line 111) | def __init__(self, config): method forward (line 117) | def forward(self, x): class InitializeMissingKeysTest (line 122) | class InitializeMissingKeysTest(unittest.TestCase): method _clear_init_flags (line 126) | def _clear_init_flags(self, model): method test_move_missing_keys_fsdp_non_rank0_moves_meta_to_cpu (line 137) | def test_move_missing_keys_fsdp_non_rank0_moves_meta_to_cpu(self): method test_fsdp_non_rank0_end_to_end_no_reinit (line 156) | def test_fsdp_non_rank0_end_to_end_no_reinit(self): function _parameterized_custom_name_func (line 179) | def _parameterized_custom_name_func(func, param_num, param): class FSDPCommandsMixin (line 191) | class FSDPCommandsMixin: method get_torchrun_cmd (line 194) | def get_torchrun_cmd(self, script, script_args=None, num_processes=None): method get_accelerate_cmd (line 209) | def get_accelerate_cmd( class TestFSDPConfig (line 239) | class TestFSDPConfig(TestCasePlus): method setUp (line 240) | def setUp(self): method test_accelerate_fsdp_config (line 277) | def test_accelerate_fsdp_config(self, sharding_strategy, dtype): method test_torchrun_fsdp_config (line 297) | def test_torchrun_fsdp_config(self): method test_fsdp_config (line 318) | def test_fsdp_config(self, sharding_strategy, dtype): class TestTrainerDistributedFSDP (line 344) | class TestTrainerDistributedFSDP(FSDPCommandsMixin, TestCasePlus): method _run_env_check (line 345) | def _run_env_check(self, cmd, num_processes): method test_torchrun_accelerate_fsdp1_env_parity (line 356) | def test_torchrun_accelerate_fsdp1_env_parity(self): method test_torchrun_accelerate_fsdp2_env_parity (line 388) | def test_torchrun_accelerate_fsdp2_env_parity(self): method _check_parity (line 420) | def _check_parity(self, torchrun_results, accel_results, num_processes... class TestTrainerDistributedFSDPCommon (line 457) | class TestTrainerDistributedFSDPCommon( method test_training (line 466) | def test_training(self, dtype, fsdp_version): method test_training_mixed_precision (line 471) | def test_training_mixed_precision(self, sharding_strategy, dtype, fsdp... method test_fsdp2_cpu_ram_efficient_loading (line 480) | def test_fsdp2_cpu_ram_efficient_loading(self, cpu_ram_efficient_loadi... method test_training_with_gradient_accumulation (line 488) | def test_training_with_gradient_accumulation(self, fsdp_version): method test_basic_run_with_cpu_offload (line 492) | def test_basic_run_with_cpu_offload(self, fsdp_version): method test_training_and_can_resume_normally (line 504) | def test_training_and_can_resume_normally(self, state_dict_type, fsdp_... method test_cp_equivalence (line 544) | def test_cp_equivalence(self): method test_eval (line 625) | def test_eval(self): method test_fsdp_generate (line 631) | def test_fsdp_generate(self): method test_fsdp2_generate (line 639) | def test_fsdp2_generate(self): FILE: tests/trainer/test_data_collator.py class DataCollatorTestMixin (line 52) | class DataCollatorTestMixin: method setUp (line 55) | def setUp(self): method tearDown (line 62) | def tearDown(self): method _check_immutability (line 65) | def _check_immutability(self, collator, features): class TestDefaultDataCollator (line 87) | class TestDefaultDataCollator(DataCollatorTestMixin, unittest.TestCase): method test_basic_collation (line 95) | def test_basic_collation(self): method test_multi_label (line 104) | def test_multi_label(self): method test_numpy_array_inputs (line 112) | def test_numpy_array_inputs(self): method test_tensor_labels (line 120) | def test_tensor_labels(self): method test_dtype_inference (line 128) | def test_dtype_inference(self): method test_none_labels_excluded (line 140) | def test_none_labels_excluded(self): method test_numpy_output (line 151) | def test_numpy_output(self): method test_numpy_dtype_inference (line 160) | def test_numpy_dtype_inference(self): method test_immutability (line 172) | def test_immutability(self): class TestDataCollatorWithPadding (line 198) | class TestDataCollatorWithPadding(DataCollatorTestMixin, unittest.TestCa... method test_dynamic_padding (line 206) | def test_dynamic_padding(self): method test_max_length_padding (line 217) | def test_max_length_padding(self): method test_pad_to_multiple_of (line 227) | def test_pad_to_multiple_of(self): method test_numpy_output (line 237) | def test_numpy_output(self): method test_attention_mask_generated (line 248) | def test_attention_mask_generated(self): method test_immutability (line 260) | def test_immutability(self): class TestDataCollatorWithFlattening (line 276) | class TestDataCollatorWithFlattening(DataCollatorTestMixin, unittest.Tes... method _get_features (line 285) | def _get_features(self): method test_basic_flattening (line 292) | def test_basic_flattening(self): method test_flash_attn_kwargs (line 308) | def test_flash_attn_kwargs(self): method test_seq_idx (line 318) | def test_seq_idx(self): method test_with_labels (line 325) | def test_with_labels(self): method test_numpy_output (line 346) | def test_numpy_output(self): method test_numpy_flash_attn_kwargs (line 354) | def test_numpy_flash_attn_kwargs(self): method test_immutability (line 362) | def test_immutability(self): class TestDataCollatorForTokenClassification (line 375) | class TestDataCollatorForTokenClassification(DataCollatorTestMixin, unit... method _get_features (line 383) | def _get_features(self): method test_padding (line 389) | def test_padding(self): method test_max_length_padding (line 400) | def test_max_length_padding(self): method test_pad_to_multiple_of (line 409) | def test_pad_to_multiple_of(self): method test_custom_label_pad_token (line 418) | def test_custom_label_pad_token(self): method test_without_labels (line 426) | def test_without_labels(self): method test_with_tensor_inputs (line 437) | def test_with_tensor_inputs(self): method test_numpy_output (line 450) | def test_numpy_output(self): method test_immutability (line 459) | def test_immutability(self): class TestDataCollatorForSeq2Seq (line 474) | class TestDataCollatorForSeq2Seq(DataCollatorTestMixin, unittest.TestCase): method _get_features (line 482) | def _get_features(self): method test_padding (line 488) | def test_padding(self): method test_with_tensor_inputs (line 499) | def test_with_tensor_inputs(self): method test_max_length_padding (line 513) | def test_max_length_padding(self): method test_pad_to_multiple_of (line 522) | def test_pad_to_multiple_of(self): method test_custom_label_pad_token (line 531) | def test_custom_label_pad_token(self): method test_do_not_pad (line 539) | def test_do_not_pad(self): method test_without_labels (line 554) | def test_without_labels(self): method test_numpy_output (line 566) | def test_numpy_output(self): method test_immutability (line 575) | def test_immutability(self): class TestDataCollatorForLanguageModeling (line 592) | class TestDataCollatorForLanguageModeling(DataCollatorTestMixin, unittes... method test_clm_mode (line 600) | def test_clm_mode(self): method test_clm_with_padding (line 611) | def test_clm_with_padding(self): method test_clm_pad_to_multiple_of (line 621) | def test_clm_pad_to_multiple_of(self): method test_mlm_mode (line 631) | def test_mlm_mode(self): method test_mlm_with_padding (line 648) | def test_mlm_with_padding(self): method test_mlm_pad_to_multiple_of (line 662) | def test_mlm_pad_to_multiple_of(self): method test_with_raw_list_features (line 676) | def test_with_raw_list_features(self): method test_mlm_seed_reproducibility (line 691) | def test_mlm_seed_reproducibility(self): method test_mlm_multiworker_dataloader (line 710) | def test_mlm_multiworker_dataloader(self): method test_missing_pad_token_error (line 727) | def test_missing_pad_token_error(self): method test_numpy_output (line 737) | def test_numpy_output(self): method test_numpy_mlm (line 748) | def test_numpy_mlm(self): method test_immutability (line 760) | def test_immutability(self): method test_calc_word_ids_and_prob_mask (line 771) | def test_calc_word_ids_and_prob_mask(self): method test_whole_word_mask_internal (line 824) | def test_whole_word_mask_internal(self): class TestDataCollatorForWholeWordMask (line 873) | class TestDataCollatorForWholeWordMask(DataCollatorTestMixin, unittest.T... method _get_tokenizer_and_features (line 881) | def _get_tokenizer_and_features(self): method test_basic (line 888) | def test_basic(self): method test_with_numpy_inputs (line 897) | def test_with_numpy_inputs(self): method test_with_tensor_inputs (line 910) | def test_with_tensor_inputs(self): method test_seed_reproducibility (line 923) | def test_seed_reproducibility(self): method test_seed_multiworker_dataloader (line 943) | def test_seed_multiworker_dataloader(self): method test_numpy_output (line 979) | def test_numpy_output(self): method test_immutability (line 988) | def test_immutability(self): class TestDataCollatorForPermutationLanguageModeling (line 1004) | class TestDataCollatorForPermutationLanguageModeling(DataCollatorTestMix... method test_basic (line 1012) | def test_basic(self): method test_with_padding (line 1025) | def test_with_padding(self): method test_odd_sequence_error (line 1035) | def test_odd_sequence_error(self): method test_numpy_output (line 1044) | def test_numpy_output(self): method test_immutability (line 1056) | def test_immutability(self): class TestNextSentencePrediction (line 1072) | class TestNextSentencePrediction(DataCollatorTestMixin, unittest.TestCase): method _get_features (line 1080) | def _get_features(self): method test_nsp (line 1086) | def test_nsp(self): method test_nsp_with_padding (line 1097) | def test_nsp_with_padding(self): method test_numpy_output (line 1106) | def test_numpy_output(self): method test_immutability (line 1115) | def test_immutability(self): class TestSentenceOrderPrediction (line 1130) | class TestSentenceOrderPrediction(DataCollatorTestMixin, unittest.TestCa... method _get_features (line 1138) | def _get_features(self): method test_sop (line 1144) | def test_sop(self): method test_sop_with_tensor_inputs (line 1155) | def test_sop_with_tensor_inputs(self): method test_sop_with_padding (line 1172) | def test_sop_with_padding(self): method test_numpy_output (line 1190) | def test_numpy_output(self): method test_immutability (line 1199) | def test_immutability(self): FILE: tests/trainer/test_trainer.py class TrainerMixedPrecisionTest (line 96) | class TrainerMixedPrecisionTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 99) | def setUp(self): method check_trained_model (line 107) | def check_trained_model(self, model, **kwargs): method test_mixed_fp16 (line 114) | def test_mixed_fp16(self): method test_mixed_bf16 (line 126) | def test_mixed_bf16(self): method test_tf32 (line 135) | def test_tf32(self): class TrainerGradientAccumulationTest (line 149) | class TrainerGradientAccumulationTest(TestCasePlus, TrainerIntegrationCo... method setUp (line 152) | def setUp(self): method check_trained_model (line 160) | def check_trained_model(self, model, **kwargs): method test_gradient_accumulation (line 165) | def test_gradient_accumulation(self): method test_gradient_accumulation_loss_alignment_with_model_loss (line 175) | def test_gradient_accumulation_loss_alignment_with_model_loss(self): method test_gradient_accumulation_loss_alignment_with_loss_func (line 273) | def test_gradient_accumulation_loss_alignment_with_loss_func(self): method test_num_batches_in_training_with_gradient_accumulation (line 376) | def test_num_batches_in_training_with_gradient_accumulation(self): class TrainerGradientCheckpointingTest (line 413) | class TrainerGradientCheckpointingTest(TestCasePlus): method test_gradient_checkpointing (line 416) | def test_gradient_checkpointing(self): class TrainerNEFTuneTest (line 442) | class TrainerNEFTuneTest(TestCasePlus): method test_neftune (line 445) | def test_neftune(self): class TrainerLoggingTest (line 503) | class TrainerLoggingTest(TestCasePlus): method test_logging_inf_nan_filter (line 506) | def test_logging_inf_nan_filter(self): method test_log_level (line 541) | def test_log_level(self): class TrainerMetricsTest (line 579) | class TrainerMetricsTest(TestCasePlus): method test_flos_extraction (line 582) | def test_flos_extraction(self): method check_mem_metrics (line 601) | def check_mem_metrics(self, trainer, check_func): method test_mem_metrics (line 619) | def test_mem_metrics(self): method test_include_num_input_tokens_seen (line 629) | def test_include_num_input_tokens_seen(self): method test_get_num_trainable_parameters (line 726) | def test_get_num_trainable_parameters(self): class TrainerStepCountingTest (line 746) | class TrainerStepCountingTest(TestCasePlus): method setUp (line 749) | def setUp(self): method test_training_loss (line 755) | def test_training_loss(self): method test_number_of_steps_in_training (line 778) | def test_number_of_steps_in_training(self): method test_num_train_epochs_in_training (line 795) | def test_num_train_epochs_in_training(self): class TrainerIntegrationPrerunTest (line 824) | class TrainerIntegrationPrerunTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 832) | def setUp(self): method check_trained_model (line 848) | def check_trained_model(self, model, alternate_seed=False, **kwargs): method test_reproducible_training (line 853) | def test_reproducible_training(self): method test_trainer_with_datasets (line 866) | def test_trainer_with_datasets(self): method test_model_init (line 895) | def test_model_init(self): class TrainerTorchCompileTest (line 919) | class TrainerTorchCompileTest(TestCasePlus): method test_torch_compile_loss_func_compatibility (line 921) | def test_torch_compile_loss_func_compatibility(self): method test_bnb_compile (line 940) | def test_bnb_compile(self): method test_torch_compile_train (line 976) | def test_torch_compile_train(self): method test_torch_compile_eval (line 988) | def test_torch_compile_eval(self): class TrainerEarlyStoppingTest (line 1006) | class TrainerEarlyStoppingTest(TestCasePlus): method test_early_stopping_callback (line 1007) | def test_early_stopping_callback(self): class TrainerLigerKernelTest (line 1067) | class TrainerLigerKernelTest(TestCasePlus): method test_use_liger_kernel_patching (line 1069) | def test_use_liger_kernel_patching(self): method test_use_liger_kernel_custom_config_patching (line 1094) | def test_use_liger_kernel_custom_config_patching(self): method test_use_liger_kernel_trainer (line 1116) | def test_use_liger_kernel_trainer(self): method test_use_liger_kernel_custom_config_trainer (line 1140) | def test_use_liger_kernel_custom_config_trainer(self): class TrainerIntegrationTest (line 1169) | class TrainerIntegrationTest(TestCasePlus): method test_end_to_end_example (line 1176) | def test_end_to_end_example(self): method test_special_token_alignment (line 1218) | def test_special_token_alignment(self): method test_trainer_works_without_model_config (line 1261) | def test_trainer_works_without_model_config(self): method test_training_arguments_are_left_untouched (line 1288) | def test_training_arguments_are_left_untouched(self): method test_double_train_wrap_once (line 1297) | def test_double_train_wrap_once(self): FILE: tests/trainer/test_trainer_accelerator.py class TrainerAcceleratorConfigTest (line 42) | class TrainerAcceleratorConfigTest(TestCasePlus): method test_accelerator_config_empty (line 43) | def test_accelerator_config_empty(self): method test_accelerator_config_from_dict (line 60) | def test_accelerator_config_from_dict(self): method test_accelerator_config_from_yaml (line 84) | def test_accelerator_config_from_yaml(self): method test_accelerator_config_from_dataclass (line 109) | def test_accelerator_config_from_dataclass(self): method test_accelerate_config_from_dataclass_grad_accum (line 130) | def test_accelerate_config_from_dataclass_grad_accum(self): method test_accelerator_config_from_partial (line 155) | def test_accelerator_config_from_partial(self): method test_accelerator_custom_state (line 176) | def test_accelerator_custom_state(self): method test_accelerator_config_from_dict_grad_accum_num_steps (line 186) | def test_accelerator_config_from_dict_grad_accum_num_steps(self): method test_accelerator_config_not_instantiated (line 223) | def test_accelerator_config_not_instantiated(self): FILE: tests/trainer/test_trainer_callback.py class EventRecorderCallback (line 61) | class EventRecorderCallback(TrainerCallback): method __init__ (line 69) | def __init__(self): method on_init_end (line 72) | def on_init_end(self, args, state, control, **kwargs): method on_train_begin (line 75) | def on_train_begin(self, args, state, control, **kwargs): method on_train_end (line 78) | def on_train_end(self, args, state, control, **kwargs): method on_epoch_begin (line 81) | def on_epoch_begin(self, args, state, control, **kwargs): method on_epoch_end (line 84) | def on_epoch_end(self, args, state, control, **kwargs): method on_step_begin (line 87) | def on_step_begin(self, args, state, control, **kwargs): method on_pre_optimizer_step (line 90) | def on_pre_optimizer_step(self, args, state, control, **kwargs): method on_optimizer_step (line 93) | def on_optimizer_step(self, args, state, control, **kwargs): method on_substep_end (line 96) | def on_substep_end(self, args, state, control, **kwargs): method on_step_end (line 99) | def on_step_end(self, args, state, control, **kwargs): method on_evaluate (line 102) | def on_evaluate(self, args, state, control, **kwargs): method on_predict (line 105) | def on_predict(self, args, state, control, **kwargs): method on_save (line 108) | def on_save(self, args, state, control, **kwargs): method on_log (line 111) | def on_log(self, args, state, control, **kwargs): method on_prediction_step (line 114) | def on_prediction_step(self, args, state, control, **kwargs): method on_push_begin (line 117) | def on_push_begin(self, args, state, control, **kwargs): class StatefulTestCallback (line 121) | class StatefulTestCallback(TrainerCallback, ExportableState): method __init__ (line 128) | def __init__(self, my_value="default"): method state (line 131) | def state(self): class StopTrainingCallback (line 138) | class StopTrainingCallback(TrainerCallback): method __init__ (line 141) | def __init__(self, stop_after_steps=1): method on_step_end (line 144) | def on_step_end(self, args, state, control, **kwargs): class ModifyControlCallback (line 150) | class ModifyControlCallback(TrainerCallback): method __init__ (line 153) | def __init__(self): method on_step_end (line 156) | def on_step_end(self, args, state, control, **kwargs): function get_callback_names (line 173) | def get_callback_names(callbacks): class TrainerCallbackTest (line 190) | class TrainerCallbackTest(unittest.TestCase): method setUp (line 193) | def setUp(self): method tearDown (line 196) | def tearDown(self): method _create_trainer (line 199) | def _create_trainer(self, callbacks=None, **kwargs): method _get_callback (line 227) | def _get_callback(self, trainer, callback_class): method test_default_callbacks_are_present (line 238) | def test_default_callbacks_are_present(self): method test_custom_callback_added_at_init (line 247) | def test_custom_callback_added_at_init(self): method test_printer_callback_when_tqdm_disabled (line 256) | def test_printer_callback_when_tqdm_disabled(self): method test_add_callback_by_class (line 265) | def test_add_callback_by_class(self): method test_add_callback_by_instance (line 275) | def test_add_callback_by_instance(self): method test_remove_callback_by_class (line 284) | def test_remove_callback_by_class(self): method test_remove_callback_by_instance (line 293) | def test_remove_callback_by_instance(self): method test_pop_callback_returns_instance (line 302) | def test_pop_callback_returns_instance(self): method test_duplicate_callback_warning (line 312) | def test_duplicate_callback_warning(self): method _get_expected_events (line 324) | def _get_expected_events(self, trainer): method test_event_flow (line 356) | def test_event_flow(self): method test_on_push_begin_event (line 402) | def test_on_push_begin_event(self): method test_no_duplicate_save_on_epoch_strategy (line 417) | def test_no_duplicate_save_on_epoch_strategy(self): method test_callback_can_stop_training (line 445) | def test_callback_can_stop_training(self): method test_callback_receives_control_flags (line 463) | def test_callback_receives_control_flags(self): class StatefulCallbackTest (line 484) | class StatefulCallbackTest(unittest.TestCase): method setUp (line 487) | def setUp(self): method tearDown (line 490) | def tearDown(self): method _create_trainer (line 493) | def _create_trainer(self, callbacks=None, **kwargs): method test_early_stopping_state_persists (line 511) | def test_early_stopping_state_persists(self): method test_mixed_stateful_and_regular_callbacks (line 551) | def test_mixed_stateful_and_regular_callbacks(self): method test_multiple_instances_of_same_stateful_callback (line 591) | def test_multiple_instances_of_same_stateful_callback(self): method test_missing_stateful_callback_warning (line 625) | def test_missing_stateful_callback_warning(self): method test_trainer_control_state_persists (line 656) | def test_trainer_control_state_persists(self): class TrainerStateTest (line 674) | class TrainerStateTest(unittest.TestCase): method setUp (line 677) | def setUp(self): method tearDown (line 680) | def tearDown(self): method test_save_and_load_json (line 683) | def test_save_and_load_json(self): method test_log_history_initialized (line 701) | def test_log_history_initialized(self): method test_stateful_callbacks_initialized (line 707) | def test_stateful_callbacks_initialized(self): method test_compute_steps_from_proportion (line 713) | def test_compute_steps_from_proportion(self): method test_compute_steps_from_integers (line 728) | def test_compute_steps_from_integers(self): class SwanLabCallbackTest (line 744) | class SwanLabCallbackTest(unittest.TestCase): method _create_callback (line 745) | def _create_callback(self, fake_swanlab): method _create_args (line 752) | def _create_args(): method _create_state (line 764) | def _create_state(): method _create_model (line 768) | def _create_model(): method test_setup_does_not_forward_id_or_resume_by_default (line 784) | def test_setup_does_not_forward_id_or_resume_by_default(self): method test_setup_forwards_id_and_resume_from_env (line 797) | def test_setup_forwards_id_and_resume_from_env(self): class KubeflowCallbackTest (line 811) | class KubeflowCallbackTest(unittest.TestCase): method _create_callback (line 814) | def _create_callback(self, fake_update_status): method _create_state (line 835) | def _create_state(is_world_process_zero=True, global_step=0, max_steps... method _create_args (line 844) | def _create_args(): method test_on_train_begin_initializes_and_reports_zero_progress (line 847) | def test_on_train_begin_initializes_and_reports_zero_progress(self): method test_on_train_begin_skips_non_world_process_zero (line 863) | def test_on_train_begin_skips_non_world_process_zero(self): method test_on_step_end_reports_progress (line 876) | def test_on_step_end_reports_progress(self): method test_on_step_end_skips_when_not_initialized (line 897) | def test_on_step_end_skips_when_not_initialized(self): method test_on_log_captures_numeric_metrics (line 910) | def test_on_log_captures_numeric_metrics(self): method test_on_train_end_reports_completion (line 926) | def test_on_train_end_reports_completion(self): method test_progress_calculation_caps_at_99 (line 944) | def test_progress_calculation_caps_at_99(self): method test_update_status_throttling (line 960) | def test_update_status_throttling(self): method test_update_status_returns_false_without_url (line 995) | def test_update_status_returns_false_without_url(self): method test_get_token_caches_token (line 1014) | def test_get_token_caches_token(self): class TrainerControlTest (line 1042) | class TrainerControlTest(unittest.TestCase): method test_default_values (line 1045) | def test_default_values(self): method test_new_training_resets_stop_flag (line 1055) | def test_new_training_resets_stop_flag(self): method test_new_epoch_resets_epoch_stop_flag (line 1063) | def test_new_epoch_resets_epoch_stop_flag(self): method test_new_step_resets_step_flags (line 1071) | def test_new_step_resets_step_flags(self): method test_state_export (line 1085) | def test_state_export(self): class CallbackHandlerTest (line 1099) | class CallbackHandlerTest(unittest.TestCase): method test_callback_list_property (line 1102) | def test_callback_list_property(self): method test_warning_without_default_flow_callback (line 1117) | def test_warning_without_default_flow_callback(self): method test_pop_callback_returns_none_if_not_found (line 1131) | def test_pop_callback_returns_none_if_not_found(self): method test_call_event_passes_kwargs (line 1145) | def test_call_event_passes_kwargs(self): class EarlyStoppingCallbackTest (line 1171) | class EarlyStoppingCallbackTest(unittest.TestCase): method test_patience_counter_increments_when_metric_does_not_improve (line 1174) | def test_patience_counter_increments_when_metric_does_not_improve(self): method test_patience_counter_resets_when_metric_improves (line 1188) | def test_patience_counter_resets_when_metric_improves(self): method test_threshold_prevents_small_improvements (line 1203) | def test_threshold_prevents_small_improvements(self): method test_state_includes_all_attributes (line 1220) | def test_state_includes_all_attributes(self): class ExportableStateTest (line 1235) | class ExportableStateTest(unittest.TestCase): method test_from_state_creates_instance (line 1238) | def test_from_state_creates_instance(self): method test_from_state_sets_attributes (line 1249) | def test_from_state_sets_attributes(self): FILE: tests/trainer/test_trainer_checkpointing.py class TrainerCheckpointSaveTest (line 113) | class TrainerCheckpointSaveTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 114) | def setUp(self): method test_save_checkpoints (line 120) | def test_save_checkpoints(self): method test_save_collator_tokenizer_by_default (line 132) | def test_save_collator_tokenizer_by_default(self): class TrainerResumeTrainingTest (line 155) | class TrainerResumeTrainingTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 156) | def setUp(self): method test_can_resume_training (line 163) | def test_can_resume_training(self): method test_can_resume_training_lm (line 268) | def test_can_resume_training_lm(self): method test_resume_training_with_randomness (line 317) | def test_resume_training_with_randomness(self): method test_resume_training_with_different_batch_size (line 372) | def test_resume_training_with_different_batch_size(self): method test_training_with_resume_from_checkpoint_false (line 416) | def test_training_with_resume_from_checkpoint_false(self): method test_resume_training_with_shard_checkpoint (line 430) | def test_resume_training_with_shard_checkpoint(self): method test_resume_training_with_checkpoint (line 455) | def test_resume_training_with_checkpoint(self): method test_resume_training_with_gradient_accumulation (line 485) | def test_resume_training_with_gradient_accumulation(self): method test_resume_training_with_frozen_params (line 523) | def test_resume_training_with_frozen_params(self): method test_multiple_peft_adapters (line 563) | def test_multiple_peft_adapters(self): class TrainerAutoBatchSizeTest (line 620) | class TrainerAutoBatchSizeTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 621) | def setUp(self): method test_auto_batch_size_finder (line 631) | def test_auto_batch_size_finder(self): method test_auto_batch_size_with_deepspeed (line 664) | def test_auto_batch_size_with_deepspeed(self): method test_auto_batch_size_with_resume_from_checkpoint (line 694) | def test_auto_batch_size_with_resume_from_checkpoint(self): class TrainerCheckpointRotationTest (line 731) | class TrainerCheckpointRotationTest(TestCasePlus, TrainerIntegrationComm... method setUp (line 732) | def setUp(self): method test_checkpoint_sorting (line 738) | def test_checkpoint_sorting(self): method check_checkpoint_deletion (line 761) | def check_checkpoint_deletion(self, trainer, output_dir, expected): method test_checkpoint_rotation (line 774) | def test_checkpoint_rotation(self): method test_compare_trainer_and_checkpoint_args_logging (line 798) | def test_compare_trainer_and_checkpoint_args_logging(self): class TrainerInterruptedTrainingTest (line 843) | class TrainerInterruptedTrainingTest(TestCasePlus, TrainerIntegrationCom... method setUp (line 844) | def setUp(self): method test_resume_from_interrupted_training (line 850) | def test_resume_from_interrupted_training(self): method test_resume_batch_order (line 959) | def test_resume_batch_order(self): class JITCheckpointTest (line 1100) | class JITCheckpointTest(unittest.TestCase): method setUp (line 1101) | def setUp(self): method tearDown (line 1104) | def tearDown(self): method get_trainer (line 1109) | def get_trainer(self, enable_jit=True): method test_checkpoint_manager_initialization (line 1131) | def test_checkpoint_manager_initialization(self): method test_signal_handler_setup (line 1145) | def test_signal_handler_setup(self): method test_sigterm_handler_flow (line 1169) | def test_sigterm_handler_flow(self, mock_timer): method test_toggle_checkpoint_flag (line 1202) | def test_toggle_checkpoint_flag(self): method test_execute_jit_checkpoint (line 1216) | def test_execute_jit_checkpoint(self): method test_execute_jit_checkpoint_sentinel_file_cleanup (line 1244) | def test_execute_jit_checkpoint_sentinel_file_cleanup(self): method test_execute_jit_checkpoint_with_exception (line 1264) | def test_execute_jit_checkpoint_with_exception(self): method test_jit_checkpoint_callback_initialization (line 1282) | def test_jit_checkpoint_callback_initialization(self): method test_jit_checkpoint_callback_set_trainer_enabled (line 1289) | def test_jit_checkpoint_callback_set_trainer_enabled(self): method test_jit_checkpoint_callback_set_trainer_disabled (line 1302) | def test_jit_checkpoint_callback_set_trainer_disabled(self): method test_jit_checkpoint_callback_on_pre_optimizer_step (line 1312) | def test_jit_checkpoint_callback_on_pre_optimizer_step(self): method test_jit_checkpoint_callback_on_step_begin (line 1336) | def test_jit_checkpoint_callback_on_step_begin(self): method test_jit_checkpoint_callback_on_step_end (line 1360) | def test_jit_checkpoint_callback_on_step_end(self): method test_jit_checkpoint_callback_on_epoch_end (line 1389) | def test_jit_checkpoint_callback_on_epoch_end(self): method test_jit_checkpoint_callback_on_train_end (line 1421) | def test_jit_checkpoint_callback_on_train_end(self): method test_kill_wait_period (line 1450) | def test_kill_wait_period(self, mock_timer): method test_integration_with_trainer (line 1464) | def test_integration_with_trainer(self): class TrainerSavingTest (line 1483) | class TrainerSavingTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 1484) | def setUp(self): method test_trainer_saves_tokenizer (line 1490) | def test_trainer_saves_tokenizer(self): method test_trainer_saves_image_processor (line 1514) | def test_trainer_saves_image_processor(self): method test_trainer_saves_feature_extractor (line 1530) | def test_trainer_saves_feature_extractor(self): method test_trainer_saves_processor (line 1548) | def test_trainer_saves_processor(self): class TrainerBestModelTest (line 1588) | class TrainerBestModelTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 1591) | def setUp(self): method test_load_best_model_with_save_best (line 1597) | def test_load_best_model_with_save_best(self): method test_load_best_model_with_save (line 1626) | def test_load_best_model_with_save(self): method test_save_best_checkpoint (line 1675) | def test_save_best_checkpoint(self): method test_metric_for_best_model_behavior (line 1743) | def test_metric_for_best_model_behavior(self): method test_best_model_checkpoint_behavior (line 1773) | def test_best_model_checkpoint_behavior(self): method test_load_best_model_at_end (line 1958) | def test_load_best_model_at_end(self): method test_load_best_model_from_safetensors (line 2029) | def test_load_best_model_from_safetensors(self): class TrainerIntegrationWithHubTester (line 2057) | class TrainerIntegrationWithHubTester(unittest.TestCase): method setUpClass (line 2059) | def setUpClass(cls): method test_push_to_hub (line 2062) | def test_push_to_hub(self): method test_push_to_hub_in_organization (line 2084) | def test_push_to_hub_in_organization(self): method get_commit_history (line 2108) | def get_commit_history(self, repo): method test_push_to_hub_with_saves_each_epoch (line 2121) | def test_push_to_hub_with_saves_each_epoch(self): method test_push_to_hub_with_saves_each_n_steps (line 2144) | def test_push_to_hub_with_saves_each_n_steps(self): method test_push_to_hub_with_tensorboard_logs (line 2183) | def test_push_to_hub_with_tensorboard_logs(self): method test_push_to_hub_tags (line 2205) | def test_push_to_hub_tags(self): method test_push_to_hub_with_revision (line 2232) | def test_push_to_hub_with_revision(self): FILE: tests/trainer/test_trainer_data.py class RandomIterableDataset (line 75) | class RandomIterableDataset(torch.utils.data.IterableDataset): method __init__ (line 77) | def __init__(self, p_stop=0.01, max_length=1000): method __iter__ (line 82) | def __iter__(self): class TrainerDataloaderTest (line 98) | class TrainerDataloaderTest(TestCasePlus): method test_train_and_eval_dataloaders (line 101) | def test_train_and_eval_dataloaders(self): method test_dataloader_without_dataset (line 143) | def test_dataloader_without_dataset(self): method test_get_eval_dataloader_without_persistent_workers (line 155) | def test_get_eval_dataloader_without_persistent_workers(self): method test_get_eval_dataloader_with_persistent_workers (line 198) | def test_get_eval_dataloader_with_persistent_workers(self): class TrainerLabelSmoothingTest (line 252) | class TrainerLabelSmoothingTest(unittest.TestCase): method test_label_smoothing (line 255) | def test_label_smoothing(self): method test_label_smoothing_multi_label_incompatibility (line 283) | def test_label_smoothing_multi_label_incompatibility(self): class TrainerSamplerTest (line 328) | class TrainerSamplerTest(unittest.TestCase): method test_group_by_length (line 331) | def test_group_by_length(self): method test_group_by_length_with_dict (line 343) | def test_group_by_length_with_dict(self): method test_group_by_length_with_batch_encoding (line 358) | def test_group_by_length_with_batch_encoding(self): method test_distributed_length_grouped (line 373) | def test_distributed_length_grouped(self): method test_distributed_sampler_with_loop (line 386) | def test_distributed_sampler_with_loop(self): method check_iterable_dataset_shard (line 411) | def check_iterable_dataset_shard(self, dataset, batch_size, drop_last,... method test_iterable_dataset_shard (line 461) | def test_iterable_dataset_shard(self): method test_iterable_dataset_shard_with_length (line 470) | def test_iterable_dataset_shard_with_length(self): method check_shard_sampler (line 498) | def check_shard_sampler(self, dataset, batch_size, drop_last, num_proc... method test_shard_sampler (line 526) | def test_shard_sampler(self): class TrainerBatchSizeFinderTest (line 543) | class TrainerBatchSizeFinderTest(unittest.TestCase): method test_executable_batch_size (line 547) | def test_executable_batch_size(self): method test_executable_batch_size_no_search (line 561) | def test_executable_batch_size_no_search(self): method test_executable_batch_size_with_error (line 573) | def test_executable_batch_size_with_error(self): class TrainerDataUtilsTest (line 589) | class TrainerDataUtilsTest(unittest.TestCase): method test_get_parameter_names (line 592) | def test_get_parameter_names(self): method test_get_parameter_names_rmsnorm (line 601) | def test_get_parameter_names_rmsnorm(self): method test_pad_and_concatenate_with_1d (line 628) | def test_pad_and_concatenate_with_1d(self): method test_remove_columns_collator (line 640) | def test_remove_columns_collator(self): method test_eval_loop_container (line 665) | def test_eval_loop_container(self): class TrainerDynamicShapesAndIterableTest (line 761) | class TrainerDynamicShapesAndIterableTest(TestCasePlus, TrainerIntegrati... method setUp (line 762) | def setUp(self): method test_dynamic_shapes (line 768) | def test_dynamic_shapes(self): method test_training_iterable_dataset (line 806) | def test_training_iterable_dataset(self): method test_evaluation_iterable_dataset (line 822) | def test_evaluation_iterable_dataset(self): method test_predict_iterable_dataset (line 853) | def test_predict_iterable_dataset(self): FILE: tests/trainer/test_trainer_evaluation.py class TrainerEvaluationTest (line 72) | class TrainerEvaluationTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 73) | def setUp(self): method test_evaluate (line 79) | def test_evaluate(self): method test_predict (line 121) | def test_predict(self): method test_train_and_predict_loss_parity (line 156) | def test_train_and_predict_loss_parity(self): method test_eval_use_gather_object (line 190) | def test_eval_use_gather_object(self): class TrainerBatchEvalMetricsTest (line 208) | class TrainerBatchEvalMetricsTest(TestCasePlus, TrainerIntegrationCommon): method setUp (line 209) | def setUp(self): method test_evaluate_with_batch_eval_metrics (line 215) | def test_evaluate_with_batch_eval_metrics(self): method test_predict_with_batch_eval_metrics (line 265) | def test_predict_with_batch_eval_metrics(self): class TrainerFullEvalMemoryTest (line 336) | class TrainerFullEvalMemoryTest(TestCasePlus): method test_fp16_full_eval (line 339) | def test_fp16_full_eval(self): method test_bf16_full_eval (line 402) | def test_bf16_full_eval(self): class TrainerSlowEvalTest (line 472) | class TrainerSlowEvalTest(TestCasePlus): method test_trainer_eval_mrpc (line 474) | def test_trainer_eval_mrpc(self): method test_trainer_eval_multiple (line 490) | def test_trainer_eval_multiple(self): method test_trainer_eval_lm (line 515) | def test_trainer_eval_lm(self): FILE: tests/trainer/test_trainer_hyperparameter.py class TrainerHyperParameterOptunaIntegrationTest (line 39) | class TrainerHyperParameterOptunaIntegrationTest(unittest.TestCase): method setUp (line 40) | def setUp(self): method test_hyperparameter_search (line 45) | def test_hyperparameter_search(self): class TrainerHyperParameterMultiObjectOptunaIntegrationTest (line 84) | class TrainerHyperParameterMultiObjectOptunaIntegrationTest(unittest.Tes... method setUp (line 85) | def setUp(self): method test_hyperparameter_search (line 90) | def test_hyperparameter_search(self): class TrainerHyperParameterOptunaIntegrationTestWithFullEval (line 139) | class TrainerHyperParameterOptunaIntegrationTestWithFullEval(unittest.Te... method test_hyperparameter_search (line 140) | def test_hyperparameter_search(self): class TrainerHyperParameterRayIntegrationTest (line 172) | class TrainerHyperParameterRayIntegrationTest(unittest.TestCase): method setUp (line 173) | def setUp(self): method ray_hyperparameter_search (line 178) | def ray_hyperparameter_search(self): method test_hyperparameter_search (line 221) | def test_hyperparameter_search(self): method test_hyperparameter_search_ray_client (line 224) | def test_hyperparameter_search_ray_client(self): class TrainerHyperParameterWandbIntegrationTest (line 235) | class TrainerHyperParameterWandbIntegrationTest(unittest.TestCase): method setUp (line 236) | def setUp(self): method test_hyperparameter_search (line 241) | def test_hyperparameter_search(self): class HyperParameterSearchBackendsTest (line 303) | class HyperParameterSearchBackendsTest(unittest.TestCase): method test_hyperparameter_search_backends (line 304) | def test_hyperparameter_search_backends(self): FILE: tests/trainer/test_trainer_optimizers.py class TrainerOptimizerIntegrationTest (line 71) | class TrainerOptimizerIntegrationTest(TestCasePlus, TrainerIntegrationCo... method setUp (line 72) | def setUp(self): method _get_llama_and_dataset (line 82) | def _get_llama_and_dataset(self): method _get_gpt2_and_dataset (line 88) | def _get_gpt2_and_dataset(self): method _train_with_llama (line 94) | def _train_with_llama(self, optim, optim_target_modules=None, **extra_... method _check_lr_display_without_scheduler (line 106) | def _check_lr_display_without_scheduler(self, optim, optim_target_modu... method _check_lr_display_with_scheduler (line 121) | def _check_lr_display_with_scheduler(self, optim, optim_target_modules... method test_adafactor_lr_none (line 162) | def test_adafactor_lr_none(self): method test_bnb_optim (line 192) | def test_bnb_optim(self, optim): method test_bnb_8bit_optimizer_skip_embedding (line 204) | def test_bnb_8bit_optimizer_skip_embedding(self): method test_lomo (line 227) | def test_lomo(self): method test_adalomo (line 241) | def test_adalomo(self): method test_grokadamw (line 250) | def test_grokadamw(self): method test_schedulefree (line 260) | def test_schedulefree(self, optim): method test_galore_matched_modules (line 267) | def test_galore_matched_modules(self): method test_galore (line 351) | def test_galore(self, optim): method test_galore_extra_args (line 356) | def test_galore_extra_args(self): method test_galore_layerwise_with_scheduler (line 365) | def test_galore_layerwise_with_scheduler(self): method test_galore_adafactor (line 381) | def test_galore_adafactor(self, optim_target_modules): method test_galore_lr_display_without_scheduler (line 402) | def test_galore_lr_display_without_scheduler(self): method test_galore_lr_display_with_scheduler (line 407) | def test_galore_lr_display_with_scheduler(self): method test_apollo (line 417) | def test_apollo(self, optim): method test_apollo_extra_args (line 422) | def test_apollo_extra_args(self): method test_apollo_layerwise_with_scheduler (line 431) | def test_apollo_layerwise_with_scheduler(self): method test_apollo_lr_display_without_scheduler (line 440) | def test_apollo_lr_display_without_scheduler(self): method test_apollo_lr_display_with_scheduler (line 445) | def test_apollo_lr_display_with_scheduler(self): method test_stable_adamw (line 454) | def test_stable_adamw(self): method test_stable_adamw_extra_args (line 459) | def test_stable_adamw_extra_args(self): method test_stable_adamw_trainer_adamw_args (line 468) | def test_stable_adamw_trainer_adamw_args(self): method test_stable_adamw_lr_display_without_scheduler (line 492) | def test_stable_adamw_lr_display_without_scheduler(self): method test_stable_adamw_lr_display_with_scheduler (line 497) | def test_stable_adamw_lr_display_with_scheduler(self): method test_optimizer_factory_pattern (line 504) | def test_optimizer_factory_pattern(self): method test_get_optimizer_group (line 531) | def test_get_optimizer_group(self): class TrainerOptimizerTest (line 553) | class TrainerOptimizerTest(TestCasePlus): method test_get_optimizer_group (line 554) | def test_get_optimizer_group(self): method test_optimizer_factory_pattern (line 570) | def test_optimizer_factory_pattern(self): method test_custom_optimizer (line 593) | def test_custom_optimizer(self): method test_no_wd_param_group (line 615) | def test_no_wd_param_group(self): class TrainerLRTest (line 628) | class TrainerLRTest(TestCasePlus): method test_get_learning_rates (line 629) | def test_get_learning_rates(self): method test_lr_scheduler_kwargs (line 638) | def test_lr_scheduler_kwargs(self): method test_cosine_with_min_lr_scheduler (line 668) | def test_cosine_with_min_lr_scheduler(self): method test_cosine_with_min_lr_schedule_with_warmup_lr_rate (line 692) | def test_cosine_with_min_lr_schedule_with_warmup_lr_rate(self): method test_reduce_lr_on_plateau_args (line 719) | def test_reduce_lr_on_plateau_args(self): method test_reduce_lr_on_plateau (line 746) | def test_reduce_lr_on_plateau(self): method test_greedy_lr_args (line 793) | def test_greedy_lr_args(self): method test_greedy_lr (line 822) | def test_greedy_lr(self): FILE: tests/trainer/test_trainer_seq2seq.py class Seq2seqTrainerTester (line 63) | class Seq2seqTrainerTester(TestCasePlus): method test_finetune_bert2bert (line 66) | def test_finetune_bert2bert(self): method test_return_sequences (line 179) | def test_return_sequences(self): method test_bad_generation_config_fail_early (line 227) | def test_bad_generation_config_fail_early(self): class TestTranslationExample (line 247) | class TestTranslationExample(TestCasePlus): method setUpClass (line 251) | def setUpClass(cls): method _run_translation (line 259) | def _run_translation( method test_run_seq2seq_no_dist (line 337) | def test_run_seq2seq_no_dist(self): method test_run_seq2seq_dp (line 345) | def test_run_seq2seq_dp(self): method test_run_seq2seq_ddp (line 353) | def test_run_seq2seq_ddp(self): method test_run_seq2seq_slow (line 361) | def test_run_seq2seq_slow(self): method test_run_seq2seq_bnb (line 377) | def test_run_seq2seq_bnb(self): FILE: tests/trainer/test_training_args.py class TestTrainingArguments (line 15) | class TestTrainingArguments(unittest.TestCase): method test_default_output_dir (line 16) | def test_default_output_dir(self): method test_custom_output_dir (line 21) | def test_custom_output_dir(self): method test_output_dir_creation (line 27) | def test_output_dir_creation(self): method test_torch_empty_cache_steps_requirements (line 51) | def test_torch_empty_cache_steps_requirements(self): method test_output_dir_expands_user (line 76) | def test_output_dir_expands_user(self): method test_enum_coercions (line 81) | def test_enum_coercions(self): method test_do_eval_auto_enabled (line 105) | def test_do_eval_auto_enabled(self): method test_eval_steps_fallback_to_logging_steps (line 116) | def test_eval_steps_fallback_to_logging_steps(self): method test_eval_steps_required_when_strategy_steps (line 126) | def test_eval_steps_required_when_strategy_steps(self): method test_logging_steps_required_nonzero (line 136) | def test_logging_steps_required_nonzero(self): method test_steps_must_be_integer_when_greater_than_one (line 146) | def test_steps_must_be_integer_when_greater_than_one(self): method test_load_best_model_requires_matching_strategies (line 178) | def test_load_best_model_requires_matching_strategies(self): method test_metric_for_best_model_defaults (line 215) | def test_metric_for_best_model_defaults(self): method test_fp16_bf16_mutual_exclusivity (line 250) | def test_fp16_bf16_mutual_exclusivity(self): method test_reduce_on_plateau_requires_eval (line 257) | def test_reduce_on_plateau_requires_eval(self): method test_torch_compile_auto_enable (line 267) | def test_torch_compile_auto_enable(self): method test_report_to_none_handling (line 291) | def test_report_to_none_handling(self): method test_kubeflow_auto_enable (line 302) | def test_kubeflow_auto_enable(self): method test_warmup_steps_validation (line 323) | def test_warmup_steps_validation(self): method test_debug_option_parsing (line 335) | def test_debug_option_parsing(self): method test_dataloader_prefetch_requires_workers (line 343) | def test_dataloader_prefetch_requires_workers(self): method test_use_cpu_disables_pin_memory (line 361) | def test_use_cpu_disables_pin_memory(self): method test_include_num_input_tokens_seen_coercion (line 366) | def test_include_num_input_tokens_seen_coercion(self): method test_dict_field_parsing (line 374) | def test_dict_field_parsing(self): method test_dtype_to_json (line 379) | def test_dtype_to_json(self): FILE: tests/trainer/trainer_test_utils.py function get_dataset (line 79) | def get_dataset(file_path, tokenizer, max_len): class StoreLossCallback (line 98) | class StoreLossCallback(TrainerCallback): method __init__ (line 103) | def __init__(self): method on_log (line 106) | def on_log(self, args, state, control, logs=None, **kwargs): class MockCudaOOMCallback (line 111) | class MockCudaOOMCallback(TrainerCallback): method __init__ (line 117) | def __init__(self, batch_size_limit=16): method on_step_end (line 120) | def on_step_end(self, args, state, control, **kwargs): class RegressionDataset (line 126) | class RegressionDataset: method __init__ (line 127) | def __init__(self, a=2, b=3, length=64, seed=42, label_names=None): method __len__ (line 135) | def __len__(self): method __getitem__ (line 138) | def __getitem__(self, i): function bytes2megabytes (line 145) | def bytes2megabytes(x): class TorchTracemalloc (line 150) | class TorchTracemalloc: method __enter__ (line 151) | def __enter__(self): method __exit__ (line 161) | def __exit__(self, *exc): class RegressionTrainingArguments (line 175) | class RegressionTrainingArguments(TrainingArguments): class RepeatDataset (line 180) | class RepeatDataset: method __init__ (line 181) | def __init__(self, x, length=64): method __len__ (line 185) | def __len__(self): method __getitem__ (line 188) | def __getitem__(self, i): class SequenceClassificationDataset (line 192) | class SequenceClassificationDataset: method __init__ (line 193) | def __init__(self, length=64, vocab_size=100, num_labels=5): method __len__ (line 198) | def __len__(self): method __getitem__ (line 201) | def __getitem__(self, i): class DynamicShapesDataset (line 205) | class DynamicShapesDataset: method __init__ (line 206) | def __init__(self, length=64, seed=42, batch_size=8): method __len__ (line 214) | def __len__(self): method __getitem__ (line 217) | def __getitem__(self, i): class AlmostAccuracy (line 221) | class AlmostAccuracy: method __init__ (line 222) | def __init__(self, thresh=0.25): method __call__ (line 225) | def __call__(self, eval_pred): class AlmostAccuracyBatched (line 231) | class AlmostAccuracyBatched: method __init__ (line 232) | def __init__(self, thresh=0.25): method __call__ (line 236) | def __call__(self, eval_pred, compute_result): class RegressionModelConfig (line 252) | class RegressionModelConfig(PreTrainedConfig): method __init__ (line 253) | def __init__(self, a=0, b=0, double_output=False, random_torch=True, *... class SampleIterableDataset (line 264) | class SampleIterableDataset(IterableDataset): method __init__ (line 265) | def __init__(self, a=2, b=3, length=64, seed=42, label_names=None): method __iter__ (line 268) | def __iter__(self): class FiniteIterableDataset (line 272) | class FiniteIterableDataset(SampleIterableDataset): method __init__ (line 273) | def __init__(self, a=2, b=3, length=64, seed=42, label_names=None): method __iter__ (line 277) | def __iter__(self): class MultiLoader (line 282) | class MultiLoader: method __init__ (line 283) | def __init__(self, loaders): method __len__ (line 286) | def __len__(self): method __iter__ (line 289) | def __iter__(self): class CustomDataloaderTrainer (line 293) | class CustomDataloaderTrainer(Trainer): method get_train_dataloader (line 294) | def get_train_dataloader(self): method get_eval_dataloader (line 298) | def get_eval_dataloader(self, eval_dataset): class RegressionModel (line 302) | class RegressionModel(nn.Module): method __init__ (line 303) | def __init__(self, a=0, b=0, double_output=False): method forward (line 310) | def forward(self, input_x, labels=None, **kwargs): class RegressionDictModel (line 317) | class RegressionDictModel(nn.Module): method __init__ (line 318) | def __init__(self, a=0, b=0): method forward (line 324) | def forward(self, input_x, labels=None, **kwargs): class RegressionPreTrainedModel (line 331) | class RegressionPreTrainedModel(PreTrainedModel): method __init__ (line 335) | def __init__(self, config): method forward (line 342) | def forward(self, input_x, labels=None, **kwargs): class RegressionPreTrainedModelWithGradientCheckpointing (line 349) | class RegressionPreTrainedModelWithGradientCheckpointing(PreTrainedModel): method __init__ (line 354) | def __init__(self, config): method forward (line 362) | def forward(self, input_x, labels=None, **kwargs): class RegressionRandomPreTrainedModel (line 382) | class RegressionRandomPreTrainedModel(PreTrainedModel): method __init__ (line 386) | def __init__(self, config): method forward (line 393) | def forward(self, input_x, labels=None, **kwargs): class BasicTextGenerationModel (line 409) | class BasicTextGenerationModel(nn.Module): method __init__ (line 410) | def __init__(self, vocab_size, hidden_size): method forward (line 416) | def forward(self, input_ids, labels=None, **kwargs): function create_dummy_dataset_for_text_generation (line 426) | def create_dummy_dataset_for_text_generation(vocab_size, seq_length, num... class TstLayer (line 437) | class TstLayer(nn.Module): method __init__ (line 438) | def __init__(self, hidden_size): method forward (line 446) | def forward(self, x): function get_regression_trainer (line 451) | def get_regression_trainer( function get_language_model_trainer (line 503) | def get_language_model_trainer(**kwargs): class TrainerIntegrationCommon (line 526) | class TrainerIntegrationCommon: method check_saved_checkpoints (line 527) | def check_saved_checkpoints(self, output_dir, freq, total, is_pretrain... method check_best_model_has_been_loaded (line 540) | def check_best_model_has_been_loaded( method remove_nan_logs (line 580) | def remove_nan_logs(self, log): method check_trainer_state_are_the_same (line 585) | def check_trainer_state_are_the_same(self, trainer_state, trainer_stat... method convert_to_sharded_checkpoint (line 604) | def convert_to_sharded_checkpoint(self, folder): FILE: tests/utils/import_structures/failing_export.py class A0 (line 21) | class A0: method __init__ (line 22) | def __init__(self): FILE: tests/utils/import_structures/import_structure_raw_register.py class A0 (line 21) | class A0: method __init__ (line 22) | def __init__(self): function a0 (line 27) | def a0(): class A1 (line 32) | class A1: method __init__ (line 33) | def __init__(self): function a1 (line 38) | def a1(): class A2 (line 45) | class A2: method __init__ (line 46) | def __init__(self): function a2 (line 53) | def a2(): class A3 (line 62) | class A3: method __init__ (line 63) | def __init__(self): function a3 (line 72) | def a3(): class A4 (line 76) | class A4: method __init__ (line 77) | def __init__(self): FILE: tests/utils/import_structures/import_structure_raw_register_with_versions.py class D0 (line 21) | class D0: method __init__ (line 22) | def __init__(self): function d0 (line 27) | def d0(): class D1 (line 32) | class D1: method __init__ (line 33) | def __init__(self): function d1 (line 38) | def d1(): class D2 (line 43) | class D2: method __init__ (line 44) | def __init__(self): function d2 (line 49) | def d2(): class D3 (line 53) | class D3: method __init__ (line 54) | def __init__(self): function d3 (line 59) | def d3(): class D4 (line 64) | class D4: method __init__ (line 65) | def __init__(self): function d4 (line 70) | def d4(): class D5 (line 75) | class D5: method __init__ (line 76) | def __init__(self): function d5 (line 81) | def d5(): class D6 (line 85) | class D6: method __init__ (line 86) | def __init__(self): function d6 (line 91) | def d6(): FILE: tests/utils/import_structures/import_structure_register_with_comments.py class B0 (line 22) | class B0: method __init__ (line 23) | def __init__(self): function b0 (line 29) | def b0(): class B1 (line 35) | class B1: method __init__ (line 36) | def __init__(self): function b1 (line 42) | def b1(): class B2 (line 48) | class B2: method __init__ (line 49) | def __init__(self): function b2 (line 55) | def b2(): class B3 (line 65) | class B3: method __init__ (line 66) | def __init__(self): function b3 (line 76) | def b3(): FILE: tests/utils/import_structures/import_structure_register_with_duplicates.py class C0 (line 21) | class C0: method __init__ (line 22) | def __init__(self): function c0 (line 27) | def c0(): class C1 (line 33) | class C1: method __init__ (line 34) | def __init__(self): function c1 (line 40) | def c1(): class C2 (line 46) | class C2: method __init__ (line 47) | def __init__(self): function c2 (line 53) | def c2(): class C3 (line 64) | class C3: method __init__ (line 65) | def __init__(self): function c3 (line 76) | def c3(): FILE: tests/utils/test_activations.py class TestActivations (line 28) | class TestActivations(unittest.TestCase): method test_gelu_versions (line 29) | def test_gelu_versions(self): method test_gelu_10 (line 35) | def test_gelu_10(self): method test_get_activation (line 48) | def test_get_activation(self): method test_activations_are_distinct_objects (line 68) | def test_activations_are_distinct_objects(self): FILE: tests/utils/test_add_new_model_like.py class TestAddNewModelLike (line 32) | class TestAddNewModelLike(unittest.TestCase): method setUpClass (line 34) | def setUpClass(cls): method tearDownClass (line 73) | def tearDownClass(cls): method assertFileIsEqual (line 76) | def assertFileIsEqual(self, text: str, filepath: str): method assertInFile (line 81) | def assertInFile(self, text: str, filepath: str): method test_llama_without_tokenizers (line 86) | def test_llama_without_tokenizers(self): method test_phi4_with_all_processors (line 364) | def test_phi4_with_all_processors(self): FILE: tests/utils/test_attention_visualizer.py function _normalize (line 27) | def _normalize(s: str) -> str: class AttentionMaskVisualizerTester (line 36) | class AttentionMaskVisualizerTester(unittest.TestCase): method test_paligemma_multimodal_visualization (line 39) | def test_paligemma_multimodal_visualization(self): method test_llama_text_only_visualization (line 86) | def test_llama_text_only_visualization(self): FILE: tests/utils/test_audio_utils.py class AudioUtilsFunctionTester (line 40) | class AudioUtilsFunctionTester(unittest.TestCase): method test_hertz_to_mel (line 44) | def test_hertz_to_mel(self): method test_mel_to_hertz (line 66) | def test_mel_to_hertz(self): method test_mel_filter_bank_shape (line 88) | def test_mel_filter_bank_shape(self): method test_mel_filter_bank_htk (line 123) | def test_mel_filter_bank_htk(self): method test_mel_filter_bank_slaney (line 155) | def test_mel_filter_bank_slaney(self): method test_mel_filter_bank_kaldi (line 187) | def test_mel_filter_bank_kaldi(self): method test_mel_filter_bank_slaney_norm (line 232) | def test_mel_filter_bank_slaney_norm(self): method test_window_function (line 264) | def test_window_function(self): method _load_datasamples (line 276) | def _load_datasamples(self, num_samples): method test_spectrogram_impulse (line 284) | def test_spectrogram_impulse(self): method test_spectrogram_batch_impulse (line 303) | def test_spectrogram_batch_impulse(self): method test_spectrogram_integration_test (line 338) | def test_spectrogram_integration_test(self): method test_spectrogram_batch_integration_test (line 436) | def test_spectrogram_batch_integration_test(self): method test_spectrogram_center_padding (line 607) | def test_spectrogram_center_padding(self): method test_spectrogram_batch_center_padding (line 696) | def test_spectrogram_batch_center_padding(self): method test_spectrogram_shapes (line 890) | def test_spectrogram_shapes(self): method test_spectrogram_batch_shapes (line 966) | def test_spectrogram_batch_shapes(self): method test_mel_spectrogram (line 1054) | def test_mel_spectrogram(self): method test_mel_spectrogram_batch (line 1097) | def test_mel_spectrogram_batch(self): method test_spectrogram_power (line 1158) | def test_spectrogram_power(self): method test_spectrogram_batch_power (line 1254) | def test_spectrogram_batch_power(self): method test_power_to_db (line 1467) | def test_power_to_db(self): method test_power_to_db_batch (line 1505) | def test_power_to_db_batch(self): method test_amplitude_to_db (line 1583) | def test_amplitude_to_db(self): method test_amplitude_to_db_batch (line 1621) | def test_amplitude_to_db_batch(self): method test_chroma_equivalence (line 1700) | def test_chroma_equivalence(self): FILE: tests/utils/test_auto_docstring.py class TestCheckDocstrings (line 60) | class TestCheckDocstrings(unittest.TestCase): method test_missing_args_detection_and_placeholder_generation (line 63) | def test_missing_args_detection_and_placeholder_generation(self): method test_multi_item_file_processing (line 111) | def test_multi_item_file_processing(self): method test_typed_dict_field_detection (line 173) | def test_typed_dict_field_detection(self): method test_file_discovery_finds_decorated_files (line 208) | def test_file_discovery_finds_decorated_files(self): class DummyConfig (line 226) | class DummyConfig(PretrainedConfig): method __init__ (line 229) | def __init__(self, vocab_size=1000, hidden_size=768, num_attention_hea... class DummyForTestModel (line 237) | class DummyForTestModel(PreTrainedModel): method __init__ (line 240) | def __init__(self, config: DummyConfig): method forward (line 244) | def forward( class ComplexProcessorKwargs (line 279) | class ComplexProcessorKwargs(ProcessingKwargs, total=False): class DummyProcessorForTest (line 298) | class DummyProcessorForTest(ProcessorMixin): method __init__ (line 299) | def __init__( method __call__ (line 322) | def __call__( class DummyImageProcessorKwargs (line 340) | class DummyImageProcessorKwargs(ImagesKwargs, total=False): class DummyForTestImageProcessorFast (line 359) | class DummyForTestImageProcessorFast(TorchvisionBackend): method __init__ (line 363) | def __init__(self, **kwargs: Unpack[DummyImageProcessorKwargs]): method preprocess (line 367) | def preprocess( class DummyStrictConfig (line 391) | class DummyStrictConfig(PretrainedConfig): class TestFullDocstringGeneration (line 405) | class TestFullDocstringGeneration(unittest.TestCase): method test_strict_config_docstring_only_documents_own_args (line 413) | def test_strict_config_docstring_only_documents_own_args(self): method test_dummy_model_complete_docstring (line 429) | def test_dummy_model_complete_docstring(self): method test_dummy_processor_complete_docstring (line 539) | def test_dummy_processor_complete_docstring(self): method test_dummy_image_processor_complete_docstring (line 609) | def test_dummy_image_processor_complete_docstring(self): class TestAutoDocstringPerformance (line 678) | class TestAutoDocstringPerformance: method test_auto_docstring_import_time_upper_bound (line 691) | def test_auto_docstring_import_time_upper_bound(self): FILE: tests/utils/test_backbone_utils.py class AnyBackboneConfig (line 35) | class AnyBackboneConfig(BackboneConfigMixin, PreTrainedConfig): method __init__ (line 36) | def __init__( class AnyBackbone (line 50) | class AnyBackbone(BackboneMixin, PreTrainedModel): ... class BackboneUtilsTester (line 53) | class BackboneUtilsTester(unittest.TestCase): method test_get_aligned_output_features_output_indices (line 54) | def test_get_aligned_output_features_output_indices(self): method test_config_verify_out_features_out_indices (line 77) | def test_config_verify_out_features_out_indices(self): method test_backbone_mixin (line 138) | def test_backbone_mixin(self): method test_load_backbone_from_config (line 158) | def test_load_backbone_from_config(self): method test_load_backbone_from_checkpoint (line 170) | def test_load_backbone_from_checkpoint(self): method test_load_backbone_backbone_kwargs (line 193) | def test_load_backbone_backbone_kwargs(self): method test_load_backbone_in_new_model (line 217) | def test_load_backbone_in_new_model(self): FILE: tests/utils/test_cache_utils.py class CacheTest (line 72) | class CacheTest(unittest.TestCase): method test_static_cache_mha_mqa_gqa (line 75) | def test_static_cache_mha_mqa_gqa(self): function _skip_on_failed_cache_prerequisites (line 112) | def _skip_on_failed_cache_prerequisites(test, cache_implementation): class CacheIntegrationTest (line 127) | class CacheIntegrationTest(unittest.TestCase): method setUpClass (line 131) | def setUpClass(cls): method test_cache_batched (line 140) | def test_cache_batched(self, cache_implementation): method test_cache_beam_search (line 166) | def test_cache_beam_search(self, cache_implementation): method test_quantized_cache_generation (line 203) | def test_quantized_cache_generation(self, backend): method test_cache_extra_left_padding (line 247) | def test_cache_extra_left_padding(self, cache_implementation): class CacheHardIntegrationTest (line 275) | class CacheHardIntegrationTest(unittest.TestCase): method setUp (line 278) | def setUp(self): method tearDownClass (line 284) | def tearDownClass(cls): method test_dynamic_cache_hard (line 289) | def test_dynamic_cache_hard(self): method test_static_cache_greedy_decoding_pad_left (line 326) | def test_static_cache_greedy_decoding_pad_left(self, attn_implementati... method test_offloaded_cache_uses_less_memory_than_dynamic_cache (line 368) | def test_offloaded_cache_uses_less_memory_than_dynamic_cache(self): method test_cache_copy (line 401) | def test_cache_copy(self): method test_data_parallel_dynamic_cache (line 439) | def test_data_parallel_dynamic_cache(self): method test_static_cache_no_cuda_graph_skips (line 474) | def test_static_cache_no_cuda_graph_skips(self): method test_static_cache_multi_accelerator (line 493) | def test_static_cache_multi_accelerator(self): method test_cache_gptj_model (line 515) | def test_cache_gptj_model(self, cache_implementation): class CacheExportIntegrationTest (line 537) | class CacheExportIntegrationTest(unittest.TestCase): method test_dynamic_cache_exportability (line 541) | def test_dynamic_cache_exportability(self): method test_dynamic_cache_exportability_multiple_run (line 583) | def test_dynamic_cache_exportability_multiple_run(self): method test_static_cache_exportability (line 679) | def test_static_cache_exportability(self): method test_hybrid_cache_exportability (line 756) | def test_hybrid_cache_exportability(self): class SyntheticCacheTest (line 819) | class SyntheticCacheTest(unittest.TestCase): method setUp (line 822) | def setUp(self): method test_static_cache_out_of_bounds (line 837) | def test_static_cache_out_of_bounds(self): method test_static_cache (line 851) | def test_static_cache(self): method test_sliding_window_cache (line 884) | def test_sliding_window_cache(self): method test_dynamic_cache (line 953) | def test_dynamic_cache(self): method test_dynamic_cache_batch_select_indices (line 996) | def test_dynamic_cache_batch_select_indices(self): method test_hybrid_cache (line 1018) | def test_hybrid_cache(self): method test_hybrid_chunked_cache (line 1111) | def test_hybrid_chunked_cache(self): method test_hybrid_chunked_cache_extra_cases (line 1192) | def test_hybrid_chunked_cache_extra_cases(self): FILE: tests/utils/test_chat_parsing_utils.py class ChatSchemaParserTest (line 232) | class ChatSchemaParserTest(unittest.TestCase): method test_schema_save_load (line 233) | def test_schema_save_load(self): method test_tokenizer_method (line 242) | def test_tokenizer_method(self): method test_batched_inputs (line 250) | def test_batched_inputs(self): method test_token_id_inputs (line 258) | def test_token_id_inputs(self): method test_numpy_inputs (line 268) | def test_numpy_inputs(self): method test_tensor_inputs (line 276) | def test_tensor_inputs(self): method test_cohere_template (line 284) | def test_cohere_template(self): method test_ernie_template_with_tools (line 301) | def test_ernie_template_with_tools(self): method test_ernie_template_no_tools (line 318) | def test_ernie_template_no_tools(self): method test_gpt_oss_template_with_tool_call (line 330) | def test_gpt_oss_template_with_tool_call(self): method test_gpt_oss_template_no_tool_call (line 347) | def test_gpt_oss_template_no_tool_call(self): method test_smollm_template_thinking_and_tool_call (line 359) | def test_smollm_template_thinking_and_tool_call(self): method test_smollm_template_tool_call_no_thinking (line 381) | def test_smollm_template_tool_call_no_thinking(self): method test_smollm_template_thinking_no_tool_call (line 394) | def test_smollm_template_thinking_no_tool_call(self): method test_qwen3_tool_calls (line 406) | def test_qwen3_tool_calls(self): method test_re_sub_schema (line 428) | def test_re_sub_schema(self): method test_required_fields_present (line 449) | def test_required_fields_present(self): method test_required_field_missing_raises (line 467) | def test_required_field_missing_raises(self): method test_required_not_enforced_when_absent (line 485) | def test_required_not_enforced_when_absent(self): method test_prefix_items (line 500) | def test_prefix_items(self): method test_prefix_items_wrong_length_raises (line 505) | def test_prefix_items_wrong_length_raises(self): method test_prefix_items_wrong_type_raises (line 510) | def test_prefix_items_wrong_type_raises(self): method test_type_any_passthrough (line 515) | def test_type_any_passthrough(self): method test_type_any_in_additional_properties (line 528) | def test_type_any_in_additional_properties(self): FILE: tests/utils/test_chat_template_utils.py class JsonSchemaGeneratorTest (line 21) | class JsonSchemaGeneratorTest(unittest.TestCase): method test_simple_function (line 22) | def test_simple_function(self): method test_no_arguments (line 44) | def test_no_arguments(self): method test_union (line 59) | def test_union(self): method test_optional (line 81) | def test_optional(self): method test_default_arg (line 103) | def test_default_arg(self): method test_nested_list (line 121) | def test_nested_list(self): method test_multiple_arguments (line 149) | def test_multiple_arguments(self): method test_multiple_complex_arguments (line 175) | def test_multiple_complex_arguments(self): method test_missing_docstring (line 205) | def test_missing_docstring(self): method test_missing_param_docstring (line 212) | def test_missing_param_docstring(self): method test_missing_type_hint (line 222) | def test_missing_type_hint(self): method test_return_value (line 235) | def test_return_value(self): method test_return_value_docstring (line 258) | def test_return_value_docstring(self): method test_tuple (line 285) | def test_tuple(self): method test_single_element_tuple_fails (line 317) | def test_single_element_tuple_fails(self): method test_ellipsis_type_fails (line 335) | def test_ellipsis_type_fails(self): method test_enum_extraction (line 353) | def test_enum_extraction(self): method test_literal (line 387) | def test_literal(self): method test_multiline_docstring_with_types (line 430) | def test_multiline_docstring_with_types(self): method test_return_none (line 465) | def test_return_none(self): method test_instance_method (line 490) | def test_instance_method(self): method test_static_method (line 513) | def test_static_method(self): method test_class_method (line 537) | def test_class_method(self): method test_everything_all_at_once (line 561) | def test_everything_all_at_once(self): FILE: tests/utils/test_configuration_utils.py class ConfigPushToHubTester (line 50) | class ConfigPushToHubTester(unittest.TestCase): method setUpClass (line 52) | def setUpClass(cls): method test_push_to_hub (line 55) | def test_push_to_hub(self): method test_push_to_hub_via_save_pretrained (line 67) | def test_push_to_hub_via_save_pretrained(self): method test_push_to_hub_in_organization (line 81) | def test_push_to_hub_in_organization(self): method test_push_to_hub_in_organization_via_save_pretrained (line 93) | def test_push_to_hub_in_organization_via_save_pretrained(self): method test_push_to_hub_dynamic_config (line 107) | def test_push_to_hub_dynamic_config(self): class ConfigTestUtils (line 123) | class ConfigTestUtils(unittest.TestCase): method test_config_from_string (line 124) | def test_config_from_string(self): method test_config_common_kwargs_is_complete (line 140) | def test_config_common_kwargs_is_complete(self): method test_nested_config_load_from_dict (line 164) | def test_nested_config_load_from_dict(self): method test_from_pretrained_subfolder (line 171) | def test_from_pretrained_subfolder(self): method test_cached_files_are_used_when_internet_is_down (line 178) | def test_cached_files_are_used_when_internet_is_down(self): method test_local_versioning (line 197) | def test_local_versioning(self): method test_repo_versioning_before (line 219) | def test_repo_versioning_before(self): method test_saving_config_with_custom_generation_kwargs_raises_error (line 242) | def test_saving_config_with_custom_generation_kwargs_raises_error(self): method test_get_generation_parameters (line 249) | def test_get_generation_parameters(self): method test_loading_config_do_not_raise_future_warnings (line 257) | def test_loading_config_do_not_raise_future_warnings(self): method test_get_text_config (line 264) | def test_get_text_config(self): method test_bc_torch_dtype (line 297) | def test_bc_torch_dtype(self): method test_unserializable_json_is_encoded (line 322) | def test_unserializable_json_is_encoded(self): FILE: tests/utils/test_convert_slow_tokenizer.py class FakeOriginalTokenizer (line 10) | class FakeOriginalTokenizer: class ConvertSlowTokenizerTest (line 14) | class ConvertSlowTokenizerTest(unittest.TestCase): method test_spm_converter_bytefallback_warning (line 15) | def test_spm_converter_bytefallback_warning(self): FILE: tests/utils/test_core_model_loading.py class TestWeightGlobMatching (line 41) | class TestWeightGlobMatching(unittest.TestCase): method setUp (line 42) | def setUp(self): method _match_glob (line 58) | def _match_glob(key, alt, mapping): method test_exact_match (line 62) | def test_exact_match(self): method test_digits_only_star_accepts_digits (line 67) | def test_digits_only_star_accepts_digits(self): method test_anychar_star_accepts_nondigits (line 77) | def test_anychar_star_accepts_nondigits(self): method test_no_match (line 87) | def test_no_match(self): method test_leftmost_alternative_wins_for_overlapping_patterns (line 90) | def test_leftmost_alternative_wins_for_overlapping_patterns(self): method test_multiple_patterns_same_prefix (line 103) | def test_multiple_patterns_same_prefix(self): method test_anchor_full_match_only (line 126) | def test_anchor_full_match_only(self): method test_large_batch_performance_smoke (line 131) | def test_large_batch_performance_smoke(self): method test_sub_key_rewrites_targets (line 138) | def test_sub_key_rewrites_targets(self): method test_sub_key_no_match_returns_original (line 155) | def test_sub_key_no_match_returns_original(self): class DummyParamModule (line 165) | class DummyParamModule(nn.Module): method __init__ (line 166) | def __init__(self, shape): class DummySelfAttn (line 171) | class DummySelfAttn(nn.Module): method __init__ (line 172) | def __init__(self): class DummyExperts (line 179) | class DummyExperts(nn.Module): method __init__ (line 180) | def __init__(self): class DummyLayer (line 186) | class DummyLayer(nn.Module): method __init__ (line 187) | def __init__(self, add_extra_moe=False): class DummyTopModel (line 195) | class DummyTopModel(nn.Module): method __init__ (line 196) | def __init__(self, add_extra_moe=False): class DummyMLP (line 201) | class DummyMLP(nn.Module): method __init__ (line 202) | def __init__(self): class DummyRoot (line 207) | class DummyRoot(nn.Module): method __init__ (line 211) | def __init__(self, add_extra_moe=False): class TestConvertAndLoadStateDict (line 217) | class TestConvertAndLoadStateDict(unittest.TestCase): method test_moe_and_qkv_conversion (line 218) | def test_moe_and_qkv_conversion(self): method test_moe_and_qkv_conversion_reversed (line 335) | def test_moe_and_qkv_conversion_reversed(self): method test_qkv_chunk_rope_permute_with_fp8_quantization (line 402) | def test_qkv_chunk_rope_permute_with_fp8_quantization(self): method test_ernie4_5_vl_moe_conversion (line 524) | def test_ernie4_5_vl_moe_conversion(self): method test_ernie4_5_vl_moe_conversion_reversed (line 646) | def test_ernie4_5_vl_moe_conversion_reversed(self): class TestConversionMapping (line 720) | class TestConversionMapping(unittest.TestCase): method test_register_checkpoint_conversion_mapping (line 721) | def test_register_checkpoint_conversion_mapping(self): method test_register_checkpoint_conversion_mapping_overwrites (line 730) | def test_register_checkpoint_conversion_mapping_overwrites(self): FILE: tests/utils/test_deprecation.py class DeprecationDecoratorTester (line 33) | class DeprecationDecoratorTester(unittest.TestCase): method test_rename_kwarg (line 34) | def test_rename_kwarg(self): method test_rename_multiple_kwargs (line 62) | def test_rename_multiple_kwargs(self): method test_warnings (line 89) | def test_warnings(self): method test_raises (line 130) | def test_raises(self): method test_additional_message (line 155) | def test_additional_message(self): method test_warning_for_both_names (line 168) | def test_warning_for_both_names(self, version): method test_compile_safe (line 180) | def test_compile_safe(self): FILE: tests/utils/test_doc_samples.py class TestCodeExamples (line 30) | class TestCodeExamples(unittest.TestCase): method analyze_directory (line 31) | def analyze_directory( method test_modeling_examples (line 83) | def test_modeling_examples(self): method test_tokenization_examples (line 92) | def test_tokenization_examples(self): method test_configuration_examples (line 97) | def test_configuration_examples(self): method test_remaining_examples (line 102) | def test_remaining_examples(self): method test_doc_sources (line 107) | def test_doc_sources(self): FILE: tests/utils/test_dynamic_module_utils.py function test_import_parsing (line 123) | def test_import_parsing(tmp_path, case): FILE: tests/utils/test_expectations.py class ExpectationsTest (line 6) | class ExpectationsTest(unittest.TestCase): method test_expectations (line 7) | def test_expectations(self): FILE: tests/utils/test_feature_extraction_utils.py class BatchFeatureTester (line 43) | class BatchFeatureTester(unittest.TestCase): method test_batch_feature_basic_access_and_no_conversion (line 46) | def test_batch_feature_basic_access_and_no_conversion(self): method test_batch_feature_numpy_conversion (line 59) | def test_batch_feature_numpy_conversion(self): method test_batch_feature_pytorch_conversion (line 92) | def test_batch_feature_pytorch_conversion(self): method test_batch_feature_error_handling (line 120) | def test_batch_feature_error_handling(self): method test_batch_feature_auto_skip_non_array_like (line 139) | def test_batch_feature_auto_skip_non_array_like(self): method test_batch_feature_skip_tensor_conversion (line 162) | def test_batch_feature_skip_tensor_conversion(self): method test_batch_feature_convert_to_tensors_method (line 176) | def test_batch_feature_convert_to_tensors_method(self): method test_batch_feature_to_with_nested_tensors (line 190) | def test_batch_feature_to_with_nested_tensors(self): class FeatureExtractorUtilTester (line 216) | class FeatureExtractorUtilTester(unittest.TestCase): method test_cached_files_are_used_when_internet_is_down (line 217) | def test_cached_files_are_used_when_internet_is_down(self): class FeatureExtractorPushToHubTester (line 237) | class FeatureExtractorPushToHubTester(unittest.TestCase): method setUpClass (line 239) | def setUpClass(cls): method test_push_to_hub (line 242) | def test_push_to_hub(self): method test_push_to_hub_via_save_pretrained (line 251) | def test_push_to_hub_via_save_pretrained(self): method test_push_to_hub_in_organization (line 264) | def test_push_to_hub_in_organization(self): method test_push_to_hub_in_organization_via_save_pretrained (line 273) | def test_push_to_hub_in_organization_via_save_pretrained(self): method test_push_to_hub_dynamic_feature_extractor (line 286) | def test_push_to_hub_dynamic_feature_extractor(self): FILE: tests/utils/test_file_utils.py function context_en (line 50) | def context_en(): function context_fr (line 57) | def context_fr(): class TestImportMechanisms (line 63) | class TestImportMechanisms(unittest.TestCase): method test_module_spec_available (line 64) | def test_module_spec_available(self): class GenericUtilTests (line 70) | class GenericUtilTests(unittest.TestCase): method test_context_managers_no_context (line 72) | def test_context_managers_no_context(self, mock_stdout): method test_context_managers_one_context (line 79) | def test_context_managers_one_context(self, mock_stdout): method test_context_managers_two_context (line 86) | def test_context_managers_two_context(self, mock_stdout): method test_find_labels_pt (line 93) | def test_find_labels_pt(self): FILE: tests/utils/test_generic.py class GenericTester (line 41) | class GenericTester(unittest.TestCase): method test_flatten_dict (line 42) | def test_flatten_dict(self): method test_transpose_numpy (line 67) | def test_transpose_numpy(self): method test_transpose_torch (line 75) | def test_transpose_torch(self): method test_reshape_torch (line 85) | def test_reshape_torch(self): method test_squeeze_torch (line 95) | def test_squeeze_torch(self): method test_expand_dims_numpy (line 104) | def test_expand_dims_numpy(self): method test_expand_dims_torch (line 109) | def test_expand_dims_torch(self): method test_to_py_obj_native (line 114) | def test_to_py_obj_native(self): method test_to_py_obj_numpy (line 119) | def test_to_py_obj_numpy(self): method test_to_py_obj_torch (line 131) | def test_to_py_obj_torch(self): method test_model_output_subclass (line 142) | def test_model_output_subclass(self): class ValidationDecoratorTester (line 168) | class ValidationDecoratorTester(unittest.TestCase): method test_cases_no_warning (line 169) | def test_cases_no_warning(self): method test_cases_with_warnings (line 214) | def test_cases_with_warnings(self): class CanReturnTupleDecoratorTester (line 240) | class CanReturnTupleDecoratorTester(unittest.TestCase): method _get_model (line 241) | def _get_model(self, config, store_config=True, raise_in_forward=False): method test_decorator_eager (line 261) | def test_decorator_eager(self): method test_decorator_compiled (line 291) | def test_decorator_compiled(self): method test_decorator_torch_export (line 308) | def test_decorator_torch_export(self): method test_attribute_cleanup (line 314) | def test_attribute_cleanup(self): FILE: tests/utils/test_hf_argparser.py function list_field (line 40) | def list_field(default=None, metadata=None): class BasicExample (line 45) | class BasicExample: class WithDefaultExample (line 53) | class WithDefaultExample: class WithDefaultBoolExample (line 59) | class WithDefaultBoolExample: class BasicEnum (line 65) | class BasicEnum(Enum): class MixedTypeEnum (line 70) | class MixedTypeEnum(Enum): class EnumExample (line 77) | class EnumExample: method __post_init__ (line 80) | def __post_init__(self): class MixedTypeEnumExample (line 85) | class MixedTypeEnumExample: method __post_init__ (line 88) | def __post_init__(self): class OptionalExample (line 93) | class OptionalExample: class ListExample (line 102) | class ListExample: class RequiredExample (line 110) | class RequiredExample: method __post_init__ (line 115) | def __post_init__(self): class StringLiteralAnnotationExample (line 120) | class StringLiteralAnnotationExample: class WithDefaultBoolExamplePep604 (line 131) | class WithDefaultBoolExamplePep604: class OptionalExamplePep604 (line 137) | class OptionalExamplePep604: class HfArgumentParserTest (line 145) | class HfArgumentParserTest(unittest.TestCase): method argparsersEqual (line 146) | def argparsersEqual(self, a: argparse.ArgumentParser, b: argparse.Argu... method test_00_basic (line 164) | def test_00_basic(self): method test_01_with_default (line 178) | def test_01_with_default(self): method test_02_with_default_bool (line 186) | def test_02_with_default_bool(self): method test_03_with_enum (line 221) | def test_03_with_enum(self): method test_04_with_literal (line 248) | def test_04_with_literal(self): method test_05_with_list (line 273) | def test_05_with_list(self): method test_06_with_optional (line 296) | def test_06_with_optional(self): method test_07_with_required (line 319) | def test_07_with_required(self): method test_08_with_string_literal_annotation (line 334) | def test_08_with_string_literal_annotation(self): method test_09_parse_dict (line 351) | def test_09_parse_dict(self): method test_10_parse_dict_extra_key (line 365) | def test_10_parse_dict_extra_key(self): method test_11_parse_json (line 378) | def test_11_parse_json(self): method test_12_parse_yaml (line 397) | def test_12_parse_yaml(self): method test_13_valid_dict_annotation (line 415) | def test_13_valid_dict_annotation(self): method test_14_valid_dict_input_parsing (line 474) | def test_14_valid_dict_input_parsing(self): method test_15_integration_training_args (line 483) | def test_15_integration_training_args(self): method test_16_cli_input_parsing (line 489) | def test_16_cli_input_parsing(self): FILE: tests/utils/test_hub_utils.py class GetFromCacheTests (line 36) | class GetFromCacheTests(unittest.TestCase): method test_cached_file (line 37) | def test_cached_file(self): method test_cached_file_errors (line 57) | def test_cached_file_errors(self): method test_non_existence_is_cached (line 67) | def test_non_existence_is_cached(self): method test_has_file (line 91) | def test_has_file(self): method test_has_file_in_cache (line 96) | def test_has_file_in_cache(self): method test_get_file_from_repo_distant (line 107) | def test_get_file_from_repo_distant(self): method test_get_file_from_repo_local (line 151) | def test_get_file_from_repo_local(self): method test_get_file_gated_repo (line 176) | def test_get_file_gated_repo(self): method test_has_file_gated_repo (line 182) | def test_has_file_gated_repo(self): method test_cached_files_exception_raised (line 188) | def test_cached_files_exception_raised(self): class OfflineModeTests (line 198) | class OfflineModeTests(unittest.TestCase): method test_list_repo_templates_w_offline (line 199) | def test_list_repo_templates_w_offline(self): FILE: tests/utils/test_image_processing_utils.py class ImageProcessorUtilTester (line 36) | class ImageProcessorUtilTester(unittest.TestCase): method test_cached_files_are_used_when_internet_is_down (line 37) | def test_cached_files_are_used_when_internet_is_down(self): method test_image_processor_from_pretrained_subfolder (line 58) | def test_image_processor_from_pretrained_subfolder(self): class ImageProcessorPushToHubTester (line 71) | class ImageProcessorPushToHubTester(unittest.TestCase): method setUpClass (line 73) | def setUpClass(cls): method test_push_to_hub (line 76) | def test_push_to_hub(self): method test_push_to_hub_fast (line 85) | def test_push_to_hub_fast(self): method test_push_to_hub_via_save_pretrained (line 94) | def test_push_to_hub_via_save_pretrained(self): method test_push_to_hub_via_save_pretrained_fast (line 105) | def test_push_to_hub_via_save_pretrained_fast(self): method test_push_to_hub_in_organization (line 116) | def test_push_to_hub_in_organization(self): method test_push_to_hub_in_organization_fast (line 125) | def test_push_to_hub_in_organization_fast(self): method test_push_to_hub_in_organization_via_save_pretrained (line 134) | def test_push_to_hub_in_organization_via_save_pretrained(self): method test_push_to_hub_in_organization_via_save_pretrained_fast (line 145) | def test_push_to_hub_in_organization_via_save_pretrained_fast(self): method test_push_to_hub_dynamic_image_processor (line 156) | def test_push_to_hub_dynamic_image_processor(self): class ImageProcessingUtilsTester (line 174) | class ImageProcessingUtilsTester(unittest.TestCase): method test_get_size_dict (line 175) | def test_get_size_dict(self): FILE: tests/utils/test_image_utils.py function get_image_from_hub_dataset (line 44) | def get_image_from_hub_dataset(dataset_id: str, filename: str, revision:... function get_random_image (line 49) | def get_random_image(height, width): class ImageFeatureExtractionTester (line 55) | class ImageFeatureExtractionTester(unittest.TestCase): method test_conversion_image_to_array (line 56) | def test_conversion_image_to_array(self): method test_conversion_array_to_array (line 83) | def test_conversion_array_to_array(self): method test_make_list_of_images_pil (line 117) | def test_make_list_of_images_pil(self): method test_make_list_of_images_numpy (line 132) | def test_make_list_of_images_numpy(self): method test_make_list_of_images_torch (line 162) | def test_make_list_of_images_torch(self): method test_make_flat_list_of_images_pil (line 184) | def test_make_flat_list_of_images_pil(self): method test_make_flat_list_of_images_numpy (line 206) | def test_make_flat_list_of_images_numpy(self): method test_make_flat_list_of_images_torch (line 245) | def test_make_flat_list_of_images_torch(self): method test_make_nested_list_of_images_pil (line 283) | def test_make_nested_list_of_images_pil(self): method test_make_nested_list_of_images_numpy (line 307) | def test_make_nested_list_of_images_numpy(self): method test_make_nested_list_of_images_torch (line 350) | def test_make_nested_list_of_images_torch(self): method test_conversion_torch_to_array (line 393) | def test_conversion_torch_to_array(self): method test_conversion_image_to_image (line 428) | def test_conversion_image_to_image(self): method test_conversion_array_to_image (line 437) | def test_conversion_array_to_image(self): method test_conversion_tensor_to_image (line 467) | def test_conversion_tensor_to_image(self): method test_resize_image_and_array (line 497) | def test_resize_image_and_array(self): method test_resize_image_and_array_non_default_to_square (line 522) | def test_resize_image_and_array_non_default_to_square(self): method test_resize_tensor (line 574) | def test_resize_tensor(self): method test_normalize_image (line 595) | def test_normalize_image(self): method test_normalize_array (line 614) | def test_normalize_array(self): method test_normalize_tensor (line 638) | def test_normalize_tensor(self): method test_center_crop_image (line 661) | def test_center_crop_image(self): method test_center_crop_array (line 675) | def test_center_crop_array(self): method test_center_crop_tensor (line 694) | def test_center_crop_tensor(self): class LoadImageTester (line 715) | class LoadImageTester(unittest.TestCase): method test_load_img_url (line 716) | def test_load_img_url(self): method test_load_img_url_timeout (line 723) | def test_load_img_url_timeout(self): method test_load_img_local (line 727) | def test_load_img_local(self): method test_load_img_base64_prefix (line 736) | def test_load_img_base64_prefix(self): method test_load_img_base64 (line 745) | def test_load_img_base64(self): method test_load_img_base64_encoded_bytes (line 754) | def test_load_img_base64_encoded_bytes(self): method test_load_img_rgba (line 763) | def test_load_img_rgba(self): method test_load_img_la (line 774) | def test_load_img_la(self): method test_load_img_l (line 789) | def test_load_img_l(self): method test_load_img_exif_transpose (line 804) | def test_load_img_exif_transpose(self): class UtilFunctionTester (line 827) | class UtilFunctionTester(unittest.TestCase): method test_get_image_size (line 828) | def test_get_image_size(self): method test_infer_channel_dimension (line 840) | def test_infer_channel_dimension(self): method test_get_channel_dimension_axis (line 878) | def test_get_channel_dimension_axis(self): FILE: tests/utils/test_import_structure.py function fetch__all__ (line 18) | def fetch__all__(file_content): class TestImportStructures (line 41) | class TestImportStructures(unittest.TestCase): method test_definition (line 46) | def test_definition(self): method test_transformers_specific_model_import (line 80) | def test_transformers_specific_model_import(self): method test_import_spread (line 119) | def test_import_spread(self): function test_backend_specification (line 203) | def test_backend_specification( FILE: tests/utils/test_import_utils.py function test_clear_import_cache (line 8) | def test_clear_import_cache(): FILE: tests/utils/test_logging.py class HfArgumentParserTest (line 26) | class HfArgumentParserTest(unittest.TestCase): method test_set_level (line 27) | def test_set_level(self): method test_integration (line 48) | def test_integration(self): method test_env_override (line 78) | def test_env_override(self): method test_env_invalid_override (line 99) | def test_env_invalid_override(self): method test_advisory_warnings (line 110) | def test_advisory_warnings(self): function test_set_progress_bar_enabled (line 130) | def test_set_progress_bar_enabled(): FILE: tests/utils/test_masking_utils.py class MaskTest (line 68) | class MaskTest(unittest.TestCase): method setup (line 69) | def setup(self): method tearDown (line 72) | def tearDown(self): method test_packed_sequence_mask_sdpa (line 75) | def test_packed_sequence_mask_sdpa(self): method test_packed_sequence_mask_eager (line 96) | def test_packed_sequence_mask_eager(self): method test_packed_sequence_mask_flex_attention (line 118) | def test_packed_sequence_mask_flex_attention(self): method test_find_packed_sequence_indices (line 145) | def test_find_packed_sequence_indices(self): method test_nonpacked_sequence_mask_skip (line 150) | def test_nonpacked_sequence_mask_skip(self): method test_chunked_mask_with_left_padding_and_large_prefill (line 183) | def test_chunked_mask_with_left_padding_and_large_prefill(self): method test_chunked_mask_with_left_padding_decoding (line 237) | def test_chunked_mask_with_left_padding_decoding(self): method _run_bidirectional_mask (line 289) | def _run_bidirectional_mask(mask_fn, attn_implementation): method test_bidirectional_mask_cudagraphs (line 354) | def test_bidirectional_mask_cudagraphs(self): method test_bidirectional_mask_skip_eager (line 362) | def test_bidirectional_mask_skip_eager(self): FILE: tests/utils/test_model_debugging_utils.py class ToyModel (line 30) | class ToyModel(nn.Module): method __init__ (line 31) | def __init__(self): method forward (line 38) | def forward(self, input_ids: str): class TestModelAdditionDebugger (line 43) | class TestModelAdditionDebugger(unittest.TestCase): method setUp (line 44) | def setUp(self): method tearDown (line 48) | def tearDown(self): method test_debugger_outputs (line 51) | def test_debugger_outputs(self): class ToyLayer (line 64) | class ToyLayer(nn.Module): method __init__ (line 65) | def __init__(self, layer_index): method forward (line 70) | def forward(self, hidden_states): class ToyModelWithLayers (line 73) | class ToyModelWithLayers(nn.Module): method __init__ (line 74) | def __init__(self): method forward (line 80) | def forward(self, x): class TestModelWithLayers (line 86) | class TestModelWithLayers(unittest.TestCase): method setUp (line 87) | def setUp(self): method tearDown (line 92) | def tearDown(self): method test_layer_pruning_behavior (line 95) | def test_layer_pruning_behavior(self): FILE: tests/utils/test_model_output.py class ModelOutputTest (line 31) | class ModelOutputTest(ModelOutput): class ModelOutputTester (line 37) | class ModelOutputTester(unittest.TestCase): method test_get_attributes (line 38) | def test_get_attributes(self): method test_index_with_ints_and_slices (line 46) | def test_index_with_ints_and_slices(self): method test_index_with_strings (line 59) | def test_index_with_strings(self): method test_dict_like_properties (line 72) | def test_dict_like_properties(self): method test_set_attributes (line 100) | def test_set_attributes(self): method test_set_keys (line 106) | def test_set_keys(self): method test_instantiate_from_dict (line 112) | def test_instantiate_from_dict(self): method test_instantiate_from_iterator (line 118) | def test_instantiate_from_iterator(self): method test_torch_pytree (line 132) | def test_torch_pytree(self): method test_export_serialization (line 162) | def test_export_serialization(self): class ModelOutputTestNoDataclass (line 180) | class ModelOutputTestNoDataclass(ModelOutput): class ModelOutputSubclassTester (line 188) | class ModelOutputSubclassTester(unittest.TestCase): method test_direct_model_output (line 189) | def test_direct_model_output(self): method test_subclass_no_dataclass (line 193) | def test_subclass_no_dataclass(self): FILE: tests/utils/test_modeling_rope_utils.py class RopeTest (line 31) | class RopeTest(unittest.TestCase): method test_rope_validation (line 32) | def test_rope_validation(self): method test_yarn_original_original_max_position_embeddings_validation (line 89) | def test_yarn_original_original_max_position_embeddings_validation(self): method test_default_rope_numerically (line 128) | def test_default_rope_numerically(self): method test_linear_rope_numerically (line 162) | def test_linear_rope_numerically(self): method test_dynamic_rope_numerically (line 176) | def test_dynamic_rope_numerically(self): method test_yarn_rope_numerically (line 229) | def test_yarn_rope_numerically(self): method test_longrope_rope_numerically (line 323) | def test_longrope_rope_numerically(self): method test_llama3_rope_numerically (line 393) | def test_llama3_rope_numerically(self): FILE: tests/utils/test_modeling_utils.py class BaseModel (line 137) | class BaseModel(PreTrainedModel): method __init__ (line 141) | def __init__(self, config): method forward (line 147) | def forward(self, x): class BaseModelWithUnexpectedKeys (line 150) | class BaseModelWithUnexpectedKeys(PreTrainedModel): method __init__ (line 155) | def __init__(self, config): method forward (line 161) | def forward(self, x): class BaseModelWithMissingKeys (line 164) | class BaseModelWithMissingKeys(PreTrainedModel): method __init__ (line 169) | def __init__(self, config): method forward (line 175) | def forward(self, x): class BaseModelWithTiedWeights (line 178) | class BaseModelWithTiedWeights(PreTrainedModel): method __init__ (line 182) | def __init__(self, config): method forward (line 188) | def forward(self, x): class BaseModelWithMultipleTiedWeights (line 191) | class BaseModelWithMultipleTiedWeights(PreTrainedModel): method __init__ (line 195) | def __init__(self, config): method forward (line 202) | def forward(self, x): class BaseModelWithMultipleMixedTiedWeights (line 205) | class BaseModelWithMultipleMixedTiedWeights(PreTrainedModel): method __init__ (line 211) | def __init__(self, config): method forward (line 218) | def forward(self, x): class ModelWithHead (line 221) | class ModelWithHead(PreTrainedModel): method _init_weights (line 225) | def _init_weights(self, module): method __init__ (line 228) | def __init__(self, config): method forward (line 236) | def forward(self, x): class ModelWithDirectParam (line 239) | class ModelWithDirectParam(PreTrainedModel): method _init_weights (line 243) | def _init_weights(self, module): method __init__ (line 246) | def __init__(self, config): method forward (line 253) | def forward(self, x): class ModelWithDirectParamSubmodule (line 256) | class ModelWithDirectParamSubmodule(PreTrainedModel): method _init_weights (line 260) | def _init_weights(self, module): method __init__ (line 263) | def __init__(self, config): method forward (line 270) | def forward(self, x): class ModelWithHeadAndTiedWeights (line 273) | class ModelWithHeadAndTiedWeights(PreTrainedModel): method _init_weights (line 278) | def _init_weights(self, module): method __init__ (line 281) | def __init__(self, config): method forward (line 287) | def forward(self, x): class VerySimpleLayer (line 290) | class VerySimpleLayer(nn.Module): method __init__ (line 291) | def __init__(self): method forward (line 295) | def forward(self, x): class DummyLanguageModel (line 298) | class DummyLanguageModel(PreTrainedModel): method __init__ (line 302) | def __init__(self, config): method forward (line 308) | def forward(self, x): class DummyVisionModel (line 311) | class DummyVisionModel(PreTrainedModel): method __init__ (line 314) | def __init__(self, config): method forward (line 319) | def forward(self, x): class MultimodalModel (line 322) | class MultimodalModel(PreTrainedModel): method __init__ (line 325) | def __init__(self, config): method forward (line 332) | def forward(self, x): class TestOffline (line 335) | class TestOffline(unittest.TestCase): method test_offline (line 336) | def test_offline(self): method test_local_files_only (line 351) | def test_local_files_only(self): class TestGammaBetaNorm (line 369) | class TestGammaBetaNorm(torch.nn.Module): method __init__ (line 370) | def __init__(self): method forward (line 375) | def forward(self): class TestModelGammaBeta (line 379) | class TestModelGammaBeta(PreTrainedModel): method __init__ (line 380) | def __init__(self, config): method forward (line 385) | def forward(self): function check_models_equal (line 398) | def check_models_equal(model1, model2): class ModelUtilsTest (line 408) | class ModelUtilsTest(TestCasePlus): method setUp (line 409) | def setUp(self): method tearDown (line 413) | def tearDown(self): method test_get_total_byte_count_does_not_require_process_group (line 418) | def test_get_total_byte_count_does_not_require_process_group(self): method test_hub_retry (line 434) | def test_hub_retry(self): method test_model_from_pretrained (line 447) | def test_model_from_pretrained(self): method test_model_from_pretrained_subfolder (line 472) | def test_model_from_pretrained_subfolder(self): method test_model_manually_shared_disjointed_tensors_optimum (line 487) | def test_model_manually_shared_disjointed_tensors_optimum(self): method test_model_from_pretrained_subfolder_sharded (line 507) | def test_model_from_pretrained_subfolder_sharded(self): method test_model_from_pretrained_hub_subfolder (line 522) | def test_model_from_pretrained_hub_subfolder(self): method test_model_from_pretrained_with_different_pretrained_model_name (line 532) | def test_model_from_pretrained_with_different_pretrained_model_name(se... method test_model_from_pretrained_with_none_quantization_config (line 546) | def test_model_from_pretrained_with_none_quantization_config(self): method test_model_from_config_dtype (line 554) | def test_model_from_config_dtype(self): method test_model_from_config_dtype_str (line 572) | def test_model_from_config_dtype_str(self): method test_model_from_config_dtype_composite (line 586) | def test_model_from_config_dtype_composite(self): method test_model_from_pretrained_dtype (line 665) | def test_model_from_pretrained_dtype(self): method test_model_from_pretrained_attn_implementation (line 752) | def test_model_from_pretrained_attn_implementation(self): method test_model_from_config_attn_implementation (line 779) | def test_model_from_config_attn_implementation(self): method test_checkpoint_sharding_local (line 814) | def test_checkpoint_sharding_local(self): method test_checkpoint_sharding_from_hub (line 855) | def test_checkpoint_sharding_from_hub(self): method test_checkpoint_variant_local (line 862) | def test_checkpoint_variant_local(self): method test_checkpoint_variant_local_sharded (line 882) | def test_checkpoint_variant_local_sharded(self): method test_checkpoint_loading_only_safetensors_available (line 906) | def test_checkpoint_loading_only_safetensors_available(self): method test_checkpoint_loading_only_pytorch_bin_available (line 939) | def test_checkpoint_loading_only_pytorch_bin_available(self): method test_checkpoint_variant_hub (line 974) | def test_checkpoint_variant_hub(self): method test_checkpoint_variant_hub_sharded (line 983) | def test_checkpoint_variant_hub_sharded(self): method test_checkpoint_variant_hub_safe (line 997) | def test_checkpoint_variant_hub_safe(self): method test_checkpoint_variant_hub_sharded_safe (line 1006) | def test_checkpoint_variant_hub_sharded_safe(self): method test_checkpoint_variant_save_load (line 1017) | def test_checkpoint_variant_save_load(self): method test_model_parallelism_gpt2 (line 1046) | def test_model_parallelism_gpt2(self): method test_from_pretrained_disk_offload_task_model (line 1063) | def test_from_pretrained_disk_offload_task_model(self): method test_from_pretrained_disk_offload_derived_to_base_model (line 1104) | def test_from_pretrained_disk_offload_derived_to_base_model(self): method test_from_pretrained_non_contiguous_checkpoint (line 1143) | def test_from_pretrained_non_contiguous_checkpoint(self): method test_cached_files_are_used_when_internet_is_down (line 1157) | def test_cached_files_are_used_when_internet_is_down(self): method test_save_model_with_device_map_cpu (line 1178) | def test_save_model_with_device_map_cpu(self): method test_save_offloaded_model (line 1196) | def test_save_offloaded_model(self): method test_save_offloaded_model_with_direct_params (line 1233) | def test_save_offloaded_model_with_direct_params(self): method test_save_offloaded_model_dynamic_tied_weights_keys (line 1247) | def test_save_offloaded_model_dynamic_tied_weights_keys(self): method test_use_safetensors (line 1267) | def test_use_safetensors(self): method test_safetensors_save_and_load (line 1319) | def test_safetensors_save_and_load(self): method test_safetensors_load_from_hub (line 1333) | def test_safetensors_load_from_hub(self): method test_safetensors_save_and_load_sharded (line 1341) | def test_safetensors_save_and_load_sharded(self): method test_safetensors_load_from_hub_sharded (line 1358) | def test_safetensors_load_from_hub_sharded(self): method test_base_model_to_head_model_load (line 1367) | def test_base_model_to_head_model_load(self): method test_tied_weights_reload (line 1389) | def test_tied_weights_reload(self): method test_tied_weights_can_load_symmetrically (line 1414) | def test_tied_weights_can_load_symmetrically(self): method test_tied_weights_can_load_symmetrically_multiple_keys (line 1438) | def test_tied_weights_can_load_symmetrically_multiple_keys(self): method test_tied_weights_are_not_tied_if_both_present_but_different (line 1495) | def test_tied_weights_are_not_tied_if_both_present_but_different(self): method test_tied_weights_are_tied_if_both_present_and_similar (line 1526) | def test_tied_weights_are_tied_if_both_present_and_similar(self): method test_tied_weights_are_missing_if_both_absent (line 1553) | def test_tied_weights_are_missing_if_both_absent(self): method test_tied_weights_are_always_tied_from_config (line 1582) | def test_tied_weights_are_always_tied_from_config(self): method test_unexpected_keys_warnings (line 1605) | def test_unexpected_keys_warnings(self): method test_warn_if_padding_and_no_attention_mask (line 1633) | def test_warn_if_padding_and_no_attention_mask(self): method test_pretrained_low_mem_new_config (line 1726) | def test_pretrained_low_mem_new_config(self): method test_generation_config_is_loaded_with_model (line 1745) | def test_generation_config_is_loaded_with_model(self): method test_safetensors_torch_from_torch (line 1757) | def test_safetensors_torch_from_torch(self): method test_safetensors_torch_from_torch_sharded (line 1767) | def test_safetensors_torch_from_torch_sharded(self): method test_saving_model_config_with_generation_params (line 1777) | def test_saving_model_config_with_generation_params(self): method test_model_from_pretrained_from_mlx (line 1791) | def test_model_from_pretrained_from_mlx(self): method test_can_generate (line 1810) | def test_can_generate(self): method test_save_and_load_config_with_custom_generation (line 1848) | def test_save_and_load_config_with_custom_generation(self): method test_load_model_with_state_dict_only (line 1874) | def test_load_model_with_state_dict_only(self): method test_cache_when_needed_at_train_time (line 1885) | def test_cache_when_needed_at_train_time(self): method test_restore_default_dtype_from_pretrained (line 1927) | def test_restore_default_dtype_from_pretrained(self): method test_restore_default_dtype_from_config (line 1951) | def test_restore_default_dtype_from_config(self): method test_unknown_quantization_config (line 1979) | def test_unknown_quantization_config(self): method test_loading_is_fast_on_gpu (line 1995) | def test_loading_is_fast_on_gpu(self, model_id: str, max_loading_time:... method test_explicit_transformers_weights (line 2049) | def test_explicit_transformers_weights(self): method test_explicit_transformers_weights_index (line 2060) | def test_explicit_transformers_weights_index(self): method test_explicit_transformers_weights_save_and_reload (line 2071) | def test_explicit_transformers_weights_save_and_reload(self): method test_explicit_transformers_weights_index_save_and_reload (line 2097) | def test_explicit_transformers_weights_index_save_and_reload(self): method test_config_class_attribute (line 2123) | def test_config_class_attribute(self): method test_ignore_missing_key_works (line 2154) | def test_ignore_missing_key_works(self): method test_device_map_works_with_unexpected_keys (line 2177) | def test_device_map_works_with_unexpected_keys(self): method test_device_map_works_with_unexpected_keys_sharded (line 2200) | def test_device_map_works_with_unexpected_keys_sharded(self): method test_loading_respect_env_variable_for_threading (line 2240) | def test_loading_respect_env_variable_for_threading(self): method test_error_in_weight_conversion_is_raised (line 2275) | def test_error_in_weight_conversion_is_raised(self): method test_composite_model_inherit_properties (line 2297) | def test_composite_model_inherit_properties(self): method test_decoder_only_model_can_be_used_as_encoder (line 2305) | def test_decoder_only_model_can_be_used_as_encoder(self, attn_implemen... class ModelOnTheFlyConversionTester (line 2385) | class ModelOnTheFlyConversionTester(unittest.TestCase): method setUpClass (line 2387) | def setUpClass(cls): method setUp (line 2396) | def setUp(self) -> None: method tearDown (line 2399) | def tearDown(self) -> None: method test_safetensors_on_the_fly_conversion (line 2402) | def test_safetensors_on_the_fly_conversion(self): method test_safetensors_on_the_fly_conversion_private (line 2424) | def test_safetensors_on_the_fly_conversion_private(self): method test_safetensors_on_the_fly_conversion_gated (line 2446) | def test_safetensors_on_the_fly_conversion_gated(self): method test_safetensors_on_the_fly_sharded_conversion (line 2469) | def test_safetensors_on_the_fly_sharded_conversion(self): method test_safetensors_on_the_fly_sharded_conversion_private (line 2491) | def test_safetensors_on_the_fly_sharded_conversion_private(self): method test_safetensors_on_the_fly_sharded_conversion_gated (line 2513) | def test_safetensors_on_the_fly_sharded_conversion_gated(self): method test_safetensors_on_the_fly_wrong_user_opened_pr (line 2540) | def test_safetensors_on_the_fly_wrong_user_opened_pr(self): method test_safetensors_on_the_fly_specific_revision (line 2579) | def test_safetensors_on_the_fly_specific_revision(self): method test_absence_of_safetensors_triggers_conversion (line 2601) | def test_absence_of_safetensors_triggers_conversion(self): method test_absence_of_safetensors_triggers_conversion_failed (line 2634) | def test_absence_of_safetensors_triggers_conversion_failed(self, spawn... class ModelPushToHubTester (line 2654) | class ModelPushToHubTester(unittest.TestCase): method setUpClass (line 2656) | def setUpClass(cls): method test_push_to_hub (line 2660) | def test_push_to_hub(self): method test_push_to_hub_via_save_pretrained (line 2673) | def test_push_to_hub_via_save_pretrained(self): method test_push_to_hub_with_description (line 2687) | def test_push_to_hub_with_description(self): method test_push_to_hub_in_organization (line 2706) | def test_push_to_hub_in_organization(self): method test_push_to_hub_in_organization_via_save_pretrained (line 2719) | def test_push_to_hub_in_organization_via_save_pretrained(self): method test_push_to_hub_dynamic_model (line 2733) | def test_push_to_hub_dynamic_model(self): method test_push_to_hub_with_tags (line 2758) | def test_push_to_hub_with_tags(self): class TestAttentionImplementation (line 2783) | class TestAttentionImplementation(unittest.TestCase): method test_error_no_sdpa_available (line 2785) | def test_error_no_sdpa_available(self): method test_error_no_flash_available (line 2798) | def test_error_no_flash_available(self): method test_error_no_flash_available_with_config (line 2808) | def test_error_no_flash_available_with_config(self): method test_error_wrong_attn_implementation (line 2820) | def test_error_wrong_attn_implementation(self): method test_not_available_flash (line 2826) | def test_not_available_flash(self): method test_not_available_flash_with_config (line 2844) | def test_not_available_flash_with_config(self): method test_kernels_fallback (line 2867) | def test_kernels_fallback(self): method test_not_available_kernels (line 2893) | def test_not_available_kernels(self): method test_attention_and_experts_modules_can_be_used_standalone (line 2905) | def test_attention_and_experts_modules_can_be_used_standalone(self): class TestTensorSharing (line 2952) | class TestTensorSharing(TestCasePlus): method test_disjoint (line 2953) | def test_disjoint(self): method test_identical (line 2971) | def test_identical(self): class TestSaveAndLoadModelWithExtraState (line 2989) | class TestSaveAndLoadModelWithExtraState(TestCasePlus): method test_save_and_load_model_with_tensor_extra_state (line 2997) | def test_save_and_load_model_with_tensor_extra_state(self): method test_save_and_load_model_with_dict_extra_state (line 3040) | def test_save_and_load_model_with_dict_extra_state(self): class TestGetDecoder (line 3082) | class TestGetDecoder(unittest.TestCase): method test_causal_lm_get_decoder_returns_underlying_model (line 3083) | def test_causal_lm_get_decoder_returns_underlying_model(self): method test_seq2seq_get_decoder_still_returns_decoder_module (line 3096) | def test_seq2seq_get_decoder_still_returns_decoder_module(self): method test_base_model_returns_self (line 3112) | def test_base_model_returns_self(self): method test_explicit_decoder_attribute_opt (line 3126) | def test_explicit_decoder_attribute_opt(self): method test_explicit_decoder_attribute_t5 (line 3141) | def test_explicit_decoder_attribute_t5(self): method test_same_type_recursion_prevention (line 3155) | def test_same_type_recursion_prevention(self): method test_nested_wrapper_recursion (line 3174) | def test_nested_wrapper_recursion(self): method test_model_without_get_decoder (line 3188) | def test_model_without_get_decoder(self): method test_vision_language_model (line 3217) | def test_vision_language_model(self): class TestGetEncoder (line 3249) | class TestGetEncoder(unittest.TestCase): method test_seq2seq_lm_get_encoder_returns_encoder (line 3250) | def test_seq2seq_lm_get_encoder_returns_encoder(self): method test_base_model_returns_encoder (line 3268) | def test_base_model_returns_encoder(self): method test_decoder_only_model_returns_self (line 3284) | def test_decoder_only_model_returns_self(self): method test_when_encoder_has_different_name (line 3298) | def test_when_encoder_has_different_name(self): method test_audio_encoder (line 3332) | def test_audio_encoder(self): method test_non_existant_modality_throws_error (line 3366) | def test_non_existant_modality_throws_error(self): method test_encoder_return_self_when_modality_not_found (line 3379) | def test_encoder_return_self_when_modality_not_found(self): method test_model_without_get_encoder (line 3393) | def test_model_without_get_encoder(self): method test_vision_language_model (line 3422) | def test_vision_language_model(self): FILE: tests/utils/test_network_logging.py class _SlowHandler (line 31) | class _SlowHandler(BaseHTTPRequestHandler): method do_GET (line 32) | def do_GET(self): method log_message (line 40) | def log_message(self, format, *args): class NetworkLoggingTester (line 44) | class NetworkLoggingTester(unittest.TestCase): method setUpClass (line 46) | def setUpClass(cls): method tearDownClass (line 53) | def tearDownClass(cls): method tearDown (line 58) | def tearDown(self): method test_network_debug_report_records_httpx_requests (line 61) | def test_network_debug_report_records_httpx_requests(self): FILE: tests/utils/test_offline.py class OfflineTests (line 23) | class OfflineTests(TestCasePlus): method test_offline_mode (line 26) | def test_offline_mode(self): method test_offline_mode_no_internet (line 66) | def test_offline_mode_no_internet(self): method test_offline_mode_sharded_checkpoint (line 101) | def test_offline_mode_sharded_checkpoint(self): method test_offline_mode_pipeline_exception (line 140) | def test_offline_mode_pipeline_exception(self): method test_offline_model_dynamic_model (line 162) | def test_offline_model_dynamic_model(self): method test_is_offline_mode (line 181) | def test_is_offline_mode(self): method _execute_with_env (line 197) | def _execute_with_env(self, *commands: tuple[str, ...], should_fail: b... FILE: tests/utils/test_skip_decorators.py function check_slow (line 45) | def check_slow(): function check_slow_torch_cuda (line 54) | def check_slow_torch_cuda(): function check_slow_torch_accelerator (line 62) | def check_slow_torch_accelerator(): class SkipTester (line 68) | class SkipTester(unittest.TestCase): method test_2_skips_slow_first (line 71) | def test_2_skips_slow_first(self): method test_2_skips_slow_last (line 76) | def test_2_skips_slow_last(self): method test_param_slow_last (line 95) | def test_param_slow_last(self, param=None): function test_pytest_2_skips_slow_first (line 105) | def test_pytest_2_skips_slow_first(): function test_pytest_2_skips_slow_last (line 111) | def test_pytest_2_skips_slow_last(): function test_pytest_param_slow_first (line 117) | def test_pytest_param_slow_first(param): function test_pytest_param_slow_last (line 123) | def test_pytest_param_slow_last(param): FILE: tests/utils/test_tokenization_utils.py class TokenizerUtilTester (line 38) | class TokenizerUtilTester(unittest.TestCase): method test_cached_files_are_used_when_internet_is_down (line 39) | def test_cached_files_are_used_when_internet_is_down(self): method test_cached_files_are_used_when_internet_is_down_missing_files (line 59) | def test_cached_files_are_used_when_internet_is_down_missing_files(self): class TokenizerPushToHubTester (line 80) | class TokenizerPushToHubTester(unittest.TestCase): method setUpClass (line 84) | def setUpClass(cls): method test_push_to_hub (line 87) | def test_push_to_hub(self): method test_push_to_hub_chat_templates (line 99) | def test_push_to_hub_chat_templates(self): method test_push_to_hub_via_save_pretrained (line 117) | def test_push_to_hub_via_save_pretrained(self): method test_push_to_hub_in_organization (line 131) | def test_push_to_hub_in_organization(self): method test_push_to_hub_in_organization_via_save_pretrained (line 143) | def test_push_to_hub_in_organization_via_save_pretrained(self): method test_push_to_hub_dynamic_tokenizer (line 158) | def test_push_to_hub_dynamic_tokenizer(self): method test_push_to_hub_dynamic_tokenizer_with_both_slow_and_fast_classes (line 175) | def test_push_to_hub_dynamic_tokenizer_with_both_slow_and_fast_classes... class TokenizersBackendTest (line 202) | class TokenizersBackendTest(unittest.TestCase): method test_clean_up_tokenization_spaces (line 203) | def test_clean_up_tokenization_spaces(self): class TrieTest (line 216) | class TrieTest(unittest.TestCase): method test_trie (line 217) | def test_trie(self): method test_trie_split (line 224) | def test_trie_split(self): method test_trie_single (line 232) | def test_trie_single(self): method test_trie_final (line 238) | def test_trie_final(self): method test_trie_subtokens (line 244) | def test_trie_subtokens(self): method test_trie_suffix_tokens (line 251) | def test_trie_suffix_tokens(self): method test_trie_skip (line 258) | def test_trie_skip(self): method test_cut_text_hardening (line 265) | def test_cut_text_hardening(self): class ExtensionsTrieTest (line 273) | class ExtensionsTrieTest(unittest.TestCase): method test_extensions (line 274) | def test_extensions(self): method test_empty_prefix (line 284) | def test_empty_prefix(self): method test_no_extension_match (line 291) | def test_no_extension_match(self): method test_update_value (line 298) | def test_update_value(self): FILE: tests/utils/test_versions_utils.py class DependencyVersionCheckTest (line 26) | class DependencyVersionCheckTest(TestCasePlus): method test_core (line 27) | def test_core(self): method test_python (line 87) | def test_python(self): FILE: tests/utils/test_video_utils.py function get_random_video (line 46) | def get_random_video(height, width, num_frames=8, return_torch=False): class BaseVideoProcessorTester (line 57) | class BaseVideoProcessorTester(unittest.TestCase): method test_make_batched_videos_pil (line 62) | def test_make_batched_videos_pil(self): method test_make_batched_videos_numpy (line 91) | def test_make_batched_videos_numpy(self): method test_make_batched_videos_torch (line 128) | def test_make_batched_videos_torch(self): method test_resize (line 167) | def test_resize(self): method test_normalize (line 177) | def test_normalize(self): method test_center_crop (line 188) | def test_center_crop(self): method test_convert_to_rgb (line 202) | def test_convert_to_rgb(self): method test_group_and_reorder_videos (line 212) | def test_group_and_reorder_videos(self): class LoadVideoTester (line 262) | class LoadVideoTester(unittest.TestCase): method test_load_video_url (line 263) | def test_load_video_url(self): method test_load_video_local (line 269) | def test_load_video_local(self): method test_load_video_backend_url (line 286) | def test_load_video_backend_url(self): method test_load_video_backend_local (line 315) | def test_load_video_backend_local(self): method test_load_video_num_frames (line 335) | def test_load_video_num_frames(self): method test_load_video_fps (line 348) | def test_load_video_fps(self): FILE: tests/vlm_tester.py class VLMModelTester (line 36) | class VLMModelTester: method all_model_classes (line 52) | def all_model_classes(self): method pipeline_model_mapping (line 66) | def pipeline_model_mapping(self): method __init__ (line 73) | def __init__(self, parent, **kwargs): method create_pixel_values (line 151) | def create_pixel_values(self): method create_attention_mask (line 155) | def create_attention_mask(self, input_ids): method place_image_tokens (line 159) | def place_image_tokens(self, input_ids, config): method get_additional_inputs (line 169) | def get_additional_inputs(self, config, input_ids, pixel_values): method prepare_config_and_inputs_for_common (line 175) | def prepare_config_and_inputs_for_common(self): method config_args (line 211) | def config_args(self): method text_config_args (line 215) | def text_config_args(self): method vision_config_args (line 223) | def vision_config_args(self): method get_config (line 226) | def get_config(self): method get_text_config (line 239) | def get_text_config(self): method get_vision_config (line 250) | def get_vision_config(self): method create_and_check_model (line 261) | def create_and_check_model( class VLMModelTest (line 273) | class VLMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTest... method setUp (line 292) | def setUp(self): method test_config (line 310) | def test_config(self): method test_mismatching_num_image_tokens (line 314) | def test_mismatching_num_image_tokens(self): method test_flash_attention_2_padding_matches_padding_free_with_position_ids (line 363) | def test_flash_attention_2_padding_matches_padding_free_with_position_... FILE: utils/add_dates.py function check_file_exists_on_github (line 55) | def check_file_exists_on_github(file_path: str) -> bool: function get_modified_cards (line 93) | def get_modified_cards() -> list[str]: function get_paper_link (line 118) | def get_paper_link(model_card: str | None, path: str | None) -> str: function get_first_commit_date (line 139) | def get_first_commit_date(model_name: str | None) -> str: function get_release_date (line 168) | def get_release_date(link: str) -> str: function replace_paper_links (line 183) | def replace_paper_links(file_path: str) -> bool: function _normalize_model_card_name (line 221) | def _normalize_model_card_name(model_card: str) -> str: function _should_skip_model_card (line 226) | def _should_skip_model_card(model_card: str) -> bool: function _read_model_card_content (line 231) | def _read_model_card_content(model_card: str) -> str: function _get_dates_pattern_match (line 238) | def _get_dates_pattern_match(content: str): function _dates_differ_significantly (line 244) | def _dates_differ_significantly(date1: str, date2: str) -> bool: function check_missing_dates (line 254) | def check_missing_dates(model_card_list: list[str]) -> list[str]: function check_incorrect_dates (line 270) | def check_incorrect_dates(model_card_list: list[str]) -> list[str]: function insert_dates (line 292) | def insert_dates(model_card_list: list[str]): function get_all_model_cards (line 350) | def get_all_model_cards(): function main (line 363) | def main(all=False, models=None, check_only=False): FILE: utils/add_pipeline_model_mapping_to_test.py function get_mapping_for_task (line 49) | def get_mapping_for_task(task): function get_model_for_pipeline_test (line 66) | def get_model_for_pipeline_test(test_class, task): function get_pipeline_model_mapping (line 84) | def get_pipeline_model_mapping(test_class): function get_pipeline_model_mapping_string (line 92) | def get_pipeline_model_mapping_string(test_class): function is_valid_test_class (line 117) | def is_valid_test_class(test_class): function find_test_class (line 124) | def find_test_class(test_file): function find_block_ending (line 141) | def find_block_ending(lines, start_idx, indent_level): function add_pipeline_model_mapping (line 154) | def add_pipeline_model_mapping(test_class, overwrite=False): function add_pipeline_model_mapping_to_test_file (line 266) | def add_pipeline_model_mapping_to_test_file(test_file, overwrite=False): FILE: utils/aggregate_failure_reports.py function aggregate_failures (line 29) | def aggregate_failures(input_dir, output_file): function main (line 60) | def main(): FILE: utils/check_bad_commit.py function create_script (line 28) | def create_script(target_test): function is_bad_commit (line 81) | def is_bad_commit(target_test, commit): function find_bad_commit (line 119) | def find_bad_commit(target_test, start_commit, end_commit): function get_commit_info (line 258) | def get_commit_info(commit, pr_number=None): FILE: utils/check_config_attributes.py function check_attribute_being_used (line 213) | def check_attribute_being_used(config_class, attributes, default_value, ... function check_config_attributes_being_used (line 269) | def check_config_attributes_being_used(config_class): function check_config_attributes (line 314) | def check_config_attributes(): FILE: utils/check_config_docstrings.py function get_checkpoint_from_config_class (line 64) | def get_checkpoint_from_config_class(config_class): function check_config_docstrings_have_checkpoints (line 71) | def check_config_docstrings_have_checkpoints(): FILE: utils/check_copies.py function _is_definition_header_ending_line (line 180) | def _is_definition_header_ending_line(line: str) -> bool: function _should_continue (line 185) | def _should_continue(line: str, indent: str) -> bool: function _sanity_check_splits (line 191) | def _sanity_check_splits(splits_1, splits_2, is_class, filename): function find_block_end (line 260) | def find_block_end(lines: list[str], start_index: int, indent: int) -> int: function split_code_into_blocks (line 288) | def split_code_into_blocks( function find_code_in_transformers (line 396) | def find_code_in_transformers( function replace_code (line 473) | def replace_code(code: str, replace_pattern: str) -> str: function find_code_and_splits (line 498) | def find_code_and_splits(object_name: str, base_path: str, buffer: dict ... function get_indent (line 547) | def get_indent(code: str) -> str: function run_ruff (line 566) | def run_ruff(code, check=False): function stylify (line 576) | def stylify(code: str) -> str: function check_codes_match (line 594) | def check_codes_match(observed_code: str, theoretical_code: str) -> int ... function is_copy_consistent (line 645) | def is_copy_consistent( function check_copies (line 842) | def check_copies(overwrite: bool = False, file: str | None = None): function get_model_list (line 875) | def get_model_list(filename: str, start_prompt: str, end_prompt: str) ->... function convert_to_localized_md (line 914) | def convert_to_localized_md(model_list: str, localized_model_list: str, ... FILE: utils/check_doc_toc.py function clean_model_doc_toc (line 54) | def clean_model_doc_toc(model_doc: list[dict]) -> list[dict]: function ensure_all_models_in_toctree (line 90) | def ensure_all_models_in_toctree(model_doc: list[dict]): function check_model_doc (line 122) | def check_model_doc(overwrite: bool = False): FILE: utils/check_docstrings.py class DecoratedItem (line 85) | class DecoratedItem: function _get_auto_docstring_names (line 404) | def _get_auto_docstring_names(file_path: str, cache: dict[str, set[str]]... function has_auto_docstring_decorator (line 436) | def has_auto_docstring_decorator(obj, cache: dict[str, set[str]] | None ... function find_indent (line 445) | def find_indent(line: str) -> int: function stringify_default (line 455) | def stringify_default(default: Any) -> str: function eval_math_expression (line 485) | def eval_math_expression(expression: str) -> float | int | None: function eval_node (line 514) | def eval_node(node): function replace_default_in_arg_description (line 525) | def replace_default_in_arg_description(description: str, default: Any) -... function get_default_description (line 590) | def get_default_description(arg: inspect.Parameter) -> str: function find_source_file (line 616) | def find_source_file(obj: Any) -> Path: function match_docstring_with_signature (line 633) | def match_docstring_with_signature(obj: Any) -> tuple[str, str] | None: function fix_docstring (line 759) | def fix_docstring(obj: Any, old_doc_args: str, new_doc_args: str): function _find_docstring_end_line (line 834) | def _find_docstring_end_line(lines, docstring_start_line): function _is_auto_docstring_decorator (line 851) | def _is_auto_docstring_decorator(dec): function _extract_function_args (line 859) | def _extract_function_args(func_node: ast.FunctionDef | ast.AsyncFunctio... function find_matching_model_files (line 865) | def find_matching_model_files(check_all: bool = False): function find_files_with_auto_docstring (line 907) | def find_files_with_auto_docstring(matching_files, decorator="@auto_docs... function get_args_in_dataclass (line 924) | def get_args_in_dataclass(lines, dataclass_content): function _normalize_docstring_code_fences (line 933) | def _normalize_docstring_code_fences(raw_doc: str) -> str: function _find_corresponding_modular_file (line 967) | def _find_corresponding_modular_file(generated_file: str) -> str | None: function _node_has_docstring (line 983) | def _node_has_docstring(node) -> bool: function _propagate_fixes_to_modular (line 993) | def _propagate_fixes_to_modular( function generate_new_docstring_for_signature (line 1165) | def generate_new_docstring_for_signature( function generate_new_docstring_for_function (line 1309) | def generate_new_docstring_for_function( function generate_new_docstring_for_class (line 1339) | def generate_new_docstring_for_class( function _build_ast_indexes (line 1402) | def _build_ast_indexes(source: str, tree: ast.Module | None = None) -> l... function _extract_type_name (line 1546) | def _extract_type_name(annotation) -> str | None: function _find_typed_dict_classes (line 1569) | def _find_typed_dict_classes(source: str, tree: ast.Module | None = None... function _process_typed_dict_docstrings (line 1663) | def _process_typed_dict_docstrings( function update_file_with_new_docstrings (line 1871) | def update_file_with_new_docstrings( function check_auto_docstrings (line 1961) | def check_auto_docstrings(overwrite: bool = False, check_all: bool = Fal... function check_docstrings (line 2084) | def check_docstrings(overwrite: bool = False, check_all: bool = False, c... FILE: utils/check_doctest_list.py function clean_doctest_list (line 58) | def clean_doctest_list(doctest_file: str, overwrite: bool = False): FILE: utils/check_dummies.py function find_backend (line 85) | def find_backend(line: str) -> str | None: function read_init (line 104) | def read_init() -> dict[str, list[str]]: function create_dummy_object (line 149) | def create_dummy_object(name: str, backend_name: str) -> str: function create_dummy_files (line 168) | def create_dummy_files(backend_specific_objects: dict[str, list[str]] | ... function check_dummies (line 195) | def check_dummies(overwrite: bool = False): FILE: utils/check_import_complexity.py class ImportNode (line 48) | class ImportNode: class LoaderProxy (line 53) | class LoaderProxy(importlib.abc.Loader): method __init__ (line 56) | def __init__(self, wrapped: Any, tracer: ImportTreeTracer, fullname: s... method create_module (line 61) | def create_module(self, spec): method exec_module (line 66) | def exec_module(self, module: ModuleType) -> None: method __getattr__ (line 78) | def __getattr__(self, name: str) -> Any: class ImportTreeFinder (line 82) | class ImportTreeFinder(importlib.abc.MetaPathFinder): method __init__ (line 85) | def __init__(self, tracer: ImportTreeTracer, original_meta_path: list[... method find_spec (line 89) | def find_spec(self, fullname: str, path=None, target=None): class ImportTreeTracer (line 112) | class ImportTreeTracer: method __init__ (line 113) | def __init__(self) -> None: method _stack (line 119) | def _stack(self) -> list[str]: method is_seen (line 126) | def is_seen(self, fullname: str) -> bool: method _get_or_create (line 129) | def _get_or_create(self, fullname: str) -> ImportNode: method record (line 134) | def record(self, fullname: str) -> None: method push (line 148) | def push(self, fullname: str) -> None: method pop (line 151) | def pop(self) -> None: method count (line 157) | def count(self) -> int: method roots (line 161) | def roots(self) -> list[ImportNode]: function trace_import (line 170) | def trace_import(target: str) -> ImportTreeTracer: function format_tree (line 190) | def format_tree(nodes: list[ImportNode]) -> str: function main (line 210) | def main() -> int: FILE: utils/check_inits.py function find_backend (line 79) | def find_backend(line: str) -> str | None: function parse_init (line 98) | def parse_init(init_file) -> tuple[dict[str, list[str]], dict[str, list[... function analyze_results (line 241) | def analyze_results(import_dict_objects: dict[str, list[str]], type_hint... function get_transformers_submodules (line 288) | def get_transformers_submodules() -> list[str]: function check_submodules (line 325) | def check_submodules(): FILE: utils/check_modular_conversion.py function process_file (line 35) | def process_file( function convert_and_run_ruff (line 74) | def convert_and_run_ruff(modular_file_path: str) -> dict[str, str]: function compare_files (line 100) | def compare_files(modular_file_path, show_diff=True): function get_models_in_diff (line 109) | def get_models_in_diff(): function guaranteed_no_diff (line 132) | def guaranteed_no_diff(modular_file_path, dependencies, models_in_diff): FILE: utils/check_pipeline_typing.py function main (line 38) | def main(pipeline_file_path: str, fix_and_overwrite: bool = False): FILE: utils/check_repo.py function check_missing_backends (line 527) | def check_missing_backends(): function check_model_list (line 552) | def check_model_list(): function get_model_modules (line 586) | def get_model_modules() -> list[str]: function get_models (line 611) | def get_models(module: types.ModuleType, include_pretrained: bool = Fals... function is_building_block (line 638) | def is_building_block(model: str) -> bool: function is_a_private_model (line 652) | def is_a_private_model(model: str) -> bool: function check_models_are_in_init (line 659) | def check_models_are_in_init(): function get_model_test_files (line 676) | def get_model_test_files() -> list[str]: function find_tested_models (line 713) | def find_tested_models(test_file: str) -> set[str]: function should_be_tested (line 790) | def should_be_tested(model_name: str) -> bool: function check_models_are_tested (line 799) | def check_models_are_tested(module: types.ModuleType, test_file: str) ->... function check_all_models_are_tested (line 834) | def check_all_models_are_tested(): function get_all_auto_configured_models (line 855) | def get_all_auto_configured_models() -> list[str]: function ignore_unautoclassed (line 865) | def ignore_unautoclassed(model_name: str) -> bool: function check_models_are_auto_configured (line 876) | def check_models_are_auto_configured(module: types.ModuleType, all_auto_... function check_all_models_are_auto_configured (line 901) | def check_all_models_are_auto_configured(): function check_all_auto_object_names_being_defined (line 916) | def check_all_auto_object_names_being_defined(): function check_all_auto_mapping_names_in_config_mapping_names (line 958) | def check_all_auto_mapping_names_in_config_mapping_names(): function check_all_auto_mappings_importable (line 987) | def check_all_auto_mappings_importable(): function check_decorator_order (line 1011) | def check_decorator_order(filename: str) -> list[int]: function check_all_decorator_order (line 1037) | def check_all_decorator_order(): function find_all_documented_objects (line 1053) | def find_all_documented_objects() -> list[str]: function ignore_undocumented (line 1176) | def ignore_undocumented(name: str) -> bool: function check_all_objects_are_documented (line 1220) | def check_all_objects_are_documented(): function check_public_method_exists (line 1238) | def check_public_method_exists(documented_methods_map): function check_model_type_doc_match (line 1287) | def check_model_type_doc_match(): function check_deprecated_constant_is_up_to_date (line 1314) | def check_deprecated_constant_is_up_to_date(): function check_models_have_kwargs (line 1343) | def check_models_have_kwargs(): function check_repo_quality (line 1405) | def check_repo_quality(): FILE: utils/check_self_hosted_runner.py function get_runner_status (line 6) | def get_runner_status(target_runners, token): function list_str (line 39) | def list_str(values): FILE: utils/check_types.py function main (line 32) | def main(): FILE: utils/checkers.py function _discover_checkers (line 72) | def _discover_checkers() -> tuple[dict, dict]: function get_checker_cache_globs (line 184) | def get_checker_cache_globs(checker_name: str) -> list[str] | None: class CheckerCache (line 197) | class CheckerCache: method __init__ (line 205) | def __init__(self, path: Path | None = None): method _load (line 209) | def _load(self) -> dict: method save (line 215) | def save(self) -> None: method _digest_files (line 222) | def _digest_files(globs: list[str]) -> str: method is_current (line 234) | def is_current(self, checker_name: str) -> bool: method update (line 241) | def update(self, checker_name: str) -> None: method invalidate (line 248) | def invalidate(self, checker_name: str) -> None: function _file_md5 (line 253) | def _file_md5(path): function format_elapsed (line 265) | def format_elapsed(seconds: float) -> str: class SlidingWindow (line 273) | class SlidingWindow: method __init__ (line 276) | def __init__(self, label, max_lines=10): method _spin (line 291) | def _spin(self): method _redraw (line 299) | def _redraw(self): method add_line (line 314) | def add_line(self, line): method finish (line 319) | def finish(self, success, elapsed=None): function _run_cmd (line 341) | def _run_cmd(cmd, line_callback=None): function run_deps_table_checker (line 359) | def run_deps_table_checker(fix=False, line_callback=None): function run_imports_checker (line 382) | def run_imports_checker(fix=False, line_callback=None): function run_ruff_check (line 393) | def run_ruff_check(fix=False, line_callback=None): function run_ruff_format (line 401) | def run_ruff_format(fix=False, line_callback=None): function get_checker_command (line 419) | def get_checker_command(name, fix=False): function run_checker (line 445) | def run_checker(name, fix=False, line_callback=None): function main (line 461) | def main(): FILE: utils/collated_reports.py function simplify_gpu_name (line 25) | def simplify_gpu_name(gpu_name: str, simplified_names: list[str]) -> str: function parse_short_summary_line (line 35) | def parse_short_summary_line(line: str) -> tuple[str | None, int]: function validate_path (line 49) | def validate_path(p: str) -> Path: function get_gpu_name (line 56) | def get_gpu_name(gpu_name: str | None) -> str: function get_commit_hash (line 73) | def get_commit_hash(commit_hash: str | None) -> str: class Args (line 86) | class Args: function get_arguments (line 95) | def get_arguments(args: argparse.Namespace) -> Args: function upload_collated_report (line 105) | def upload_collated_report(job: str, report_repo_id: str, filename: str): FILE: utils/compare_test_runs.py function normalize_test_line (line 18) | def normalize_test_line(line): function parse_summary_file (line 34) | def parse_summary_file(file_path): function compare_job_sets (line 50) | def compare_job_sets(job_set1, job_set2): FILE: utils/create_dependency_mapping.py function topological_sort (line 7) | def topological_sort(dependencies: dict) -> list[list[str]]: function is_model_import (line 58) | def is_model_import(module: str | None) -> bool: function extract_model_imports_from_file (line 73) | def extract_model_imports_from_file(file_path): function find_priority_list (line 87) | def find_priority_list(modular_files: list[str]) -> tuple[list[list[str]... FILE: utils/create_dummy_models.py function get_processor_types_from_config_class (line 127) | def get_processor_types_from_config_class(config_class, allowed_mappings... function get_architectures_from_config_class (line 169) | def get_architectures_from_config_class(config_class, arch_mappings, mod... function get_config_class_from_processor_class (line 198) | def get_config_class_from_processor_class(processor_class): function build_processor (line 222) | def build_processor(config_class, processor_class, allow_no_checkpoint=F... function get_tiny_config (line 352) | def get_tiny_config(config_class, model_class=None, **model_tester_kwargs): function convert_tokenizer (line 446) | def convert_tokenizer(tokenizer_fast: PreTrainedTokenizerFast): function convert_feature_extractor (line 458) | def convert_feature_extractor(feature_extractor, tiny_config): function convert_processors (line 507) | def convert_processors(processors, tiny_config, output_folder, result): function get_checkpoint_dir (line 737) | def get_checkpoint_dir(output_dir, model_arch): function build_model (line 743) | def build_model(model_arch, tiny_config, output_dir): function fill_result_with_error (line 769) | def fill_result_with_error(result, error, trace, models_to_create): function upload_model (line 782) | def upload_model(model_dir, organization, token): function build_composite_models (line 821) | def build_composite_models(config_class, output_dir): function get_token_id_from_tokenizer (line 946) | def get_token_id_from_tokenizer(token_id_name, tokenizer, original_token... function get_config_overrides (line 968) | def get_config_overrides(config_class, processors): function build (line 1033) | def build(config_class, models_to_create, output_dir): function build_tiny_model_summary (line 1180) | def build_tiny_model_summary(results, organization=None, token=None): function build_failed_report (line 1235) | def build_failed_report(results, include_warning=True): function build_simple_report (line 1264) | def build_simple_report(results): function update_tiny_model_summary_file (line 1281) | def update_tiny_model_summary_file(report_path): function create_tiny_models (line 1308) | def create_tiny_models( function list_str (line 1425) | def list_str(values): FILE: utils/custom_init_isort.py function get_indent (line 67) | def get_indent(line: str) -> str: function split_code_in_indented_blocks (line 73) | def split_code_in_indented_blocks( function ignore_underscore_and_lowercase (line 140) | def ignore_underscore_and_lowercase(key: Callable[[Any], str]) -> Callab... function sort_objects (line 151) | def sort_objects(objects: list[Any], key: Callable[[Any], str] | None = ... function sort_objects_in_import (line 185) | def sort_objects_in_import(import_statement: str) -> str: function sort_imports (line 243) | def sort_imports(file: str, check_only: bool = True): function sort_imports_in_all_inits (line 316) | def sort_imports_in_all_inits(check_only=True): FILE: utils/deprecate_models.py function get_last_stable_minor_release (line 28) | def get_last_stable_minor_release(): function build_tip_message (line 44) | def build_tip_message(last_stable_release): function insert_tip_to_model_doc (line 58) | def insert_tip_to_model_doc(model_doc_path, tip_message): function get_model_doc_path (line 79) | def get_model_doc_path(model: str) -> tuple[str | None, str | None]: function extract_model_info (line 92) | def extract_model_info(model): function update_relative_imports (line 111) | def update_relative_imports(filename, model): function remove_copied_from_statements (line 126) | def remove_copied_from_statements(model): function move_model_files_to_deprecated (line 145) | def move_model_files_to_deprecated(model): function delete_model_tests (line 161) | def delete_model_tests(model): function get_line_indent (line 168) | def get_line_indent(s): function update_main_init_file (line 172) | def update_main_init_file(models): function remove_model_references_from_file (line 195) | def remove_model_references_from_file(filename, models, condition): function remove_model_config_classes_from_config_check (line 218) | def remove_model_config_classes_from_config_check(model_config_classes): function add_models_to_deprecated_models_in_config_auto (line 268) | def add_models_to_deprecated_models_in_config_auto(models): function deprecate_models (line 302) | def deprecate_models(models): FILE: utils/download_glue_data.py function download_and_extract (line 47) | def download_and_extract(task, data_dir): function format_mrpc (line 57) | def format_mrpc(data_dir, path_to_data): function download_diagnostic (line 109) | def download_diagnostic(data_dir): function get_tasks (line 119) | def get_tasks(task_names): function main (line 132) | def main(arguments): FILE: utils/extract_metadata.py function get_setup_module (line 29) | def get_setup_module() -> ModuleType: function extract_extras (line 38) | def extract_extras() -> None: function extract_python_versions (line 45) | def extract_python_versions() -> None: FILE: utils/extract_warnings.py function extract_warnings_from_single_artifact (line 15) | def extract_warnings_from_single_artifact(artifact_path, targets): function extract_warnings (line 67) | def extract_warnings(artifact_dir, targets): function list_str (line 81) | def list_str(values): FILE: utils/fetch_hub_objects_for_ci.py function url_to_local_path (line 43) | def url_to_local_path(url, return_url_if_not_found=True): function parse_hf_url (line 52) | def parse_hf_url(url): function validate_downloaded_content (line 73) | def validate_downloaded_content(filepath): function download_test_file (line 91) | def download_test_file(url): FILE: utils/format_extras_slack_message.py function format_slack_message (line 29) | def format_slack_message(failures_file, workflow_url, output_file=None): function main (line 90) | def main(): FILE: utils/get_ci_error_statistics.py function get_jobs (line 17) | def get_jobs(workflow_run_id, token=None): function get_job_links (line 43) | def get_job_links(workflow_run_id, token=None): function get_artifacts_links (line 69) | def get_artifacts_links(workflow_run_id, token=None): function download_artifact (line 97) | def download_artifact(artifact_name, artifact_url, output_dir, token): function get_errors_from_single_artifact (line 116) | def get_errors_from_single_artifact(artifact_zip_path, job_links=None): function get_all_errors (line 163) | def get_all_errors(artifact_dir, job_links=None): function reduce_by_error (line 175) | def reduce_by_error(logs, error_filter=None): function get_model (line 190) | def get_model(test): function reduce_by_model (line 201) | def reduce_by_model(logs, error_filter=None): function make_github_table (line 223) | def make_github_table(reduced_by_error): function make_github_table_per_model (line 235) | def make_github_table_per_model(reduced_by_model): FILE: utils/get_github_job_time.py function extract_time_from_single_job (line 9) | def extract_time_from_single_job(job): function get_job_time (line 29) | def get_job_time(workflow_run_id, token=None): FILE: utils/get_pr_run_slow_jobs.py function get_jobs_to_run (line 10) | def get_jobs_to_run(): function parse_message (line 49) | def parse_message(message: str) -> str: function get_jobs (line 76) | def get_jobs(message: str): function check_name (line 81) | def check_name(model_name: str): FILE: utils/get_previous_daily_ci.py function get_daily_ci_runs (line 8) | def get_daily_ci_runs(token, num_runs=7, workflow_id=None): function get_last_daily_ci_run (line 42) | def get_last_daily_ci_run(token, workflow_run_id=None, workflow_id=None,... function get_last_daily_ci_workflow_run_id (line 68) | def get_last_daily_ci_workflow_run_id(token, workflow_run_id=None, workf... function get_last_daily_ci_run_commit (line 81) | def get_last_daily_ci_run_commit(token, workflow_run_id=None, workflow_i... function get_last_daily_ci_artifacts (line 93) | def get_last_daily_ci_artifacts( function get_last_daily_ci_reports (line 123) | def get_last_daily_ci_reports( FILE: utils/get_test_info.py function get_module_path (line 30) | def get_module_path(test_file): function get_test_module (line 52) | def get_test_module(test_file): function get_tester_classes (line 68) | def get_tester_classes(test_file): function get_test_classes (line 80) | def get_test_classes(test_file): function get_model_classes (line 100) | def get_model_classes(test_file): function get_model_tester_from_test_class (line 111) | def get_model_tester_from_test_class(test_class): function get_test_classes_for_model (line 126) | def get_test_classes_for_model(test_file, model_class): function get_tester_classes_for_model (line 139) | def get_tester_classes_for_model(test_file, model_class): function get_test_to_tester_mapping (line 153) | def get_test_to_tester_mapping(test_file): function get_model_to_test_mapping (line 163) | def get_model_to_test_mapping(test_file): function get_model_to_tester_mapping (line 172) | def get_model_to_tester_mapping(test_file): function to_json (line 181) | def to_json(o): FILE: utils/get_test_reports.py function is_valid_test_dir (line 41) | def is_valid_test_dir(path: Path) -> bool: function run_pytest (line 46) | def run_pytest( function handle_suite (line 80) | def handle_suite( FILE: utils/mlinter/_helpers.py class Violation (line 26) | class Violation: function full_name (line 33) | def full_name(node: ast.AST): function _simple_name (line 43) | def _simple_name(name: str) -> str: function _model_dir_name (line 47) | def _model_dir_name(file_path: Path) -> str | None: function _known_model_dirs (line 60) | def _known_model_dirs() -> set[str]: function _has_rule_suppression (line 64) | def _has_rule_suppression(lines: list[str], rule_id: str, line_number: i... function _collect_class_bases (line 75) | def _collect_class_bases(tree: ast.Module) -> dict[str, list[str]]: function _inherits_pretrained_model (line 90) | def _inherits_pretrained_model( function iter_pretrained_classes (line 110) | def iter_pretrained_classes(tree: ast.Module, source_lines: list[str], r... function _get_class_assignments (line 125) | def _get_class_assignments(class_node: ast.ClassDef) -> dict[str, ast.AST]: function _class_methods (line 135) | def _class_methods(class_node: ast.ClassDef) -> dict[str, ast.FunctionDef]: function _function_argument_names (line 139) | def _function_argument_names(function_node: ast.FunctionDef) -> set[str]: function _function_uses_name (line 149) | def _function_uses_name(function_node: ast.FunctionDef, name: str) -> bool: function is_self_method_call (line 156) | def is_self_method_call(node: ast.AST, method: str) -> bool: function is_super_method_call (line 167) | def is_super_method_call(node: ast.AST, method: str) -> bool: function _is_direct_pretrained_config_subclass (line 179) | def _is_direct_pretrained_config_subclass(class_node: ast.ClassDef) -> b... function _has_strict_decorator (line 189) | def _has_strict_decorator(class_node: ast.ClassDef) -> bool: FILE: utils/mlinter/mlinter.py function _load_rule_specs (line 42) | def _load_rule_specs() -> dict[str, dict]: function _is_rule_allowlisted_for_file (line 89) | def _is_rule_allowlisted_for_file(rule_id: str, file_path: Path) -> bool: function _content_hash (line 96) | def _content_hash(text: str, enabled_rules: set[str]) -> str: function _load_cache (line 102) | def _load_cache() -> dict[str, str]: function _save_cache (line 109) | def _save_cache(cache: dict[str, str]) -> None: function _validate_rule_ids (line 116) | def _validate_rule_ids(rule_ids: set[str]) -> set[str]: function _rule_id_from_module_name (line 123) | def _rule_id_from_module_name(name: str) -> str | None: function iter_modeling_files (line 129) | def iter_modeling_files(paths: set[Path] | None = None): function colored_error_message (line 140) | def colored_error_message(file_path: str, line_number: int, message: str... function _is_modeling_candidate (line 144) | def _is_modeling_candidate(path: Path) -> bool: function _git_name_only (line 152) | def _git_name_only(command: list[str]) -> list[str]: function _git_diff (line 159) | def _git_diff(base_ref: str, triple_dot: bool) -> list[str]: function _git_worktree_changes (line 165) | def _git_worktree_changes() -> set[Path]: function get_changed_modeling_files (line 172) | def get_changed_modeling_files(base_ref: str) -> set[Path]: function _build_rule_checks (line 187) | def _build_rule_checks() -> dict[str, CheckFn]: function analyze_file (line 218) | def analyze_file(file_path: Path, text: str, enabled_rules: set[str] | N... function format_violation (line 247) | def format_violation(violation: Violation) -> str: function emit_violation (line 251) | def emit_violation(violation: Violation, github_annotations: bool): function parse_args (line 262) | def parse_args() -> argparse.Namespace: function should_show_progress (line 312) | def should_show_progress(args: argparse.Namespace) -> bool: function resolve_enabled_rules (line 316) | def resolve_enabled_rules(args: argparse.Namespace) -> set[str]: function format_rule_summary (line 326) | def format_rule_summary(rule_id: str) -> str: function format_rule_details (line 332) | def format_rule_details(rule_id: str) -> str: function maybe_handle_rule_docs_cli (line 362) | def maybe_handle_rule_docs_cli(args: argparse.Namespace) -> bool: function main (line 377) | def main() -> int: FILE: utils/mlinter/trf001.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf002.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf003.py function _has_return_dict_branching (line 26) | def _has_return_dict_branching(function_node: ast.FunctionDef) -> bool: function check (line 43) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf004.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf005.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf006.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf007.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf008.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf009.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf010.py function check (line 31) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf011.py function _pp_iterated_module_name (line 95) | def _pp_iterated_module_name(node: ast.AST, pp_modules: set[str]) -> str... function _pp_loop_var (line 111) | def _pp_loop_var(for_node: ast.For, pp_modules: set[str]) -> tuple[str, ... function _is_non_module_attr_access (line 124) | def _is_non_module_attr_access(node: ast.Attribute) -> bool: function _pp_plan_modules_in_tree (line 129) | def _pp_plan_modules_in_tree(tree: ast.AST) -> set[str]: function _pp_plan_modules_by_model_dir (line 150) | def _pp_plan_modules_by_model_dir() -> dict[str, set[str]]: function _pp_plan_modules_for_file (line 177) | def _pp_plan_modules_for_file(file_path: Path) -> set[str]: function _unsafe_pp_submodule_attr_access (line 188) | def _unsafe_pp_submodule_attr_access(node: ast.Attribute, pp_modules: se... function check (line 201) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf012.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf013.py function check (line 26) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/mlinter/trf014.py class TrustRemoteCodeVisitor (line 26) | class TrustRemoteCodeVisitor(ast.NodeVisitor): method __init__ (line 27) | def __init__(self, file_path: Path): method _add (line 31) | def _add(self, node: ast.AST, message: str) -> None: method visit_Call (line 40) | def visit_Call(self, node: ast.Call) -> None: function check (line 74) | def check(tree: ast.Module, file_path: Path, source_lines: list[str]) ->... FILE: utils/models_to_deprecate.py class HubModelLister (line 135) | class HubModelLister: method __init__ (line 140) | def __init__(self, tags): method __iter__ (line 144) | def __iter__(self): function _extract_commit_hash (line 152) | def _extract_commit_hash(commits): function get_list_of_repo_model_paths (line 159) | def get_list_of_repo_model_paths(models_dir): function get_list_of_models_to_deprecate (line 176) | def get_list_of_models_to_deprecate( FILE: utils/modular_integrations.py function convert_relative_import_to_absolute (line 13) | def convert_relative_import_to_absolute( function convert_to_relative_import (line 87) | def convert_to_relative_import(import_node: cst.ImportFrom, file_path: s... class AbsoluteImportTransformer (line 165) | class AbsoluteImportTransformer(cst.CSTTransformer): method __init__ (line 166) | def __init__(self, relative_path: str, source_library: str): method leave_ImportFrom (line 171) | def leave_ImportFrom(self, original_node: cst.ImportFrom, updated_node... class RelativeImportTransformer (line 177) | class RelativeImportTransformer(cst.CSTTransformer): method __init__ (line 178) | def __init__(self, relative_path: str, source_library: str): method leave_ImportFrom (line 183) | def leave_ImportFrom(self, original_node: cst.ImportFrom, updated_node... FILE: utils/modular_model_converter.py function get_module_source_from_name (line 53) | def get_module_source_from_name(module_name: str) -> str: function preserve_case_replace (line 64) | def preserve_case_replace(text, patterns: dict, default_name: str): function get_cased_name (line 86) | def get_cased_name(lowercase_name: str) -> str: function get_lowercase_name (line 97) | def get_lowercase_name(cased_name: str) -> str: class ReplaceNameTransformer (line 106) | class ReplaceNameTransformer(m.MatcherDecoratableTransformer): method __init__ (line 116) | def __init__(self, old_name: str, new_name: str, original_new_model_na... method _replace_name (line 134) | def _replace_name(self, original_node, updated_node): method replace_name (line 141) | def replace_name(self, original_node, updated_node): method leave_Name (line 144) | def leave_Name(self, original_node, updated_node): method leave_ImportFrom (line 149) | def leave_ImportFrom(self, original_node, updated_node): function get_full_attribute_name (line 178) | def get_full_attribute_name(node: cst.Attribute | cst.Name) -> str | None: class ReplaceParentClassCallTransformer (line 199) | class ReplaceParentClassCallTransformer(cst.CSTTransformer): method __init__ (line 205) | def __init__(self, new_bases: list[str]): method is_call_to_parent_class (line 208) | def is_call_to_parent_class(self, node: cst.SimpleStatementLine): method leave_Call (line 212) | def leave_Call(self, original_node: cst.Call, updated_node: cst.Call) ... class ReplaceSuperCallTransformer (line 238) | class ReplaceSuperCallTransformer(cst.CSTTransformer): method __init__ (line 246) | def __init__( method update_body (line 261) | def update_body(self, existing_body, new_statements): method _fix_post_init_location (line 305) | def _fix_post_init_location(self, new_body: list[cst.CSTNode]): method _fix_init_location (line 320) | def _fix_init_location(self, new_body, original_body): method is_call_to_super (line 352) | def is_call_to_super(self, node: cst.BaseStatement, func_name: str): method leave_FunctionDef (line 357) | def leave_FunctionDef(self, original_node: cst.FunctionDef, updated_no... function find_all_dependencies (line 377) | def find_all_dependencies( class ClassDependencyMapper (line 471) | class ClassDependencyMapper(CSTVisitor): method __init__ (line 476) | def __init__( method visit_Name (line 487) | def visit_Name(self, node): function dependencies_for_class_node (line 496) | def dependencies_for_class_node(node: cst.ClassDef, global_names: set[st... function augmented_dependencies_for_class_node (line 504) | def augmented_dependencies_for_class_node( class ModuleMapper (line 529) | class ModuleMapper(CSTVisitor, ABC): method __init__ (line 539) | def __init__(self, python_module: cst.Module): method visit_ImportFrom (line 556) | def visit_ImportFrom(self, node): method visit_SimpleStatementLine (line 571) | def visit_SimpleStatementLine(self, node): method leave_SimpleStatementLine (line 601) | def leave_SimpleStatementLine(self, node): method visit_FunctionDef (line 606) | def visit_FunctionDef(self, node): method leave_FunctionDef (line 612) | def leave_FunctionDef(self, node): method visit_If (line 617) | def visit_If(self, node): method visit_ClassDef (line 624) | def visit_ClassDef(self, node: ClassDef) -> None: method leave_ClassDef (line 629) | def leave_ClassDef(self, node): method visit_Name (line 632) | def visit_Name(self, node: cst.Call): method leave_Module (line 639) | def leave_Module(self, node): method _restrict_dependencies_to_known_entities (line 652) | def _restrict_dependencies_to_known_entities(self): method _compute_recursive_object_dependencies (line 660) | def _compute_recursive_object_dependencies(self) -> dict[str, set]: method augment_dependencies (line 683) | def augment_dependencies(self, dependencies: set[str]) -> set[str]: method compute_class_dependencies (line 694) | def compute_class_dependencies(self): method compute_relative_order (line 703) | def compute_relative_order(self, missing_dependencies: set) -> dict[st... class ModelFileMapper (line 707) | class ModelFileMapper(ModuleMapper): method __init__ (line 717) | def __init__(self, python_module: cst.Module): method compute_relative_order (line 720) | def compute_relative_order(self, missing_dependencies: set[str]) -> di... method _merge_functions (line 790) | def _merge_functions(self, functions: dict[str, cst.CSTNode], object_m... method _merge_assignments (line 802) | def _merge_assignments(self, assignments: dict[str, cst.CSTNode], obje... method _merge_classes (line 823) | def _merge_classes(self, classes: dict[str, cst.CSTNode]): method merge_modular_dependencies (line 838) | def merge_modular_dependencies(self, classes, functions, assignments, ... method visit_and_merge_dependencies (line 855) | def visit_and_merge_dependencies( function common_partial_suffix (line 868) | def common_partial_suffix(str1: str, str2: str) -> str: function replace_class_node (line 883) | def replace_class_node( function find_file_type (line 1111) | def find_file_type(class_name: str, model_name: str) -> str: function append_new_import_node (line 1139) | def append_new_import_node( function get_needed_imports (line 1156) | def get_needed_imports(body: dict[str, dict], all_imports: list[cst.CSTN... function _ensure_utils_availability_imports (line 1202) | def _ensure_utils_availability_imports(imports: list[cst.CSTNode], neede... function protect_torch_imports_for_pil (line 1246) | def protect_torch_imports_for_pil(imports: list[cst.CSTNode]) -> list[cs... function split_all_assignment (line 1306) | def split_all_assignment(node: cst.CSTNode, model_name: str) -> dict[str... class ModularFileMapper (line 1327) | class ModularFileMapper(ModuleMapper): method __init__ (line 1333) | def __init__(self, python_module, new_name, package_name): method visit_ImportFrom (line 1346) | def visit_ImportFrom(self, node: cst.ImportFrom) -> None: method visit_SimpleStatementLine (line 1391) | def visit_SimpleStatementLine(self, node): method leave_Module (line 1437) | def leave_Module(self, node): method merge_model_specific_imports (line 1489) | def merge_model_specific_imports(self, visited_modules): method compute_relative_order (line 1540) | def compute_relative_order(self, missing_dependencies: set) -> dict[st... method infer_new_model_name (line 1569) | def infer_new_model_name(self) -> dict: function check_dependencies_and_create_import_node (line 1660) | def check_dependencies_and_create_import_node( function get_class_node_and_dependencies (line 1706) | def get_class_node_and_dependencies( function create_modules (line 1805) | def create_modules( function run_ruff (line 1888) | def run_ruff(file: str): function convert_modular_file (line 1894) | def convert_modular_file(modular_file: str, source_library: str | None =... function save_modeling_files (line 1943) | def save_modeling_files(modular_file: str, converted_files: dict[str, st... function count_loc (line 1958) | def count_loc(file_path: str) -> int: function run_converter (line 1966) | def run_converter(modular_file: str, source_library: str | None = "trans... FILE: utils/modular_model_detector.py function _normalize (line 149) | def _normalize(string: str | None) -> str: function _strip_source_for_tokens (line 162) | def _strip_source_for_tokens(code: str) -> str: function _tokenize (line 177) | def _tokenize(code: str) -> set[str]: function _leading_symbol_prefix (line 190) | def _leading_symbol_prefix(name: str) -> str: function _sanitize_for_embedding (line 204) | def _sanitize_for_embedding(code: str, model_hint: str | None, symbol_hi... class CodeSimilarityAnalyzer (line 235) | class CodeSimilarityAnalyzer: method __init__ (line 246) | def __init__(self, hub_dataset: str): method _resolve_index_path (line 264) | def _resolve_index_path(self, filename: str) -> Path: method ensure_local_index (line 269) | def ensure_local_index(self) -> None: method push_index_to_hub (line 291) | def push_index_to_hub(self) -> None: method _extract_definitions (line 306) | def _extract_definitions( method _infer_model_from_relative_path (line 354) | def _infer_model_from_relative_path(self, relative_path: Path) -> str ... method _infer_query_model_name (line 361) | def _infer_query_model_name(self, modeling_file: Path) -> str | None: method _encode_batch (line 370) | def _encode_batch(self, texts: list[str]) -> np.ndarray: method encode (line 399) | def encode(self, texts: list[str]) -> np.ndarray: method build_index (line 418) | def build_index(self) -> None: method _topk_embedding (line 453) | def _topk_embedding( method _topk_jaccard (line 479) | def _topk_jaccard( method analyze_file (line 519) | def analyze_file( function build_date_data (line 585) | def build_date_data() -> dict[str, str]: function _format_table (line 617) | def _format_table(headers: list[str], rows: list[tuple[str, ...] | None]... function _parse_release_date (line 649) | def _parse_release_date(value: str) -> datetime | None: function _load_definition_line_map (line 658) | def _load_definition_line_map(relative_path: str) -> dict[str, int]: function _resolve_definition_location (line 680) | def _resolve_definition_location(relative_path: str, definition: str) ->... function _colorize_heading (line 688) | def _colorize_heading(text: str) -> str: function main (line 692) | def main(): FILE: utils/notification_service.py function handle_test_results (line 74) | def handle_test_results(test_results): function handle_stacktraces (line 105) | def handle_stacktraces(test_results): function dicts_to_sum (line 126) | def dicts_to_sum(objects: dict[str, dict] | list[dict]): class Message (line 138) | class Message: method __init__ (line 139) | def __init__( method time (line 204) | def time(self) -> str: method header (line 217) | def header(self) -> dict: method ci_title_section (line 221) | def ci_title_section(self) -> dict: method no_failures (line 225) | def no_failures(self) -> dict: method failures (line 241) | def failures(self) -> dict: method warnings (line 261) | def warnings(self) -> dict: method get_device_report (line 293) | def get_device_report(report, rjust=6): method category_failures (line 302) | def category_failures(self) -> dict: method compute_diff_for_failure_reports (line 337) | def compute_diff_for_failure_reports(self, curr_failure_report, prev_f... method model_failures (line 375) | def model_failures(self) -> list[dict]: method additional_failures (line 534) | def additional_failures(self) -> dict: method payload (line 559) | def payload(self) -> str: method error_out (line 671) | def error_out(title, ci_title="", runner_not_available=False, runner_f... method post (line 732) | def post(self): method get_reply_blocks (line 745) | def get_reply_blocks(self, job_name, job_result, failures, device, text): method get_new_failures (line 787) | def get_new_failures(self, prev_ci_artifacts, include_all=False): method post_reply (line 883) | def post_reply(self): function retrieve_artifact (line 933) | def retrieve_artifact(artifact_path: str, gpu: str | None): function retrieve_available_artifacts (line 951) | def retrieve_available_artifacts(): function prepare_reports (line 1003) | def prepare_reports(title, header, reports, to_truncate=True): function pop_default (line 1026) | def pop_default(l: list[Any], i: int, default: Any) -> Any: FILE: utils/notification_service_doc_tests.py function handle_test_results (line 27) | def handle_test_results(test_results): function extract_first_line_failure (line 46) | def extract_first_line_failure(failures_short_lines): class Message (line 61) | class Message: method __init__ (line 62) | def __init__(self, title: str, doc_test_results: dict): method time (line 73) | def time(self) -> str: method header (line 92) | def header(self) -> dict: method no_failures (line 96) | def no_failures(self) -> dict: method failures (line 112) | def failures(self) -> dict: method category_failures (line 131) | def category_failures(self) -> list[dict]: method payload (line 169) | def payload(self) -> str: method error_out (line 184) | def error_out(): method post (line 209) | def post(self): method get_reply_blocks (line 221) | def get_reply_blocks(self, job_name, job_link, failures, text): method post_reply (line 252) | def post_reply(self): function retrieve_artifact (line 276) | def retrieve_artifact(name: str): function retrieve_available_artifacts (line 291) | def retrieve_available_artifacts(): FILE: utils/patch_helper.py function get_release_branch_name (line 47) | def get_release_branch_name(): function checkout_branch (line 62) | def checkout_branch(branch): function get_prs_by_label (line 72) | def get_prs_by_label(label): function get_commit_timestamp (line 97) | def get_commit_timestamp(commit_sha): function cherry_pick_commit (line 106) | def cherry_pick_commit(sha): function commit_in_history (line 115) | def commit_in_history(commit_sha, base_branch="HEAD"): function main (line 126) | def main(verbose=False): FILE: utils/pr_slow_ci_models.py function get_new_python_files_between_commits (line 42) | def get_new_python_files_between_commits(base_commit: str, commits: list... function get_new_python_files (line 67) | def get_new_python_files(diff_with_last_commit=False) -> list[str]: function get_new_model (line 99) | def get_new_model(diff_with_last_commit=False): function parse_message (line 113) | def parse_message(message: str) -> str: function get_models (line 140) | def get_models(message: str): function check_model_names (line 145) | def check_model_names(model_name: str): FILE: utils/process_test_artifacts.py function count_lines (line 29) | def count_lines(filepath): function compute_parallel_nodes (line 38) | def compute_parallel_nodes(line_count, max_tests_per_node=10): function process_artifacts (line 46) | def process_artifacts(input_file, output_file): FILE: utils/release.py function update_version_in_file (line 80) | def update_version_in_file(fname: str, version: str, file_type: str): function update_version_in_examples (line 98) | def update_version_in_examples(version: str, patch: bool = False): function global_version_update (line 121) | def global_version_update(version: str, patch: bool = False): function remove_conversion_scripts (line 134) | def remove_conversion_scripts(): function remove_internal_utils (line 145) | def remove_internal_utils(): function get_version (line 152) | def get_version() -> packaging.version.Version: function pre_release_work (line 162) | def pre_release_work(patch: bool = False): function post_release_work (line 195) | def post_release_work(): FILE: utils/scan_skipped_tests.py function get_common_tests (line 32) | def get_common_tests(file_paths_with_origin: list[tuple[Path, str]]) -> ... function get_models_and_test_files (line 44) | def get_models_and_test_files(models_dir: Path) -> tuple[list[str], list... function _extract_reason_from_decorators (line 52) | def _extract_reason_from_decorators(decorators_block: str) -> str: function extract_test_info (line 63) | def extract_test_info(file_content: str) -> dict[str, tuple[str, str]]: function build_model_overrides (line 78) | def build_model_overrides(model_test_files: list[Path]) -> dict[str, dic... function save_json (line 88) | def save_json(obj: dict, output_path: Path) -> None: function summarize_single_test (line 93) | def summarize_single_test( function summarize_all_tests (line 127) | def summarize_all_tests( function main (line 161) | def main() -> None: FILE: utils/sort_auto_mappings.py function sort_auto_mapping (line 56) | def sort_auto_mapping(fname: str, overwrite: bool = False) -> bool | None: function sort_all_auto_mappings (line 108) | def sort_all_auto_mappings(overwrite: bool = False): FILE: utils/test_module/custom_configuration.py class CustomConfig (line 4) | class CustomConfig(PreTrainedConfig): method __init__ (line 7) | def __init__(self, attribute=1, **kwargs): FILE: utils/test_module/custom_feature_extraction.py class CustomFeatureExtractor (line 4) | class CustomFeatureExtractor(Wav2Vec2FeatureExtractor): FILE: utils/test_module/custom_image_processing.py class CustomImageProcessor (line 4) | class CustomImageProcessor(CLIPImageProcessor): FILE: utils/test_module/custom_modeling.py class CustomModel (line 8) | class CustomModel(PreTrainedModel): method __init__ (line 11) | def __init__(self, config): method forward (line 16) | def forward(self, x): method _init_weights (line 19) | def _init_weights(self, module): FILE: utils/test_module/custom_pipeline.py function softmax (line 6) | def softmax(outputs): class PairClassificationPipeline (line 12) | class PairClassificationPipeline(Pipeline): method _sanitize_parameters (line 13) | def _sanitize_parameters(self, **kwargs): method preprocess (line 19) | def preprocess(self, text, second_text=None): method _forward (line 22) | def _forward(self, model_inputs): method postprocess (line 25) | def postprocess(self, model_outputs): FILE: utils/test_module/custom_processing.py class CustomProcessor (line 4) | class CustomProcessor(ProcessorMixin): method __init__ (line 5) | def __init__(self, feature_extractor, tokenizer): FILE: utils/test_module/custom_tokenization.py class CustomTokenizer (line 4) | class CustomTokenizer(BertTokenizer): FILE: utils/test_module/custom_tokenization_fast.py class CustomTokenizerFast (line 6) | class CustomTokenizerFast(BertTokenizerFast): FILE: utils/test_module/custom_video_processing.py class CustomVideoProcessor (line 4) | class CustomVideoProcessor(LlavaOnevisionVideoProcessor): FILE: utils/tests_fetcher.py function checkout_commit (line 88) | def checkout_commit(repo: Repo, commit_id: str): function clean_code (line 106) | def clean_code(content: str) -> str: function keep_doc_examples_only (line 138) | def keep_doc_examples_only(content: str) -> str: function get_all_tests (line 165) | def get_all_tests() -> list[str]: function diff_is_docstring_only (line 194) | def diff_is_docstring_only(repo: Repo, branching_point: str, filename: s... function diff_contains_doc_examples (line 220) | def diff_contains_doc_examples(repo: Repo, branching_point: str, filenam... function get_impacted_files_from_tiny_model_summary (line 246) | def get_impacted_files_from_tiny_model_summary(diff_with_last_commit: bo... function get_diff (line 325) | def get_diff(repo: Repo, base_commit: str, commits: list[str]) -> list[s... function get_modified_python_files (line 363) | def get_modified_python_files(diff_with_last_commit: bool = False) -> li... function get_diff_for_doctesting (line 393) | def get_diff_for_doctesting(repo: Repo, base_commit: str, commits: list[... function get_all_doctest_files (line 434) | def get_all_doctest_files() -> list[str]: function get_new_doctest_files (line 467) | def get_new_doctest_files(repo, base_commit, branching_commit) -> list[s... function get_doctest_files (line 494) | def get_doctest_files(diff_with_last_commit: bool = False) -> list[str]: function extract_imports (line 563) | def extract_imports(module_fname: str, cache: dict[str, list[str]] | Non... function get_module_dependencies (line 645) | def get_module_dependencies(module_fname: str, cache: dict[str, list[str... function create_reverse_dependency_tree (line 728) | def create_reverse_dependency_tree() -> list[tuple[str, str]]: function get_tree_starting_at (line 742) | def get_tree_starting_at(module: str, edges: list[tuple[str, str]]) -> l... function print_tree_deps_of (line 770) | def print_tree_deps_of(module, all_edges=None): function init_test_examples_dependencies (line 803) | def init_test_examples_dependencies() -> tuple[dict[str, list[str]], lis... function create_reverse_dependency_map (line 835) | def create_reverse_dependency_map() -> dict[str, list[str]]: function create_module_to_test_map (line 890) | def create_module_to_test_map(reverse_map: dict[str, list[str]] | None =... function get_repo_utils_tests (line 919) | def get_repo_utils_tests() -> list[str]: function should_run_repo_utils_tests (line 932) | def should_run_repo_utils_tests(modified_files: list[str]) -> bool: function _print_list (line 946) | def _print_list(l) -> str: function infer_tests_to_run (line 953) | def infer_tests_to_run(output_file: str, diff_with_last_commit: bool = F... function filter_tests (line 1036) | def filter_tests(output_file: str, filters: list[str]): function parse_commit_message (line 1063) | def parse_commit_message(commit_message: str) -> dict[str, bool]: function create_test_list_from_filter (line 1106) | def create_test_list_from_filter(full_test_list, out_path): FILE: utils/update_metadata.py function camel_case_split (line 132) | def camel_case_split(identifier: str) -> list[str]: function get_frameworks_table (line 154) | def get_frameworks_table() -> pd.DataFrame: function update_pipeline_and_auto_class_table (line 210) | def update_pipeline_and_auto_class_table(table: dict[str, tuple[str, str... function update_metadata (line 240) | def update_metadata(token: str, commit_sha: str): function check_pipeline_tags (line 323) | def check_pipeline_tags(): FILE: utils/update_tiny_models.py function get_all_model_names (line 39) | def get_all_model_names(): function get_tiny_model_names_from_repo (line 59) | def get_tiny_model_names_from_repo(): function get_tiny_model_summary_from_hub (line 69) | def get_tiny_model_summary_from_hub(output_path):