NeMo icon indicating copy to clipboard operation
NeMo copied to clipboard

scripts to convert HF lora to nemo

Open arendu opened this issue 9 months ago • 0 comments

What does this PR do ?

scripts to convert hugging face lora model into nemo.

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
#  convert NeMo to HF:
# the script expects a adapter_config.json file which is standard in HF:
python scripts/checkpoint_converters/lora_converters/convert_nemo_to_canonical.py \
    --nemo_lora_path nemo_style_lora_model.nemo \
    --output_path ./canonical_style_lora_model.nemo \
    --hf_format --hf_config checkpoints/bin/adapter_config.json


#  convert HF to NeMo:
# /checkpoints/bin/ is a folder containing the HF lora checkpoint (usually named adapter_model.bin)
# and a HF lora config file (usually named adapter_config.json)
python scripts/checkpoint_converters/lora_converters/convert_hf_to_canonical.py \
    --hf_lora_path /checkpoints/bin/ \
    --output_path output_dir/converted_lora.nemo \
    --nemo_config model_config.yaml

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:

  • [x] 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)

arendu avatar May 03 '24 07:05 arendu