Buckets:

mishig's picture
|
download
raw
10.4 kB
# Bria Fibo
텍스트-이미지 모델은 상상력은 마스터했지만, 제어는 아직 아닙니다. FIBO가 이를 바꿉니다.
FIBO는 최대 1,000단어 이상의 구조화된 JSON 캡션으로 학습되었으며, 조명, 구도, 색상, 카메라 설정 등 다양한 시각적 매개변수를 이해하고 제어하도록 설계되어 정확하고 재현 가능한 출력을 가능하게 합니다.
단 80억 개의 파라미터만으로 FIBO는 새로운 수준의 이미지 품질, 프롬프트 준수, 전문적인 제어를 제공합니다.
FIBO is trained exclusively on a structured prompt and will not work with freeform text prompts. you can use the [FIBO-VLM-prompt-to-JSON](https://huggingface.co/briaai/FIBO-VLM-prompt-to-JSON) model or the [FIBO-gemini-prompt-to-JSON](https://huggingface.co/briaai/FIBO-gemini-prompt-to-JSON) to convert your freeform text prompt to a structured JSON prompt.
> [!NOTE]
> FIBO는 최적의 결과를 제공하지 않으므로, 자유 형식 텍스트 프롬프트를 FIBO에 직접 사용하는 것을 피하세요.
자세한 내용은 Bria Fibo Hugging Face [페이지](https://huggingface.co/briaai/FIBO)를 참고하세요.
## 사용
_해당 모델은 게이트가 적용되어 있으므로, diffusers와 함께 사용하기 전에 먼저 [Bria Fibo Hugging Face 페이지](https://huggingface.co/briaai/FIBO)에 접속하여 양식을 작성하고 게이트를 수락해야 합니다. 접근 권한이 부여된 후에는 로그인하여 시스템이 게이트 수락을 인지할 수 있도록 해야 합니다._
아래 명령을 사용하여 로그인하세요:
```bash
hf auth login
```
## BriaFiboPipeline[[diffusers.BriaFiboPipeline]]
#### diffusers.BriaFiboPipeline[[diffusers.BriaFiboPipeline]]
```python
diffusers.BriaFiboPipeline(transformer: BriaFiboTransformer2DModel, scheduler: diffusers.schedulers.scheduling_flow_match_euler_discrete.FlowMatchEulerDiscreteScheduler | diffusers.schedulers.scheduling_utils.KarrasDiffusionSchedulers, vae: AutoencoderKLWan, text_encoder: SmolLM3ForCausalLM, tokenizer: AutoTokenizer)
```
[소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py#L76)
**매개변수:**
transformer (`BriaFiboTransformer2DModel`) : 2D 확산 모델링을 위한 transformer 모델입니다.
scheduler (`FlowMatchEulerDiscreteScheduler` 또는 `KarrasDiffusionSchedulers`) : `transformer`와 함께 인코딩된 latents의 노이즈를 제거하는 데 사용되는 Scheduler입니다.
vae (`AutoencoderKLWan`) : 이미지를 잠재 표현으로 인코딩하고 잠재 표현에서 이미지로 디코딩하는 변분 오토인코더(Variational Auto-Encoder)입니다.
text_encoder (`SmolLM3ForCausalLM`) : 입력 프롬프트를 처리하는 텍스트 인코더
tokenizer (`AutoTokenizer`) : text_encoder의 입력 텍스트 프롬프트를 처리하는 데 사용되는 Tokenizer
#### __호출__[[diffusers.BriaFiboPipeline.__call__]]
```python
__call__(prompt: str | list[str] = None, height: int | None = None, width: int | None = None, num_inference_steps: int = 30, timesteps: list[int] = None, guidance_scale: float = 5, negative_prompt: str | list[str] | None = None, num_images_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.FloatTensor] = None, output_type: str | None = 'pil', return_dict: bool = True, joint_attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Optional[typing.Callable[[int, int], NoneType]] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 3000, do_patching = False)
```
[소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py#L435)
**매개변수:**
prompt (`str` 또는 `list[str]`) : 이미지 생성을 안내하는 프롬프트 또는 프롬프트 목록입니다.
height (`int`, *선택 사항*, 기본값은 self.unet.config.sample_size * self.vae_scale_factor) : 생성된 이미지의 픽셀 단위 높이입니다. 최적의 결과를 위해 기본값은 1024로 설정됩니다.
width (`int`, *선택 사항*, 기본값은 self.unet.config.sample_size * self.vae_scale_factor) : 생성된 이미지의 픽셀 단위 너비입니다. 최적의 결과를 위해 기본값은 1024로 설정됩니다.
num_inference_steps (`int`, *선택 사항*, 기본값 50) : 디노이징 단계의 수입니다. 디노이징 단계가 많을수록 일반적으로 추론 속도가 느려지는 대신 더 높은 품질의 이미지를 생성합니다.
timesteps (`list[int]`, *선택 사항*) : `set_timesteps` 메서드에 `timesteps` 인수를 지원하는 스케줄러의 노이즈 제거 과정에 사용할 커스텀 타임스텝입니다. 정의되지 않은 경우, `num_inference_steps`가 전달될 때의 기본 동작이 사용됩니다. 내림차순으로 정렬되어 있어야 합니다.
guidance_scale (`float`, *선택 사항*, 기본값 5.0) : [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598)에서 정의한 가이던스 스케일입니다. `guidance_scale`은 [Imagen Paper](https://huggingface.co/papers/2205.11487)의 2번 식의 `w`로 정의됩니다. `guidance_scale > 1`을 설정하여 가이던스 스케일을 활성화합니다. 가이던스 스케일이 높을수록 `prompt` 텍스트와 밀접하게 연결된 이미지를 생성하도록 장려하지만, 일반적으로 이미지 품질이 낮아지는 대가를 치릅니다.
negative_prompt (`str` 또는 `list[str]`, *선택 사항*) : 이미지 생성을 안내하지 않을 프롬프트입니다. 가이던스를 사용하지 않는 경우 무시됩니다(즉, `guidance_scale`이 `1`보다 작은 경우 무시됩니다).
num_images_per_prompt (`int`, *선택 사항*, 기본값 1) : 프롬프트당 생성할 이미지의 수.
generator (`torch.Generator` 또는 `list[torch.Generator]`, *선택 사항*) : 생성을 결정적으로 만들기 위한 [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) 하나 또는 목록.
latents (`torch.FloatTensor`, *선택 사항*) : 이미지 생성의 입력으로 사용할 가우시안 분포에서 샘플링된 사전 생성된 노이즈된 latents입니다. 동일한 생성을 다른 프롬프트로 조정하는 데 사용할 수 있습니다. 제공되지 않으면, 제공된 랜덤 `generator`를 사용하여 샘플링을 통해 latents 텐서가 생성됩니다.
output_type (`str`, *선택 사항*, 기본값 `"pil"`) : 이미지 생성의 출력 형식입니다. [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` 또는 `np.array` 중 하나를 선택합니다.
return_dict (`bool`, *선택 사항*, 기본값 `True`) : 일반 튜플 대신 `~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput`을 반환할지 여부.
joint_attention_kwargs (`dict`, *선택 사항*) : 지정된 경우 [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py)의 `self.processor` 아래에서 정의된 `AttentionProcessor`로 전달되는 kwargs 사전입니다.
callback_on_step_end (`Callable`, *선택 사항*) : 추론 중 각 디노이징 단계의 끝에서 호출되는 함수입니다. 이 함수는 다음 인수를 받아 호출됩니다: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs`에는 `callback_on_step_end_tensor_inputs`로 지정된 모든 텐서 목록이 포함됩니다.
callback_on_step_end_tensor_inputs (`List`, *선택 사항*) : `callback_on_step_end` 함수의 텐서 입력 목록입니다. 목록에 지정된 텐서는 `callback_kwargs` 인수로 전달됩니다. 파이프라인 클래스의 `._callback_tensor_inputs` 속성에 나열된 변수만 포함할 수 있습니다.
max_sequence_length (`int` 기본값은 3000) : `prompt`에 사용할 최대 시퀀스 길이입니다.
do_patching (`bool`, *선택 사항*, 기본값 `False`) : 패칭을 사용할지 여부.
**반환값:** `~pipelines.flux.BriaFiboPipelineOutput` 또는 `tuple`
`return_dict`가 True인 경우 `~pipelines.flux.BriaFiboPipelineOutput`, 그렇지 않으면 `tuple`입니다. tuple을 반환할 경우 첫 번째 요소는 생성된 이미지의 목록입니다.
생성을 위해 파이프라인을 호출할 때 호출되는 함수.
예:
```python
import torch
from diffusers import BriaFiboPipeline
from diffusers.modular_pipelines import ModularPipeline
torch.set_grad_enabled(False)
vlm_pipe = ModularPipeline.from_pretrained("briaai/FIBO-VLM-prompt-to-JSON", trust_remote_code=True)
pipe = BriaFiboPipeline.from_pretrained(
"briaai/FIBO",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
)
pipe.enable_model_cpu_offload()
with torch.inference_mode():
# 1. Create a prompt to generate an initial image
output = vlm_pipe(prompt="a beautiful dog")
json_prompt_generate = output.values["json_prompt"]
# Generate the image from the structured json prompt
results_generate = pipe(prompt=json_prompt_generate, num_inference_steps=50, guidance_scale=5)
results_generate.images[0].save("image_generate.png")
```
#### encode_prompt[[diffusers.BriaFiboPipeline.encode_prompt]]
```python
encode_prompt(prompt: str | list[str], device: typing.Optional[torch.device] = None, num_images_per_prompt: int = 1, guidance_scale: float = 5, negative_prompt: str | list[str] | None = None, max_sequence_length: int = 3000, lora_scale: float | None = None)
```
[소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py#L201)
**매개변수:**
prompt (`str` 또는 `list[str]`, *선택 사항*) : 인코딩할 프롬프트
device : (`torch.device`): torch 디바이스
num_images_per_prompt (`int`) : 프롬프트당 생성할 이미지 수
guidance_scale (`float`) : classifier free guidance의 guidance scale입니다.
negative_prompt (`str` 또는 `list[str]`, *선택 사항*) : 이미지 생성을 안내하지 않을 프롬프트입니다. 가이던스를 사용하지 않는 경우 무시됩니다(즉, `guidance_scale`이 `1`보다 작은 경우 무시됩니다).

Xet Storage Details

Size:
10.4 kB
·
Xet hash:
42141ac2911cdf514eaffd87a9f41265d4f622bcda734463b52838ab7c2c29a7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.