From e66e5e0547e8b4aec93b3bf16885fe3ce818745c Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Thu, 21 Nov 2024 13:03:54 -0500 Subject: [PATCH] use cached_property instead --- src/axolotl/utils/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/axolotl/utils/models.py b/src/axolotl/utils/models.py index 6285d99a6a..5bba615e15 100644 --- a/src/axolotl/utils/models.py +++ b/src/axolotl/utils/models.py @@ -7,6 +7,7 @@ import math import os import types +from functools import cached_property from typing import Any, Dict, Optional, Tuple, Union # noqa: F401 import addict @@ -452,7 +453,7 @@ def patch_attention(self) -> None: replace_stablelm_attn_with_flash_attn(self.cfg.base_model) - @property + @cached_property def flash_attn(self) -> bool: """Check if flash attention is installed""" return importlib.util.find_spec("flash_attn") is not None