Skip to content

Commit

Permalink
Merge pull request #133 from moritzschaefer/main
Browse files Browse the repository at this point in the history
Fix missing `batch_first` attribute
  • Loading branch information
subercui authored Dec 12, 2023
2 parents 9f75191 + c32ce7d commit db58fca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scgpt/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ def __init__(
attention_dropout=dropout,
**factory_kwargs,
)
# Version compatibility workaround
if not hasattr(self.self_attn, "batch_first"):
self.self_attn.batch_first = batch_first
# Implementation of Feedforward model
self.linear1 = nn.Linear(d_model, dim_feedforward, **factory_kwargs)
self.dropout = nn.Dropout(dropout)
Expand Down

0 comments on commit db58fca

Please sign in to comment.