Qwen-Image-Edit Context
- HuggingFace: https://huggingface.co/Qwen/Qwen-Image-Edit
- lora finetuning 제공 git repo: https://github.com/FlyMyAI/flymyai-lora-trainer
Qwen2_5_VLForConditionalGeneration class로 loadprompt_template_encode)User Prompt + Input Image (리사이즈됨) → Text Encoder →Prompt EmbeddingsAutoencoderKLQwenImage_pack_latents)[Batch, Channel, Height, Width] → [Batch, Sequence_Len, Channel * 4]latents_mean, latents_std를 사용하여 Latent 값을 정규화QwenImageTransformer2DModelimage_latents)와 노이즈(latents)를 Channel 방향으로 Concatenate하여 입력 받음latent_model_input = torch.cat([latents, image_latents], dim=1)prompt_embeds (이미지+텍스트 정보 포함)가 Cross-Attention 을 통해 주입됨img_shapes: 이미지의 종횡비(Aspect Ratio) 정보를 RoPE(Rotary Positional Embedding)에 활용FlowMatchEulerDiscreteSchedulercalculate_shift):LoRA 삽입 위치
QwenImageTransformer2DModel 내부의 Attention Layer에만 주입됨requires_grad = False)Target Modules
LoraConfig 설정을 보면 Attention 메커니즘의 Query, Key, Value, Output 전체에 LoRA가 적용됨.target_modules=["to_k", "to_q", "to_v", "to_out.0"]to_k, to_q, to_v: Self/Cross Attention의 입력 투영층to_out.0: Attention의 결과 출력층학습 진행 과정 (Flow Matching)
sigmas에 따른 노이즈를 섞음 (noisy_model_input).noisy_model_input과 timestep, prompt_embeds를 받아 Flow 예측 (model_pred).noise - pixel_latents (Source에서 Target으로 가는 벡터).model_pred)와 실제 목표 Flow(target) 간의 차이를 최소화.loss = torch.mean((weighting * (model_pred - target) ** 2))학습 리소스 및 속도 관련 파라미터

학습 성능 및 수렴 관련 파라미터

데이터 및 저장 관련 파라미터
