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

Val list -> tensor bugfix #152

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions open_lm/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self):

def reset(self):
self.points = []
self.points_tensor = None

def update(self, val):
self.points.append(val)
Expand All @@ -53,13 +54,13 @@ def compute_bootstrap_ci(self, num_samples=10_000, interval=95):
lower = None
upper = None

points_tensor = torch.cat(self.points)
num_points = self.points.shape[0]
self.points_tensor = torch.cat(self.points)
num_points = self.points_tensor.shape[0]

estimates = []
for _ in range(num_samples):
i = np.random.choice(num_points, size=num_points)
estimate = torch.sum(points_tensor[i]) / num_points
estimate = torch.sum(self.points_tensor[i]) / num_points
estimates.append(estimate.item())

half = (100 - interval) / 2
Expand Down Expand Up @@ -384,8 +385,8 @@ def evaluate(model, data, start_epoch, args, writer):

lower_seq, upper_seq = losses_seq_ci_m.compute_bootstrap_ci()
lower_tok, upper_tok = losses_tok_ci_m.compute_bootstrap_ci()
num_seqs = losses_seq_ci_m.points.shape[0]
num_toks = losses_tok_ci_m.points.shape[0]
num_seqs = losses_seq_ci_m.points_tensor.shape[0]
num_toks = losses_tok_ci_m.points_tensor.shape[0]

# Save eval loss / etc.
log_data = {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _read_reqs(relpath):

setuptools.setup(
name="open_lm",
version="0.0.21",
version="0.0.22",
author=[
"Suchin Gururangan*",
"Mitchell Wortsman*",
Expand Down
Loading