From c36e2e2d060b3ebb79b7a987a08e454e90deda72 Mon Sep 17 00:00:00 2001 From: Michael Benayoun Date: Tue, 17 Dec 2024 19:48:40 +0100 Subject: [PATCH] Trying to fix the doc --- optimum/exporters/executorch/__init__.py | 3 +++ tests/executorch/runtime/test_modeling.py | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/optimum/exporters/executorch/__init__.py b/optimum/exporters/executorch/__init__.py index cbdd2bfc0a..6759072370 100644 --- a/optimum/exporters/executorch/__init__.py +++ b/optimum/exporters/executorch/__init__.py @@ -27,6 +27,9 @@ "discover_tasks", "register_task", ], + "xnnpack": [ + "export_to_executorch_with_xnnpack", + ], "__main__": ["main_export"], } diff --git a/tests/executorch/runtime/test_modeling.py b/tests/executorch/runtime/test_modeling.py index a73c82a496..d8c6e1bb49 100644 --- a/tests/executorch/runtime/test_modeling.py +++ b/tests/executorch/runtime/test_modeling.py @@ -21,7 +21,6 @@ from executorch.extension.pybindings.portable_lib import ExecuTorchModule from transformers import AutoTokenizer from transformers.testing_utils import ( - require_read_token, slow, ) @@ -107,9 +106,9 @@ def test_llama3_2_3b_text_generation_with_xnnpack(self): self.assertIsInstance(model.model, ExecuTorchModule) EXPECTED_GENERATED_TEXT = ( - "Simply put, the theory of relativity states that the speed of light is constant. This " - "means that no matter how fast you are traveling, the speed of light will always be " - "186,000 miles per second." + "Simply put, the theory of relativity states that time is relative and can be affected " + "by an object's speed. This theory was developed by Albert Einstein in the early 20th " + "century. The theory has two parts" ) tokenizer = AutoTokenizer.from_pretrained(model_id) generated_text = model.text_generation( @@ -155,7 +154,9 @@ def test_gemma2_text_generation_with_xnnpack(self): self.assertIsInstance(model, ExecuTorchModelForCausalLM) self.assertIsInstance(model.model, ExecuTorchModule) - EXPECTED_GENERATED_TEXT = "Hello I am doing a project for my school. I need help with my science homework" + EXPECTED_GENERATED_TEXT = ( + "Hello I am doing a project for my school and I need to make sure it is a great to be creative and I can!" + ) tokenizer = AutoTokenizer.from_pretrained(model_id) generated_text = model.text_generation( tokenizer=tokenizer, @@ -178,7 +179,7 @@ def test_gemma_text_generation_with_xnnpack(self): self.assertIsInstance(model, ExecuTorchModelForCausalLM) self.assertIsInstance(model.model, ExecuTorchModule) - EXPECTED_GENERATED_TEXT = "Hello I am doing a project for my school and I need to make a 3D model of a car." + EXPECTED_GENERATED_TEXT = "Hello I am doing a project for my school and I need to write a report on the history of the United States." tokenizer = AutoTokenizer.from_pretrained(model_id) generated_text = model.text_generation( tokenizer=tokenizer,