Skip to content

Fix wave training script imports#45

Merged
pderrenger merged 2 commits into
mainfrom
update-format-headers-redirects-20260612201348
Jun 12, 2026
Merged

Fix wave training script imports#45
pderrenger merged 2 commits into
mainfrom
update-format-headers-redirects-20260612201348

Conversation

@pderrenger

@pderrenger pderrenger commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • replace star imports in training scripts with explicit utility imports
  • add direct numpy/torch imports for names used by the scripts
  • format the affected utilities and scripts with Ruff

Tests

  • python -m ruff check gcp/wave_pytorch_gcp.py train.py train_tf.py utils/utils.py utils/torch_utils.py
  • python -m ruff format gcp/wave_pytorch_gcp.py train.py train_tf.py utils/utils.py utils/torch_utils.py
  • python -m compileall -q gcp/wave_pytorch_gcp.py train.py train_tf.py utils/utils.py utils/torch_utils.py
  • git diff --check

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

🧹 This PR mainly cleans up and standardizes the ultralytics/wave training scripts, improving code clarity, import safety, and maintainability without changing the core training behavior.

📊 Key Changes

  • ✅ Replaced wildcard imports with explicit imports in PyTorch, TensorFlow, and GCP scripts:
    • from utils import * → targeted function imports
    • from utils.torch_utils import * and from utils.utils import * → explicit named imports
  • 📦 Added missing direct imports for numpy and torch where they were already being used.
  • 🔇 Renamed unused variables like nz, nx, and ymu to _nz, _nx, and _ymu to make it clear they are intentionally unused.
  • ✨ Improved string formatting consistency using safer f-string patterns like f"{a!s}" and f"{i!s}".
  • 📚 Reformatted several long lines and nested calls for better readability, including:
    • scipy.io.savemat(...)
    • TensorFlow apply_gradients(...)
    • Plotly layout definitions
    • PyTorch convolution layer definitions
    • large list definitions in experiment settings
  • 🧩 Reformatted splitdata() to return values across multiple lines for easier reading.
  • 📝 Minor README formatting cleanup for dependency setup.

🎯 Purpose & Impact

  • 👀 Makes the codebase easier to read and understand for new contributors and researchers.
  • 🛡️ Reduces risks from wildcard imports, which can hide dependencies and cause naming conflicts.
  • 🔧 Improves maintainability by making module dependencies explicit and code style more consistent.
  • 🚀 Helps future development and debugging by clarifying which variables are used and which are not.
  • 📈 Likely no major user-facing behavior change, but it should make the project more stable and easier to extend over time.

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working fixed Bug has been resolved priority: low Low urgency; can wait behind higher-priority work. labels Jun 12, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @pderrenger, thank you for submitting a ultralytics/wave 🚀 PR! This is an automated message to help with review readiness, and an engineer will assist shortly. Please review the checklist below to help ensure a smooth merge ✨

-✅ Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
-✅ Synchronize with Source: Confirm your PR is synchronized with the ultralytics/wave main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
-✅ Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
-✅ Update Documentation: Update the relevant documentation for any new or modified features.
-✅ Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
-✅ Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
-✅ Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review

Made with ❤️ by Ultralytics Actions

PR looks clean. The diff is limited to explicit import fixes, adding missing NumPy/Torch imports, and non-functional formatting/cleanup changes, and I did not find any genuine issues in the changed lines.

@pderrenger pderrenger merged commit 397c34d into main Jun 12, 2026
4 checks passed
@pderrenger pderrenger deleted the update-format-headers-redirects-20260612201348 branch June 12, 2026 20:30
@UltralyticsAssistant

Copy link
Copy Markdown
Member

Merged — great cleanup work by @pderrenger, with contributions from @glenn-jocher. 🎉

As Leonardo da Vinci said, “Simplicity is the ultimate sophistication.” This PR reflects that well: clearer imports, safer dependencies, improved readability, and more consistent formatting all make ultralytics/wave easier to maintain and extend without changing its core behavior.

Thanks for helping strengthen the codebase in ways that will benefit every future contributor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixed Bug has been resolved priority: low Low urgency; can wait behind higher-priority work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants