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

Estimate adapter memory overhead in choose_num_blocks() #346

Merged
merged 6 commits into from
Jul 13, 2023

Conversation

justheuristic
Copy link
Collaborator

@justheuristic justheuristic commented Jul 12, 2023

This PR changes the way the server determines how many blocks it can handle if that server has at least one adapter. It does so by including the adapter parameters in the total block size that divides the free GPU memory.

ToDos:

  • make sure adapters are actually loaded in the same dtype that was used
  • update artek0chumak/bloom-560m-safe-peft to disable dropout
  • create github issues from Support peft LoRA adapters #335 comments

block, block_index=0, adapter_name=adapter, peft_config=peft_config, peft_state_dict=peft_state_dict
)
adapter_parameters = sum(p.numel() for p in block.parameters()) - base_block_parameters
bytes_per_parameter = torch.finfo(resolve_block_dtype(block_config, torch_dtype)).bits / 8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't adapters have a different dtype from the base block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they should have the same, lest forward pass would cause an error

@borzunov borzunov changed the title Estimate adapter memory overhead for the purpose of num_blocks Estimate adapter memory overhead in choose_num_blocks() Jul 13, 2023
justheuristic and others added 5 commits July 14, 2023 00:18
Co-authored-by: Alexander Borzunov <borzunov.alexander@gmail.com>
Co-authored-by: Alexander Borzunov <borzunov.alexander@gmail.com>
@justheuristic justheuristic merged commit 010857a into main Jul 13, 2023
7 checks passed
@justheuristic justheuristic deleted the fix-num-blocks branch July 13, 2023 22:03
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