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

Method export

examples/models/llava/export_llava.py:57–69  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

55
56class LlavaEdgeManager(LLMEdgeManager):
57 def export(self) -> "LlavaEdgeManager":
58 dynamic_shape = self._get_dynamic_shape()
59 # 1. torch.nn.attention.sdpa_kernel([SDPBackend.MATH]) is for bypassing the dynamo error when tracing
60 # 2. torch.no_grad() is for getting rid of the dropout (not sure why training ops will show up)
61 with torch.nn.attention.sdpa_kernel([SDPBackend.MATH]), torch.no_grad():
62 self.export_program = torch.export.export(
63 self.model,
64 self.example_inputs,
65 dynamic_shapes=dynamic_shape,
66 strict=False,
67 )
68 self.pre_autograd_graph_module = self.export_program.module()
69 return self
70
71
72def export_text_model(llava, embeddings, dynamic_shapes):

Callers 15

quantize_modelFunction · 0.45
export_to_pteFunction · 0.45
build_executorch_binaryFunction · 0.45
export_to_et_irFunction · 0.45
export_to_et_irFunction · 0.45
export_to_et_irFunction · 0.45
export_to_et_irFunction · 0.45
export_encoder_to_et_irFunction · 0.45
export_to_et_irFunction · 0.45
cifar_net.pyFile · 0.45

Calls 2

_get_dynamic_shapeMethod · 0.80
moduleMethod · 0.80