NVIDIA / NVIDIA/TransformerEngine

Examples: Using TE with LLaMA-Factory

Open
#2,509 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
3.5k
Forks
831
Avg merge
3d 11h
Merged PRs (30d)
65

Description

Is your feature request related to a problem? Please describe.

When trying to integrate TE FP8 training with frameworks built on Hugging Face Trainer (like LLaMA-Factory), because there's no documentation showing the correct integration pattern, this led to bugs in LLaMA-Factory where:

  1. FP8 training silently fell back to BF16
  2. When FP8 was activated, it used torchao backend instead of TE

Without official documentation showing best practices for framework integration, it was implemented incorrectly, leading to poor user experiences and TE getting blamed for performance issues that are actually integration bugs.

Related issue: https://github.com/hiyouga/LLaMA-Factory/issues/9500

Describe the solution you'd like

Add official documentation/examples in the TE repository showing how to integrate TE with frameworks built on Hugging Face Trainer. Specifically:

  1. Integration Guide Page covering:
  • Architecture: TE → HF Accelerate → HF Trainer
  • Why config files are recommended over programmatic setup
  • Common pitfalls when wrapping Trainer
  1. Framework-Specific Examples:
  • examples/llamafactory/ - LLaMA-Factory integration
  • examples/axolotl/ - Axolotl integration example

Describe alternatives you've considered

N/A

Additional context

Key Findings:

  • When properly configured, TE delivers the expected 1.3-1.5x speedup on H100/B200
  • The accelerate launch --config_file approach is more reliable than programmatic config

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the requested integration path, accelerate launch --config_file, and the proposed examples/llamafactory/ and examples/axolotl/ directories. Document the TE → HF Accelerate → HF Trainer architecture, explain why configuration files are preferred, and cover the listed Trainer-wrapping pitfalls. Done means the guide and both framework examples clearly show reliable TE FP8 setup and avoid BF16 fallback or torchao selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.