Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,16 +63,16 @@ cls_model = cls_model.to(device)
|
|
| 63 |
|
| 64 |
@spaces.GPU(duration=1500) # maximum duration allowed during startup
|
| 65 |
def compile_transformer():
|
| 66 |
-
with spaces.aoti_capture(
|
| 67 |
chat_model("arbitrary example prompt")
|
| 68 |
|
| 69 |
-
exported = torch.export.export(
|
| 70 |
return spaces.aoti_compile(exported)
|
| 71 |
|
| 72 |
print("\n=== Model Compilation ===")
|
| 73 |
|
| 74 |
compiled_transformer = compile_transformer()
|
| 75 |
-
spaces.aoti_apply(compiled_transformer,
|
| 76 |
|
| 77 |
|
| 78 |
def generate_responses(model, tokenizer, prompts):
|
|
|
|
| 63 |
|
| 64 |
@spaces.GPU(duration=1500) # maximum duration allowed during startup
|
| 65 |
def compile_transformer():
|
| 66 |
+
with spaces.aoti_capture(chat_model.model) as call:
|
| 67 |
chat_model("arbitrary example prompt")
|
| 68 |
|
| 69 |
+
exported = torch.export.export(chat_model.model, args=call.args, kwargs=call.kwargs)
|
| 70 |
return spaces.aoti_compile(exported)
|
| 71 |
|
| 72 |
print("\n=== Model Compilation ===")
|
| 73 |
|
| 74 |
compiled_transformer = compile_transformer()
|
| 75 |
+
spaces.aoti_apply(compiled_transformer, chat_model.model)
|
| 76 |
|
| 77 |
|
| 78 |
def generate_responses(model, tokenizer, prompts):
|