hpcaitech / Open-Sora

Open-Sora: Democratizing Efficient Video Production for All
https://hpcaitech.github.io/Open-Sora/
Apache License 2.0
21.76k stars 2.1k forks source link

question regarding failure case of finding t_id in get_bucket_id method #511

Closed erliding closed 3 months ago

erliding commented 3 months ago

Dear Open-Sora,

i have a noob question, in the code https://github.com/hpcaitech/Open-Sora/blob/cdaa1d6c32fd00aed7e1ee2ae6087af5f650a78f/opensora/datasets/bucket.py#L102-L103 my understanding is t_id * frame_interval is the minimum required number of frames the video should have, such that after performing temporal crop, the remaining frames can match the t_id of the assigned bucket, if so it seems the code should be instead something like below or i might misunderstand something here?

if T < t_id * frame_interval and t_id != 1: 
    t_fail = False
zhengzangw commented 3 months ago

Your understanding is almost right, except for the meaning of t_fail, which if True, means we failed to find a suitable t_id. So this loop is to find the suitable t_id. Thus, once T > t_id * frame_interval, a suitable t_id is found, and then we set t_fail to False as we successfully find the t_id, and break.

erliding commented 3 months ago

oh yeah, thanks for explanation :)