-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add spam dataloader #37
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @Prateek0xeo !
I added some review comments.
@dfalbel Thank you for the feedback!
If additional modifications are needed, please let me know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Prateek0xeo
Thanks for updating the PR! I added a couple more comments.
Can you also add the dataset to the Readme table?
@@ -0,0 +1,16 @@ | |||
if (requireNamespace("testthat", quietly = TRUE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this require statement here. devtools::test()
will make sure testthat is laoded.
|
||
test_that("spam_dataloader works as expected", { | ||
|
||
loader <- spam_dataloader(download = TRUE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably need to update the test cases, as spam_dataloader
is now called spam_dataset
.
R/spam-dataloader.R
Outdated
x = torch_tensor(x, dtype = torch_float()), | ||
y = torch_tensor(y, dtype = torch_long()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely to work in most scenarios because torch would already be loaded but in any case, we should prefix the call with:
x = torch_tensor(x, dtype = torch_float()), | |
y = torch_tensor(y, dtype = torch_long()) | |
x = torch::torch_tensor(x, dtype = torch_float()), | |
y = torch::torch_tensor(y, dtype = torch_long()) |
@dfalbel I have updated the PR in accordance to the new requests made |
This PR refactors the spam_dataloader function and introduces robust unit tests to ensure it meets expected functionality.
Results:
All test cases pass, confirming expected behavior of the dataloader under various scenarios.
Ensures compatibility with the Spam dataset structure and Torch requirements.