peft.Interceptor

peft.Interceptor#

class gemma.peft.Interceptor[source]

Bases: etils.epy.contextlib.ContextManager, abc.ABC

Base class for interceptors.

Subclasses can be used as context managers like:

with MyInterceptor():
  y = nn.Dense(10)(x)
abstractmethod interceptor(
next_fun,
args,
kwargs,
context: flax.linen.module.InterceptorContext,
)[source]

Returns the names of the methods to intercept.