Fix: Unpack dataset_config dictionary when calling load_dataset #706
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses an issue in the dataset loading logic where
args.dataset_config, if it is a dictionary, is not being correctly unpacked.The
datasets.load_datasetfunction expects configuration parameters (likename,split,data_files, etc.) to be passed as keyword arguments. When these arguments are grouped into a dictionary, it must be unpacked with**to be passed correctly.This change modifies the function call to use
**args.dataset_config, ensuring that dictionary-based configurations are properly applied.Change Details
if args.dataset_name and not args.dataset_mixture: logger.info(f"Loading dataset: {args.dataset_name}") - return datasets.load_dataset(args.dataset_name, args.dataset_config) + return datasets.load_dataset(args.dataset_name, **args.dataset_config) elif args.dataset_mixture: logger.info(f"Creating dataset mixture with {len(args.dataset_mixture.datasets)} datasets") seed = args.dataset_mixture.seedThis ensures that if
args.dataset_configis, for example,{'name': 'en', 'split': 'train'}, the call becomesload_dataset(dataset_name, name='en', split='train')instead of an incorrectload_dataset(dataset_name, {'name': 'en', 'split': 'train'}).