-
Notifications
You must be signed in to change notification settings - Fork 2
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
New modular lenses #48
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request improves lens modularity and adds new lenses. It also updates the tutorial notebook to use the new LczeroBoard class and adds a MODE variable to select the execution environment. Class diagram for the updated lens architectureclassDiagram
class Lens {
<<abstract>>
-_lens_type: str
-_registry: Dict[str, Type[Lens]]
+is_compatible(model: LczeroModel): bool
+prepare(model: LczeroModel): LczeroModel
+analyse(model: LczeroModel, *inputs): dict
+analyse_batched(model: LczeroModel, iter_inputs): Generator
#_intervene(model: LczeroModel): dict*
}
class ActivationLens {
-_reg_exp: Pattern
+__init__(pattern: str)
#_get_modules(model: Module)
#_intervene(model: LczeroModel): dict
}
class ProbingLens {
-_probe_fn: Callable
-_reg_exp: Pattern
+__init__(probe_fn: Callable, pattern: str)
#_get_modules(model: Module)
#_intervene(model: LczeroModel): dict
}
class CompositeLens {
-lenses: List[Lens]
+__init__(lenses: List[Lens])
+is_compatible(model: LczeroModel): bool
+prepare(model: LczeroModel): LczeroModel
#_intervene(model: LczeroModel): dict
}
class OutputLens {
#_intervene(model: LczeroModel): dict
}
class GradientLens {
#_intervene(model: LczeroModel): dict
}
Lens <|-- ActivationLens
Lens <|-- ProbingLens
Lens <|-- CompositeLens
Lens <|-- OutputLens
Lens <|-- GradientLens
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @Xmaster6y - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please clarify why ActivationBuffer was removed and where that functionality is now handled.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
What does this PR do?
Improve lens modularity and add new lenses.
Linked Issues
N/A
Summary by Sourcery
Refactor the lczerolens library to improve modularity. Update the tutorial notebook to reflect these changes.
New Features:
CompositeLens
,GradientLens
, andOutputLens
.Enhancements:
Tests: