Skip to content

Commit

Permalink
further improve error message of wrong hard coded splits
Browse files Browse the repository at this point in the history
Signed-off-by: dafnapension <[email protected]>
  • Loading branch information
dafnapension committed Feb 8, 2025
1 parent 007be74 commit e5755f5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/unitxt/test_utils/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ def load_examples_from_dataset_recipe(card, template_card_index, debug, **kwargs
and loader.splits is not None
and isinstance(loader.splits, list)
):
endms = recipe()
keys_endms = str(sorted(endms.keys()))
loaded_splits = loader()
keys_loaded_splits = str(sorted(loaded_splits.keys()))
saved_splits = loader.splits
loader.splits = None
non_splits_endms = recipe()
keys_non_splits_endms = str(sorted(non_splits_endms.keys()))
non_splits_loaded_splits = loader()
keys_non_splits_loaded_splits = str(sorted(non_splits_loaded_splits.keys()))
loader.splits = saved_splits
assert (
keys_endms == keys_non_splits_endms
), f"splits names {non_splits_endms}, at end of recipe() when starting with self.splits=None, are different from {keys_endms} -- obtained at the end of recipe() when starting with the hard coded splits: {saved_splits} for card of path {loader.path}"
keys_loaded_splits == keys_non_splits_loaded_splits
), f"splits names {keys_non_splits_loaded_splits}, at end of loader() when starting with self.splits=None, are different from {keys_loaded_splits} -- obtained at the end of loader() when starting with the hard coded splits: {saved_splits}, for card of path {loader.path}"

logger.info(f"Using these card recipe parameters: {kwargs}")

Expand Down

0 comments on commit e5755f5

Please sign in to comment.