Skip to content

CUDA out of memory for larger datasets during attributionΒ #191

@lsickert

Description

@lsickert

πŸ› Bug Report

When loading inseq with a larger dataset, on a CUDA device, an out-of-memory error is occurring regardless of the defined batch_size. I believe that is is caused by the call to self.encode inattribution_model.py lines 345 and 347, which is operating on the full inputs instead of a single batch and moves all inputs to the CUDA device after the encoding.

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. Load any model without pre-generated targets
  2. Load a larger dataset with at least 1000 samples
  3. Call the .attribute() method with any batch_size parameter

Code sample

Environment

  • OS: macOS

  • Python version: 3.10

  • Inseq version: 0.4.0

Expected behavior

The input texts should ideally only be encoded or moved to the GPU once they are actually processed.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions