MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / __init__

Method __init__

lightx2v/shot_runner/utils.py:41–60  ·  view source on GitHub ↗
(
        self,
        samples: torch.Tensor,
        first_clip_len: int = 81,
        clip_len: int = 84,
        sr: int = 16000,
        fps: int = 16,
    )

Source from the content-addressed store, hash-verified

39
40class RS2V_SlidingWindowReader:
41 def __init__(
42 self,
43 samples: torch.Tensor,
44 first_clip_len: int = 81,
45 clip_len: int = 84,
46 sr: int = 16000,
47 fps: int = 16,
48 ):
49 assert isinstance(samples, torch.Tensor)
50 assert samples.dim() in [1, 2], "samples 必须是 1D 或 2D Tensor"
51 if samples.dim() == 1:
52 samples = samples.unsqueeze(0)
53
54 self.samples = samples
55 self.first_clip_len = first_clip_len
56 self.clip_len = clip_len
57
58 self.audio_per_frame = sr // fps
59 self.pos_frame = 0
60 self.chunk_idx = 0
61
62 def next_frame(self):
63 cur_clip_len = self.first_clip_len if self.chunk_idx == 0 else self.clip_len

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected