Slapo

Latest version: v0.0.3

Safety actively analyzes 681874 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.0.3

This release mainly improves

1. Fix some fidelity issues.
2. Refactor schedule primitives, and add `.fork_rng()`, `.annotate()`, and `.replace_all()` primitives.
3. Other bug fixing.

If any of the following cases match your existing schedule based on v0.0.2, you have to change them to support v0.0.3.

1. Tagging parameters for DeepSpeed pipeline runtime to perform an additional all-reduce on TP group. For example, you may have the following code snippet that tags LayerNorm parameters:
python
def tag_layernorm(sch):
for m in sch.mod.modules():
if isinstance(m, nn.LayerNorm):
for p in m.parameters(recurse=False):
p.replicated_param = True

This can be changed to the following in v0.0.3:
python
def annotate_layernorm_and_bias(sch):
for sub_sch in sch.child.values():
if isinstance(sub_sch.mod, nn.LayerNorm):
for name, _ in sub_sch.mod.named_parameters(recurse=False):
sub_sch.annotate(name, "replicated_param", True)
if issubclass(sub_sch.mod.__class__, LinearWithSyncFunc):
sub_sch.annotate("bias", "replicated_param", True)
annotate_layernorm_and_bias(sub_sch)

Reference: https://github.com/awslabs/slapo/blob/main/slapo/model_schedule/gpt2.py#L529

2. RNG control can be done easily with a new introduced schedule primitive `.fork_rng()`. Accordingly, the old `slapo.op.AttentionOpWithRNG` is removed. If you have the following code snippet:
python
new_op = AttentionOpWithRNG(
sub_sch["module"]["attn_op"].mod.attn_op_name,
sub_sch["module"]["attn_op"].mod.apply_causal_mask,
sub_sch["module"]["attn_op"].mod.scale,
)
sub_sch["module"]["attn_op"].replace(new_op)

It has to be changed to
python
sub_sch["module"]["attn_op"].fork_rng()


3. The primitive `.trace_for_pipeline()` has been renamed to `.trace_until()`. Since the arguments remain the same, you could simply replace all occurrences.

4. If you use `slapo.op.FusedMLP` with sharding, you need to change your schedule to reflect the change of FusedMLP implementation. For example:
python
fc_names = ["fc_in", "act", "fc_out"]
sub_sch[fc_names[0]].shard("weight", axis=0)
sub_sch[fc_names[1]].shard("bias", axis=0)
sub_sch[fc_names[2]].shard("weight", axis=1)
sub_sch[fc_names[0]].sync(mode="bwd_post", sync_op_or_fn="all_reduce")
sub_sch[fc_names[2]].sync(mode="fwd_post", sync_op_or_fn="all_reduce")

changes to
python
fc_names = ["fc_in", "fc_out"]
sub_sch[fc_names[0]].shard("weight", axis=0)
sub_sch[fc_names[0]].shard("bias", axis=0)
sub_sch[fc_names[1]].shard("weight", axis=1)
sub_sch[fc_names[0]].sync(mode="bwd_post", sync_op_or_fn="all_reduce")
sub_sch[fc_names[1]].sync(mode="fwd_post", sync_op_or_fn="all_reduce")


What's Changed
* [Action] Fix release flow by comaniac in https://github.com/awslabs/slapo/pull/69
* [Refactor] Schedule primitives by comaniac in https://github.com/awslabs/slapo/pull/68
* [Primitive] .fork_rng() by comaniac in https://github.com/awslabs/slapo/pull/70
* [Primitive] .annotate() and .trace_until() by comaniac in https://github.com/awslabs/slapo/pull/71
* [CI] Update CI rules for docs by chhzh123 in https://github.com/awslabs/slapo/pull/72
* [Op] Fuse bias+dropout in FusedMLP by comaniac in https://github.com/awslabs/slapo/pull/73
* [Refactor] Modulize sharding methods by comaniac in https://github.com/awslabs/slapo/pull/74
* [CI] Quick fix by chhzh123 in https://github.com/awslabs/slapo/pull/75
* [Primitive][fork_rng] Do not replace module by comaniac in https://github.com/awslabs/slapo/pull/76
* [Bugfix] Include other custom LinearWithXX by comaniac in https://github.com/awslabs/slapo/pull/77
* [Primitive] Add fallback fusion by chhzh123 in https://github.com/awslabs/slapo/pull/78
* [examples] Refactor dataloader to support BERT by chhzh123 in https://github.com/awslabs/slapo/pull/79
* [Bugfix] Shard embedding hooks by comaniac in https://github.com/awslabs/slapo/pull/80
* [Version] Refactor version updating logic by comaniac in https://github.com/awslabs/slapo/pull/82
* [Op] Print by comaniac in https://github.com/awslabs/slapo/pull/81
* [Primitive] Add .replace_all() by chhzh123 in https://github.com/awslabs/slapo/pull/85
* [Version] Update version to v0.0.3 by chhzh123 in https://github.com/awslabs/slapo/pull/84


**Full Changelog**: https://github.com/awslabs/slapo/compare/v0.0.2...v0.0.3

0.0.2

This release mainly improves
1. More unit tests.
2. Add `.fuse` and related primitives.
3. Improve overall training efficiency of GPT models by adding sequence parallelism, tie weight supports, etc.
4. Documentation and tutorials.
5. Bug fixing.

What's Changed
* [Release] Setup wheel and release scripts by comaniac in https://github.com/awslabs/slapo/pull/18
* [Pipeline] Drop last batch in DeepSpeed scripts by comaniac in https://github.com/awslabs/slapo/pull/19
* [Examples] Add disable_flash_attn by chhzh123 in https://github.com/awslabs/slapo/pull/22
* [Bugfix] Fix sequence parallelism by szhengac in https://github.com/awslabs/slapo/pull/20
* [Schedule][replace] Transfer hooks when replacing modules by comaniac in https://github.com/awslabs/slapo/pull/27
* [Bugfix] Fix GPT script by szhengac in https://github.com/awslabs/slapo/pull/26
* [Bugfix] Transfer hooks in pipeline modules by comaniac in https://github.com/awslabs/slapo/pull/28
* [Tracer] Add `flatten` argument to .trace() by chhzh123 in https://github.com/awslabs/slapo/pull/29
* [Benchmark] Fix ZeRO-3 step log by comaniac in https://github.com/awslabs/slapo/pull/31
* [Bugfix] Fix for sharding TP only by zarzen in https://github.com/awslabs/slapo/pull/32
* [Primitive][shard] Use autograd function for all sync ops by comaniac in https://github.com/awslabs/slapo/pull/33
* [Bugfix] Using None for mpu when PP > 1 by zarzen in https://github.com/awslabs/slapo/pull/34
* [Bugfix] Fix GPT script by szhengac in https://github.com/awslabs/slapo/pull/36
* [Schedule] Refactor subgraph matching by chhzh123 in https://github.com/awslabs/slapo/pull/35
* [Schedule] Add .fuse() primitive by chhzh123 in https://github.com/awslabs/slapo/pull/25
* [Setup] Fix dependency by chhzh123 in https://github.com/awslabs/slapo/pull/39
* [Random] Random state management by comaniac in https://github.com/awslabs/slapo/pull/38
* [GPT] Use flash-attention and enable dropout by comaniac in https://github.com/awslabs/slapo/pull/40
* [Op] Add attention and bias_gelu ops by comaniac in https://github.com/awslabs/slapo/pull/41
* [Tracer] Remove SelfAttention renaming by chhzh123 in https://github.com/awslabs/slapo/pull/44
* [Model] Add HuggingFace GPT-2 by comaniac in https://github.com/awslabs/slapo/pull/45
* [Op] Refactor qkv processing by comaniac in https://github.com/awslabs/slapo/pull/46
* Add num_workers to GPT dataloader by szhengac in https://github.com/awslabs/slapo/pull/48
* [Op] Add flash-attention CUDA kernel by comaniac in https://github.com/awslabs/slapo/pull/49
* [Bugfix] Fix tensor device by szhengac in https://github.com/awslabs/slapo/pull/50
* [Example] Use .fuse() primitive when possible by chhzh123 in https://github.com/awslabs/slapo/pull/42
* [Refactor] model_dialect -> framework_dialect by comaniac in https://github.com/awslabs/slapo/pull/51
* [Test] Add default initialization test by chhzh123 in https://github.com/awslabs/slapo/pull/54
* [Schedule] Create subschedule for subgraph replacement by chhzh123 in https://github.com/awslabs/slapo/pull/52
* [Schedule] Support partial checkpointing by chhzh123 in https://github.com/awslabs/slapo/pull/55
* [DeepSpeed] Support TP=nGPU and PP=DP=1 by comaniac in https://github.com/awslabs/slapo/pull/56
* [Examples] Move examples to slapo.model_schedule by chhzh123 in https://github.com/awslabs/slapo/pull/53
* [Bugfix] Support tree-like subgraph matching by chhzh123 in https://github.com/awslabs/slapo/pull/58
* [Bugfix] Consolidate params with orig size by comaniac in https://github.com/awslabs/slapo/pull/59
* [Bugfix] Fix a small device bug by szhengac in https://github.com/awslabs/slapo/pull/57
* [README] Temporary remove paper info by comaniac in https://github.com/awslabs/slapo/pull/60
* Add param_name to shard infer type and fix consolidate by comaniac in https://github.com/awslabs/slapo/pull/62
* [Feature] Layernorm Tag by szhengac in https://github.com/awslabs/slapo/pull/61
* [Docs] Add initial documentations by chhzh123 in https://github.com/awslabs/slapo/pull/63
* Enable launch training with torchrun by zarzen in https://github.com/awslabs/slapo/pull/64
* [Examples] Enable launch with torchrun by comaniac in https://github.com/awslabs/slapo/pull/65

New Contributors
* zarzen made their first contribution in https://github.com/awslabs/slapo/pull/32

**Full Changelog**: https://github.com/awslabs/slapo/compare/v0.0.1...v0.0.2

0.0.1

What's Changed
* [Lint] Fix almost all linting errors by comaniac in https://github.com/awslabs/slapo/pull/1
* [CI] Setup CI by comaniac in https://github.com/awslabs/slapo/pull/3
* [Lint] Fix rest linting errors by comaniac in https://github.com/awslabs/slapo/pull/2
* [Bugfix] Fix batch size in slapo-deepspeed by chhzh123 in https://github.com/awslabs/slapo/pull/7
* Fix transformers import order in megatron scripts by szhengac in https://github.com/awslabs/slapo/pull/5
* [Pipeline] Tie weight analysis by comaniac in https://github.com/awslabs/slapo/pull/8
* [Bugfix] fix initialization by szhengac in https://github.com/awslabs/slapo/pull/4
* [Bugfix] Reproduce experimental results in docker image by chhzh123 in https://github.com/awslabs/slapo/pull/9
* [Schedule] Support sequence parallelism by comaniac in https://github.com/awslabs/slapo/pull/6
* [Test] Add end-to-end tests by chhzh123 in https://github.com/awslabs/slapo/pull/14
* [Pipeline] Register tie weights by comaniac in https://github.com/awslabs/slapo/pull/15
* [Bugfix] Fix schedule and dockerfile by comaniac in https://github.com/awslabs/slapo/pull/17
* [Test] Add tracer unit tests by chhzh123 in https://github.com/awslabs/slapo/pull/16

New Contributors
* comaniac made their first contribution in https://github.com/awslabs/slapo/pull/1
* chhzh123 made their first contribution in https://github.com/awslabs/slapo/pull/7
* szhengac made their first contribution in https://github.com/awslabs/slapo/pull/5

**Full Changelog**: https://github.com/awslabs/slapo/commits/v0.0.1

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.