File tree Expand file tree Collapse file tree
mostlyai/engine/_language Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,21 +51,6 @@ def __init__(
5151
5252class LSTMFromScratchLMHeadModel (PreTrainedModel , GenerationMixin ):
5353 config_class = LSTMFromScratchConfig
54- # Opacus DPLSTM exposes duplicate parameter aliases (for example `lstm.l0.ih.weight`
55- # and `lstm.weight_ih_l0`) that need to be treated as tied when saving.
56- _tied_weights_keys = [
57- r"lstm\.l\d+\.(ih|hh)\.(weight|bias)" ,
58- r"lstm\.(weight|bias)_(ih|hh)_l\d+" ,
59- ]
60-
61- @property
62- def all_tied_weights_keys (self ) -> set [str ]:
63- """
64- Compatibility shim for newer Transformers save paths.
65- """
66- tied_keys = set (getattr (self , "_tied_weights_keys" , []) or [])
67- tied_keys .update (getattr (self , "_dynamic_tied_weights_keys" , []) or [])
68- return tied_keys
6954
7055 def __init__ (self , config : LSTMFromScratchConfig ):
7156 super ().__init__ (config )
@@ -88,7 +73,6 @@ def __init__(self, config: LSTMFromScratchConfig):
8873 )
8974 self .lm_head = nn .Linear (self .config .hidden_size , self .config .vocab_size )
9075 self .loss_fn = nn .CrossEntropyLoss ()
91- self .post_init ()
9276
9377 # this will be filled by left_to_right_padding() during the generation
9478 self .pad_token_id = None
You can’t perform that action at this time.
0 commit comments