Skip to content

Commit 4b0f368

Browse files
committed
fix req
1 parent aae5d21 commit 4b0f368

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

_doc/examples/plot_export_tiny_llm.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def get_tiny_llm(
181181
# Let's get the model, inputs and dynamic shapes.
182182

183183
experiment = get_tiny_llm()
184-
model, inputs, dynamic_shapes = (
184+
untrained_model, inputs, dynamic_shapes = (
185185
experiment["model"],
186186
experiment["inputs"],
187187
experiment["dynamic_shapes"],
@@ -198,7 +198,26 @@ def get_tiny_llm(
198198
# +++++++++++++++
199199

200200
try:
201-
ep = torch.export.export(model, (), inputs, dynamic_shapes=dynamic_shapes)
201+
ep = torch.export.export(
202+
untrained_model, (), inputs, dynamic_shapes=dynamic_shapes, strict=False
203+
)
204+
print("It worked:")
205+
print(ep)
206+
except Exception as e:
207+
# To work, it needs at least PRs:
208+
# * https://github.com/huggingface/transformers/pull/36311
209+
# * https://github.com/huggingface/transformers/pull/36652
210+
print("It failed:", e)
211+
212+
213+
# %%
214+
# Back to the original model
215+
# ++++++++++++++++++++++++++
216+
#
217+
# Let's use the same dummy inputs but we use the downloaded model.
218+
219+
try:
220+
ep = torch.export.export(model, (), inputs, dynamic_shapes=dynamic_shapes, strict=False)
202221
print("It worked:")
203222
print(ep)
204223
except Exception as e:

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pytest-coverage
1414
pytest-subtests
1515
ruff
1616
scikit-learn>=1.4.0
17+
sentencepiece
1718
skl2onnx
1819
sphinx
1920
sphinx-gallery

0 commit comments

Comments
 (0)