> This page is for version 0.5.0 · 26.06.
> For other versions, use one of these documentation indexes:
> - Nightly (default): https://docs.nvidia.com/nemo/automodel/nightly/llms.txt
> - Latest: https://docs.nvidia.com/nemo/automodel/latest/llms.txt
> - 0.5.0 · 26.06: https://docs.nvidia.com/nemo/automodel/v0.5/llms.txt
> - 0.4.0 · 26.04: https://docs.nvidia.com/nemo/automodel/v0.4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/automodel/_mcp/server.

# nemo_automodel.shared

## Submodules

* **[`nemo_automodel.shared.embedding_padding`](/nemo-automodel/nemo_automodel/shared/embedding_padding)**
* **[`nemo_automodel.shared.import_utils`](/nemo-automodel/nemo_automodel/shared/import_utils)**
* **[`nemo_automodel.shared.model_utils`](/nemo-automodel/nemo_automodel/shared/model_utils)**
* **[`nemo_automodel.shared.parameter_names`](/nemo-automodel/nemo_automodel/shared/parameter_names)**
* **[`nemo_automodel.shared.retrieval_ids`](/nemo-automodel/nemo_automodel/shared/retrieval_ids)**
* **[`nemo_automodel.shared.te_patches`](/nemo-automodel/nemo_automodel/shared/te_patches)**
* **[`nemo_automodel.shared.tied_weights`](/nemo-automodel/nemo_automodel/shared/tied_weights)**
* **[`nemo_automodel.shared.tokenizer_serialization`](/nemo-automodel/nemo_automodel/shared/tokenizer_serialization)**
* **[`nemo_automodel.shared.torch_patches`](/nemo-automodel/nemo_automodel/shared/torch_patches)**
* **[`nemo_automodel.shared.tp_linear`](/nemo-automodel/nemo_automodel/shared/tp_linear)**
* **[`nemo_automodel.shared.transformers_patches`](/nemo-automodel/nemo_automodel/shared/transformers_patches)**
* **[`nemo_automodel.shared.utils`](/nemo-automodel/nemo_automodel/shared/utils)**

## Package Contents

### Functions

| Name                                                                                     | Description                                                             |
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [`dtype_from_str`](#nemo_automodel-shared-utils-dtype_from_str)                          | Translate a str val of a dtype into the corresponding torch.dtype       |
| [`patch_t5_layer_norm`](#nemo_automodel-shared-transformers_patches-patch_t5_layer_norm) | Replace apex's FusedRMSNorm with a native T5LayerNorm in the T5 module. |

### API

```python
nemo_automodel.shared.utils.dtype_from_str(
    val,
    default = torch.bfloat16
)
```

Translate a str val of a dtype into the corresponding torch.dtype
Args:
val (str): the dotted path of the dtype (e.g., "torch.bfloat16").

**Returns:**

torch.dtype: the actual dtype (e.g., torch.bfloat16)

```python
nemo_automodel.shared.transformers_patches.patch_t5_layer_norm() -> None
```

Replace apex's FusedRMSNorm with a native T5LayerNorm in the T5 module.

Apex's FusedRMSNorm doesn't support bfloat16, but the native T5LayerNorm
handles it correctly by upcasting to fp32 internally for numerical stability.
This must be called before loading any T5 models.

This function is idempotent and safe to call multiple times.