Skip to content
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

Merged
merged 12 commits into from
Dec 15, 2024

Conversation

DRosen766
Copy link

@DRosen766 DRosen766 commented Dec 12, 2024

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 here

but nowhere during loading.

To fix this, I added a call to os.path.expanduser in the Dataset class's init

I 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.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.49%. Comparing base (a4e8a45) to head (30d993b).
Report is 72 commits behind head on develop.

❗ 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.
📢 Have feedback on the report? Share it here.

Comment on lines +10 to +11
TEST_LOCATION_ON_SYSTEM = "~/../../tmp"
TEST_LOCATION_ON_SYSTEM = os.path.expanduser(TEST_LOCATION_ON_SYSTEM)
Copy link
Member

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

@fabrizio-ottati
Copy link
Collaborator

fabrizio-ottati commented Dec 14, 2024 via email

@DRosen766
Copy link
Author

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
Yea that was my reasoning for leaving it as a hardcoded value. I just converted it to a global constant to avoid several magic constants with the same value.

I can parameterize it with various paths but since there is no parameterization I left it as one value.

@biphasic biphasic merged commit 82ff84c into neuromorphs:develop Dec 15, 2024
9 checks passed
@DRosen766 DRosen766 deleted the fix_tilde_in_dataset_path branch December 15, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants