> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/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. ## Docs - [nemo_automodel.shared.embedding_padding](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/embedding_padding.md) - [nemo_automodel.shared.import_utils](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/import_utils.md) - [nemo_automodel.shared.model_utils](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/model_utils.md) - [nemo_automodel.shared.parameter_names](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/parameter_names.md) - [nemo_automodel.shared.retrieval_ids](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/retrieval_ids.md) - [nemo_automodel.shared.te_patches](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/te_patches.md) - [nemo_automodel.shared.tied_weights](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/tied_weights.md) - [nemo_automodel.shared.tokenizer_serialization](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/tokenizer_serialization.md) - [nemo_automodel.shared.torch_patches](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/torch_patches.md) - [nemo_automodel.shared.tp_linear](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/tp_linear.md) - [nemo_automodel.shared.transformers_patches](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/transformers_patches.md) - [nemo_automodel.shared.utils](https://docs.nvidia.com/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/shared/utils.md)