cocktailpeanut / fluxgym

Dead simple FLUX LoRA training UI with LOW VRAM support
689 stars 44 forks source link

Only using the CPU #43

Open tre4b opened 1 week ago

tre4b commented 1 week ago

I installed as per the instruction, however this does not seem to be using my gpu (4090) at all. Worse looking through the logs I see this

[2024-09-10 08:09:35] [INFO] INFO prepare dataset train_util.py:884 [2024-09-10 08:09:35] [INFO] INFO preparing accelerator train_network.py:345 [2024-09-10 08:09:35] [INFO] accelerator device: cpu

this seems to suggest that it is only seeing the cpu. I've installed twice and can see nothing in the instructions about doing anything to specify the GPU. Any ideas why it would do this and what I can do about it?

catlog66 commented 1 week ago

Check if PyTorch detects the GPU: I have run the following Python code to ensure that PyTorch can detect the GPU:

import torch print(torch.cuda.is_available()) # Returns True print(torch.cuda.device_count()) # Returns the correct number of GPUs

Configure accelerate to use the GPU: I ran the accelerate config command to automatically detect and configure the GPU settings:

accelerate config

During the configuration, I made sure to select GPU as the device. Additionally, in my script, I explicitly specified the use of the GPU like this:

from accelerate import Accelerator

accelerator = Accelerator(cpu=False) # Ensures that the GPU is used device = accelerator.device

Verify installation of CUDA-enabled PyTorch:

tre4b commented 1 week ago

I just reinstalled again, and this time when I tried to use Florence 2 it said device=cuda and ran through rapidly. It looks like this is now working, though I will know more when I try and actually train.

The only difference between this time and the last two times was this time I heeded the advice to upgrade Pip (normally I've ignored it as in the past this has caused problems). Not sure if this is why it is different this time.

AgeevAlex89 commented 6 days ago

I'd like to add that I was able to resolve this issue on my machine by verifying that the version of CUDA Toolkit matched the version required by the version of torch installed for fluxgym -- it is 12.1. After I installed it, fluxgym began utilizing my GPU.

The download link for CUDA Toolkit 12.1 is here

Dartsgame974 commented 5 days ago

I install cuda but still nothing

dominion2 commented 4 days ago

I'm getting the same issue as well. My CPU is maxed out while my GPU barely does anything.