• Nicolas Patry's avatar
    Hard error when ignoring tensors. (#27484) (#29906) · 9b0a8ea7
    Nicolas Patry authored
    
    
    * Hard error when ignoring tensors. (#27484)
    
    * [WIP] Hard error when ignoring tensors.
    
    * Better selection/error when saving a checkpoint.
    
    - Find all names we should normally drop (those are in the transformers
      config)
    - Find all disjoint tensors (for those we can safely trigger a copy to
      get rid of the sharing before saving)
    - Clone those disjoint tensors getting rid of the issue
    - Find all identical names (those should be declared in the config
      but we try to find them all anyway.)
    - For all identical names:
      - If they are in the config, just ignore them everything is fine
      - If they are not, warn about them.
    - For all remainder tensors which are shared yet neither identical NOR
      disjoint. raise a hard error.
    
    * Adding a failing test on `main` that passes here.
    
    * We don't need to keep the subfolder logic in this test.
    
    * Apply suggestions from code review
    Co-authored-by: default avatarArthur <48595927+ArthurZucker@users.noreply.github.com>
    
    ---------
    Co-authored-by: default avatarArthur <48595927+ArthurZucker@users.noreply.github.com>
    
    * Add small tests.
    
    * Dead variable.
    
    * Fixup.
    
    * Fixing tied_Weights_keys on generic models.
    
    * Fixup + T5 encoder/decoder tying (with different layers)
    
    * Code quality.
    
    * Dynamic member.
    
    * trigger
    
    * Fixing encoder name for other types of encoder/decoder combos.
    
    * Fix scoping.
    
    * Update .github/workflows/self-scheduled.yml
    Co-authored-by: default avatarArthur <48595927+ArthurZucker@users.noreply.github.com>
    
    * Fixing the tied_weights after the call.
    
    ---------
    Co-authored-by: default avatarArthur <48595927+ArthurZucker@users.noreply.github.com>
    Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
    9b0a8ea7
test_modeling_utils.py 99.7 KB