NeMo
NeMo copied to clipboard
Fix bug on Llama 2/3 NeMo to hf convertion
What does this PR do ?
Fix the script to convert Llama 2/3 from .nemo format to hf format. This will resolve #9496
Collection: [Note which collection this PR will affect]
Changelog
- In Llama3, basically
AutoTokenizer
(fast tokenizer) is used, but in Llama2 and other derivatives, both (LlamaTokenizer
andAutoTokenizer
) are used. This PR works both patterns.
Usage
No changes in API
# llama3
export INPUT="/workspace/models/Meta-Llama-3-8B.nemo"
export OUTPUT="/workspace/models/llama3-8b/pytorch_model.bin"
python /opt/NeMo/scripts/checkpoint_converters/convert_llama_nemo_to_hf.py \
--input_name_or_path=${INPUT} \
--output_path=${OUTPUT} \
--hf_input_path /workspace/models/Meta-Llama-3-8B \
--hf_output_path /workspace/models/llama3-8b \
--input_tokenizer /workspace/models/Meta-Llama-3-8B \
--hf_output_tokenizer /workspace/models/llama3-8b
# llama2
export INPUT="/workspace/models/Llama-2-7b-hf.nemo"
export OUTPUT="/workspace/models/llama2-7b/pytorch_model.bin"
python /opt/NeMo/scripts/checkpoint_converters/convert_llama_nemo_to_hf.py \
--input_name_or_path=${INPUT} \
--output_path=${OUTPUT} \
--hf_input_path /workspace/models/Llama-2-7b-hf \
--hf_output_path /workspace/models/llama2-7b \
--input_tokenizer /workspace/models/Llama-2-7b-hf \
--hf_output_tokenizer /workspace/models/llama2-7b
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:
- [x] 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
- [x] 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 #9496