Skip to content

[Bug] No backend type associated with device type cpu #2553

Closed

Description

@TriLoo

Describe the bug
A clear and concise description of what the bug is. Please fill out the following sections and provide a minimal reproduction script so that we can provide a solution as quickly as possible!

  1. Environment Setup:

    • OS: Ubuntu 20.04
    • Python Version: 3.12
    • Frameworks/Libraries: please paste output of pip freeze here
      accelerate==1.7.0
      aiohappyeyeballs==2.6.1
      aiohttp==3.11.18
      aiosignal==1.3.2
      annotated-types==0.7.0
      attrs==25.3.0
      bitsandbytes==0.45.5
      certifi==2025.4.26
      charset-normalizer==3.4.2
      cut-cross-entropy==25.1.1
      datasets==3.6.0
      deepspeed==0.16.7
      diffusers==0.33.1
      dill==0.3.8
      docstring_parser==0.16
      einops==0.8.1
      filelock==3.18.0
      fire==0.7.0
      frozenlist==1.6.0
      fsspec==2025.3.0
      hf_transfer==0.1.9
      hjson==3.1.0
      huggingface-hub==0.31.2
      idna==3.10
      importlib_metadata==8.7.0
      Jinja2==3.1.6
      markdown-it-py==3.0.0
      MarkupSafe==3.0.2
      mdurl==0.1.2
      mpmath==1.3.0
      msgpack==1.1.0
      msgspec==0.19.0
      multidict==6.4.3
      multiprocess==0.70.16
      networkx==3.4.2
      ninja==1.11.1.4
      numpy==2.2.5
      nvidia-cublas-cu12==12.6.4.1
      nvidia-cuda-cupti-cu12==12.6.80
      nvidia-cuda-nvrtc-cu12==12.6.77
      nvidia-cuda-runtime-cu12==12.6.77
      nvidia-cudnn-cu12==9.5.1.17
      nvidia-cufft-cu12==11.3.0.4
      nvidia-cufile-cu12==1.11.1.6
      nvidia-curand-cu12==10.3.7.77
      nvidia-cusolver-cu12==11.7.1.2
      nvidia-cusparse-cu12==12.5.4.2
      nvidia-cusparselt-cu12==0.6.3
      nvidia-ml-py==12.575.51
      nvidia-nccl-cu12==2.26.2
      nvidia-nvjitlink-cu12==12.6.85
      nvidia-nvtx-cu12==12.6.77
      packaging==25.0
      pandas==2.2.3
      peft==0.15.2
      pillow==11.2.1
      propcache==0.3.1
      protobuf==3.20.3
      psutil==7.0.0
      py-cpuinfo==9.0.0
      pyarrow==20.0.0
      pydantic==2.11.4
      pydantic_core==2.33.2
      Pygments==2.19.1
      python-dateutil==2.9.0.post0
      pytz==2025.2
      PyYAML==6.0.2
      regex==2024.11.6
      requests==2.32.3
      rich==14.0.0
      safetensors==0.5.3
      sentencepiece==0.2.0
      setuptools==78.1.1
      shtab==1.7.2
      six==1.17.0
      sympy==1.14.0
      termcolor==3.1.0
      tokenizers==0.21.1
      torch==2.7.0
      torchvision==0.22.0
      tqdm==4.67.1
      transformers==4.51.3
      triton==3.3.0
      trl==0.15.2
      typeguard==4.4.2
      typing-inspection==0.4.0
      typing_extensions==4.13.2
      tyro==0.9.20
      tzdata==2025.2
      unsloth==2025.5.4
      unsloth_zoo==2025.5.6
      urllib3==2.4.0
      wheel==0.45.1
      xformers==0.0.30
      xxhash==3.5.0
      yarl==1.20.0
      zipp==3.21.0
  2. Dataset Details:

    • Dataset Name: alpaca
  3. Model Details:

  4. Training Configuration:

    • Trainer Args: Huggingface transformers Trainer
  5. Reproduction Steps:

    • I'm using torchrun to launch the training scripts, I have 8 H100, and the error raise when I call FastLanguageModel.from_pretrained(...)
  6. Expected Behavior:
    start train.

  7. Actual Behavior:
    05/16/2025 13:05:50 - WARNING - main - Process rank: 4, device: cuda:4, n_gpu: 1distributed training: True, 16-bits training: False
    05/16/2025 13:05:50 - WARNING - main - Process rank: 7, device: cuda:7, n_gpu: 1distributed training: True, 16-bits training: False
    05/16/2025 13:05:53 - WARNING - main - Process rank: 5, device: cuda:5, n_gpu: 1distributed training: True, 16-bits training: False
    05/16/2025 13:05:53 - WARNING - main - Process rank: 2, device: cuda:2, n_gpu: 1distributed training: True, 16-bits training: False
    05/16/2025 13:05:53 - WARNING - main - Process rank: 6, device: cuda:6, n_gpu: 1distributed training: True, 16-bits training: False 05/16/2025 13:05:53 - WARNING - main - Process rank: 1, device: cuda:1, n_gpu: 1distributed training: True, 16-bits training: False
    05/16/2025 13:05:53 - WARNING - main - Process rank: 3, device: cuda:3, n_gpu: 1distributed training: True, 16-bits training: False
    [rank0]: Traceback (most recent call last):
    [rank0]: File "/home/aiscuser/l3training_onetask/train_impl_unsloth.py", line 260, in
    [rank0]: main()
    [rank0]: File "/home/aiscuser/l3training_onetask/train_impl_unsloth.py", line 256, in main
    [rank0]: train()
    [rank0]: File "/home/aiscuser/l3training_onetask/train_impl_unsloth.py", line 180, in train
    [rank0]: model = prepare_model(model_args, total_num_labels)
    [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [rank0]: File "/home/aiscuser/l3training_onetask/train_impl_unsloth.py", line 123, in prepare_model
    [rank0]: model, _ = FastLanguageModel.from_pretrained(model_args.model_name_or_path, full_finetuning=True, device_map="auto", load_in_4bit=False, load_in_8bit=False, dtype=torch.bfloat16) [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth/models/loader.py", line 108, in from_pretrained
    [rank0]: return FastModel.from_pretrained( [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^ [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth/models/loader.py", line 688, in from_pretrained [rank0]: model_types, supports_sdpa = unsloth_compile_transformers( [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth/models/_utils.py", line 1198, in unsloth_compile_transformers [rank0]: _unsloth_compile_transformers(
    [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 1537, in unsloth_compile_transformers [rank0]: patch_lora_forwards(torch_compile_options)
    [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 1322, in patch_lora_forwards [rank0]: forward = create_new_function( [rank0]: ^^^^^^^^^^^^^^^^^^^^ [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 329, in create_new_function [rank0]: compile_folder, UNSLOTH_COMPILE_USE_TEMP = get_compile_folder(use_tempfile = False) [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 265, in get_compile_folder [rank0]: location, UNSLOTH_COMPILE_USE_TEMP = distributed_function(2, _get_compile_folder, use_tempfile) [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/unsloth_zoo/utils.py", line 82, in distributed_function [rank0]: torch.distributed.broadcast_object_list(object_list, src = 0, device = "cpu") [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/torch/distributed/c10d_logger.py", line 81, in wrapper [rank0]: return func(*args, **kwargs) [rank0]: ^^^^^^^^^^^^^^^^^^^^^ [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/torch/distributed/distributed_c10d.py", line 3483, in broadcast_object_list [rank0]: broadcast(object_sizes_tensor, src=global_src, group=group) [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/torch/distributed/c10d_logger.py", line 81, in wrapper [rank0]: return func(*args, **kwargs) [rank0]: ^^^^^^^^^^^^^^^^^^^^^ [rank0]: File "/home/aiscuser/.conda/envs/unsloth/lib/python3.12/site-packages/torch/distributed/distributed_c10d.py", line 2714, in broadcast [rank0]: work = group.broadcast([tensor], opts) [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [rank0]: RuntimeError: No backend type associated with device type cpu

8: does unsloth support multi-gpu fullfinetune training now ?

Activity

  1. mmathew23 commented on May 16, 2025

    @mmathew23
    Contributor

    @TriLoo Thanks for reporting on this! At the moment we don't officially support multi gpu training, but the team is working on it. You can follow along with this issue to see updates #2435.

    Or even subscribe to the newsletter to hear about the official launch. https://unsloth.ai/newsletter

    Going to close this, so please comment on #2435

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions