Skip to content

Conversation

@pggPL
Copy link
Collaborator

@pggPL pggPL commented Sep 30, 2025

Description

This PR adds short custom feature tutorial to precision debug tools docs.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

  • Infra/Build change

  • Code refactoring

  • I have read and followed the contributing guidelines

  • The functionality is complete

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation

  • My changes generate no new warnings

  • I have added tests that prove my fix is effective or that my feature works

  • New and existing unit tests pass locally with my changes

pggPL and others added 10 commits September 30, 2025 10:41
Signed-off-by: Pawel Gadzinski <[email protected]>
Signed-off-by: Pawel Gadzinski <[email protected]>
Signed-off-by: Pawel Gadzinski <[email protected]>
Signed-off-by: Pawel Gadzinski <[email protected]>
Signed-off-by: Pawel Gadzinski <[email protected]>
Signed-off-by: Pawel Gadzinski <[email protected]>
Signed-off-by: Pawel Gadzinski <[email protected]>
@pggPL
Copy link
Collaborator Author

pggPL commented Oct 17, 2025

It's better to debug this PR with docs generated, instead of looking into changes.

pggPL added 2 commits October 17, 2025 16:31
Signed-off-by: Pawel Gadzinski <[email protected]>
Signed-off-by: Pawel Gadzinski <[email protected]>
@ptrendx ptrendx requested a review from Copilot October 23, 2025 23:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a tutorial for creating custom features in PyTorch debug tools, demonstrating how to implement and use a custom PercentageGreaterThanThreshold feature.

  • Adds a custom feature implementation that calculates the percentage of tensor values exceeding a threshold
  • Provides utility functions for plotting statistics from debug logs
  • Includes YAML configuration example showing how to enable custom features alongside built-in ones

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
docs/debug/custom_feature_dir/percentage_greater_than_threshold.py Implements the custom PercentageGreaterThanThreshold feature class with tensor inspection methods
docs/debug/custom_feature_dir/utils.py Provides plotting utilities to visualize statistics from debug logs
docs/debug/custom_feature_dir/custom_feature_example_config.yaml Configuration file demonstrating how to enable both custom and built-in features
docs/debug.rst Adds reference to the new custom feature tutorial notebook

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +32 to +33
rowwise_quantized_tensor: Optional[torch.Tensor | QuantizedTensor] = None,
columnwise_quantized_tensor: Optional[torch.Tensor | QuantizedTensor] = None,
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

The union type syntax torch.Tensor | QuantizedTensor uses Python 3.10+ syntax. Consider using Union[torch.Tensor, QuantizedTensor] from the typing module for better backward compatibility, especially since Optional from typing is already imported.

Copilot uses AI. Check for mistakes.
custom_feature_values = []

with open(stat_file, "r") as f:
import re
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

The import re statement should be moved to the top of the file with other imports (after line 9) following Python's PEP 8 style guidelines.

Copilot uses AI. Check for mistakes.
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.

1 participant