torch-influence icon indicating copy to clipboard operation
torch-influence copied to clipboard

feat: Add docstrings; Add Support for UserDict in _transfer_to_device

Open proshian opened this issue 8 months ago • 0 comments

This PR

  • Docstrings: Adds docstring to undocumented methods in base.py
  • torch-influence & transformers: Updates the _transfer_to_device method to support UserDict instances. The Hugging Face BatchEncoding class, which is a common otype for a batch in the library, inherits from UserDict but not from dict. This change ensures that _transfer_to_device correctly handles these batch types, fixing error-raising in _transfer_to_device that prevented torch-influence from working seamlessly with the transformers library.

proshian avatar Aug 10 '25 19:08 proshian