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

feat: refactor metrics and switch to ruff #64

Merged
merged 4 commits into from
Jan 24, 2025
Merged

Conversation

CuriousDolphin
Copy link
Member

@CuriousDolphin CuriousDolphin commented Jan 22, 2025

Enhance Model Training Monitoring and Integrate Ruff

CONTEXT

This PR was created to modernize the development toolchain and improve the model training monitoring capabilities. The existing linting tools were fragmented, and the model training lacked comprehensive monitoring and visualization features.

KEY CHANGES

  • Development Tools

    • Replaced multiple linting tools (isort, black, flake8) with Ruff for unified linting and formatting.
    • Updated pre-commit hooks to include Ruff and removed redundant hooks.
    • Updated Makefile to streamline virtual environment creation and linting processes.
  • Model Training & Monitoring

    • Introduced MetricsVisualizer class for enhanced training metrics visualization.
    • Refactored RemoteModel class to improve training monitoring.
    • Added notebook_monitor_train method for real-time training monitoring in Jupyter notebooks.
    • Removed deprecated anyma_version parameter from model training configuration.
  • Code Quality & Structure

    • Refactored code for better readability and consistency.
    • Improved error handling and logging across various modules.
    • Enhanced test coverage with new test cases for MetricsVisualizer.

IMPACT

  • Development Workflow: Developers need to update their local pre-commit hooks and VSCode settings.
  • Code Quality: Global impact on code style and formatting due to the adoption of Ruff.
  • Training Pipeline: Enhanced monitoring capabilities for model training, especially in Jupyter notebooks.
  • Testing: Improved test coverage and readability.

TECHNICAL DETAILS

Development Tools Configuration

Updated .pre-commit-config.yaml to use Ruff

New MetricsVisualizer Implementation

The MetricsVisualizer class provides methods for logging and visualizing training metrics:

class MetricsVisualizer:
def __init__(metrics:Metrics):
      pass
def log_training_metrics(self, metrics: Dict[str, float]) -> None:
"""Log training metrics for visualization"""
pass
def plot_metrics(self, metric_names: List[str]) -> None:
"""Visualize specified metrics over time"""
pass

RemoteModel Enhancements

Refactored RemoteModel class to improve monitoring:

class RemoteModel:
def train_info(self) -> Optional[TrainingInfo]:
"""Returns current training status and progress"""
pass
def notebook_monitor_train(self) -> None:
"""Provides real-time training monitoring in Jupyter"""
pass

Key Dependencies Updates

  • Added: opencv-python, matplotlib, colorama, ipython
  • Removed: isort, black, flake8
  • Updated: Various dependency versions

These changes aim to streamline the development process and enhance the model training experience with better monitoring and visualization tools.

Copy link

github-actions bot commented Jan 22, 2025

Coverage

Coverage Report •
FileStmtsMissCoverMissing
__init__.py100100% 
focoos.py1150100% 
local_model.py610100% 
ports.py2300100% 
remote_model.py1403674%227–229, 234, 238–239, 241–242, 246–247, 275–283, 285–288, 292–295, 299–304, 306–307, 364
runtime.py13810722%118–128, 130–138, 140–144, 155–157, 168–174, 186, 188, 190, 192–200, 202–211, 219–222, 224, 226, 239–244, 246, 255–258, 260, 262–263, 276–277, 279–284, 286, 295–296, 298, 300–304, 306–308, 310–315, 317–318, 328–329
utils
   logger.py320100% 
   metrics.py900100% 
   system.py80593%218–222
   vision.py730100% 
TOTAL98114884% 

Tests Skipped Failures Errors Time
100 0 💤 0 ❌ 0 🔥 4.770s ⏱️

@CuriousDolphin CuriousDolphin linked an issue Jan 23, 2025 that may be closed by this pull request
- Added new dependencies: matplotlib, colorama, and ipython for improved visualization and interactivity.
- Updated cloud training documentation to reflect changes in training job initiation and monitoring.
- Refactored training status retrieval to use a new `train_info` method, replacing the previous `train_status`.
- Introduced a `metrics` method in the RemoteModel class to fetch training metrics.
- Enhanced the `notebook_monitor_train` method to support real-time monitoring and plotting of training metrics.
- Fixed typos in class names and improved code consistency across files.
@fcdl94
Copy link
Member

fcdl94 commented Jan 24, 2025

Cosa cambia lato users? Solo la parte di metriche, giusto?

Abbiamo aggiornato la doc in modo che sia allineata?

@CuriousDolphin CuriousDolphin merged commit dea2d65 into main Jan 24, 2025
9 checks passed
@CuriousDolphin CuriousDolphin deleted the feat/update-metrics branch January 24, 2025 15:25
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.

[deps] add opencv-python 4.10.0.84 [style] switch to ruff [metrics] update with new metrics
2 participants