-
Notifications
You must be signed in to change notification settings - Fork 320
Fixed SMoG examples #1876
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
Fixed SMoG examples #1876
Conversation
|
Hey @thomasmarchioro3 and thank you for the contribution! We will have a look at your PR in the next few days :) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1876 +/- ##
=========================================
Coverage ? 86.07%
=========================================
Files ? 167
Lines ? 6966
Branches ? 0
=========================================
Hits ? 5996
Misses ? 970
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @thomasmarchioro3, thank you for your contribution! Quick note: in
Then the "check example notebooks" test will pass. |
yutong-xiang-97
left a comment
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.
Great catch in finding the dimension mistake!
For scikit-learn dependency, your solution is sufficient since SMoG is not officially added to LightlySSL yet, and it is not used anywhere else.
|
Thanks for the suggestions! I hadn't notice that the feature tensor was being transposed in I also have removed the |
yutong-xiang-97
left a comment
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.
Approved!
This PR addresses some minor fixes in the SMoG example scripts and notebook (
examples/notebooks/pytorch/smog.ipynb,examples/notebooks/pytorch_lightning/smog.ipynb,examples/pytorch/smog.py,examples/pytorch_lightning/smog.py):OS and enviroment:
Fix 1: Missing
scikit-learnrequirementscikit-learnwas not listed in the example dependencies, leading toImportErrorwhen running the code.scikit-learn>=1.7.1to the example installation instructions.Note: Consider also adding this to the default dependencies in
pyproject.toml.Fix 2: KMeans
ValueErrordue to incorrect tensor shapecaused by an incorrect array shape — features were shaped
(num_features, memory_size)instead of(memory_size, num_features).Fix 3: Incorrect import in pytorch_lightning examples
Additional minor fixes
#type: ignorewhen convertingfeaturesfrom tensor to numpy array to avoid warnings from the language server