Skip to content

Introduce export_llama to extension/llm as export_llm #11527

Open
@jackzhxng

Description

@jackzhxng

🚀 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 attention directory
  • export_llama_hydra.py -> this will be renamed to export_llm.py and 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 Llama2Model renamed to TransformerModel. Also not a big fan of the naming of this file, open to take this opportunity to rename to eager.py or something like that to its intent better, which is to instantiate the model.
    • We could remove Llama-specific components from the version in extension/llm such as Fairseq2 and have Llama2Model inherit from it
  • model_args.py
  • norm.py
  • rope.py
  • static_attention.py -> Will go into a new attention directory

Key notes:

  • export_llama.py stays put, export_llama will 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_llm powered by Hydra, and it will be in extension/llm. Note that this means that the export_llm API will not support the legacy CLI
  • Lots of internal callsites for functions in export_llama_lib such as _prepare_for_llama_export and _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

Metadata

Metadata

Assignees

Labels

module: llmIssues related to LLM examples and apps, and to the extensions/llm/ codetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status

To triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions