XLabs-AI / x-flux

Apache License 2.0
1.59k stars 114 forks source link

OSError: No such device (os error 19) #60

Open chenzhongzheng opened 2 months ago

chenzhongzheng commented 2 months ago

python main.py --prompt "Female furry Pixie with text 'hello world'" --lora_repo_id XLabs-AI/flux-furry-lora --lora_local_path /data/lora/flux/flux-lora-collection --lora_name furry_lora.safetensors --device cuda:0 --offload --use_lora --model_type flux-dev-fp8 --width 1024 --height 1024 --timestep_to_start_cfg 1 --num_steps 25 --true_gs 3.5 --guidance 4 Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.58s/it] Init AE Traceback (most recent call last): File "/data/image/x-flux/main.py", line 136, in main(args) File "/data/image/x-flux/main.py", line 109, in main xflux_pipeline = XFluxPipeline(args.model_type, args.device, args.offload, args.seed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/image/x-flux/src/flux/xflux_pipeline.py", line 22, in init self.ae = load_ae(model_type, device="cpu" if offload else self.device) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/image/x-flux/src/flux/util.py", line 337, in load_ae sd = load_sft(ckpt_path, device=str(device)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/anaconda3/envs/xflux/lib/python3.11/site-packages/safetensors/torch.py", line 313, in load_file with safe_open(filename, framework="pt", device=device) as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: No such device (os error 19)

NVIDIA TITAN RTX CUDA Version: 12.4

arrowonstr commented 2 months ago

I think it happens when filename is a dictory rather than a file name Did u export FLUX_DEV and AE? If do, make sure export FLUX='path/flux1-dev.saftertensors' rather than 'path/'

XHB-ZMM commented 2 months ago

你的ae权重,应该是这样:ckpt_path = "/data/FLUX.1-dev/ae.safetensors",直接定位到权重本身

chenzhongzheng commented 2 months ago

嗯嗯,多谢!已解决。

XHB-ZMM commented 2 months ago

嗯嗯,多谢!已解决。 你也是都是本地加载模型权重吗,我也有这个需求,但是我最后失败了,你成功跑起来了嘛?【详情看这个项目的最后一个issue】