Introduce export_llama to extension/llm as export_llm
Open
@jackzhxng is already working on this.
Since Jun 10, 2025.
module: llm
triaged
- Dominant language
- Python
- Stars
- 5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 581
Description
🚀 The feature, motivation and pitch
To generalize export_llama better to transformers as export_llm, the following directories and files in examples/models/llama will be moved to extension/llm:
- examples/models/llama/config
- examples/models/llama/source_transformation
- examples/models/llama/tests
- attention.py -> Will go into a new
attentiondirectory - export_llama_hydra.py -> this will be renamed to
export_llm.pyand will be the main entrypoint to the new API - export_llama_lib.py -> this will be renamed to
export_llm_lib.py - fairseq2.py
- hf_download.py
- llama_transformer.py -> this will be renamed to
transformer.py - model.py -> this will have
Llama2Modelrenamed toTransformerModel. Also not a big fan of the naming of this file, open to take this opportunity to rename toeager.pyor something like that to its intent better, which is to instantiate the model.- We could remove Llama-specific components from the version in
extension/llmsuch as Fairseq2 and haveLlama2Modelinherit from it
- We could remove Llama-specific components from the version in
- model_args.py
- norm.py
- rope.py
- static_attention.py -> Will go into a new
attentiondirectory
Key notes:
- export_llama.py stays put,
export_llamawill still exist to preserve BC, especially internally- export_llama_args.py then also stays put, supporting the legacy CLI
- export_llama_hydra.py will be the new
export_llmpowered by Hydra, and it will be inextension/llm. Note that this means that theexport_llmAPI will not support the legacy CLI
- Lots of internal callsites for functions in
export_llama_libsuch as_prepare_for_llama_exportand_export_llama. These will need to all be renamed and refactored.
Alternatives
No response
Additional context
No response
RFC (Optional)
No response
cc @larryliu0820 @mergennachin @cccclai @helunwencser
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.