Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/diffusers/models/transformers/transformer_bria_fibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ class BriaFiboTransformer2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin, From
...
"""

_no_split_modules = ["BriaFiboTransformerBlock", "BriaFiboSingleTransformerBlock"]
_supports_gradient_checkpointing = True

@register_to_config
Expand Down
9 changes: 8 additions & 1 deletion src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from ...schedulers import FlowMatchEulerDiscreteScheduler, KarrasDiffusionSchedulers
from ...utils import (
USE_PEFT_BACKEND,
deprecate,
is_torch_xla_available,
logging,
replace_example_docstring,
Expand Down Expand Up @@ -107,7 +108,7 @@ def __init__(
scheduler=scheduler,
)

self.vae_scale_factor = 16
self.vae_scale_factor = self.vae.config.scale_factor_spatial if getattr(self, "vae", None) else 16
self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor * 2)
self.default_sample_size = 64

Expand Down Expand Up @@ -659,6 +660,12 @@ def __call__(
else:
seq_len = (height // self.vae_scale_factor) * (width // self.vae_scale_factor)

if timesteps is not None:
deprecate(
"timesteps",
"1.0.0",
"Passing `timesteps` to `__call__` is deprecated and has no effect; it will be removed in a future version.",
)
sigmas = np.linspace(1.0, 1 / num_inference_steps, num_inference_steps)

mu = calculate_shift(
Expand Down
15 changes: 12 additions & 3 deletions src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from ...schedulers import FlowMatchEulerDiscreteScheduler, KarrasDiffusionSchedulers
from ...utils import (
USE_PEFT_BACKEND,
deprecate,
is_torch_xla_available,
logging,
replace_example_docstring,
Expand All @@ -50,7 +51,6 @@
torch.FloatTensor, Image.Image, List[Image.Image], List[torch.FloatTensor], np.ndarray, List[np.ndarray]
]

# TODO: Update example docstring
EXAMPLE_DOC_STRING = """
Example:
```python
Expand All @@ -59,7 +59,7 @@
from diffusers.modular_pipelines import ModularPipeline

torch.set_grad_enabled(False)
vlm_pipe = ModularPipelineBlocks.from_pretrained("briaai/FIBO-VLM-prompt-to-JSON", trust_remote_code=True)
vlm_pipe = ModularPipeline.from_pretrained("briaai/FIBO-VLM-prompt-to-JSON", trust_remote_code=True)
vlm_pipe = vlm_pipe.init_pipeline()

pipe = BriaFiboEditPipeline.from_pretrained(
Expand Down Expand Up @@ -265,7 +265,7 @@ def __init__(
scheduler=scheduler,
)

self.vae_scale_factor = 16
self.vae_scale_factor = self.vae.config.scale_factor_spatial if getattr(self, "vae", None) else 16
self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor) # * 2)
self.default_sample_size = 32 # 64

Expand Down Expand Up @@ -877,6 +877,12 @@ def __call__(
else:
seq_len = (height // self.vae_scale_factor) * (width // self.vae_scale_factor)

if timesteps is not None:
deprecate(
"timesteps",
"1.0.0",
"Passing `timesteps` to `__call__` is deprecated and has no effect; it will be removed in a future version.",
)
sigmas = np.linspace(1.0, 1 / num_inference_steps, num_inference_steps)

mu = calculate_shift(
Expand Down Expand Up @@ -1039,6 +1045,9 @@ def prepare_image_latents(
image_latents_cthw = torch.concat(latents_scaled, dim=0)
image_latents_bchw = image_latents_cthw[:, :, 0, :, :]

repeat_by = batch_size // image_latents_bchw.shape[0]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we talked about standardlize this across pipelines using a function like this https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ideogram4/pipeline_ideogram4.py#L115

maybe we can start addingthat while you're doing these pipeline refactors?

image_latents_bchw = image_latents_bchw.repeat_interleave(repeat_by, dim=0)

image_latent_height, image_latent_width = image_latents_bchw.shape[2:]
image_latents_bsd = self._pack_latents_no_patch(
latents=image_latents_bchw,
Expand Down
Loading