-
Notifications
You must be signed in to change notification settings - Fork 5
Draft: Yifeit/assume pure #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
cd77464
to
d577a40
Compare
def replace_nn_linear_with_einsum(module: torch.nn.Module, config: DictConfig): | ||
"""Recursively replace `nn.Linear` layers with `EinsumLinear` in the module. | ||
|
||
Without this patch, an `nn.Linear` module in PyTorch/XLA will lower to reshapes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall that xla's einsum worked fine when used without custom-op - can you point me to where the einsum becomes a custom op and remind me why?
do we need to use this torch_xla.distributed.spmd.xla_sharding.apply_xla_patch_to_nn_linear
- could we use assume_pure on the linear model directly in this code? That question may be missing some basic knowledge of assume-pure, my apologies if so.
- Support nested tuples in `assume_pure(mark_sharding)` - Add a `PureModule` from AI-Hypercomputer/torchprime#308 - Support `PureModule(EinsumLinear)` which uses `torch.ops.xla.einsum_linear_forward`
- Support nested tuples in `assume_pure(mark_sharding)` - Add a `PureModule` from AI-Hypercomputer/torchprime#308 - Support `PureModule(EinsumLinear)` which uses `torch.ops.xla.einsum_linear_forward`
- Support nested tuples in `assume_pure(mark_sharding)` - Add a `PureModule` from AI-Hypercomputer/torchprime#308 - Support `PureModule(EinsumLinear)` which uses `torch.ops.xla.einsum_linear_forward`
- Support nested tuples in `assume_pure(mark_sharding)` - Add a `PureModule` from AI-Hypercomputer/torchprime#308 - Support `PureModule(EinsumLinear)` which uses `torch.ops.xla.einsum_linear_forward`
TESTED: python3 torchprime/torch_xla_models/train.py model.pure_modules=[LlamaMLP,Linear]
574f142
to
c8ba416
Compare
No description provided.