-
Notifications
You must be signed in to change notification settings - Fork 48
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
Fix tilde in dataset path #296
Fix tilde in dataset path #296
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #296 +/- ##
===========================================
+ Coverage 77.07% 77.49% +0.42%
===========================================
Files 54 55 +1
Lines 3067 3231 +164
===========================================
+ Hits 2364 2504 +140
- Misses 703 727 +24 ☔ View full report in Codecov by Sentry. |
TEST_LOCATION_ON_SYSTEM = "~/../../tmp" | ||
TEST_LOCATION_ON_SYSTEM = os.path.expanduser(TEST_LOCATION_ON_SYSTEM) |
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.
such hardcoded paths seem extremely brittle, maybe it would be worth adding a separate test for a path that includes a tilde
But this is the same as hardcoding `/tmp` on an Unix system! It’s better to use pathlib to define this path. No idea how to make it Windows friendly. On 14 Dec 2024, at 22:49, Gregor Lenz ***@***.***> wrote:
@biphasic commented on this pull request.
In test/dataset_utils.py:
+TEST_LOCATION_ON_SYSTEM = "~/../../tmp"
+TEST_LOCATION_ON_SYSTEM = os.path.expanduser(TEST_LOCATION_ON_SYSTEM)
such hardcoded paths seem extremely brittle, maybe it would be worth adding a separate test for a path that includes a tilde
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@fabrizio-ottati @biphasic I can parameterize it with various paths but since there is no parameterization I left it as one value. |
This PR corresponds to this issue: Improper Dataset Extraction when Tilde In path #295
Previously, if a tilde existed in the path passed to a dataset for saving/extraction, the dataset would not be able to recognize the location to extract after downloading. This is because the function
os.path.expanduser
was only run during extraction herebut nowhere during loading.
To fix this, I added a call to
os.path.expanduser
in the Dataset class's initI also added a global variable to the dataset_utils test to make changing the test directory easier and made a call to the
os.path.expanduser
function so it can be assigned to a tilde path and still work.All the tests work on my end locally, lmk if they fail anywhere else or if something is missing.
Also, in order to run CICD successfully, I had to update the pytorch requirements.