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

Add hyperparamter sweep to sweep.py; Fall back to eig when eigh fails #235

Merged
merged 15 commits into from
May 5, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove superfluous assert
  • Loading branch information
norabelrose committed May 5, 2023
commit c5980a40d7450c90bb036d6b255faa9ce87cd9d2
11 changes: 0 additions & 11 deletions elk/training/eigen_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ def consistency(self) -> Tensor:

@torch.no_grad()
def update(self, hiddens: Tensor) -> None:
assert (
self.contrastive_xcov_M2 is not None
and self.intercluster_cov_M2 is not None
and self.intracluster_cov is not None
), "Covariance matrices have been deleted"

(n, _, k, d) = hiddens.shape

# Sanity checks
Expand Down Expand Up @@ -231,11 +225,6 @@ def update(self, hiddens: Tensor) -> None:
def fit_streaming(self, truncated: bool = False) -> float:
"""Fit the probe using the current streaming statistics."""
inv_weight = 1 - self.config.neg_cov_weight
assert (
self.contrastive_xcov_M2 is not None
and self.intercluster_cov_M2 is not None
and self.intracluster_cov is not None
), "Covariance matrices have been deleted"
A = (
self.config.var_weight * self.intercluster_cov
- inv_weight * self.intracluster_cov
Expand Down