syCen commited on
Commit
b40eb7b
·
verified ·
1 Parent(s): ca6d962

Update inference_lora.py

Browse files
Files changed (1) hide show
  1. inference_lora.py +4 -17
inference_lora.py CHANGED
@@ -51,24 +51,11 @@ from safetensors.torch import load_file
51
  from diffsynth.pipelines.wan_video import WanVideoPipeline
52
  from diffsynth.core import ModelConfig
53
  from diffsynth.models.wan_video_dit import TemporalAttentionAdapter, FramewiseCrossAttention
 
 
 
54
 
55
-
56
- # ============================================================================
57
- # ActionFFNEncoder (must match training definition)
58
- # ============================================================================
59
-
60
-
61
- class ActionFFNEncoder(nn.Module):
62
- def __init__(self, action_dim: int, embed_dim: int, num_layers: int = 2):
63
- super().__init__()
64
- layers: list[nn.Module] = [nn.Linear(action_dim, embed_dim), nn.GELU()]
65
- for _ in range(max(0, num_layers - 2)):
66
- layers += [nn.Linear(embed_dim, embed_dim), nn.GELU()]
67
- self.mlp = nn.Sequential(*layers)
68
- self.norm = nn.LayerNorm(embed_dim)
69
-
70
- def forward(self, actions: torch.Tensor) -> torch.Tensor:
71
- return self.norm(self.mlp(actions))
72
 
73
 
74
  # ============================================================================
 
51
  from diffsynth.pipelines.wan_video import WanVideoPipeline
52
  from diffsynth.core import ModelConfig
53
  from diffsynth.models.wan_video_dit import TemporalAttentionAdapter, FramewiseCrossAttention
54
+ _MT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "examples", "wanvideo", "model_training")
55
+ if _MT_DIR not in sys.path:
56
+ sys.path.insert(0, _MT_DIR)
57
 
58
+ from train_acwm import ActionFFNEncoder
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
 
61
  # ============================================================================