Skip to content

RuntimeError: User specified an unsupported autocast device_type 'meta' #684

Closed

Description

Activity

  1. shimmyshimmer commented on Jun 26, 2024

    @shimmyshimmer
    Member

    Hi for some reason it says I need access? When you load in 4 bit = False, you will consume a lot more VRAM so the notebook may have gone out of memory causing this error.

  2. VanDavv commented on Oct 11, 2024

    @VanDavv

    @shimmyshimmer We're encountering the same issue when trying to load 2 models with 4bit=False, even when ran in separate processes. Seems like some memory issues.

    Below is a full traceback:

    Exception in thread Thread-4 (_fast_generate):
    Traceback (most recent call last):
      File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
        self.run()
      File "/usr/lib/python3.11/threading.py", line 982, in run
        self._target(*self._args, **self._kwargs)
      File "/root/venv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/root/venv/lib/python3.11/site-packages/unsloth/models/llama.py", line 1406, in _fast_generate
        with torch.autocast(device_type = device_type, dtype = dtype):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/venv/lib/python3.11/site-packages/torch/amp/autocast_mode.py", line 241, in __init__
        raise RuntimeError(
    RuntimeError: User specified an unsupported autocast device_type 'meta'
    

    This happens after model is loaded and tries to perform inference on the prompt.

  3. ilyes1999 commented on Dec 12, 2024

    @ilyes1999

    was anyone able to solve this? it happened to me with load_in_4bit = True

  4. nnakshat commented on Feb 8, 2025

    @nnakshat

    Did anybody resolve this issue? I am facing the same error during inference time.

  5. rolandtannous commented on Jun 6, 2025

    @rolandtannous
    Contributor

    @nnakshat @VanDavv @brand17 @ilyes1999

    loading a model with load_in_4bit=False, will load it in 16bit.For an 8b model that's slightly around 15GB of VRAM that the T4 colab has. You will either get thrown a runtime error while loading the model or when trying to run inference or training. either pick a smaller model or use load_in_4bit=True.
    meta usually means it tried to offload to system RAM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions