Repository navigation
[Python][ML] Accept file paths as input of the RDataLoader - #23765
Open
siliataider wants to merge 4 commits into
Open
siliataider wants to merge 4 commits into
siliataider wants to merge 4 commits into
Conversation
siliataider
force-pushed
the
rdataloader-from-files
branch
from
October 20, 2026 10:04
0afd40f to
6af7a44
Compare
Test Results 23 files 23 suites 3d 19h 15m 14s ⏱️ For more details on these failures, see this check. Results for commit 2deed51. ♻️ This comment has been updated with latest results. |
siliataider
force-pushed
the
rdataloader-from-files
branch
from
October 20, 2026 16:51
6af7a44 to
7493430
Compare
vepadulano
requested changes
Oct 21, 2026
vepadulano
left a comment
Member
There was a problem hiding this comment.
Thanks! Some minor considerations to discuss before final approval.
siliataider
force-pushed
the
rdataloader-from-files
branch
from
October 21, 2026 12:30
e550bc9 to
40ee506
Compare
siliataider
force-pushed
the
rdataloader-from-files
branch
2 times, most recently
from
October 22, 2026 10:42
6e1320c to
48ce7fb
Compare
vepadulano
requested changes
Oct 22, 2026
siliataider
force-pushed
the
rdataloader-from-files
branch
from
October 22, 2026 13:30
48ce7fb to
117d735
Compare
vepadulano
approved these changes
Oct 22, 2026
vepadulano
left a comment
Member
There was a problem hiding this comment.
Thank you! I believe the interface looks much cleaner now and it should also be pretty sturdy!
siliataider
force-pushed
the
rdataloader-from-files
branch
from
October 22, 2026 17:25
117d735 to
2deed51
Compare
Member
|
Just wanted to note that at least from my side I see also the commit from this other PR #23788 as the first commit in this PR now. |
Contributor
Author
|
Thanks! Just solving a merge conflict, will rebase on master once the other PR is merged :) |
Assisted-by: Claude Opus 5.5
siliataider
force-pushed
the
rdataloader-from-files
branch
from
October 23, 2026 09:05
2deed51 to
ee28904
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This Pull request:
Changes or fixes:
The
RDataLoadercan now be created directly from files without building theRDataFramemanually first. The first argument accepts a(dataset_name, files)tuple, wheredataset_namenames the TTree or RNTuple to read andfilesis a file path (astror anyos.PathLike) or a list of them. Internally, each tuple is turned into oneROOT.RDataFrame(dataset_name, files). A list of tuples gives one RDataFrame per tuple, and tuples can be mixed with RDataFrames.Everything works as before,
RDataFramejust becomes an implementation detail in this case without the user interacting with it.Demo:
A file path given without the name of the dataset raises a
TypeError, and giving no input at all now raises aValueError.All the arguments but the inputs are now keyword-only, e.g.
RDataLoader(df, batch_size=64)instead ofRDataLoader(df, 64). The tutorials passing them by position are updated accordingly.Note
The files of one tuple give a single dataset, like
RDataFrame(dataset_name, files). Resampling withsampling_typeneeds two datasets, so two tuples (or two RDataFrames).Accepted inputs
Below,
tis the name of the TTree or RNTuple,f,f1andf2are file paths anddfis an RDataFrame.df,[df1, df2]("t", "f"),("t", Path("f"))tfrom one file("t", ["f1", "f2"]),("t", ("f1", Path("f2"))),("t", (f for f in files))tfrom several files, as one dataset("t", "f*.root")tfrom the files matching the glob[("t", "f1"), ("t", "f2")][("t", "f"), df](spec for spec in specs)None,[],(),iter([]),(df for df in [])ValueError: Detected empty input, at least one valid input is required."f",Path("f"),["f1", "f2"]TypeError: File paths are given together with the dataset to read, as (dataset_name, files) tuples["t", "f"](list instead of tuple),("t", "f1", "f2"),("t",)TypeError(Path("t"), "f"),(1, "f")(dataset name not astr),{"t": "f"}TypeError("t", 42)TypeError: 'int' object is not iterable("t", ["f", 3])TypeError: expected str, bytes or os.PathLike object, not int42,3.14,True,[1, 2],[[df]],b"f"TypeErrorfromRDataFrame:Failed to instantiate ...("t", "missing.root"),("t", []),("missing", "f")TypeErrorfrom theRDataFrameconstructor, with the reason in the details, e.g.could not open file "missing.root"orempty list of input filesNote
Since the backend is created lazily, these errors are raised on the first
as_numpy(),as_torch(),as_tensorflow(),train_test_split()orsave()call, not when theRDataLoaderis constructed.Checklist: