Skip to content

Commit 68eda92

Browse files
committed
Update aoti APIs
1 parent 654bb03 commit 68eda92

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: torchchat/cli/builder.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,8 @@ def do_nothing(max_batch_size, max_seq_length):
571571
# attributes will NOT be seen on by AOTI-compiled forward
572572
# function, e.g. calling model.setup_cache will NOT touch
573573
# AOTI compiled and maintained model buffers such as kv_cache.
574-
from torch._inductor.package import load_package
575574

576-
aoti_compiled_model = load_package(
575+
aoti_compiled_model = torch._inductor.aoti_load_package(
577576
str(builder_args.aoti_package_path.absolute())
578577
)
579578

Diff for: torchchat/export.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ def export_for_server(
7272
if not package:
7373
options = {"aot_inductor.output_path": output_path}
7474

75-
path = torch._export.aot_compile(
75+
ep = torch.export.export(
7676
model,
7777
example_inputs,
7878
dynamic_shapes=dynamic_shapes,
79-
options=options,
8079
)
80+
options=options,
8181

8282
if package:
83-
from torch._inductor.package import package_aoti
84-
path = package_aoti(output_path, path)
83+
path = torch._inductor.aoti_copmile_and_package(ep, package_path=output_path, inductor_configs=options)
84+
else:
85+
path = torch._inductor.aot_compile(ep.module(), example_inputs, options=options)
8586

8687
print(f"The generated packaged model can be found at: {path}")
8788
return path

0 commit comments

Comments
 (0)