Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

TextEmbedder._get_sentence_embedding returned a raw Tensor for aggregation_method='first'/'last' but a dict for 'mean', causing crashes when the caller accessed out["sentence_embedding"].

Changes:

  • Return consistent dict structure {"sentence_embedding": Tensor, "label_attention_matrix": None} for all aggregation methods
  • Fix indexing bug in 'last' aggregation: add .long() conversion to lengths tensor
  • Update return type annotation from torch.Tensor to dict[str, Optional[torch.Tensor]]

Before:

if self.attention_config.aggregation_method == "first":
    return token_embeddings[:, 0, :]  # Raw tensor

After:

if self.attention_config.aggregation_method == "first":
    return {
        "sentence_embedding": token_embeddings[:, 0, :],
        "label_attention_matrix": None,
    }

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 27, 2026 10:19
…r all aggregation methods

Co-authored-by: meilame-tayebjee <114609737+meilame-tayebjee@users.noreply.github.com>
…dict return

Co-authored-by: meilame-tayebjee <114609737+meilame-tayebjee@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add cross attention labels based on feedback Fix inconsistent return type in TextEmbedder._get_sentence_embedding Jan 27, 2026
@meilame-tayebjee meilame-tayebjee deleted the copilot/sub-pr-60-another-one branch January 27, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants