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

[Minor] Fix use_cache flag propagation #172

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyvene/models/intervenable_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ def forward(
labels: Optional[torch.LongTensor] = None,
output_original_output: Optional[bool] = False,
return_dict: Optional[bool] = None,
use_cache: Optional[bool] = True,
use_cache: Optional[bool] = None,
):
activations_sources = source_representations
if sources is not None and not isinstance(sources, list):
Expand Down Expand Up @@ -1017,7 +1017,7 @@ def forward(
model_kwargs = {}
if labels is not None: # for training
model_kwargs["labels"] = labels
if 'use_cache' in self.model.config.to_dict(): # for transformer models
if use_cache is not None and 'use_cache' in self.model.config.to_dict(): # for transformer models
model_kwargs["use_cache"] = use_cache

if self.mode == "parallel":
Expand Down
Loading