Upload loaders.py with huggingface_hub
Browse files12327 unmodified lines31323334353637import importlibimport itertoolsimport os27 unmodified lines# The loader can use this value to limit the amount of data downloaded from the source# to reduce loading time. However, this may not always be possible, so the# loader may ingore this. In any case, the recipe, will limit the number of instances in the returned# stream after, after load is complete.loader_limit: int = Nonepass12345678910111213141516171819202122232425262727 unmodified lines55565758596061"""This section describes unitxt loaders.Loaders: Generators of Unitxt Multistreams from existing date sources==============================================================Unitxt is all about readily preparing of any given data source for feeding into any given language model, and then,postprocessing the model's output, preparing it for any given evaluator.Through that journey, the data advances in the form of Unitxt Multistream, undergoing a sequential applicationof various off the shelf operators (i.e, picked from Unitxt catalog), or operators easily implemented by inheriting.The journey starts by a Unitxt Loeader bearing a Multistream from the given datasource.A loader, therefore, is the first item on any Unitxt Recipe.Unitxt catalog contains several loaders for the most popular datasource formats.All these loaders inherit from Loader, and hence, implementing a loader to expand over a new type of datasource, isstraight forward.Operators in Unitxt catalog:LoadHF : loads from Huggingface dataset.LoadCSV: loads from csv (comma separated value) filesLoadFromKaggle: loads datasets from the kaggle.com community siteLoadFromIBMCloud: loads a dataset from the IBM cloud.------------------------"""import importlibimport itertoolsimport os27 unmodified lines# The loader can use this value to limit the amount of data downloaded from the source# to reduce loading time. However, this may not always be possible, so the# loader may ingore this. In any case, the recipe, will limit the number of instances in the returned# stream, after load is complete.loader_limit: int = Nonepass
loaders.py+25-1