Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix chunking equal number of videos for each thread.#40

Open
pulinagrawal wants to merge 1 commit intomit-han-lab:masterfrom
pulinagrawal:master
Open

fix chunking equal number of videos for each thread.#40
pulinagrawal wants to merge 1 commit intomit-han-lab:masterfrom
pulinagrawal:master

Conversation

@pulinagrawal
Copy link

Previously NUM_THREADS sized chunks were created out of the videos list. Now NUM_THREADS chunks of almost equal size are created.

YodaEmbedding reacted with thumbs up emoji
@YodaEmbedding
Copy link

YodaEmbedding commentedJul 17, 2020
edited
Loading

That's one way but I think the following way is nicer since a single thread processes contiguous array elements (from which it is easier to trace any errors which might have occurred during the process):

defsplit(xs,n):"""Yields n roughly even-sized chunks from xs."""size=len(xs)q=size//nr=size%noffset=0foriinrange(r):yieldxs[offset :offset+ (q+1)]offset+=q+1foriinrange(n-r):yieldxs[offset :offset+q]offset+=qassertoffset==size

One should also sort the list of files beforehand via:

video_list=os.listdir(VIDEO_ROOT)video_list.sort(key=lambdax:int(x.split(".")[0]))

EDIT: On the other hand, your method makes it so that the dataset is mostly processed "in order", assuming the threads are roughly synced.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@pulinagrawal@YodaEmbedding

Comments


[8]ページ先頭

©2009-2026 Movatter.jp