Skip to content

Attack on an HF model split into multiple GPUs #798

@RealPolitiX

Description

@RealPolitiX

Does textattack allow running the attack calculation on a single model doing distributed inference across multiple GPUs?

For example, one can use the argument device_map="auto", which distributes a large model to multiple GPUs, on HuggingFaceModelWrapper. However, it seems that if you split a single instance of a large model onto multiple GPUs, then when doing the attack, such as using attacker.attack_dataset(), then there will be a RuntimeError similar to the following (if two GPUs are present)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cuda:1!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions