Run this model with HF Jobs
Run diffusers/FLUX.2-dev-bnb-4bit on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/diffusers/FLUX.2-dev-bnb-4bit. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/diffusers/FLUX.2-dev-bnb-4bit on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use diffusers/FLUX.2-dev-bnb-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use diffusers/FLUX.2-dev-bnb-4bit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("diffusers/FLUX.2-dev-bnb-4bit", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
2 gpu
how run diffusers/FLUX.2-dev-bnb-4bit on two gpu 16 g rtx 4060ti???
on kagle
????????????
no idea, I don't use kagle, this model is big and using two GPUs is for very advanced users which you don't seem to be if you're asking, you probably should just rent some bigger instance or use group offloading if kagle has the RAM needed. In the future we will provide some kind of guide to use multiple GPUs but I repeat, this is for advanced users.
diffusers/FLUX.2-dev-bnb-4bit
2*16gb t4
g30 ram
kagle
In general, how can the model
diffusers/FLUX.2-dev-bnb-4bit
work on two gpu?
group offloading
?????????????????????????
في Google Colab Pro مع 2 T4 GPUs
import torch
from diffusers import Flux2Pipeline, ContextParallelConfig
from diffusers.hooks import apply_context_parallel
التحقق من عدد الأجهزة
print(f"عدد GPUs: {torch.cuda.device_count()}")
إذا كان لديك جهازان فقط
if torch.cuda.device_count() >= 2:
config = ContextParallelConfig(
ring_degree=2,
convert_to_fp32=True
)
pipe = Flux2Pipeline.from_pretrained(
"diffusers/FLUX.2-dev-bnb-4bit",
torch_dtype=torch.float16, # T4 لا يدعم bf16
)
# تطبيق التوازي
apply_context_parallel(pipe.transformer, config)
# تشغيل
prompt = "A futuristic city at night with flying cars"
image = pipe(prompt, num_inference_steps=28).images[0]
image.save("colab_ring_parallel.png")
else:
print("⚠️ هذا الكود يتطلب جهازين على الأقل")
RuntimeError: Failed to import diffusers.pipelines.flux2.pipeline_flux2 because of the following error (look up to see its traceback):
Could not import module 'AutoProcessor'. Are this object's requirements defined correctly?
add Codeadd Markdown
KAgl 2 T4
kagle 2*t4
code
https://huggingface.co/docs/diffusers/main/en/api/parallel
https://huggingface.co/diffusers/FLUX.2-dev-bnb-4bit/discussions/3#69d4c4443f29c59da80cb052
with parallelism
how??????????????????????????