Skip to content

Conversation

@kashif
Copy link
Collaborator

@kashif kashif commented Nov 1, 2025

What does this PR do?

Added an ALST/Ulysses section to the distributed training doc with yaml config.

Needs:

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

- Simplify ALST/Ulysses section to match style of other docs sections
- Condense from ~495 lines to ~164 lines while keeping essential info
- Add practical example using trl/scripts/sft.py with 4 GPUs
- Update requirements to recommend Flash Attention 2 over SDPA
- Add concise 2D parallelism explanation with code snippet
- Simplify best practices to 5 key points
- Streamline troubleshooting section
- Fix alst_ulysses_4gpu.yaml config (remove 'auto' values)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@kashif kashif marked this pull request as draft November 1, 2025 18:41
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

kashif and others added 4 commits November 1, 2025 18:43
- Simplify ALST/Ulysses section to match style of other docs sections
- Condense from ~495 lines to ~164 lines while keeping essential info
- Add practical example using trl/scripts/sft.py with 4 GPUs
- Update requirements to recommend Flash Attention 2 over SDPA
- Add concise 2D parallelism explanation with code snippet
- Simplify best practices to 5 key points
- Streamline troubleshooting section
- Fix alst_ulysses_4gpu.yaml config (remove 'auto' values)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

### 2D Parallelism

The 4 GPU configuration above automatically enables 2D parallelism by combining Data Parallelism (DP) with Context Parallelism (CP). The `dp_shard_size` is automatically calculated to distribute across available GPUs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add experiments here as the fsdp example

cp_size = 2
dp_shard_size = num_gpus // cp_size # Automatically calculated

parallelism_config = ParallelismConfig(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do it via .yaml as in the other example to follow the same style?

Here's how to run ALST/Ulysses training using the built-in [`sft.py`](https://github.com/huggingface/trl/blob/main/trl/scripts/sft.py) script with 4 GPUs:

```bash
accelerate launch --config_file examples/accelerate_configs/alst_ulysses_4gpu.yaml \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@SunMarc
Copy link
Member

SunMarc commented Nov 4, 2025

cc @stas00

Copy link
Member

@NouamaneTazi NouamaneTazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 🙌

Copy link
Member

@sergiopaniego sergiopaniego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants