@@ -269,7 +269,6 @@ def get_random_inputs(self):
269
269
270
270
def export_module_to_program (
271
271
module_class : Type [nn .Module ],
272
- skip_type_promotion : bool ,
273
272
external_constants : bool = False ,
274
273
) -> ExecutorchProgramManager :
275
274
"""Exports the module and returns the serialized program data."""
@@ -293,7 +292,6 @@ def export_module_to_program(
293
292
module = ExportedModule .export (
294
293
module_class ,
295
294
methods ,
296
- skip_type_promotion = skip_type_promotion ,
297
295
export_joint_graph = export_joint ,
298
296
external_constants = external_constants ,
299
297
export_state_names = export_state_names ,
@@ -342,17 +340,11 @@ def main() -> None:
342
340
# Export and write to the output files.
343
341
os .makedirs (args .outdir , exist_ok = True )
344
342
for module_name , module_class in module_names_to_classes .items ():
345
- skip_type_promotion = False
346
- if module_name == "ModuleAddHalf" :
347
- # Skip type promotion to keep the model in fp16.
348
- # Type promotion will convert to fp32.
349
- skip_type_promotion = True
350
343
if args .external_constants :
351
344
module_name = f"{ module_name } Program"
352
345
outfile = os .path .join (args .outdir , f"{ module_name } .pte" )
353
346
prog = export_module_to_program (
354
347
module_class ,
355
- skip_type_promotion = skip_type_promotion ,
356
348
external_constants = args .external_constants ,
357
349
)
358
350
with open (outfile , "wb" ) as fp :
0 commit comments