mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Fix Switch Transformers When sparse_step = 1 (#28564)
Fix sparse_step = 1 I case sparse_step = 1, the current code will not work.
This commit is contained in:
parent
fa6d12f74f
commit
98dda8ed03
@ -898,7 +898,7 @@ class SwitchTransformersStack(SwitchTransformersPreTrainedModel):
|
||||
config.num_layers = config.num_decoder_layers if self.is_decoder else config.num_layers
|
||||
self.block = nn.ModuleList()
|
||||
for i in range(config.num_layers):
|
||||
is_sparse = (i % sparse_step == 1) if sparse_step > 0 else False
|
||||
is_sparse = (i % sparse_step == 1 or sparse_step == 1) if sparse_step > 0 else False
|
||||
|
||||
self.block.append(
|
||||
SwitchTransformersBlock(config, has_relative_attention_bias=bool(i == 0), is_sparse=is_sparse)
|
||||
|
Loading…
Reference in New Issue
Block a user