Skip to content

CUDA_VISIBLE_DEVICES #53

Closed
Closed

Description

@fst813

Hi,I got the following warning when using a single machine for multi-gpu training
/usr/local/lib/python3.10/dist-packages/unsloth/__init__.py:23: UserWarning: Unsloth: 'CUDA_VISIBLE_DEVICES' is currently 0,1,2,3 but we require 'CUDA_VISIBLE_DEVICES=0' We shall set it ourselves.
How does this affect my training?,The training framework uses:LLaMA-Factory

Activity

  1. danielhanchen commented on Dec 26, 2023

    @danielhanchen
    Member

    @fst813 Oh Unsloth currently only works on 1 GPU (multi GPU in a future release). So it'll just use 1 GPU for now

  2. fst813 commented on Dec 26, 2023

    @fst813
    Author

    I now use a single machine with multiple gpus(4 gpus), and found that the training speed has been significantly improved, and the loss is normal. Will using unsloth on only one gpu also increase the training speed?

  3. danielhanchen commented on Dec 26, 2023

    @danielhanchen
    Member

    @fst813 Well the point of multi GPUs is you can consume more batches quickly. I'm still working on multi GPU support, but in theory Unsloth on 1 GPU will most likely not trump over 4 GPUs, but you're more than happy to try it out and see!

  4. fst813 commented on Dec 26, 2023

    @fst813
    Author

    @danielhanchen What I mean is that I use 4 gpus to train one of them using unsloth faster than simply using 4 gpus.

  5. danielhanchen commented on Dec 26, 2023

    @danielhanchen
    Member

    @fst813 Wait so are you implying that using Unsloth on 1 GPU actually is faster than 4 GPUs? Sorry maybe I misunderstood!

  6. fst813 commented on Dec 26, 2023

    @fst813
    Author

    @danielhanchen I used Unsloth and 4 gpus for training at the same time. I read the log and it said that the Unsloth was only used on one GPU , and the other three gpus were not used. But during the training process, all 4 gpus are participating in the training. The other three gpus do not useUnsloth calculations, but they can work together.

  7. danielhanchen commented on Dec 26, 2023

    @danielhanchen
    Member

    @fst813 Oh do you know the GPU utilization for the other 3 GPUs? That's super interesting!

  8. fst813 commented on Dec 26, 2023

    @fst813
    Author

    GPU utilization,4 gpus are all the same

  9. changed the title [-]multigpu[/-] [+]CUDA_VISIBLE_DEVICES[/+] on Dec 26, 2023
  10. danielhanchen commented on Dec 26, 2023

    @danielhanchen
    Member

    @fst813 OOHH so essentially 3 GPUs are using Llama-Factory's original code, whilst maybe GPU-0 uses Unsloth?

  11. fst813 commented on Dec 26, 2023

    @fst813
    Author

    Maybe.
    Please tell me when will multi-gpus training be supported?

  12. danielhanchen commented on Dec 26, 2023

    @danielhanchen
    Member

    @fst813 We're still working on it, so not exactly sure when sadly

  13. fst813 commented on Dec 26, 2023

    @fst813
    Author

    Okay!Thanks

  14. danielhanchen commented on Dec 26, 2023

    @danielhanchen
    Member

    Coolies! I'll close this for now!

  15. nmd2k commented on Feb 2, 2024

    @nmd2k

    Are Unsloth support multi-gpus training yet?

  16. added a commit that references this issue on Jun 8, 2025
  17. added a commit that references this issue on Jun 25, 2025
  18. added a commit that references this issue on Jul 7, 2025
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