mirror of
https://github.com/storytold/FineTrainers-Conditioning.git
synced 2026-10-18 07:33:20 +00:00
Full Finetune should work with this adapter removed the residual_x
This commit is contained in:
@@ -93,8 +93,7 @@ class LTXVideoConditionedTransformer3DModel(LTXVideoTransformer3DModel):
|
|||||||
return_dict: bool = True,
|
return_dict: bool = True,
|
||||||
residual_x: torch.Tensor = None
|
residual_x: torch.Tensor = None
|
||||||
) -> torch.Tensor:
|
) -> torch.Tensor:
|
||||||
if residual_x == None:
|
|
||||||
print("Residual Not included in the calculation.")
|
|
||||||
image_rotary_emb = self.rope(hidden_states, num_frames, height, width, rope_interpolation_scale)
|
image_rotary_emb = self.rope(hidden_states, num_frames, height, width, rope_interpolation_scale)
|
||||||
|
|
||||||
# convert encoder_attention_mask to a bias the same way we do for attention_mask
|
# convert encoder_attention_mask to a bias the same way we do for attention_mask
|
||||||
|
|||||||
@@ -119,6 +119,10 @@ def conditioned_forward_pass(
|
|||||||
# encoder_hidden_states=prompt_embeds,
|
# encoder_hidden_states=prompt_embeds,
|
||||||
# timestep=timesteps,
|
# timestep=timesteps,
|
||||||
# encoder_attention_mask=prompt_attention_mask,
|
# encoder_attention_mask=prompt_attention_mask,
|
||||||
|
|
||||||
|
if noisy_latents_residual == None:
|
||||||
|
print("Residual Not included in the calculation.")
|
||||||
|
|
||||||
denoised_latents = transformer(
|
denoised_latents = transformer(
|
||||||
hidden_states=noisy_latents,
|
hidden_states=noisy_latents,
|
||||||
encoder_hidden_states=prompt_embeds,
|
encoder_hidden_states=prompt_embeds,
|
||||||
|
|||||||
@@ -840,7 +840,7 @@ class Trainer:
|
|||||||
# That dict says latents but actually tokens.
|
# That dict says latents but actually tokens.
|
||||||
latent_conditions.update({"noisy_latents": condition_tokens["latents"]})
|
latent_conditions.update({"noisy_latents": condition_tokens["latents"]})
|
||||||
# input video noise at level residual information to adapter
|
# input video noise at level residual information to adapter
|
||||||
latent_conditions.update({"noisy_latents_residual":noisy_residual_tokens["latents"]})
|
# latent_conditions.update({"noisy_latents_residual":noisy_residual_tokens["latents"]})
|
||||||
else:
|
else:
|
||||||
# Default to flow-matching noise addition
|
# Default to flow-matching noise addition
|
||||||
noisy_latents = (1.0 - sigmas) * latent_conditions["latents"] + sigmas * noise
|
noisy_latents = (1.0 - sigmas) * latent_conditions["latents"] + sigmas * noise
|
||||||
|
|||||||
Reference in New Issue
Block a user