Lightning-AI / Lightning-AI/pytorch-lightning

Add support to Fairscale Parallel Layers

Open
#20,237 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3rd party feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Description & Motivation

Add support to Fairscale parallel layers:

```python
from fairscale.nn.model_parallel.layers import (
ColumnParallelLinear,
RowParallelLinear,
VocabParallelEmbedding,
)
```

that requires `_MODEL_PARALLEL_GROUP` to be initialized

```
self.tok_embeddings = VocabParallelEmbedding(
File "/home/coder/.local/lib/python3.8/site-packages/fairscale/nn/model_parallel/layers.py", line 118, in __init__
self.num_embeddings, get_model_parallel_rank(), get_model_parallel_world_size()
File "/home/coder/.local/lib/python3.8/site-packages/fairscale/nn/model_parallel/initialize.py", line 157, in get_model_parallel_rank
return torch.distributed.get_rank(group=get_model_parallel_group())
File "/home/coder/.local/lib/python3.8/site-packages/fairscale/nn/model_parallel/initialize.py", line 128, in get_model_parallel_group
assert _MODEL_PARALLEL_GROUP is not None, "model parallel group is not initialized"
AssertionError: model parallel group is not initialized
```

See https://github.com/Lightning-AI/pytorch-lightning/issues/20234 for details.

### Pitch

To support Llama3.1 initialization that requires Fariscale in the original release with parallel layers.

### Alternatives

Get rid of parallel layers or wrap into Lightning (if it is not available already)

### Additional context

_No response_

cc @lantiga @borda

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 by reading Fairscale's model_parallel/layers.py and initialize.py traceback, then review the linked Lightning issue #20234. Done means Llama3.1 initialization can use the parallel layers without the model-parallel-group assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.