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 Python 3.11 to CI tests #91

Merged
merged 18 commits into from
Feb 19, 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
fix connectionreseterror
  • Loading branch information
AlexWan0 committed Feb 19, 2023
commit bfb795527e59c4867891d58d8df748347a575597
9 changes: 7 additions & 2 deletions elk/extraction/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ def reduce_seqs(
output_hidden_states=True,
)
# [batch_size, num_layers, num_choices, hidden_size]
# need to convert hidden states to numpy array first or
# you get a ConnectionResetErrror
queue.put(
{
"hiddens": torch.stack(outputs.decoder_hidden_states, dim=2),
"hiddens": torch.stack(outputs.decoder_hidden_states, dim=2).cpu().numpy(),
"labels": labels,
}
)
Expand All @@ -228,9 +230,12 @@ def reduce_seqs(

# Skip the input embeddings which are unlikely to be interesting
h = model(**choices, output_hidden_states=True).hidden_states[1:]

# need to convert hidden states to numpy array first or
# you get a ConnectionResetErrror
queue.put(
{
"hiddens": reduce_seqs(h, choices["attention_mask"]),
"hiddens": reduce_seqs(h, choices["attention_mask"]).cpu().numpy(),
"labels": labels,
}
)