How to run from python script?
I want to run the fp8 versions from python script. The provided code on the readme only works for non-quantized versions of the models. Can anyone help?
+1
+1
+1
pipe = DiffusionPipeline.from_pretrained("/data/vjuicefs_ai_camera_lgroup_ql/public_data/11154612/MODEL/diffuser/FLUX.2-klein-base-9b-fp8", 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]
type object 'Flux2KleinPipeline' has no attribute 'from_single_file'
from diffusers import Flux2KleinPipeline,Flux2Transformer2DModel
checkpoint_model = hf_hub_download(
repo_id="black-forest-labs/FLUX.2-klein-9b-fp8",
filename="flux-2-klein-9b-fp8.safetensors")
transformer = Flux2Transformer2DModel.from_single_file(checkpoint_model)
pipeline = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-9B",transformer=transformer,torch_dtype=torch.bfloat16)