From 8e76bee651f19f04219c137992164a0a493341b9 Mon Sep 17 00:00:00 2001 From: Ethan Ma Date: Thu, 30 May 2024 16:19:19 -0700 Subject: [PATCH] UnknownExampleType Error Message display only keys --- llmfoundry/data/finetuning/tasks.py | 2 +- tests/data/test_dataloader.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/llmfoundry/data/finetuning/tasks.py b/llmfoundry/data/finetuning/tasks.py index b7cce4d20a..96ca17f5f4 100644 --- a/llmfoundry/data/finetuning/tasks.py +++ b/llmfoundry/data/finetuning/tasks.py @@ -148,7 +148,7 @@ def _get_example_type(example: Example) -> ExampleType: ): return 'prompt_response' else: - raise UnknownExampleTypeError(str(example.keys())) + raise UnknownExampleTypeError(str(list(example.keys()))) def _is_empty_or_nonexistent(dirpath: str) -> bool: diff --git a/tests/data/test_dataloader.py b/tests/data/test_dataloader.py index 7c8e808bab..f567aeb3ba 100644 --- a/tests/data/test_dataloader.py +++ b/tests/data/test_dataloader.py @@ -915,7 +915,8 @@ def test_malformed_data( if add_unknown_example_type: error_context = pytest.raises( UnknownExampleTypeError, - match=r'.*Unknown example type', + match= + r'\[("|\')(\w+)("|\')(?:,\s*("|\')(\w+)("|\'))*\].*Unknown example type', ) if add_too_many_example_keys: error_context = pytest.raises(