[Proposal] Type hint support for self.model
in ActivationCache
#830
Labels
complexity-moderate
Moderately complicated issues for people who have intermediate experience with the code
Milestone
Proposal
I propose to do a simple refractoring of the class
HookedTransformer
to support type hints for themodel
attribute in theActivationCache
class.Motivation
I am frastrated by the lack of type hinting for
self.model
in theActivationCache
class. I think the current state is that we want to avoid circular imports, but I think we can do better.Pitch
Create a class, say
HookedTransformerMixin
, that holds all methods without accessing to the definition ofActivationCache
. Currently only the functionrun_with_cache
access theActivationCache
class.In
transformer_lens/ActivationCache.py
, we could importHookedTransformerMixin
to provide type hint. Intransformer_lens/HookedTransformer.py
,HookedTransformer
could inheritHookedTransformerMixin
and import fromActivationCache
.Checklist
The text was updated successfully, but these errors were encountered: