MCPcopy Create free account
hub / github.com/pytorch/executorch / get_instance

Function get_instance

examples/qualcomm/oss_scripts/fastvit.py:44–56  ·  view source on GitHub ↗
(repo_path: str, checkpoint_path: str)

Source from the content-addressed store, hash-verified

42
43
44def get_instance(repo_path: str, checkpoint_path: str):
45 import sys
46
47 sys.path.insert(0, repo_path)
48
49 from models.modules.mobileone import reparameterize_model
50 from timm.models import create_model
51
52 checkpoint = torch.load(checkpoint_path, weights_only=True)
53 model = create_model("fastvit_s12")
54 model = reparameterize_model(model).eval()
55 model.load_state_dict(checkpoint["state_dict"])
56 return model
57
58
59def main(args):

Callers 1

mainFunction · 0.70

Calls 2

insertMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected