Spaces:
Build error
Build error
Julian Bilcke commited on
Commit ·
6f7875d
1
Parent(s): 491fbbe
finetrainers is broken, reverting
Browse filesFiles changed (7)
16 unmodified lines17181920212223242526272816 unmodified linesif parallel_backend.tensor_parallel_enabled:patch.patch_apply_rotary_emb_for_tp_compatibility()if args.model_name == ModelType.WAN:from .models.wan import patchpatch.patch_time_text_image_embedding_forward()if args.training_type == TrainingType.LORA and len(args.layerwise_upcasting_modules) > 0:from .dependencies.peft import patchpatch.patch_peft_move_adapter_to_device_of_base_layer()16 unmodified lines1718192021222316 unmodified linesif parallel_backend.tensor_parallel_enabled:patch.patch_apply_rotary_emb_for_tp_compatibility()if args.training_type == TrainingType.LORA and len(args.layerwise_upcasting_modules) > 0:from dependencies.peft import patchpatch.patch_peft_move_adapter_to_device_of_base_layer()
15 unmodified lines1617181920212212 unmodified lines3536373839404115 unmodified linesdef _perform_ltx_transformer_forward_patch() -> None:LTXVideoTransformer3DModel.forward = _patched_LTXVideoTransformer3D_forwarddef _perform_ltx_apply_rotary_emb_tensor_parallel_compatibility_patch() -> None:12 unmodified linesdiffusers.models.transformers.transformer_ltx.apply_rotary_emb = apply_rotary_embdef _patched_LTXVideoTransformer3D_forward(self,hidden_states: torch.Tensor,encoder_hidden_states: torch.Tensor,15 unmodified lines1617181920212212 unmodified lines3536373839404115 unmodified linesdef _perform_ltx_transformer_forward_patch() -> None:LTXVideoTransformer3DModel.forward = _patched_LTXVideoTransformer3Dforwarddef _perform_ltx_apply_rotary_emb_tensor_parallel_compatibility_patch() -> None:12 unmodified linesdiffusers.models.transformers.transformer_ltx.apply_rotary_emb = apply_rotary_embdef _patched_LTXVideoTransformer3Dforward(self,hidden_states: torch.Tensor,encoder_hidden_states: torch.Tensor,
123456789101112131415161718192021222324252627282930313233from typing import Optional
import diffusersimport torch
def patch_time_text_image_embedding_forward() -> None: _patch_time_text_image_embedding_forward()
def _patch_time_text_image_embedding_forward() -> None: diffusers.models.transformers.transformer_wan.WanTimeTextImageEmbedding.forward = ( _patched_WanTimeTextImageEmbedding_forward )
def _patched_WanTimeTextImageEmbedding_forward( self, timestep: torch.Tensor, encoder_hidden_states: torch.Tensor, encoder_hidden_states_image: Optional[torch.Tensor] = None,): # Some code has been removed compared to original implementation in Diffusers # Also, timestep is typed as that of encoder_hidden_states timestep = self.timesteps_proj(timestep).type_as(encoder_hidden_states) temb = self.time_embedder(timestep).type_as(encoder_hidden_states) timestep_proj = self.time_proj(self.act_fn(temb))
encoder_hidden_states = self.text_embedder(encoder_hidden_states) if encoder_hidden_states_image is not None: encoder_hidden_states_image = self.image_embedder(encoder_hidden_states_image)
return temb, timestep_proj, encoder_hidden_states, encoder_hidden_states_image333 unmodified lines334335336337338339340107 unmodified lines448449450451452453454455333 unmodified linesparallel_backend = self.state.parallel_backendtrain_state = self.state.train_statedevice = parallel_backend.devicedtype = self.args.transformer_dtypememory_statistics = utils.get_memory_statistics()logger.info(f"Memory before training start: {json.dumps(memory_statistics, indent=4)}")107 unmodified lineslogger.debug(f"Starting training step ({train_state.step}/{self.args.train_steps})")latent_model_conditions = utils.align_device_and_dtype(latent_model_conditions, device, dtype)condition_model_conditions = utils.align_device_and_dtype(condition_model_conditions, device, dtype)latent_model_conditions = utils.make_contiguous(latent_model_conditions)condition_model_conditions = utils.make_contiguous(condition_model_conditions)333 unmodified lines334335336337338339107 unmodified lines447448449450451452453454333 unmodified linesparallel_backend = self.state.parallel_backendtrain_state = self.state.train_statedevice = parallel_backend.devicememory_statistics = utils.get_memory_statistics()logger.info(f"Memory before training start: {json.dumps(memory_statistics, indent=4)}")107 unmodified lineslogger.debug(f"Starting training step ({train_state.step}/{self.args.train_steps})")utils.align_device_and_dtype(latent_model_conditions, device, self.args.transformer_dtype)utils.align_device_and_dtype(condition_model_conditions, device, self.args.transformer_dtype)latent_model_conditions = utils.make_contiguous(latent_model_conditions)condition_model_conditions = utils.make_contiguous(condition_model_conditions)
18 unmodified lines1920212223242518 unmodified lineswandbpandassentencepiece>=0.2.0imageio-ffmpeg>=0.5.1torchdata==0.11.0flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl18 unmodified lines192021222324252618 unmodified lineswandbpandassentencepiece>=0.2.0imageioimageio-ffmpegtorchdata==0.11.0flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
19 unmodified lines2021222324252619 unmodified lineswandbpandassentencepiece>=0.2.0imageio-ffmpeg>=0.5.1torchdata==0.11.0# for youtube video download19 unmodified lines202122232425262719 unmodified lineswandbpandassentencepiece>=0.2.0imageioimageio-ffmpegtorchdata==0.11.0# for youtube video download
32 unmodified lines33343536373843 unmodified lines82838485868788899091929394959697989910010110210310410510632 unmodified lineswith gr.Row():with gr.Column(scale=2):self.components["prompt"] = gr.Textbox(label="Prompt",placeholder="Enter your prompt here...",43 unmodified lineschoices=self.get_model_version_choices(default_model),value=self.get_default_model_version(default_model))# Add dropdown to choose between LoRA and original modelhas_lora = self.check_lora_model_exists()lora_choices = []default_lora_choice = ""if has_lora:lora_choices = ["Use LoRA model", "Use original model"]default_lora_choice = "Use LoRA model"else:lora_choices = ["Cannot find LoRA model", "Use original model"]default_lora_choice = "Use original model"self.components["use_lora"] = gr.Dropdown(choices=lora_choices,label="Model Selection",value=default_lora_choice)# Add image input for image-to-video modelsself.components["conditioning_image"] = gr.Image(label="Conditioning Image (for Image-to-Video models)",32 unmodified lines3334353637383940414243444546474849505152535455565743 unmodified lines10110210310410510610732 unmodified lineswith gr.Row():with gr.Column(scale=2):# Add dropdown to choose between LoRA and original modelhas_lora = self.check_lora_model_exists()lora_choices = []default_lora_choice = ""if has_lora:lora_choices = ["Use LoRA model", "Use original model"]default_lora_choice = "Use LoRA model"else:lora_choices = ["Cannot find LoRA model", "Use original model"]default_lora_choice = "Use original model"self.components["use_lora"] = gr.Dropdown(choices=lora_choices,label="Model Selection",value=default_lora_choice)self.components["prompt"] = gr.Textbox(label="Prompt",placeholder="Enter your prompt here...",43 unmodified lineschoices=self.get_model_version_choices(default_model),value=self.get_default_model_version(default_model))# Add image input for image-to-video modelsself.components["conditioning_image"] = gr.Image(label="Conditioning Image (for Image-to-Video models)",
finetrainers/patches/__init__.py+1-6
finetrainers/patches/models/ltx_video/patch.py+2-2
finetrainers/patches/models/wan/patch.pyDeleted-33
finetrainers/trainer/sft_trainer/trainer.py+2-3
requirements.txt+2-1
requirements_without_flash_attention.txt+2-1
vms/ui/project/tabs/preview_tab.py+19-18