_get_model_cls_and_config() — pytorch Function Reference
Architecture documentation for the _get_model_cls_and_config() function in huggingface.py from the pytorch codebase.
Entity Profile
Dependency Diagram
graph TD 121584aa_ef62_fff7_1d2f_03dd864e80c3["_get_model_cls_and_config()"] 2c3d93c7_6719_b38f_a928_3d268c212537["_download_model()"] 2c3d93c7_6719_b38f_a928_3d268c212537 -->|calls| 121584aa_ef62_fff7_1d2f_03dd864e80c3 f731aa1a_ba23_ab06_f8e5_e87d6a842749["load_model()"] f731aa1a_ba23_ab06_f8e5_e87d6a842749 -->|calls| 121584aa_ef62_fff7_1d2f_03dd864e80c3 9931b867_b7b5_822c_d65c_02abd3724b2f["get_module_cls_by_model_name()"] 121584aa_ef62_fff7_1d2f_03dd864e80c3 -->|calls| 9931b867_b7b5_822c_d65c_02abd3724b2f style 121584aa_ef62_fff7_1d2f_03dd864e80c3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
benchmarks/dynamo/huggingface.py lines 376–398
def _get_model_cls_and_config(self, model_name):
if model_name not in EXTRA_MODELS:
model_cls = get_module_cls_by_model_name(model_name)
config_cls = model_cls.config_class
config = config_cls()
# NB: some models need a pad token defined to handle BS > 1
if (
model_cls
in [
GPT2ForSequenceClassification,
GPTNeoForSequenceClassification,
GPTJForSequenceClassification,
]
or model_cls.__name__.startswith("Roberta")
or model_cls.__name__.startswith("Marian")
):
config.pad_token_id = 0
else:
config, model_cls = EXTRA_MODELS[model_name]
return model_cls, config
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _get_model_cls_and_config() do?
_get_model_cls_and_config() is a function in the pytorch codebase.
What does _get_model_cls_and_config() call?
_get_model_cls_and_config() calls 1 function(s): get_module_cls_by_model_name.
What calls _get_model_cls_and_config()?
_get_model_cls_and_config() is called by 2 function(s): _download_model, load_model.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free