Skip to content

Commit

Permalink
Merge pull request #13 from PolymathicAI/tutorial
Browse files Browse the repository at this point in the history
fixed tutorial
  • Loading branch information
lhparker1 authored Nov 2, 2023
2 parents cb92c5c + bc45957 commit 843a09f
Show file tree
Hide file tree
Showing 2 changed files with 256 additions and 307 deletions.
557 changes: 254 additions & 303 deletions notebooks/tutorial/AstroCLIPTutorial.ipynb

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions notebooks/tutorial/tutorial_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ def forward(
pos_emb = self.position_embed(pos) # to shape (t, embedding_dim)

x = self.dropout(data_emb + pos_emb)
embeddings = []
for block in self.blocks:
x = block(x)
embeddings.append(x.detach().clone())
x = self.final_layernorm(x)
embedding = x.detach().clone()

preds = self.head(x)
if y is not None:
Expand All @@ -66,7 +65,7 @@ def forward(
else:
loss = None

return {"preds": preds, "loss": loss, "embeddings": embeddings}
return {"preds": preds, "loss": loss, "embedding": embedding}

def slice(x, section_length=10, overlap=5):

Expand All @@ -79,7 +78,6 @@ def slice(x, section_length=10, overlap=5):

return torch.cat(sections, 1)


def fnc(x):
std, mean = x.std(1, keepdim=True).clip_(0.2), x.mean(1, keepdim=True)
x = (x - mean) / std
Expand Down

0 comments on commit 843a09f

Please sign in to comment.