Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
cd26c0d
what it should look like
ArthurZucker May 26, 2025
59a90ee
waht it should look like
ArthurZucker May 26, 2025
a6cfc4b
updates
ArthurZucker May 26, 2025
d70e1c1
fixup
ArthurZucker May 26, 2025
388ee4b
check this out
ArthurZucker May 26, 2025
fbad09c
push
ArthurZucker May 26, 2025
5abbe87
small nits
ArthurZucker May 26, 2025
3c791b6
fix import
ArthurZucker May 26, 2025
afecb00
small fixes
ArthurZucker May 26, 2025
818cef6
some small fixes
ArthurZucker May 26, 2025
8f45617
simplify
ArthurZucker May 26, 2025
da51096
cache the caller for now
ArthurZucker May 26, 2025
1428907
done for the day gotta jumb on other stuffs
ArthurZucker May 26, 2025
081ebcc
mega simplify
ArthurZucker May 28, 2025
b5c6501
much simpler
ArthurZucker May 28, 2025
5b95608
noice!
ArthurZucker May 28, 2025
b76a44d
this one will be for another PR, it's a bit annoying to handle right now
ArthurZucker May 28, 2025
d0035f7
weird
ArthurZucker May 28, 2025
91fc267
fix typing?
ArthurZucker May 28, 2025
949f149
fixup
ArthurZucker May 28, 2025
4affc57
fix the arg issues
ArthurZucker May 28, 2025
4e35168
?
ArthurZucker May 28, 2025
71838e4
lol one single nit
ArthurZucker May 28, 2025
46b1b90
update
ArthurZucker May 28, 2025
b7ae7d9
keep one check explicit
ArthurZucker May 28, 2025
19ef67a
oups
ArthurZucker May 28, 2025
8fcc791
pass compile exigences
ArthurZucker May 28, 2025
39322ed
fixes, and update mixtral
ArthurZucker May 28, 2025
7d0ab1a
more advanced api
ArthurZucker May 28, 2025
2de1fcd
update
ArthurZucker May 28, 2025
531dc0c
fix return dict not even present
ArthurZucker May 28, 2025
168db36
models that we should update
ArthurZucker May 28, 2025
4853171
fix merge conflicts with main
ArthurZucker Jun 18, 2025
2ab361b
fix
ArthurZucker Jun 18, 2025
675cd88
proper cleanup of albert
ArthurZucker Jun 18, 2025
2dbf9a1
modify align as well
ArthurZucker Jun 18, 2025
6099f09
all the files this PR is scoped to tackle
ArthurZucker Jun 18, 2025
ce60925
updates
ArthurZucker Jun 21, 2025
f167286
more updats
ArthurZucker Jun 21, 2025
2d71cb3
revert tf changes
ArthurZucker Jun 21, 2025
f334151
more changes propagation
ArthurZucker Jun 22, 2025
54242e2
revert changes to the cursted libraries
ArthurZucker Jun 22, 2025
a4ec22a
Most probably explicit register of the attention classes to prevent h…
ArthurZucker Jun 22, 2025
f06e39e
some more cleanup
ArthurZucker Jun 22, 2025
b135112
up
ArthurZucker Jun 22, 2025
eb727c5
push what it should look like for llama
ArthurZucker Jun 26, 2025
6c34e8a
small fix
ArthurZucker Jun 26, 2025
81b2678
nits
ArthurZucker Jun 26, 2025
cfa8c40
todo comment
ArthurZucker Jun 26, 2025
e155ae8
fix attentions
ArthurZucker Jun 26, 2025
a304370
cleanup
ArthurZucker Jun 26, 2025
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
  •  
  •  
  •  
15 changes: 8 additions & 7 deletions src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from enum import Enum
from functools import partial, wraps
from threading import Thread
from typing import Any, Callable, Optional, TypeVar, Union
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
from zipfile import is_zipfile

import torch
Expand Down Expand Up @@ -73,14 +73,9 @@
verify_tp_plan,
)
from .loss.loss_utils import LOSS_MAPPING
from .modeling_layers import GradientCheckpointingLayer
from .pytorch_utils import ( # noqa: F401
Conv1D,
apply_chunking_to_forward,
find_pruneable_heads_and_indices,
id_tensor_storage,
prune_conv1d_layer,
prune_layer,
prune_linear_layer,
)
from .quantizers import AutoHfQuantizer, HfQuantizer
from .quantizers.quantizers_utils import get_module_from_name
Expand Down Expand Up @@ -2001,6 +1996,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, PushToHubMixin, PeftAdapterMi
# In practice, it means that they support attention interface functions, fully pass the kwargs
# through all modules up to the Attention layer, can slice logits with Tensor, and have a default TP plan
_supports_attention_backend = False
_can_record_outputs = None

@property
def dummy_inputs(self) -> dict[str, torch.Tensor]:
Expand Down Expand Up @@ -2050,6 +2046,11 @@ def __init__(self, config: PretrainedConfig, *inputs, **kwargs):
self._keep_in_fp32_modules = copy.copy(self.__class__._keep_in_fp32_modules)

self._no_split_modules = self._no_split_modules or []
_param_to_record = {}
for module in self.modules():
if hasattr(module, "return_hooks"):
_param_to_record.update({module.return_hooks[0]: (module, module.return_hooks[1])})
self._can_record_outputs: Dict[str, Tuple[nn.Module, int]] = _param_to_record

def post_init(self):
"""
Expand Down
Loading