Skip to content

The MPS Backend is Not Working Properly #35

@AtakanTekparmak

Description

@AtakanTekparmak

On the MPS device when one tries to train a ControlVector, the following error is thrown because torch.autocast() does not support MPS:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[12], [line 8]
      [1] happy_dataset = make_dataset(
      [2]     "Act as if you're extremely {persona}.",
      [3]     ["happy", "joyous"],
      [4]     ["sad", "depressed"],
      [5]     truncated_output_suffixes,
      [6])
      [7] model.reset()
----> [8] happy_vector = ControlVector.train(model, tokenizer, happy_dataset)

File [.../repeng/extract.py:51), in ControlVector.train(cls, model, tokenizer, dataset, **kwargs)
     [27] @classmethod
     [28] def train(
     [29]     cls,
   (...)
     [33]   **kwargs,
     [34]) -> "ControlVector":
     [35] """
     [36] Train a ControlVector for a given model and tokenizer using the provided dataset.
     [37]
   (...)
     [49]      ControlVector: The trained vector.
     [50] """
...
    [247]     and torch.cuda.amp.common.amp_definitely_not_available()
    [248]    and self.device == "cuda"
    [249](.../lib/python3.11/site-packages/torch/amp/autocast_mode.py:249) ):

RuntimeError: User specified an unsupported autocast device_type 'mps'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions