Repository navigation
[docs] AWS Trainium: rewrite guide for native TorchNeuron support #15138
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
Changes from all commits
f8cdceb
db9a189
33d42fa
0bfeb7d
b59b9c8
192a3db
eb7b907
543a598
c85de92
e6c9ebe
1bf9eca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,16 +10,18 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o | |
| specific language governing permissions and limitations under the License. | ||
| --> | ||
|
|
||
| # TorchTPU | ||
| # Google TPU | ||
|
|
||
| [TorchTPU](https://github.com/google-pytorch/torch_tpu/) is a PyTorch backend for Google's Tensor Processing Units | ||
| (TPUs), which lets you run Diffusers pipelines on Cloud TPUs (v6e, v7x) with minimal code changes. | ||
| Tensor Processing Units (TPUs) are Google's machine learning accelerators, available as Cloud TPUs (v6e, v7x). | ||
| Diffusers runs on them through [TorchTPU](https://github.com/google-pytorch/torch_tpu/), the PyTorch backend for TPUs, | ||
| with minimal code changes. | ||
|
|
||
| Two execution modes are available: | ||
| Three execution modes are available: | ||
|
|
||
| | Mode | Constant | How to activate | Notes | | ||
| |---|---|---|---| | ||
| | Strict eager (default) | `EagerMode.DEFER_NEVER` | `pipe.to("tpu")` | Operations dispatched one at a time, asynchronous | | ||
| | Optimized eager | `EagerMode.DEFER_AND_FUSE` | `TORCH_TPU_DEFER_AND_FUSE=1` | Operations deferred and fused into larger graphs; faster than strict eager, longer compile | | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we tested for this mode?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we did, actually there are 3 eager modes... (there's a debug mode as well), I did not put in the beginning since I found it confusing and one should use torch.compile for deployment anyway, but indeed the semi-compiled mode is faster in between strict compile and compiled... |
||
| | Compile | — | `torch.compile(module, backend="tpu")` | AOT compilation with `TpuBackend` | | ||
|
|
||
| Follow the [TorchTPU installation guide](https://github.com/google-pytorch/torch_tpu/). Once installed, `import torch` | ||
|
|
||
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.
We should refer the readers to the dedicated TP section and show Neuron-relevant stuff here?