Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,4 @@ example_files/
_site/
.quarto/
**/*.quarto_ipynb
my_ttc/
4 changes: 3 additions & 1 deletion torchTextClassifiers/model/components/text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ def forward(self, token_embeddings, compute_attention_matrix: Optional[bool] = F
compute_attention_matrix = bool(compute_attention_matrix)

# 1. Create label indices [0, 1, ..., C-1] for the whole batch
label_indices = torch.arange(self.num_classes).expand(B, -1)
label_indices = torch.arange(
self.num_classes, dtype=torch.long, device=token_embeddings.device
).expand(B, -1)

all_label_embeddings = self.label_embeds(
label_indices
Expand Down