From 12dcc1f2f670ccba7bf277cdaff2db24dd1695b4 Mon Sep 17 00:00:00 2001 From: JackUrb Date: Tue, 17 Jun 2025 11:51:57 -0400 Subject: [PATCH 1/2] Deferring import of torch in config to allow faster import --- litgpt/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litgpt/config.py b/litgpt/config.py index cba52e3374..79215fa9c0 100644 --- a/litgpt/config.py +++ b/litgpt/config.py @@ -5,7 +5,6 @@ from pathlib import Path from typing import Any, List, Literal, Optional, Type, Union -import torch import yaml from typing_extensions import Self @@ -184,6 +183,7 @@ def norm_class(self) -> Type: # `self.norm_class_name` cannot be the type to keep the config serializable from functools import partial + import torch # Torch import is lazy to make config loading faster if self.norm_class_name == "RMSNorm": from litgpt.model import RMSNorm From a939ec7b9dd8403b44f833428be7ec9957f7bfe1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 15:54:58 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- litgpt/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litgpt/config.py b/litgpt/config.py index 79215fa9c0..be9e568b13 100644 --- a/litgpt/config.py +++ b/litgpt/config.py @@ -183,7 +183,8 @@ def norm_class(self) -> Type: # `self.norm_class_name` cannot be the type to keep the config serializable from functools import partial - import torch # Torch import is lazy to make config loading faster + + import torch # Torch import is lazy to make config loading faster if self.norm_class_name == "RMSNorm": from litgpt.model import RMSNorm