-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle videos with begin_stream_seconds > 0 #345
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to unblock but maybe try arange
(or linspace
?) as it might provide a cleaner solution
# The epislon of 1e-6 is added to avoid floating point issues. Otherwise I see error messages like: | ||
# RuntimeError: frame pts is 0.015999; must be in range [0.015999, 5.004316). | ||
begin = metadata.begin_stream_seconds + 1e-6 | ||
uniform_pts_list = [ | ||
i * duration / num_samples + begin for i in range(num_samples) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: try to rely on torch.arange
instead, like we do in the samplers
clip_start_seconds = torch.arange( |
begin
which hopefully wouldn't cause the error we're seeing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same thought when I was refactoring things, and I can't remember why I didn't do it. :) I'll dig in later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like arange doesn't work here, possibly due to rounding:
uniform_pts_list = list(
torch.arange(
metadata.begin_stream_seconds,
metadata.end_stream_seconds,
(metadata.end_stream_seconds - metadata.begin_stream_seconds)
/ num_samples,
)
)
Gives me the same error:
RuntimeError: frame pts is 0.015999; must be in range [0.015999, 5.004316).
Without this PR I get error messages like this:
After this PR, I can run the benchmark on that video: