Home / Function/ get_module_cls_by_model_name() — pytorch Function Reference

get_module_cls_by_model_name() — pytorch Function Reference

Architecture documentation for the get_module_cls_by_model_name() function in huggingface.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  9931b867_b7b5_822c_d65c_02abd3724b2f["get_module_cls_by_model_name()"]
  121584aa_ef62_fff7_1d2f_03dd864e80c3["_get_model_cls_and_config()"]
  121584aa_ef62_fff7_1d2f_03dd864e80c3 -->|calls| 9931b867_b7b5_822c_d65c_02abd3724b2f
  11c86f38_3751_f253_e544_6933536508cd["refresh_model_names_and_batch_sizes()"]
  11c86f38_3751_f253_e544_6933536508cd -->|calls| 9931b867_b7b5_822c_d65c_02abd3724b2f
  style 9931b867_b7b5_822c_d65c_02abd3724b2f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/huggingface.py lines 139–146

def get_module_cls_by_model_name(model_cls_name):
    _module_by_model_name = {
        "Speech2Text2Decoder": "transformers.models.speech_to_text_2.modeling_speech_to_text_2",
        "TrOCRDecoder": "transformers.models.trocr.modeling_trocr",
    }
    module_name = _module_by_model_name.get(model_cls_name, "transformers")
    module = importlib.import_module(module_name)
    return getattr(module, model_cls_name)

Subdomains

Frequently Asked Questions

What does get_module_cls_by_model_name() do?
get_module_cls_by_model_name() is a function in the pytorch codebase.
What calls get_module_cls_by_model_name()?
get_module_cls_by_model_name() is called by 2 function(s): _get_model_cls_and_config, refresh_model_names_and_batch_sizes.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free