twodgirl / flux-magcache-pulid-diffusers

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: July 05 2025

Introduction of flux-magcache-pulid-diffusers

Model Details of flux-magcache-pulid-diffusers

Flux MagCache and PuLID

The merge of two projects ( 1 , 2 ).

The transformer model supports block swapping during inference. This saves more resources in addition to the enable_model_cpu_offload function.

Using MagCache with float8 precision provides an additional speed benefit.

Inference
from diffusers import FluxPipeline
from flux_magcache_model import FluxTransformer2DModel
from flux_pulid_loader import PuLID
from PIL import Image
import torch

class FluxGenerator:
    def __init__(self, pulid=False, compute_fp8=False, **kwargs):
        pipe_args = {}
        if compute_fp8:
            transformer = FluxTransformer2DModel.from_pretrained('repo-name/flux.1-dev-fp8-diffusers',
                                                                 subfolder='transformer',
                                                                 torch_dtype=torch.float8_e4m3fn)
            replace_regular_linears(transformer)
            pipe_args['transformer'] = transformer
        self.pipe = MagPipeline.from_pretrained('black-forest-labs/FLUX.1-dev', torch_dtype=torch.bfloat16, **pipe_args)
        self.pipe.enable_model_cpu_offload()
        if pulid:
            self.pulid_model = PuLID()
            self.pulid_model.setup(self.pipe.transformer)

    def clear_id(self):
        self.pipe.transformer.pul_id = None
        self.pipe.transformer.pul_weight = 1.0

    def set_id(self,
               id_image: Image.Image,
               id_weight=1.0,
               true_cfg=1.0):
        use_true_cfg = abs(true_cfg - 1.0) > 1e-2
        id_embeddings, uncond_id_embeddings = self.pulid_model.get_id_embedding_by_pil(id_image, true_cfg=true_cfg)
        self.pipe.transformer.pul_id = uncond_id_embeddings if use_true_cfg else id_embeddings
        self.pipe.transformer.pul_id_weight = id_weight

class MagPipeline(FluxPipeline):
    def __call__(self, **kwargs):
        num_inference_steps = kwargs.get('num_inference_steps', 28)
        self.transformer.retention_steps = int(num_inference_steps * self.transformer.retention_ratio)

        return super().__call__(**kwargs)

if __name__ == '__main__':
    gen = FluxGenerator()
    gen.set_id(Image.open('reference_image.png'))
    prompt = """A stylish woman walks down a street filled with warm glowing neon and animated city signs."""
    image = gen.pipe(prompt=prompt).images[0]
    image.save('preview.png')

Disclaimer

Use of this code and the model requires citation and attribution to the author via a link to their Hugging Face profile in all resulting work.

Runs of twodgirl flux-magcache-pulid-diffusers on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About flux-magcache-pulid-diffusers huggingface.co Model

More flux-magcache-pulid-diffusers license Visit here:

https://choosealicense.com/licenses/apache-2.0

flux-magcache-pulid-diffusers huggingface.co

flux-magcache-pulid-diffusers huggingface.co is an AI model on huggingface.co that provides flux-magcache-pulid-diffusers's model effect (), which can be used instantly with this twodgirl flux-magcache-pulid-diffusers model. huggingface.co supports a free trial of the flux-magcache-pulid-diffusers model, and also provides paid use of the flux-magcache-pulid-diffusers. Support call flux-magcache-pulid-diffusers model through api, including Node.js, Python, http.

flux-magcache-pulid-diffusers huggingface.co Url

https://huggingface.co/twodgirl/flux-magcache-pulid-diffusers

twodgirl flux-magcache-pulid-diffusers online free

flux-magcache-pulid-diffusers huggingface.co is an online trial and call api platform, which integrates flux-magcache-pulid-diffusers's modeling effects, including api services, and provides a free online trial of flux-magcache-pulid-diffusers, you can try flux-magcache-pulid-diffusers online for free by clicking the link below.

twodgirl flux-magcache-pulid-diffusers online free url in huggingface.co:

https://huggingface.co/twodgirl/flux-magcache-pulid-diffusers

flux-magcache-pulid-diffusers install

flux-magcache-pulid-diffusers is an open source model from GitHub that offers a free installation service, and any user can find flux-magcache-pulid-diffusers on GitHub to install. At the same time, huggingface.co provides the effect of flux-magcache-pulid-diffusers install, users can directly use flux-magcache-pulid-diffusers installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

flux-magcache-pulid-diffusers install url in huggingface.co:

https://huggingface.co/twodgirl/flux-magcache-pulid-diffusers

Url of flux-magcache-pulid-diffusers

flux-magcache-pulid-diffusers huggingface.co Url

Provider of flux-magcache-pulid-diffusers huggingface.co

twodgirl
ORGANIZATIONS

Other API from twodgirl

huggingface.co

Total runs: 7
Run Growth: 0
Growth Rate: 0.00%
Updated:September 27 2024
huggingface.co

Total runs: 1
Run Growth: 0
Growth Rate: 0.00%
Updated:August 18 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 13 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:October 07 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:April 21 2024