-
Notifications
You must be signed in to change notification settings - Fork 540
Docs fix #2301
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?
Docs fix #2301
Changes from 1 commit
8124d3d
a23a365
2413bcb
8dec718
3ff3ca0
8118005
1a9b993
dd792f8
0116d34
20ba719
f800a1f
19da61b
15c6741
556ab28
35e75de
0a5eafd
b9506aa
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,16 +37,22 @@ pyTorch | |||||||||
| .. autoapiclass:: transformer_engine.pytorch.CudaRNGStatesTracker() | ||||||||||
| :members: reset, get_states, set_states, add, fork | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.fp8_autocast | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.fp8_model_init | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.autocast | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.quantized_model_init | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.checkpoint | ||||||||||
|
|
||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.make_graphed_callables | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.get_cpu_offload_context | ||||||||||
|
|
||||||||||
|
|
||||||||||
| Recipe availability | ||||||||||
| ------------------------ | ||||||||||
|
||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.is_fp8_available | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.is_mxfp8_available | ||||||||||
|
|
@@ -63,9 +69,8 @@ pyTorch | |||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.get_default_recipe | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.make_graphed_callables | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.get_cpu_offload_context | ||||||||||
| Mixture of Experts (MoE) functions | ||||||||||
| ------------------------------------------ | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.moe_permute | ||||||||||
|
|
||||||||||
|
|
@@ -79,9 +84,22 @@ pyTorch | |||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.moe_sort_chunks_by_index_with_probs | ||||||||||
|
|
||||||||||
|
|
||||||||||
| GEMM Comm overlap | ||||||||||
pggPL marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
| --------------------- | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.initialize_ub | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.destroy_ub | ||||||||||
|
|
||||||||||
| .. autoapiclass:: transformer_engine.pytorch.UserBufferQuantizationMode | ||||||||||
| :members: FP8, NONE | ||||||||||
|
|
||||||||||
|
|
||||||||||
| Deprecated functions | ||||||||||
| --------------------- | ||||||||||
|
|
||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.fp8_autocast | ||||||||||
|
|
||||||||||
| .. autoapifunction:: transformer_engine.pytorch.fp8_model_init | ||||||||||
pggPL marked this conversation as resolved.
Show resolved
Hide resolved
pggPL marked this conversation as resolved.
Show resolved
Hide resolved
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. syntax: missing final newline
Suggested change
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. syntax: missing final newline
Suggested change
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,10 @@ | |
| ] | ||
|
|
||
| templates_path = ["_templates"] | ||
| exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
| exclude_patterns = [ | ||
| "_build", | ||
| "sphinx_rtd_theme", | ||
| ] | ||
|
|
||
| source_suffix = ".rst" | ||
|
|
||
|
|
@@ -101,3 +104,22 @@ | |
|
|
||
| autoapi_generate_api_docs = False | ||
| autoapi_dirs = [root_path / "transformer_engine"] | ||
|
|
||
|
|
||
| # There are 2 warnings about the same namespace (transformer_engine) in two different c++ api | ||
| # docs pages. This seems to be the only way to suppress these warnings. | ||
|
||
| def setup(app): | ||
| """Custom Sphinx setup to filter warnings.""" | ||
| import logging | ||
|
|
||
| # Filter out duplicate C++ declaration warnings | ||
| class DuplicateDeclarationFilter(logging.Filter): | ||
| def filter(self, record): | ||
| message = record.getMessage() | ||
| if "Duplicate C++ declaration" in message and "transformer_engine" in message: | ||
| return False | ||
| return True | ||
|
|
||
| # Apply filter to Sphinx logger | ||
| logger = logging.getLogger("sphinx") | ||
| logger.addFilter(DuplicateDeclarationFilter()) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| See LICENSE for license information. | ||
|
|
||
| Getting started | ||
| ============== | ||
| =============================== | ||
|
||
|
|
||
| .. note:: | ||
|
|
||
|
|
@@ -38,7 +38,7 @@ To start debugging, one needs to create a configuration YAML file. This file lis | |
| one - ``UserProvidedPrecision`` - is a custom feature implemented by the user. Nvidia-DL-Framework-Inspect inserts features into the layers according to the config. | ||
|
|
||
| Example training script | ||
| ---------------------- | ||
| ------------------------------ | ||
|
||
|
|
||
| Let's look at a simple example of training a Transformer layer using Transformer Engine with FP8 precision. This example demonstrates how to set up the layer, define an optimizer, and perform a few training iterations using synthetic data. | ||
|
|
||
|
|
@@ -81,7 +81,7 @@ We will demonstrate two debug features on the code above: | |
| 2. Logging statistics for other GEMM operations, such as gradient statistics for data gradient GEMM within the LayerNormLinear sub-layer of the TransformerLayer. | ||
|
|
||
| Config file | ||
| ---------- | ||
| ------------------------------ | ||
|
||
|
|
||
| We need to prepare the configuration YAML file, as below | ||
|
|
||
|
|
@@ -114,7 +114,8 @@ We need to prepare the configuration YAML file, as below | |
| Further explanation on how to create config files is in the :doc:`next part of the documentation <2_config_file_structure>`. | ||
|
|
||
| Adjusting Python file | ||
| -------------------- | ||
| ---------------------------- | ||
|
||
|
|
||
|
|
||
| .. code-block:: python | ||
|
|
||
|
|
@@ -145,7 +146,8 @@ In the modified code above, the following changes were made: | |
| 3. Added ``debug_api.step()`` after each of the forward-backward pass. | ||
|
|
||
| Inspecting the logs | ||
| ------------------ | ||
| ---------------------------- | ||
|
||
|
|
||
|
|
||
| Let's look at the files with the logs. Two files will be created: | ||
|
|
||
|
|
@@ -213,7 +215,8 @@ The second log file (``nvdlfw_inspect_statistics_logs/nvdlfw_inspect_globalrank- | |
| INFO - transformer_layer.self_attention.layernorm_qkv_activation_l1_norm iteration=000004 value=130776.7969 | ||
|
|
||
| Logging using TensorBoard | ||
| ------------------------ | ||
| ---------------------------- | ||
|
||
|
|
||
|
|
||
| Precision debug tools support logging using `TensorBoard <https://www.tensorflow.org/tensorboard>`_. To enable it, one needs to pass the argument ``tb_writer`` to the ``debug_api.initialize()``. Let's modify ``train.py`` file. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,8 @@ | |
| "\n", | ||
| "[Transformer Engine](https://github.com/NVIDIA/TransformerEngine.git) supports the calculation of dot product attention in two frameworks, [PyTorch](https://github.com/pytorch/pytorch) and [JAX](https://github.com/google/jax). The API for each framework is\n", | ||
| "\n", | ||
| "- [transformer_engine.pytorch.DotProductAttention](../../api/pytorch.rst#transformer_engine.pytorch.DotProductAttention)\n", | ||
| "- [transformer_engine.jax.flax.DotProductAttention](../../api/jax.rst#transformer_engine.jax.flax.DotProductAttention)" | ||
| "- [transformer_engine.pytorch.DotProductAttention](../../api/pytorch.rst#transformer_engine.pytorch.dotproductattention)\n", | ||
| "- [transformer_engine.jax.flax.DotProductAttention](../../api/jax.rst#transformer_engine.jax.flax.dotproductattention)" | ||
|
||
| ] | ||
| }, | ||
| { | ||
|
|
@@ -606,7 +606,7 @@ | |
| "\n", | ||
| "A unique feature of Transformer Engine is its FP8 support, not only for the `Linear` layers but also for dot product attention. Transformer Engine's FP8 attention support is through its cuDNN attention sub-backend 2. Recall Figure 1: the two `MatMul` operations are performed in FP8 for computational efficiency, and the `SoftMax` operation is performed in FP32 for numerical accuracy.\n", | ||
| "\n", | ||
| "Transformer Engine supports FP8 attention through its [C APIs](../../api/c/fused_attn.rst), and [PyTorch API](../../api/pytorch.rst#transformer_engine.pytorch.DotProductAttention), as of v2.0. Its PyTorch API offers two options, both controlled through the FP8 recipe definition, `transformer_engine.common.recipe.DelayedScaling`.\n", | ||
| "Transformer Engine supports FP8 attention through its [C APIs](../../api/c/fused_attn.rst), and [PyTorch API](../../api/pytorch.rst#transformer_engine.pytorch.dotproductattention), as of v2.0. Its PyTorch API offers two options, both controlled through the FP8 recipe definition, `transformer_engine.common.recipe.DelayedScaling`.\n", | ||
| "\n", | ||
| "- `DelayedScaling.fp8_dpa=True (default=False)`: This enables the use of cuDNN attention sub-backend 2, when it does support the provided user inputs. The `FusedAttention` module for cuDNN attention takes FP16 or BF16 tensors as inputs, performs dot product attention in FP8, and returns attention logits in FP16 or BF16 (same as the input type). Casting operations are required to cast tensors to FP8 at the beginning, and back to FP16/BF16 at the end of the module.\n", | ||
| "\n", | ||
|
|
||
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 do want to have them still in the documentation though, just marked as deprecated.
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.
Ok, I see that you just moved it.