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

implement activation offloading and opt_in_bwd in knowledge_distillation recipes #1959

Open
felipemello1 opened this issue Nov 7, 2024 · 2 comments
Labels
community help wanted We would love the community's help completing this issue good first issue Good for newcomers

Comments

@felipemello1
Copy link
Contributor

felipemello1 commented Nov 7, 2024

Current knowledge distillation recipes don't have support for activation offloading and opt_in_bwd.

The implementation should be similar to the one in other recipes, like full_finetuning_distributed.

After enabling it in the recipe, it should also be enabled in the configs related to KD.

PRs with reference implementation:
activation offloading: #1847
opt_in_bwd implementation: #1833

KD recipes:
https://github.com/pytorch/torchtune/blob/main/recipes/knowledge_distillation_single_device.py
https://github.com/pytorch/torchtune/blob/main/recipes/knowledge_distillation_distributed.py

after implementing it, run it with the flag on/off and plot the graphs of loss/memory/words per second. The easier way is to add the wandb logger to the config.

to update configs in bulk, you can use the script here: #1954

@felipemello1 felipemello1 added community help wanted We would love the community's help completing this issue good first issue Good for newcomers labels Nov 7, 2024
@AnuravModak
Copy link
Contributor

Hi @felipemello1 is it available for external contributors? if yes kindly assign it to me will look into it. Thanks in advance!

@felipemello1
Copy link
Contributor Author

felipemello1 commented Nov 18, 2024

@AnuravModak yes! Any issue with "community help wanted" is something that we think would be a great fit for external contributors. Feel free to ask me questions and just submit a PR.

More info on contributing here, but the TLDR:
main/CONTRIBUTING.md

  1. Fork torchtune: pytorch/torchtune
    then clone from it: git clone github.com<YOUR_GITHUB_USER>/torchtune.git

  2. install dependencies

cd torchtune
conda create -n torchtune python=3.11
conda activate torchtune
pip install --pre --upgrade torch torchvision torchao --index-url download.pytorch.org/whl/nightly/cu124
pip install -e ".[dev]"
pre-commit install

  1. create the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community help wanted We would love the community's help completing this issue good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants