From 4df9ead396d40c3280c537dff767a3c3058af114 Mon Sep 17 00:00:00 2001 From: Damian Date: Tue, 21 Nov 2023 11:07:55 +0000 Subject: [PATCH 1/2] initial commit --- src/sparseml/transformers/export.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sparseml/transformers/export.py b/src/sparseml/transformers/export.py index a15a1692b4f..48d3e308729 100644 --- a/src/sparseml/transformers/export.py +++ b/src/sparseml/transformers/export.py @@ -328,8 +328,16 @@ def export_transformer_to_onnx( recipe_args=None, teacher=None, ) - - applied = trainer.apply_manager(epoch=math.inf, checkpoint=None) + try: + applied = trainer.apply_manager(epoch=math.inf, checkpoint=None) + except ValueError as e: + raise ValueError( + f"Failed to applied the recipy to the " + f"model with the exception message:\n{e}\n" + "It is possible, that there are missing modules " + "specific to the model, that were not properly loaded. " + "A possible solution would be setting the --trust_remote_code flag" + ) if not applied: _LOGGER.warning( From ce4b1bb36852b20088f49f34418a71c25faf57ed Mon Sep 17 00:00:00 2001 From: dbogunowicz <97082108+dbogunowicz@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:10:16 +0100 Subject: [PATCH 2/2] Update src/sparseml/transformers/export.py --- src/sparseml/transformers/export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sparseml/transformers/export.py b/src/sparseml/transformers/export.py index 052608e82ca..0ef3f82c7d8 100644 --- a/src/sparseml/transformers/export.py +++ b/src/sparseml/transformers/export.py @@ -340,7 +340,7 @@ def export_transformer_to_onnx( applied = trainer.apply_manager(epoch=math.inf, checkpoint=None) except ValueError as e: raise ValueError( - f"Failed to applied the recipy to the " + f"Failed to apply the recipe to the " f"model with the exception message:\n{e}\n" "It is possible, that there are missing modules " "specific to the model, that were not properly loaded. "