class_docstr: EfficientViT backbone model.
class_docstr_tok: ["EfficientViT","backbone","model","."]
docstr: Build the EfficientViT model from a configuration object.
  
  Args:
      config: EfficientViT configuration object. See :class:`EfficientViTConfig`.
  
  Returns:
      EfficientViT: the EfficientViT model.
docstr_tok: ["Build","the","EfficientViT","model","from","a","configuration","object",".","Args",":","config",":","EfficientViT","configuration","object",".","See",":","class",":","`","EfficientViTConfig","`",".","Returns",":","EfficientViT",":","the","EfficientViT","model","."]
code: def from_config(config: EfficientViTConfig) -> EfficientViT:
      """Build the EfficientViT model from a configuration object.
  
      Args:
          config: EfficientViT configuration object. See :class:`EfficientViTConfig`.
  
      Returns:
          EfficientViT: the EfficientViT model.
      """
      # load the model from the checkpoint
      try:
          model_file = torch.hub.load_state_dict_from_url(
              config.checkpoint, map_location="cpu"
          )
          model_file = (
              model_file["state_dict"]
              if "state_dict" in model_file
              else model_file
          )
      except RuntimeError:
          raise RuntimeError(
              f"Unable to load the model from {config.checkpoint}."
          )
  
      file_name = config.checkpoint.split("/")[-1]
      model_type = file_name.split("-")[0]
  
      if model_type not in [
          "b0",
          "b1",
          "b2",
          "b3",
          "l0",
          "l1",
          "l2",
          "l3",
      ]:
          raise ValueError(f"Unknown model type: {model_type}.")
  
      # create and load the model weights without strict until we polish the model files
      model = getattr(vit, f"efficientvit_backbone_{model_type}")()
      model.load_state_dict(model_file, strict=False)
  
      return EfficientViT(backbone=model)
  
file_path: kornia/kornia/contrib/models/efficient_vit/model.py
imports: from __future__ import annotations
  from dataclasses import dataclass, field
  from typing import Literal
  import torch
  from kornia.contrib.models.base import ModelBase
  from kornia.contrib.models.efficient_vit import backbone
  from kornia.core import Tensor
label_desc: Use image node_id 2 for calling the EfficientViT obj's underlying member method code with example usage: obj.from_config(config) and returns: EfficientViT