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

Add support and recipes for HF models via AutoModelForCausalLM #10962

Merged
merged 47 commits into from
Oct 23, 2024

Conversation

akoumpa
Copy link
Member

@akoumpa akoumpa commented Oct 20, 2024

What does this PR do ?

Can be invoked with nemo or via the example

nemo llm pretrain --factory 'HfAutoModelForCausalLM(model_name="meta-llama/Llama-3.2-1B", num_gpus_per_node=1)'

the example:

cd examples/llm/sft/
python3 hf.py --model=meta-llama/Llama-3.2-1B --devices=1 --strategy=ddp

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

@github-actions github-actions bot added the NLP label Oct 20, 2024
@akoumpa akoumpa force-pushed the akoumparouli/hf_lit_module branch 2 times, most recently from 5a01f6c to 887ed5a Compare October 21, 2024 21:07
examples/llm/sft/hf.py Fixed Show fixed Hide fixed
examples/llm/sft/hf.py Fixed Show fixed Hide fixed
examples/llm/sft/hf.py Fixed Show fixed Hide fixed
examples/llm/sft/hf.py Fixed Show fixed Hide fixed
examples/llm/sft/hf.py Fixed Show fixed Hide fixed
nemo/lightning/pytorch/optim/pytorch.py Fixed Show fixed Hide fixed
nemo/lightning/pytorch/optim/pytorch.py Fixed Show fixed Hide fixed
nemo/lightning/pytorch/optim/pytorch.py Fixed Show fixed Hide fixed
nemo/lightning/pytorch/optim/pytorch.py Fixed Show fixed Hide fixed
nemo/lightning/pytorch/optim/pytorch.py Fixed Show fixed Hide fixed
@akoumpa akoumpa force-pushed the akoumparouli/hf_lit_module branch 14 times, most recently from 723f74c to 2276451 Compare October 21, 2024 22:47
@akoumpa akoumpa force-pushed the akoumparouli/hf_lit_module branch 7 times, most recently from f431889 to 22931e2 Compare October 22, 2024 05:57
@akoumpa akoumpa removed the Run CICD label Oct 22, 2024
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
@akoumpa akoumpa force-pushed the akoumparouli/hf_lit_module branch from 2733fda to 8d1d6aa Compare October 22, 2024 21:07
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
@akoumpa akoumpa force-pushed the akoumparouli/hf_lit_module branch from c040e20 to bf8ee45 Compare October 22, 2024 21:22
Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>
@akoumpa akoumpa added Run CICD and removed Run CICD labels Oct 22, 2024
Copy link
Contributor

[🤖]: Hi @akoumpa 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully

So it might be time to merge this PR or get some approvals

I'm just a bot so I'll leave it you what to do next.

//cc @pablo-garay @ko3n1g

@akoumpa akoumpa merged commit 8f26236 into main Oct 23, 2024
153 of 156 checks passed
@akoumpa akoumpa deleted the akoumparouli/hf_lit_module branch October 23, 2024 05:11
akoumpa added a commit that referenced this pull request Oct 24, 2024
* initial hf_lit_module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make sft gpt dataset sanity check optional

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HF sft example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Rename HfLitModule to HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update default model id

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* move rank&world_size as params

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix mbs in example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix for fsdp and logger

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make loss_fn configurable

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove optim from HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add pytorch native optim

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add hfAutoModel pretrain nemorun recipe

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove debug

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* tokenizer fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename pytorch_adam to pytorch_adam_with_cosine_annealing

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* small refactor

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix no_weight_decay_cond

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* switch to flat_lr optim for example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove imports & update docstrings

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add a tokenizer setter to allow it to work with nemo/collections/llm/api.py::_use_tokenizer

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove unused import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* allow loss_mask to be none

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Add HF-dataset lightning module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* check if pad_token_id is None

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename hf_lit_module.py to hf_auto_model.py

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* class rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HfAutoModelForCausalLM

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add option to start with random weights

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add check in megatron-strategy

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename param

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* drop mcore sampler from squadmodule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make megatron_sampler optional in HfDatasetDataModule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* copyright

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* use is_hf_model to mark hf classes

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>
Co-authored-by: akoumpa <akoumpa@users.noreply.github.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
yashaswikarnati pushed a commit that referenced this pull request Oct 24, 2024
* initial hf_lit_module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make sft gpt dataset sanity check optional

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HF sft example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Rename HfLitModule to HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update default model id

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* move rank&world_size as params

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix mbs in example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix for fsdp and logger

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make loss_fn configurable

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove optim from HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add pytorch native optim

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add hfAutoModel pretrain nemorun recipe

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove debug

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* tokenizer fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename pytorch_adam to pytorch_adam_with_cosine_annealing

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* small refactor

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix no_weight_decay_cond

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* switch to flat_lr optim for example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove imports & update docstrings

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add a tokenizer setter to allow it to work with nemo/collections/llm/api.py::_use_tokenizer

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove unused import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* allow loss_mask to be none

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Add HF-dataset lightning module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* check if pad_token_id is None

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename hf_lit_module.py to hf_auto_model.py

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* class rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HfAutoModelForCausalLM

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add option to start with random weights

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add check in megatron-strategy

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename param

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* drop mcore sampler from squadmodule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make megatron_sampler optional in HfDatasetDataModule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* copyright

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* use is_hf_model to mark hf classes

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>
Co-authored-by: akoumpa <akoumpa@users.noreply.github.com>
titu1994 pushed a commit that referenced this pull request Oct 28, 2024
* initial hf_lit_module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make sft gpt dataset sanity check optional

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HF sft example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Rename HfLitModule to HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update default model id

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* move rank&world_size as params

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix mbs in example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix for fsdp and logger

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make loss_fn configurable

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove optim from HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add pytorch native optim

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add hfAutoModel pretrain nemorun recipe

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove debug

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* tokenizer fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename pytorch_adam to pytorch_adam_with_cosine_annealing

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* small refactor

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix no_weight_decay_cond

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* switch to flat_lr optim for example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove imports & update docstrings

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add a tokenizer setter to allow it to work with nemo/collections/llm/api.py::_use_tokenizer

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove unused import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* allow loss_mask to be none

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Add HF-dataset lightning module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* check if pad_token_id is None

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename hf_lit_module.py to hf_auto_model.py

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* class rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HfAutoModelForCausalLM

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add option to start with random weights

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add check in megatron-strategy

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename param

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* drop mcore sampler from squadmodule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make megatron_sampler optional in HfDatasetDataModule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* copyright

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* use is_hf_model to mark hf classes

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>
Co-authored-by: akoumpa <akoumpa@users.noreply.github.com>
hainan-xv pushed a commit to hainan-xv/NeMo that referenced this pull request Nov 5, 2024
…A#10962)

* initial hf_lit_module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make sft gpt dataset sanity check optional

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HF sft example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Rename HfLitModule to HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update default model id

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* move rank&world_size as params

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix mbs in example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix for fsdp and logger

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make loss_fn configurable

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove optim from HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add pytorch native optim

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add hfAutoModel pretrain nemorun recipe

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove debug

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* tokenizer fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename pytorch_adam to pytorch_adam_with_cosine_annealing

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* small refactor

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix no_weight_decay_cond

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* switch to flat_lr optim for example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove imports & update docstrings

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add a tokenizer setter to allow it to work with nemo/collections/llm/api.py::_use_tokenizer

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove unused import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* allow loss_mask to be none

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Add HF-dataset lightning module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* check if pad_token_id is None

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename hf_lit_module.py to hf_auto_model.py

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* class rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HfAutoModelForCausalLM

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add option to start with random weights

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add check in megatron-strategy

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename param

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* drop mcore sampler from squadmodule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make megatron_sampler optional in HfDatasetDataModule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* copyright

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* use is_hf_model to mark hf classes

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>
Co-authored-by: akoumpa <akoumpa@users.noreply.github.com>
Signed-off-by: Hainan Xu <hainanx@nvidia.com>
HuiyingLi pushed a commit to HuiyingLi/NeMo that referenced this pull request Nov 15, 2024
…A#10962)

* initial hf_lit_module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make sft gpt dataset sanity check optional

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HF sft example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Rename HfLitModule to HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update default model id

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* move rank&world_size as params

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix mbs in example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix for fsdp and logger

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make loss_fn configurable

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove optim from HfAutoModel

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add pytorch native optim

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add hfAutoModel pretrain nemorun recipe

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove debug

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale imports

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* tokenizer fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename pytorch_adam to pytorch_adam_with_cosine_annealing

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* small refactor

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix no_weight_decay_cond

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* fix

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* switch to flat_lr optim for example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

* remove imports & update docstrings

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add a tokenizer setter to allow it to work with nemo/collections/llm/api.py::_use_tokenizer

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* remove unused import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* allow loss_mask to be none

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Add HF-dataset lightning module

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* check if pad_token_id is None

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename hf_lit_module.py to hf_auto_model.py

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* class rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update example

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* HfAutoModelForCausalLM

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rm stale import

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add option to start with random weights

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add check in megatron-strategy

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* rename param

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* drop mcore sampler from squadmodule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* make megatron_sampler optional in HfDatasetDataModule

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* copyright

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* use is_hf_model to mark hf classes

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: akoumpa <akoumpa@users.noreply.github.com>
Co-authored-by: akoumpa <akoumpa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants