MCPcopy
hub / github.com/apple/ml-depth-pro / create_backbone_model

Function create_backbone_model

src/depth_pro/depth_pro.py:49–69  ·  view source on GitHub ↗

Create and load a backbone model given a config. Args: ---- preset: A backbone preset to load pre-defind configs. Returns: ------- A Torch module and the associated config.

(
    preset: ViTPreset
)

Source from the content-addressed store, hash-verified

47
48
49def create_backbone_model(
50 preset: ViTPreset
51) -> Tuple[nn.Module, ViTPreset]:
52 """Create and load a backbone model given a config.
53
54 Args:
55 ----
56 preset: A backbone preset to load pre-defind configs.
57
58 Returns:
59 -------
60 A Torch module and the associated config.
61
62 """
63 if preset in VIT_CONFIG_DICT:
64 config = VIT_CONFIG_DICT[preset]
65 model = create_vit(preset=preset, use_pretrained=False)
66 else:
67 raise KeyError(f"Preset {preset} not found.")
68
69 return model, config
70
71
72def create_model_and_transforms(

Callers 1

Calls 1

create_vitFunction · 0.85

Tested by

no test coverage detected