Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion src/transformers/models/afmoe/modeling_afmoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ def __init__(self, config: AfmoeConfig):
)
self.norm = AfmoeRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = AfmoeRotaryEmbedding(config=config)
self.gradient_checkpointing = False

self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/afmoe/modular_afmoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ def __init__(self, config: AfmoeConfig):
)
self.norm = AfmoeRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = AfmoeRotaryEmbedding(config=config)
self.gradient_checkpointing = False

self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/aimv2/modeling_aimv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ def __init__(self, config: Aimv2Config):
super().__init__()
self.config = config
self.layers = nn.ModuleList([Aimv2EncoderLayer(config) for _ in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

# Ignore copy
@auto_docstring
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/align/modeling_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ def __init__(self, config):
super().__init__()
self.config = config
self.layer = nn.ModuleList([AlignTextLayer(config) for i in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

@can_return_tuple
def forward(
Expand Down
2 changes: 0 additions & 2 deletions src/transformers/models/altclip/modeling_altclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ def __init__(self, config):
super().__init__()
self.config = config
self.layer = nn.ModuleList([AltRobertaLayer(config) for i in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

@can_return_tuple
def forward(
Expand Down Expand Up @@ -596,7 +595,6 @@ def __init__(self, config: AltCLIPConfig):
super().__init__()
self.config = config
self.layers = nn.ModuleList([AltCLIPEncoderLayer(config) for _ in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

@can_return_tuple
def forward(
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/apertus/modeling_apertus.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ def __init__(self, config: ApertusConfig):
)
self.norm = ApertusRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = ApertusRotaryEmbedding(config=config)
self.gradient_checkpointing = False

# Initialize weights and apply final processing
self.post_init()
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/arcee/modeling_arcee.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ def __init__(self, config: ArceeConfig):
)
self.norm = ArceeRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = ArceeRotaryEmbedding(config=config)
self.gradient_checkpointing = False

# Initialize weights and apply final processing
self.post_init()
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/aria/modeling_aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ def __init__(self, config: AriaTextConfig):
)
self.norm = AriaTextRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = AriaTextRotaryEmbedding(config=config)
self.gradient_checkpointing = False

# Initialize weights and apply final processing
self.post_init()
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/aria/modular_aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ def __init__(self, config: AriaTextConfig):
self.layers = nn.ModuleList(
[AriaTextDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
)
self.gradient_checkpointing = False

self.post_init()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ def __init__(self, config: ASTConfig):
super().__init__()
self.config = config
self.layer = nn.ModuleList([ASTLayer(config) for _ in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

def forward(self, hidden_states: torch.Tensor) -> BaseModelOutput:
for i, layer_module in enumerate(self.layer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ def __init__(self, config: AudioFlamingo3EncoderConfig):
# Ignore copy
self.avg_pooler = nn.AvgPool1d(2, stride=2)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
2 changes: 0 additions & 2 deletions src/transformers/models/autoformer/modeling_autoformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ def __init__(self, config: AutoformerConfig):
self.layers = nn.ModuleList([AutoformerEncoderLayer(config) for _ in range(config.encoder_layers)])
self.layernorm_embedding = nn.LayerNorm(config.d_model)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down Expand Up @@ -977,7 +976,6 @@ def __init__(self, config: AutoformerConfig):
# https://github.com/thuml/Autoformer/blob/e6371e24f2ae2dd53e472edefdd5814c5176f864/models/Autoformer.py#L74
self.seasonality_projection = nn.Linear(config.d_model, config.feature_size)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/bamba/modeling_bamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,6 @@ def __init__(self, config: BambaConfig):
self.final_layernorm = BambaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = BambaRotaryEmbedding(config=config)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/bamba/modular_bamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ def __init__(self, config: BambaConfig):
self.final_layernorm = BambaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = BambaRotaryEmbedding(config=config)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
3 changes: 1 addition & 2 deletions src/transformers/models/bark/modeling_bark.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ def __init__(self, config):
self.layernorm_final = nn.LayerNorm(config.hidden_size, bias=config.bias)

self.lm_head = nn.Linear(config.hidden_size, config.output_vocab_size, bias=False)
self.gradient_checkpointing = False

# Initialize weights and apply final processing
self.post_init()
Expand Down Expand Up @@ -900,7 +899,7 @@ def __init__(self, config):
for _ in range(config.n_codes_given, config.n_codes_total)
]
)
self.gradient_checkpointing = False

self.n_codes_total = config.n_codes_total

# Initialize weights and apply final processing
Expand Down
2 changes: 0 additions & 2 deletions src/transformers/models/bart/modeling_bart.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ def __init__(self, config: BartConfig):
self.layers = nn.ModuleList([BartEncoderLayer(config, layer_idx=i) for i in range(config.encoder_layers)])
self.layernorm_embedding = nn.LayerNorm(embed_dim)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down Expand Up @@ -674,7 +673,6 @@ def __init__(self, config: BartConfig):

self.layernorm_embedding = nn.LayerNorm(config.d_model)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/beit/modeling_beit.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ def __init__(self, config: BeitConfig, window_size: tuple | None = None) -> None
for i in range(config.num_hidden_layers)
]
)
self.gradient_checkpointing = False

def forward(
self,
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/bert/modeling_bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ def __init__(self, config, add_pooling_layer=True):
"""
super().__init__(config)
self.config = config
self.gradient_checkpointing = False

self.embeddings = BertEmbeddings(config)
self.encoder = BertEncoder(config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ class BertGenerationEncoder(BertGenerationPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.config = config
self.gradient_checkpointing = False

self.embeddings = BertGenerationEmbeddings(config)
self.encoder = BertEncoder(config)
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/big_bird/modeling_big_bird.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,6 @@ def __init__(self, config):
self.layer = nn.ModuleList(
[BigBirdLayer(config, seed=layer_idx) for layer_idx in range(config.num_hidden_layers)]
)
self.gradient_checkpointing = False

def set_attention_type(self, value: str):
if value not in ["original_full", "block_sparse"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,6 @@ def __init__(self, config: BigBirdPegasusConfig):
self.layers = nn.ModuleList([BigBirdPegasusEncoderLayer(config, seed=i) for i in range(config.encoder_layers)])
self.layernorm_embedding = nn.LayerNorm(embed_dim)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down Expand Up @@ -1855,7 +1854,6 @@ def __init__(self, config: BigBirdPegasusConfig):
)
self.layernorm_embedding = nn.LayerNorm(config.d_model)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/biogpt/modeling_biogpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ def __init__(self, config: BioGptConfig):
self.layers = nn.ModuleList([BioGptDecoderLayer(config, layer_idx=i) for i in range(config.num_hidden_layers)])
self.layer_norm = nn.LayerNorm(self.embed_dim)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/biogpt/modular_biogpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def __init__(self, config: BioGptConfig):
self.layers = nn.ModuleList([BioGptDecoderLayer(config, layer_idx=i) for i in range(config.num_hidden_layers)])
self.layer_norm = nn.LayerNorm(self.embed_dim)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/bitnet/modeling_bitnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ def __init__(self, config: BitNetConfig):
)
self.norm = BitNetRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = BitNetRotaryEmbedding(config=config)
self.gradient_checkpointing = False

# Initialize weights and apply final processing
self.post_init()
Expand Down
2 changes: 0 additions & 2 deletions src/transformers/models/blenderbot/modeling_blenderbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ def __init__(self, config: BlenderbotConfig):
self.layers = nn.ModuleList([BlenderbotEncoderLayer(config) for _ in range(config.encoder_layers)])
self.layer_norm = nn.LayerNorm(config.d_model)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down Expand Up @@ -627,7 +626,6 @@ def __init__(self, config: BlenderbotConfig):
)
self.layer_norm = nn.LayerNorm(config.d_model)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ def __init__(self, config: BlenderbotSmallConfig):
self.layers = nn.ModuleList([BlenderbotSmallEncoderLayer(config) for _ in range(config.encoder_layers)])
self.layernorm_embedding = nn.LayerNorm(embed_dim)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down Expand Up @@ -615,7 +614,6 @@ def __init__(self, config: BlenderbotSmallConfig):
)
self.layernorm_embedding = nn.LayerNorm(config.d_model)

self.gradient_checkpointing = False
# Initialize weights and apply final processing
self.post_init()

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/blip/modeling_blip.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ def __init__(self, config: BlipConfig):
super().__init__()
self.config = config
self.layers = nn.ModuleList([BlipEncoderLayer(config) for _ in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

@auto_docstring
def forward(
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/blip/modeling_blip_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ def __init__(self, config):
super().__init__()
self.config = config
self.layer = nn.ModuleList([BlipTextLayer(config, i) for i in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

def forward(
self,
Expand Down
2 changes: 0 additions & 2 deletions src/transformers/models/blip_2/modeling_blip_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ def __init__(self, config: Blip2Config):
super().__init__()
self.config = config
self.layers = nn.ModuleList([Blip2EncoderLayer(config) for _ in range(config.num_hidden_layers)])
self.gradient_checkpointing = False

@auto_docstring
def forward(
Expand Down Expand Up @@ -797,7 +796,6 @@ def __init__(self, config):
self.layer = nn.ModuleList(
[Blip2QFormerLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
)
self.gradient_checkpointing = False

@can_return_tuple
def forward(
Expand Down
2 changes: 0 additions & 2 deletions src/transformers/models/bloom/modeling_bloom.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ def __init__(self, config: BloomConfig):
# Final Layer Norm
self.ln_f = LayerNorm(self.embed_dim, eps=config.layer_norm_epsilon)

self.gradient_checkpointing = False

# Initialize weights and apply final processing
self.post_init()

Expand Down
5 changes: 2 additions & 3 deletions src/transformers/models/blt/modeling_blt.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class BltLocalEncoder(BltPreTrainedModel):

def __init__(self, config: BltLocalEncoderConfig):
super().__init__(config)
self.gradient_checkpointing = False

self.config = config
self.layers = nn.ModuleList(
[BltTransformerLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
Expand Down Expand Up @@ -720,7 +720,7 @@ class BltLocalDecoder(BltPreTrainedModel):

def __init__(self, config: BltLocalDecoderConfig):
super().__init__(config)
self.gradient_checkpointing = False

self.config = config
self.cross_attn_decoder = True
self.layers = nn.ModuleList(
Expand Down Expand Up @@ -1196,7 +1196,6 @@ def _prepare_patch_cross_attention_mask(
class BltModel(BltPreTrainedModel):
def __init__(self, config: BltConfig):
super().__init__(config)
self.gradient_checkpointing = False

self.config = config
self.local_encoder = BltLocalEncoder(config.encoder_config)
Expand Down
5 changes: 2 additions & 3 deletions src/transformers/models/blt/modular_blt.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ class BltLocalEncoder(BltPreTrainedModel):

def __init__(self, config: BltLocalEncoderConfig):
super().__init__(config)
self.gradient_checkpointing = False

self.config = config
self.layers = nn.ModuleList(
[BltTransformerLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
Expand Down Expand Up @@ -647,7 +647,7 @@ class BltLocalDecoder(BltPreTrainedModel):

def __init__(self, config: BltLocalDecoderConfig):
super().__init__(config)
self.gradient_checkpointing = False

self.config = config
self.cross_attn_decoder = True
self.layers = nn.ModuleList(
Expand Down Expand Up @@ -916,7 +916,6 @@ def patch_lengths_from_entropies(
class BltModel(BltPreTrainedModel):
def __init__(self, config: BltConfig):
super().__init__(config)
self.gradient_checkpointing = False

self.config = config
self.local_encoder = BltLocalEncoder(config.encoder_config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ def __init__(self, config, add_pooling_layer=True):
"""
super().__init__(config)
self.config = config
self.gradient_checkpointing = False

self.embeddings = BridgeTowerTextEmbeddings(config)
self.encoder = BridgeTowerTextEncoder(config)
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/camembert/modeling_camembert.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ def __init__(self, config, add_pooling_layer=True):
"""
super().__init__(config)
self.config = config
self.gradient_checkpointing = False

self.embeddings = CamembertEmbeddings(config)
self.encoder = CamembertEncoder(config)
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/canine/modeling_canine.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,6 @@ def __init__(
for _ in range(config.num_hidden_layers)
]
)
self.gradient_checkpointing = False

def forward(
self,
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/chameleon/modeling_chameleon.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,6 @@ def __init__(self, config: ChameleonConfig):
self.norm = ChameleonRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.vqmodel = ChameleonVQVAE._from_config(config.vq_config)
self.rotary_emb = ChameleonRotaryEmbedding(config=config)
self.gradient_checkpointing = False

# Initialize weights and apply final processing
self.post_init()
Expand Down
Loading