Skip to content
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

[zero] add chunk size search for chunk manager #1052

Merged
merged 1 commit into from
Jun 2, 2022
Merged

Conversation

ver217
Copy link
Member

@ver217 ver217 commented Jun 2, 2022

Add chunk size search:

def search_chunk_size(module: torch.nn.Module,
                      search_range: int,
                      n_grids: int,
                      min_chunk_size: Optional[int] = None) -> int:
    pass

Apply grid search in [min_chunk_size, min_chunk_size+search_range]. If min_chunk_size=None, it's set to the number of elements of the largest parameter.

Usage:

best_chunk_size = ChunkManager.search_chunk_size(model, 128 * 1024**2, 4)

@ver217 ver217 requested a review from feifeibear June 2, 2022 04:26
@ver217 ver217 merged commit e1922ea into main Jun 2, 2022
@ver217 ver217 deleted the feature/chunk-search branch June 2, 2022 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants